CSES - E4590 2019 0 - Results
Submission details
Task:A + B
Sender:Ipek Guren
Submission time:2019-09-14 04:29:35 +0300
Language:C++ (C++11)
Status:READY
Result:
Test results
testverdicttime
#10.01 sdetails
#20.01 sdetails
#30.01 sdetails
#40.01 sdetails
#50.01 sdetails
#60.01 sdetails
#70.01 sdetails
#80.01 sdetails
#90.01 sdetails
#100.01 sdetails

Code

#include <stdio.h>
#include <cstdlib>
#include <iostream>

int main(){

	//get input

	char input[16];

	std::cin >> input;

	//find the blank space and the end of input

	int 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 parts

	char 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 print

	printf("%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  5
          k               m  

k=5
m=12

a= input[ 0 ~ k-1]
b= input[ k+1 ~ m-1]

size a = k
size b = m-k-1
*/












Test details

Test 1

Verdict:

input
3 5

correct output
8

user output
3

Test 2

Verdict:

input
-6 4

correct output
-2

user output
-6

Test 3

Verdict:

input
-882818 -697825

correct output
-1580643

user output
-8

Test 4

Verdict:

input
-357110 -868193

correct output
-1225303

user output
-3

Test 5

Verdict:

input
577866 -227464

correct output
350402

user output
57

Test 6

Verdict:

input
571335 750047

correct output
1321382

user output
57

Test 7

Verdict:

input
744471 719178

correct output
1463649

user output
74

Test 8

Verdict:

input
629697 -138795

correct output
490902

user output
62

Test 9

Verdict:

input
308833 436123

correct output
744956

user output
30

Test 10

Verdict:

input
-486131 -888278

correct output
-1374409

user output
-4