|
|
вернуться в форумWhat wrong with this solution??? #include <stdio.h> #include <stdlib.h> #include <string.h> short a[10000]; short sets[10000]; short p[10000]; int main() { long i,n; // freopen("input.txt","rt",stdin); // freopen("output.txt","wt",stdout); while (scanf("%ld",&n)==1) { if (n==1) { printf("1\n"); continue; } long k,j,sum; sum=0; memset(a,0,sizeof(a)); memset(sets,0,sizeof(sets)); for (i=0; i<n; i++) { scanf("%ld",&k); for(j=2; j<=k; j++) a[j]--; sets[k]++; sum+=k; } for(j=2; j<=sum; j++) a[j]++; for(i=1; i<=sum; i++) for(j=2; j<=sets[i]; j++) a[j]--; memset(p,0,sizeof(p)); unsigned long result=1; for(i=2; i<=sum; i++) if(!p[i]) { j=i+i; while (j<=sum) { p[j]=1; k=j; while(k%i==0) { k/=i; a[i]+=a[j]; } j+=i; } for(j=a[i]; j>=1; j--) result*=i; } printf("%lu\n",result); } exit(0); return 0; } ?! how can I see 1063 problem?!!! http://acm.timus.ru/detail.asp?id=1063 Noone has got AC on this problem since 14 Nov. 2001. It's just locked forever. Leonid Volkov, open it, please! Give us a chance to solve it (-) > How I must see the Description. There are no 1063 on set? > > Re: What wrong with this solution??? You've made a terrible mistake. What does it mean "sum+=k"? IS NOT A PASCAL STYLE! Use "sum=sum+k"! Re: What wrong with this solution??? Crazy Lemming you are not very informed with C and C++! It can be done in the way you say and in the way he made it! In c++ and in C(as i suppose) sum+=k adds k to sum! In pascal can be different but in C or C++ it isn't! Edited by author 06.06.2008 13:04 Edited by author 06.06.2008 13:04 |
|
|