1 solutions
-
0
C++ :
#include <bits/stdc++.h> using namespace std; int main() { string s; int m; while (cin >> s >> m) { int res = 0, base = 1; for (int i = s.size() - 1; i >= 0; i --) { res += (s[i] - '0') * base % m; res %= m; base = base * 10 % m; } cout << res << endl; } return 0; }
- 1
Information
- ID
- 19573
- Time
- 1000ms
- Memory
- 128MiB
- Difficulty
- (None)
- Tags
- # Submissions
- 0
- Accepted
- 0
- Uploaded By