• 博客园logo
  • 会员
  • 众包
  • 新闻
  • 博问
  • 闪存
  • 赞助商
  • HarmonyOS
  • Chat2DB
    • 搜索
      所有博客
    • 搜索
      当前博客
  • 写随笔 我的博客 短消息 简洁模式
    用户头像
    我的博客 我的园子 账号设置 会员中心 简洁模式 ... 退出登录
    注册 登录
asdflkj
博客园 | 首页 | 新随笔 | 新文章 | 联系 | 订阅 订阅 | 管理

2016年9月29日

今日头条笔试题 1~n的每个数,按字典序排完序后,第m个数是什么?
摘要: # 由于n和m都是10^18的范围,暴力明显不行,只能dfs了。# 先预处理n的十进制,存到num数组中,长度计算出来为len, 答案存到Num中。# 写个函数cntOfBeginNum(int *Num,int anslen),计算以num为前缀的小于等于n的数的个数cnt,考虑长度比n的十进制长度小的数,则cnt+=1+10+100+1000......# 长度和n相等的则要特判一下... 阅读全文
posted @ 2016-09-29 21:27 asdflkj 阅读(1948) 评论(0) 推荐(0)
 
 

2015年5月22日

Gym 100500B Conference Room(最小表示法,哈希)
摘要: #include using namespace std;const int maxn=1005;const int base=37;typedef unsigned long long ULL;setsave;int n;int a[4][maxn],b[maxn];int id[maxn=n?i... 阅读全文
posted @ 2015-05-22 00:21 asdflkj 阅读(276) 评论(0) 推荐(0)
 
CodeForces 438D The Child and Sequence(线段树)
摘要: 题目:http://codeforces.com/problemset/problem/438/D一个数取模n%m,有两种情况、1.m>n, n%m=n;2.mn时,取模操作可以忽略。每个a[i]最多需要log(a[i])次取模操作变为0,因此我们可以对所有取模进行暴力更新。最多要更新n*log(a... 阅读全文
posted @ 2015-05-22 00:14 asdflkj 阅读(277) 评论(0) 推荐(0)
 
 

2015年5月11日

UVALIVE 6905 Two Yachts(最小费用最大流)
摘要: #include using namespace std;const int maxn=11111;const int inf=0x3f3f3f3f;int t,n;int u[maxn],v[maxn],w[maxn],head[maxnq; q.push(s); while(!q.e... 阅读全文
posted @ 2015-05-11 19:43 asdflkj 阅读(181) 评论(0) 推荐(0)
 
Gym Conference Room (最小表示法,哈希)
摘要: #include using namespace std;const int maxn=1005;const int base=10007;typedef unsigned long long ULL;setsave;int n;int a[4][maxn],b[maxn];int id[maxn=... 阅读全文
posted @ 2015-05-11 19:41 asdflkj 阅读(341) 评论(0) 推荐(0)
 
 

2015年2月18日

hdu 2389 Rain on your Parade(二分图HK算法)
摘要: #include #include #include #include #include using namespace std;const int inf=0x3f3f3f3f;const int maxn=3003;const int maxm=maxn*maxn;int xlink[maxn]... 阅读全文
posted @ 2015-02-18 21:17 asdflkj 阅读(177) 评论(0) 推荐(0)
 
 

2015年2月9日

Codeforces Fox And Dinner(最大流)
摘要: 抄了个DINIC的模板,然后模拟一下。#include using namespace std;const int maxn=80005;const int inf=0x3f3f3f3f;typedef vector vi;typedef vector vii;bool vis[maxn];vect... 阅读全文
posted @ 2015-02-09 19:15 asdflkj 阅读(243) 评论(0) 推荐(0)
 
 

2014年10月16日

zoj 3367 Counterfeit Money(dp)
摘要: 先搞定这题。ZOJ1985 Largest Rectangle in a Histogram再做这题。先枚举第二个矩形对第一个矩形的偏移量(x,y),再进行2维DP,复杂度为O(n^2 *n^2),即O(n^4).#include using namespace std;const int maxn... 阅读全文
posted @ 2014-10-16 22:12 asdflkj 阅读(276) 评论(0) 推荐(0)
 
ZOJ3370. Radio Waves(2-sat)
摘要: 算是很裸的吧,二分半径,然后2-sat判定能不能满足条件。#include using namespace std;const int maxn=1222;const double eps=1e-9;struct node{ double x,y;}p[maxn];struct twoset{... 阅读全文
posted @ 2014-10-16 22:05 asdflkj 阅读(231) 评论(0) 推荐(0)
 
 

2014年10月4日

hdu 3723 Card Game(JAVA,卡特兰数)
摘要: 很容易想到的卡特兰数,不过复杂度高精度还是挺恶心的。于是用JAVA秒杀了。import java.math.BigInteger;import java.util.Scanner;public class Main { static BigInteger[] f=new BigInteger... 阅读全文
posted @ 2014-10-04 00:59 asdflkj 阅读(278) 评论(0) 推荐(0)
 
 
下一页

公告


博客园  ©  2004-2025
浙公网安备 33010602011771号 浙ICP备2021040463号-3