|
|
back to boardWhat's Wrong ! ACM Timus system wrote me WA № Test 1 . Can anybody help me? #include <stdio.h> int fact(int n, int k){ int res = 1; if (n == 0) return res; while (n > k) { res *= n; n -= k; } if (n % k) res *= (n % k); else res *= k; return res; } int main () { char sym; int n = 0; int symCount = 0; scanf("%d ", &n); while (scanf("%1[!]", &sym) == 1) { symCount++; } printf("%d\n", fact(n, symCount)); return 0; } |
|
|