| ||||||||||
| Online Judge | Problem Set | Authors | Online Contests | User | ||||||
|---|---|---|---|---|---|---|---|---|---|---|
| Web Board Home Page F.A.Qs Statistical Charts | Current Contest Past Contests Scheduled Contests Award Contest | |||||||||
RE 除0 的童鞋们注意了如果你是手动打表的话,一定要注意:
for(num=0;factorMax[num]<=n&&num<35;num++);
num--;
num<35是关键,否则可能会超出,而造成RE。
这题我开始不知道怎么判断因子个数,后来网上搜了个表,就懒了,直接粘上去了:
#define L(a) ((a)<<1)
#define R(a) ((a)<<1|1)
static const int MAXN = 500010;
static const int factorMax[] = {
1, 2, 4, 6, 12,
24, 36, 48, 60, 120,
180, 240, 360, 720, 840,
1260, 1680, 2520, 5040, 7560,
10080, 15120, 20160, 25200, 27720,
45360, 50400, 55440, 83160, 110880,
166320, 221760, 277200, 332640, 498960};
static const int factorNumber[] = {
1, 2, 3, 4, 6,
8, 9, 10, 12, 16,
18, 20, 24, 30, 32,
36, 40, 48, 60, 64,
72, 80, 84, 90, 96,
100,108,120,128,144,
160,168,180,192,200};
int n, k;
char name[MAXN][15];
int next[MAXN];
后面我接着写,悲剧了一下午啊,伤不起啊~~~
Followed by: Post your reply here: |
All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator