Skip to content

Commit c0cdf71

Browse files
authored
Adding vectors and fixing bugs
1 parent e606e01 commit c0cdf71

File tree

1 file changed

+6
-5
lines changed

1 file changed

+6
-5
lines changed
Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,18 @@
11
#include <iostream>
2-
#include<string.h>
2+
#include <vector>
33
using namespace std;
44

55
int main()
66
{
7-
int t;
7+
int t,n,sum;
88
cin>>t;
9-
char n[10];
9+
vector<int>v;
1010
while(t--)
1111
{
1212
cin>>n;
13-
cout<<(n[0]-'0' + n[strlen(n)-1] - '0')<<"\n";
13+
v.push_back(n);
1414
}
15-
15+
sum=v.back()+v[0];
16+
cout << sum << endl;
1617
return 0;
1718
}

0 commit comments

Comments
 (0)