|
|
back to boardWA test 10 C++ #include <iostream> #include <string> using namespace std; int main() { int num, res; string c, b = "!", a = "!"; cin >> num >> c; res = num; int sign = 0; for (int i = 1; b <= c; i++) { b = b + a; sign = i; } if (num%sign != 0) { for (int i = 1; i*sign < num; i++) { res = res * (num - i*sign); } res = res *(num%sign); } else { for (int i = 1; i*sign < num; i++) { res = res * (num - i*sign); } } cout << res; return 0; } |
|
|