| Task: | ModAdd |
| Sender: | EduardoVaca |
| Submission time: | 2016-09-24 13:49:57 +0300 |
| Language: | C++ |
| Status: | READY |
| Result: | WRONG ANSWER |
| test | verdict | time | |
|---|---|---|---|
| #1 | WRONG ANSWER | 0.06 s | details |
| #2 | WRONG ANSWER | 0.06 s | details |
| #3 | WRONG ANSWER | 0.06 s | details |
| #4 | WRONG ANSWER | 0.06 s | details |
| #5 | WRONG ANSWER | 0.06 s | details |
| #6 | WRONG ANSWER | 0.06 s | details |
| #7 | WRONG ANSWER | 0.06 s | details |
| #8 | WRONG ANSWER | 0.06 s | details |
| #9 | WRONG ANSWER | 0.07 s | details |
| #10 | WRONG ANSWER | 0.06 s | details |
Code
#include <iostream>
#include <ios>
int get_carryless_sum(int n1, int n2) {
int temp_digit_1, temp_digit_2;
int count = 1;
int sum = 0;
int temp_sum;
while ((n1 > 0) || (n2 > 0)) {
if (n1 > 0) {
temp_digit_1 = n1 % 10;
n1 /= 10;
} else {
temp_digit_1 = 0;
}
if (n2 > 0) {
temp_digit_2 = n2 % 10;
n2 /= 10;
} else {
temp_digit_2 = 0;
}
temp_sum = temp_digit_1 + temp_digit_2;
sum += ((temp_sum < 10 ? temp_sum : temp_sum - 10) * count);
count *= 10;
}
return sum;
}
int main() {
std::ios::sync_with_stdio(false);
int n1, n2;
std::cin >> n1;
std::cin >> n2;
std::cout << get_carryless_sum(n1, n2);
return 0;
}
Test details
Test 1
Verdict: WRONG ANSWER
| input |
|---|
| 3797629225 9766508989 |
| correct output |
|---|
| 2453127104 |
| user output |
|---|
| 2147483647 |
Test 2
Verdict: WRONG ANSWER
| input |
|---|
| 552139016901047883384892240490... |
| correct output |
|---|
| 552139016901047883384892240490... |
| user output |
|---|
| 2147483647 |
Test 3
Verdict: WRONG ANSWER
| input |
|---|
| 860793811134668093345482099582... |
| correct output |
|---|
| 487710306894083216377653715430... |
| user output |
|---|
| 2147483647 |
Test 4
Verdict: WRONG ANSWER
| input |
|---|
| 2 870841652294197226626825161089... |
| correct output |
|---|
| 870841652294197226626825161089... |
| user output |
|---|
| -2147483647 |
Test 5
Verdict: WRONG ANSWER
| input |
|---|
| 0 404905566051213252279994991040... |
| correct output |
|---|
| 404905566051213252279994991040... |
| user output |
|---|
| 2147483647 |
Test 6
Verdict: WRONG ANSWER
| input |
|---|
| 430112167406460960088878635088... |
| correct output |
|---|
| 430112167406460960088878635088... |
| user output |
|---|
| 2147483647 |
Test 7
Verdict: WRONG ANSWER
| input |
|---|
| 867016005819001635643395991596... |
| correct output |
|---|
| 999999999999999999999999999999... |
| user output |
|---|
| 2147483647 |
Test 8
Verdict: WRONG ANSWER
| input |
|---|
| 120453771521975552204976752778... |
| correct output |
|---|
| 0 |
| user output |
|---|
| 2147483647 |
Test 9
Verdict: WRONG ANSWER
| input |
|---|
| 239979749009277805816504910098... |
| correct output |
|---|
| 239979749009277805816504910098... |
| user output |
|---|
| 2147483647 |
Test 10
Verdict: WRONG ANSWER
| input |
|---|
| 990963963634143754324162574923... |
| correct output |
|---|
| 818540385713473048971388312665... |
| user output |
|---|
| 2147483647 |
