题解 | #A+B(6)#
A+B(1)
https://ac.nowcoder.com/acm/contest/5657/A
#include <iostream>
#include <vector>
using namespace std;
int main() {
vector<int> b;
int a;
while (cin>>a) { // 注意 while 处理多个 case
int n=a,c=0;
b.resize(n);
for(int i=0;i<n;++i){
cin>>b[i];
c+=b[i];
}
cout<<c<<endl;
}
}
#include <vector>
using namespace std;
int main() {
vector<int> b;
int a;
while (cin>>a) { // 注意 while 处理多个 case
int n=a,c=0;
b.resize(n);
for(int i=0;i<n;++i){
cin>>b[i];
c+=b[i];
}
cout<<c<<endl;
}
}