标签:
在那楼梯那边数实里面,有一只 guard,他活泼又聪明,他卖萌又霸气。他每天刷题虐 场 D 人考上了 PKU,如果无聊就去数一数质数~~ 有一天 guard 在纸上写下了一串数字,他发现数出每个数有多少个质因子是非常有(wu) 趣(liao)的事情,于是快乐的开始了数质因子之旅。现在他有一个更有(wu)趣(liao)的想法, 他想知道第a个数到第b个数每个数的质因子个数之和。更有趣的是,他一共写下了200 万个数字哟。由于guard是神犇所以不屑于求如此简单的问题,现在他把问题交给了Mr.shu, 但是他不会…,如果你能回答他的问题就能获得 guard 的亲笔签名哦~~。
第一行 1 个数 n,表示 guard 写下了 n 个数。 第二行 n 个用空格隔开的数,表示 guard 写下的 n 个数(每个数都不大于 10000,不小 于 1)。 第三行 1 个数 m,表示 guard 的询问数。 接下来 m 行,每行一个 a 和 b,表示 guard 想知道 a 到 b(包括 a 和 b)的每个数的质 因子个数之和。
一共 m 行。每行一个数表示对每个询问的答案。
5
4 2 1 6 30
2
1 3
2 5
3
6
【输入输出样例说明】
4=2*2 有 2 个不同质因子,2 有 1 个,1 有 0 个,6 有 2 个,30 有 3 个,
所以[1,3]有 2+1+0 个,[2,5]有 1+0+2+3 个。
【数据范围】
20%的数据满足 n<=1000,m<=10
50%的数据满足 n<=10000
100%的数据满足 n<=2000000,m<=100000
正解:暴力
解题报告:
这是不需要解释的搜索。
1 //It is made by jump~ 2 #include <iostream> 3 #include <cstdlib> 4 #include <cstring> 5 #include <cstdio> 6 #include <cmath> 7 #include <algorithm> 8 #include <ctime> 9 #include <vector> 10 #include <queue> 11 #include <map> 12 #include <set> 13 using namespace std; 14 typedef long long LL; 15 #define RG register 16 const int MAXN = 2000011; 17 int n,m,cnt; 18 bool vis[10011]; 19 int prime[MAXN]; 20 int a[MAXN],num[10011]; 21 int sum[MAXN]; 22 23 inline int getint() 24 { 25 RG int w=0,q=0; char c=getchar(); 26 while((c<‘0‘ || c>‘9‘) && c!=‘-‘) c=getchar(); if(c==‘-‘) q=1,c=getchar(); 27 while (c>=‘0‘ && c<=‘9‘) w=w*10+c-‘0‘, c=getchar(); return q ? -w : w; 28 } 29 30 inline void work(){ 31 n=getint(); for(RG int i=1;i<=n;i++) a[i]=getint(); 32 for(RG int i=2;i<=10000;i++) if(!vis[i]) for(RG int j=i+i;j<=10000;j+=i) vis[j]=1; 33 for(RG int i=2;i<=10000;i++) if(!vis[i]) prime[++cnt]=i; 34 for(RG int i=1;i<=n;i++) { 35 sum[i]=sum[i-1]; if(a[i]<=1) continue; 36 if(num[a[i]]!=0) { sum[i]+=num[a[i]]; continue; } 37 RG int cun=a[i]; 38 for(RG int j=1;j<=cnt;j++) { 39 while(a[i]%prime[j]==0) a[i]/=prime[j],sum[i]++,num[cun]++; 40 if(a[i]==1) break; 41 } 42 } 43 m=getint(); RG int l,r; 44 while(m--) { 45 l=getint(); r=getint(); 46 printf("%d\n",sum[r]-sum[l-1]); 47 } 48 } 49 50 int main() 51 { 52 work(); 53 return 0; 54 }
怒打表,并没有快多少。。。codevs只能提交20KB以下的代码,差评!
1 #include <cstdio> 2 using namespace std; 3 int n,m,l,r,a[2000011],s[2000011],nu[10011]={0,0,1,1,2,1,2,1,3,2,2,1,3,1,2,2,4,1,3,1,3,2,2,1,4,2,2,3,3,1,3,1,5,2,2,2,4,1,2,2,4,1,3,1,3,3,2,1,5,2,3,2,3,1,4,2,4,2,2,1,4,1,2,3,6,2,3,1,3,2,3,1,5,1,2,3,3,2,3,1,5,4,2,1,4,2,2,2,4,1,4,2,3,2,2,2,6,1,3,3,4,1,3,1,4,3,2,1,5,1,3,2,5,1,3,2,3,3,2,2,5,2,2,2,3,3,4,1,7,2,3,1,4,2,2,4,4,1,3,1,4,2,2,2,6,2,2,3,3,1,4,1,4,3,3,2,4,1,2,2,6,2,5,1,3,3,2,1,5,2,3,3,3,1,3,3,5,2,2,1,5,1,3,2,4,2,3,2,3,4,3,1,7,1,2,3,4,1,4,1,5,2,2,2,4,2,2,3,5,2,4,1,3,2,2,2,6,2,2,2,4,2,3,1,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6,2,5,3,4,2,3,2,6,2,3,6,4,2,4,1,6,2,3,3,5,1,2,5,5,2,3,2,4,3,4,2,10,2,2,2,4,2,6,2,4,2,3,2,6,2,2,4,8};int getint(){int w=0;char c=getchar();while(c<‘0‘||c>‘9‘)c=getchar();while (c>=‘0‘&&c<=‘9‘)w=w*10+c-‘0‘,c=getchar();return w;} 4 int main(){n=getint();for(int i=1;i<=n;i++)a[i]=getint(),s[i]=s[i-1]+nu[a[i]];m=getint();for(int i=1;i<=m;i++){l=getint(),r=getint();printf("%d\n",s[r]-s[l-1]);} return 0;}
标签:
原文地址:http://www.cnblogs.com/ljh2000-jump/p/5859628.html