a+b(1)
#include <bits/stdc++.h>
using namespace std;
int main() {
int a, b;
while (cin >> a >> b) {
cout << a + b << endl;;
}
return 0;
}
a+b(2)
#include <bits/stdc++.h>
using namespace std;
int main() {
int count;
int a, b;
cin >> count;
while (count--) {
cin >> a >> b;
cout << a + b << endl;
}
return 0;
}
a+b(3)
#include <bits/stdc++.h>
using namespace std;
int main() {
int a, b;
while (cin >> a >> b) {
if (a == 0 && b == 0) break;
cout << a + b << endl;
}
return 0;
}
a+b(4)
#include <bits/stdc++.h>
using namespace std;
int main() {
int n;
while (cin >> n && n != 0) {
int sum = 0;
int temp;
while (n--) {
cin >> temp;
sum += temp;
}
cout << sum << endl;
}
return 0;
}
a+b(5)
#include <bits/stdc++.h>
using namespace std;
int main() {
int n;
cin >> n;
while (n--) {
int count;
int temp;
int sum = 0;
cin >> count;
while (count--) {
cin >> temp;
sum += temp;
}
cout << sum << endl;
}
return 0;
}
a+b(6)
#include <bits/stdc++.h>
using namespace std;
int main() {
int n;
while (cin >> n && n != 0) {
int sum = 0;
int temp;
while (n--) {
cin >> temp;
sum += temp;
}
cout << sum << endl;
}
return 0;
}
a+b(7)
#include <bits/stdc++.h>
using namespace std;
int main() {
string s;
while (getline(cin, s)) {
stringstream ss(s);
string num;
int sum = 0;
while (getline(ss, num, ' ')) {
sum += stoi(num);
}
cout << sum << endl;
}
return 0;
}
#include <bits/stdc++.h>
using namespace std;
int main() {
int n;
int sum = 0;
while (cin >> n) {
sum += n;
if (cin.get() == '\n') {
cout << sum << endl;
sum = 0;
}
}
return 0;
}
自测本地通过提交为0
#include <bits/stdc++.h>
using namespace std;
int main() {
long long a, b;
while (cin >> a >> b) {
cout << a + b << endl;
}
return 0;
}