|
|
вернуться в форумWrong answer Test#1 What's wrong with it? I tried every test in previous topics and everything is fine, but Timus system does not accept my program. #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; } |
|
|