1 solutions
-
0
C++ :
#include <bits/stdc++.h> using namespace std; int g; long long a[10]; long long b[10] = {0, 1, 10, 100, 1000, 10000, 100000, 1000000}; int main() { cin >> g; while (g--) { for (int i = 1; i <= 7; i++) cin >> a[i]; for (int i = 1; i < 7; i++) { while (a[i]-10>=9) { a[i] -= 10; a[i+1]++; } } // for(int i=1;i<=7;i++) // cout<<a[i]<<" "; // cout<<endl; long long sum = 0; long long ans = -1; for (int i = 1; i <= 7; i++) { sum += a[i]*b[i]; if (a[i] < 9) { ans = sum+1; break; } } if (ans == -1) ans = sum+1; cout << ans << endl; } return 0; }
- 1
Information
- ID
- 896
- Time
- 1000ms
- Memory
- 128MiB
- Difficulty
- (None)
- Tags
- # Submissions
- 0
- Accepted
- 0
- Uploaded By