| ||||||||||
| 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 | |||||||||
最无语的TLE!我是不知道原因!难道隐式转化很费时?唉~我怎么一到pku上做题都这种情况啊// poj 2480
// April 28,2010
#include<cstdio>
#include<cstring>
typedef long long LL;
int main(){
int n,k,i;// 换成long long就Ac!!不然死活TLE!
LL ans;
while(scanf("%d",&n)==1){
for(ans=n,i=2;i*i<=n;i++){
if(n%i==0){
k=0,ans/=i;
while(n%i==0)
n/=i,k++;
ans*=i*(k+1)-k;
}
}
if(n>1){
ans/=n;
ans*=2*n-1;
}
printf("%lld\n",ans);
}
return 0;
}
Followed by:
Post your reply here: |
All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator