|
|
back to boardWhy wrong?? WA #1 #include<iostream> #include<string> int res; int Fr(short int nm, short int q) { if((nm-q) == 0) return res; if((nm-q)>0) { res *= nm-q; Fr(nm-q,q); } else return res; } int main() { short int n=0; char c; int k=0; std::string s; std::string ss=""; std::getline(std::cin,s); for(int i=0;i<s.length();i++) { if(isdigit(s[i])) ss += s[i]; if(s[i] == '!') k++; } int w=1; int temp; for(int i=0;i<ss.length();i++) { for(int j=0;j<(ss.length()-i-1);j++) w *= 10; if (ss[i] >= '0' && ss[i] <= '9') temp = ss[i] - '0'; n += temp*w; w=1; }
res = n; printf("%d",Fr(res,k)); } |
|
|