Task: | Greater Integers |
Sender: | spirrevip |
Submission time: | 2021-01-31 12:54:36 +0200 |
Language: | C++ (C++11) |
Status: | READY |
Result: | 35 |
group | verdict | score |
---|---|---|
#1 | ACCEPTED | 35 |
#2 | WRONG ANSWER | 0 |
test | verdict | time | group | |
---|---|---|---|---|
#1 | ACCEPTED | 0.01 s | 1, 2 | details |
#2 | WRONG ANSWER | 0.01 s | 2 | details |
Compiler report
input/code.cpp: In function 'int main()': input/code.cpp:41:23: warning: comparison between signed and unsigned integer expressions [-Wsign-compare] for (int i = 0; i < V.size(); i++){ ~~^~~~~~~~~~
Code
#include <iostream> #include <vector> using namespace std; int main(){ int t; long long n; cin >> t; long long mini = 9; for (int i = 0; i<t; i++){ vector<int> V; mini = 9; cin >> n; while(n > 0){ V.push_back(n%10); mini = min(mini, n%10); n /= 10; } int a = V[V.size()-1]; int ciffer = a; if (a == 9 && mini == 9){ ciffer = 1; V.push_back(1); } else if (a == mini){ ciffer++; } else { for(int i = V.size()-2; i>=0; i++){ if (V[i] > a){ ciffer++; break; } else if (V[i] < a){ break; } } } for (int i = 0; i < V.size(); i++){ cout << ciffer; } cout << endl; } }
Test details
Test 1
Group: 1, 2
Verdict: ACCEPTED
input |
---|
1000 1 2 3 4 ... |
correct output |
---|
2 3 4 5 6 ... |
user output |
---|
2 3 4 5 6 ... Truncated |
Test 2
Group: 2
Verdict: WRONG ANSWER
input |
---|
1000 735425311146082632 756615631808964686 466489470801941584 100417544394053220 ... |
correct output |
---|
777777777777777777 777777777777777777 555555555555555555 111111111111111111 555555555555555555 ... |
user output |
---|
777777777777777777 777777777777777777 555555555555555555 111111111111111111 55555555555555 ... Truncated |