WA#10 help pls
Posted by
Tom 5 Aug 2011 14:19
what s test 10 ? here s my code, if U know what s wrong with the code without test 10 i would be most greatful to know it.
thx - tom
and btw what s the answer for n = 0 ?
1 or 0 ?
anyway i checked it and it s not test 10.
#include<iostream>
#include<cstring>
#include<string>
using namespace std;
int main(){
int k,n;
string a;
cin >> n;
cin >> a;
int i;
i=0; k=0;
int x =1;
while(a[i]=='!'){
i++;
k++;
}
if(!(n%k==0)){
if(n%k==1){
while(n!=1){
x*=n;
n-=i;
}
}
else x=n;
}
else{
while(n!=0){
x*=n;
n-=i;
}
}
cout << x;
getchar();getchar();
}
Edited by author 05.08.2011 14:34