比赛 20160420s 评测结果 AAAAAAAAAA
题目名称 最小生成树 最终得分 100
用户昵称 Satoshi 运行时间 0.015 s
代码语言 C++ 内存使用 0.62 MiB
提交时间 2016-04-20 08:26:31
显示代码纯文本
#include <fstream>
#include <algorithm>
#define N 20010
using namespace std;
typedef long long ll;
ifstream in("msta.in");
ofstream out("msta.out");ll hongzhuizidongji[N]={0};ll mod=100000007;ll linkcuttree[N]={0};int n;void fuck(){int i,j;for(i=1;i<=n;i++){if(!hongzhuizidongji[i]){for(j=i;j<=n;j+=i){if(!hongzhuizidongji[j])hongzhuizidongji[j]=j;hongzhuizidongji[j]=hongzhuizidongji[j]/i;hongzhuizidongji[j]=hongzhuizidongji[j]*(i-1);}}}}void read(){in>>n;}void slayklzwii(){int i,tim,kuotashi,satoshi;for(i=1;i<=n;i++){tim+=1;satoshi=tim*kuotashi;kuotashi=satoshi*2+1;}}void work(){int i;linkcuttree[1]=1;for(i=2;i<=n;i++){linkcuttree[i]=linkcuttree[i-1]*hongzhuizidongji[i];linkcuttree[i]%=mod;}out<<linkcuttree[n]<<endl;}
int main()
{
	read();
	fuck();
	slayklzwii();
	work();
	return 0;
}