Task: | A + B |
Sender: | Ipek Guren |
Submission time: | 2019-09-14 04:29:35 +0300 |
Language: | C++ (C++11) |
Status: | READY |
Result: | WRONG ANSWER |
test | verdict | time | |
---|---|---|---|
#1 | WRONG ANSWER | 0.01 s | details |
#2 | WRONG ANSWER | 0.01 s | details |
#3 | WRONG ANSWER | 0.01 s | details |
#4 | WRONG ANSWER | 0.01 s | details |
#5 | WRONG ANSWER | 0.01 s | details |
#6 | WRONG ANSWER | 0.01 s | details |
#7 | WRONG ANSWER | 0.01 s | details |
#8 | WRONG ANSWER | 0.01 s | details |
#9 | WRONG ANSWER | 0.01 s | details |
#10 | WRONG ANSWER | 0.01 s | details |
Code
#include <stdio.h>#include <cstdlib>#include <iostream>int main(){//get inputchar input[16];std::cin >> input;//find the blank space and the end of inputint k = 0;int m = 0;while (input[k] != ' '){k++;//index of the blank space}while (input[m] != '\0'){m++;//index of the last digit}//seperate input into 2 partschar a [k];char b [m-k-1];for (int i=0; i<k ; i++){a[i]= input[i];}for (int j=0; j<m-k-1 ; j++){b[j]= input[j+k+1];}//turn char array to int (use atoi)int no_a = atoi(a);int no_b = atoi(b);//add them up and printprintf("%d" , no_a + no_b);}/*0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16- 5 7 8 9 8 1 2 3 4 5k mk=5m=12a= input[ 0 ~ k-1]b= input[ k+1 ~ m-1]size a = ksize b = m-k-1*/
Test details
Test 1
Verdict: WRONG ANSWER
input |
---|
3 5 |
correct output |
---|
8 |
user output |
---|
3 |
Test 2
Verdict: WRONG ANSWER
input |
---|
-6 4 |
correct output |
---|
-2 |
user output |
---|
-6 |
Test 3
Verdict: WRONG ANSWER
input |
---|
-882818 -697825 |
correct output |
---|
-1580643 |
user output |
---|
-8 |
Test 4
Verdict: WRONG ANSWER
input |
---|
-357110 -868193 |
correct output |
---|
-1225303 |
user output |
---|
-3 |
Test 5
Verdict: WRONG ANSWER
input |
---|
577866 -227464 |
correct output |
---|
350402 |
user output |
---|
57 |
Test 6
Verdict: WRONG ANSWER
input |
---|
571335 750047 |
correct output |
---|
1321382 |
user output |
---|
57 |
Test 7
Verdict: WRONG ANSWER
input |
---|
744471 719178 |
correct output |
---|
1463649 |
user output |
---|
74 |
Test 8
Verdict: WRONG ANSWER
input |
---|
629697 -138795 |
correct output |
---|
490902 |
user output |
---|
62 |
Test 9
Verdict: WRONG ANSWER
input |
---|
308833 436123 |
correct output |
---|
744956 |
user output |
---|
30 |
Test 10
Verdict: WRONG ANSWER
input |
---|
-486131 -888278 |
correct output |
---|
-1374409 |
user output |
---|
-4 |