|
|
back to boardWA on 4 Posted by Pumar 5 Oct 2011 16:34 Can someone please say why the hell is it wrong?:( #include<iostream> using namespace std; int main() { const int size=10; int pro[10]={0}; long long int magic=1; int licz=2; const int n=10000; bool numbersTable[n+1]={0}; int pierw[1229]; int w=0; //sito
for (int i = 2; i <= n; i++ ) { if (numbersTable[i] == true) continue; pierw[w++]=i; for (int j = 2 * i ; j <= n; j += i) numbersTable[j] = true; }
for(int i=0;i<size;i++) { cin>>pro[i]; magic*=pro[i]; }
int k=0; long long int z=0; licz=1; for(int i=0; i<1229; i++) {
if(magic/pierw[i]<1) break; k=0; z=magic; while(z%pierw[i]==0) {
z/=pierw[i]; k++; } licz*=(k+1);
} if (magic==1) licz=1;
cout << licz%10;
} Re: WA on 4 Dear friend: Is not necessary multiply the input, working each a_i you can reduce the complexity |
|
|