Task: | ModAdd |
Sender: | Ollie |
Submission time: | 2016-09-24 13:23:54 +0300 |
Language: | C++ |
Status: | READY |
Result: | TIME LIMIT EXCEEDED |
test | verdict | time | |
---|---|---|---|
#1 | ACCEPTED | 0.06 s | details |
#2 | TIME LIMIT EXCEEDED | -- | details |
#3 | ACCEPTED | 0.29 s | details |
#4 | TIME LIMIT EXCEEDED | -- | details |
#5 | TIME LIMIT EXCEEDED | -- | details |
#6 | TIME LIMIT EXCEEDED | -- | details |
#7 | ACCEPTED | 0.31 s | details |
#8 | WRONG ANSWER | 0.28 s | details |
#9 | TIME LIMIT EXCEEDED | -- | details |
#10 | TIME LIMIT EXCEEDED | -- | details |
Compiler report
input/code.cpp: In function 'int main()': input/code.cpp:12:19: warning: comparison between signed and unsigned integer expressions [-Wsign-compare] if(a.length() != l) { ^ input/code.cpp:13:30: warning: comparison between signed and unsigned integer expressions [-Wsign-compare] for(int i=0;i<l-a.length()+1;i++) a = "0" + a; ^ input/code.cpp:15:19: warning: comparison between signed and unsigned integer expressions [-Wsign-compare] if(b.length() != l) { ^ input/code.cpp:16:30: warning: comparison between signed and unsigned integer expressions [-Wsign-compare] for(int i=0;i<l-b.length()+1;i++) b = "0" + b; ^
Code
#include <bits/stdc++.h> #define ll long long #define vi vector<int> using namespace std; int main() { string a, b; cin >> a >> b; int l = max(a.length(), b.length()); if(a.length() != l) { for(int i=0;i<l-a.length()+1;i++) a = "0" + a; } if(b.length() != l) { for(int i=0;i<l-b.length()+1;i++) b = "0" + b; } string res = ""; for(int i=0;i<l;i++) { int va = a[i]-'0'; int vb = b[i]-'0'; res += to_string((va+vb)%10); } int s = 0; while(res[s] == '0') s++; for(;s<l;s++) cout << res[s]; cout << endl; return 0; }
Test details
Test 1
Verdict: ACCEPTED
input |
---|
3797629225 9766508989 |
correct output |
---|
2453127104 |
user output |
---|
2453127104 |
Test 2
Verdict: TIME LIMIT EXCEEDED
input |
---|
552139016901047883384892240490... |
correct output |
---|
552139016901047883384892240490... |
user output |
---|
(empty) |
Test 3
Verdict: ACCEPTED
input |
---|
860793811134668093345482099582... |
correct output |
---|
487710306894083216377653715430... |
user output |
---|
487710306894083216377653715430... Truncated |
Test 4
Verdict: TIME LIMIT EXCEEDED
input |
---|
2 870841652294197226626825161089... |
correct output |
---|
870841652294197226626825161089... |
user output |
---|
(empty) |
Test 5
Verdict: TIME LIMIT EXCEEDED
input |
---|
0 404905566051213252279994991040... |
correct output |
---|
404905566051213252279994991040... |
user output |
---|
(empty) |
Test 6
Verdict: TIME LIMIT EXCEEDED
input |
---|
430112167406460960088878635088... |
correct output |
---|
430112167406460960088878635088... |
user output |
---|
(empty) |
Test 7
Verdict: ACCEPTED
input |
---|
867016005819001635643395991596... |
correct output |
---|
999999999999999999999999999999... |
user output |
---|
999999999999999999999999999999... Truncated |
Test 8
Verdict: WRONG ANSWER
input |
---|
120453771521975552204976752778... |
correct output |
---|
0 |
user output |
---|
(empty) |
Test 9
Verdict: TIME LIMIT EXCEEDED
input |
---|
239979749009277805816504910098... |
correct output |
---|
239979749009277805816504910098... |
user output |
---|
(empty) |
Test 10
Verdict: TIME LIMIT EXCEEDED
input |
---|
990963963634143754324162574923... |
correct output |
---|
818540385713473048971388312665... |
user output |
---|
(empty) |