记录编号 |
252985 |
评测结果 |
AAAAAAAAAA |
题目名称 |
最小生成树 |
最终得分 |
100 |
用户昵称 |
FoolMike |
是否通过 |
通过 |
代码语言 |
C++ |
运行时间 |
0.021 s |
提交时间 |
2016-04-21 13:24:08 |
内存使用 |
0.42 MiB |
显示代码纯文本
- #include<cstdio>
- #include<iostream>
- //#include"debug.h"
- using namespace std;
-
- const int maxl=20010;
- int n,phi[maxl],p[maxl],cnt,i,j,k,ji;
- long long ans=1;
-
- int main()
- {
- freopen("msta.in","r",stdin);
- freopen("msta.out","w",stdout);
- scanf("%d",&n);
- phi[1]=1;
- for (i=2;i<=n;i++){
- for (j=1;j<=cnt;j++)
- if (i%p[j]==0) break;
- if (j==cnt+1){
- p[++cnt]=i;
- phi[i]=i-1;
- }
- else{
- for (k=i,ji=1;k%p[j]==0;k/=p[j],ji*=p[j]);
- if (i!=ji) phi[i]=phi[ji]*phi[i/ji];
- else phi[i]=i-i/p[j];
- }
- ans=(ans*phi[i])%100000007;
- }
- //print(phi,1,n,' ');
- cout<<ans<<endl;
- return 0;
- }