What's wrong with long? Why is subtracting 1 automatically?
问题 #include <iostream> #include <math.h> #include <algorithm> using namespace std; int main() { int t, c1, c2, res; string str1, str2; cin >> t; for (int i = 0; i < t; i++) { c1 = c2 = res = 0; cin >> str1 >> str2; c1 = count(str1.begin(), str1.end(), '1'); c2 = count(str2.begin(), str2.end(), '1'); cout << (long)(((pow(10, c1) - 1) / 9) * ((pow(10, c2) - 1) / 9)) << '\n'; } } For input: 1 11111 11111 Output is: 123454321 but, here is the problem, For input: 1 10101 10100 Output is: 1220 Also,