-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathA+B.cpp
More file actions
35 lines (35 loc) · 754 Bytes
/
A+B.cpp
File metadata and controls
35 lines (35 loc) · 754 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
#include<bits/stdc++.h>
using namespace std;
int main()
{
int t;
cin>>t;
while(t--)
{
string s;
cin>>s;
string x = "", y = "";
int tr, xr = 0;
for(int i = 0; i < s.size(); i++)
{
if(s[i] == '+')
{
x = s.substr(0, i);
for(int j = 0; j < x.size(); j++)
{
xr = xr*10 + (x[j]-'0');
}
tr = i;
break;
}
}
y = s.substr(tr+1);
int yr = 0;
for(int j = 0; j < y.size(); j++)
{
yr = yr*10 + (y[j]-'0');
}
cout<<xr+yr<<endl;
}
return 0;
}