|
|
back to boardWrong answer 5 Posted by Inna 31 May 2011 16:54 Why????? #include <stdio.h> #include<math.h> #include <iostream> using namespace std; int n,k=0,f=1,i,t=0; char s[500]; int main() { cin>>n; cin>>s; for (i=0; s[i]!='\0'; i++) { if (s[i]!='\n') { k++; } } if (k==0) { cout<<"n"<<"\n"; } if (((n%k)>0)&(k!=0)&(n>k)) { while ((n-k*t)>0) { f*=n-k*t; t++; } f*=(n%k); cout<<f<<"\n"; } else if((k!=0)&(n>k)) { while ((n-k*t)>0) { f*=n-k*t; t++; } f*=k; cout<<f<<"\n"; } else if (n==k) { cout<<k*n<<"\n"; } else { if (((n%k)>0)&(k!=0)) { while ((k*t-n)>0) { f*=k*t-n; t++; } f*=(n%k); cout<<f<<"\n"; } else if(k!=0) { while ((k*t-n)>0) { f*=k*t-n; t++; } f*=k; cout<<f<<"\n"; } } } Re: Wrong answer 5 Posted by Noob 31 May 2011 23:31 OH NO WHAT A WALL OF CODE |
|
|