# a+b(1) ![image-20230313204155024](assets/image-20230313204155024.png) ```cpp #include using namespace std; int main() { int a, b; while (cin >> a >> b) { cout << a + b << endl;; } return 0; } ``` # a+b(2) ![image-20230313204305951](assets/image-20230313204305951.png) ```cpp #include 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) ![image-20230313204324472](assets/image-20230313204324472.png) ```cpp #include 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) ![image-20230313204410566](assets/image-20230313204410566.png) ```cpp #include 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) ![image-20230313204509666](assets/image-20230313204509666.png) ```cpp #include 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) ![image-20230313204601641](assets/image-20230313204601641.png) ```cpp #include 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) ![image-20230313204720691](assets/image-20230313204720691.png) ```cpp #include 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; } ``` ```cpp #include 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 ![image-20230313204747133](assets/image-20230313204747133.png) ```cpp #include using namespace std; int main() { long long a, b; while (cin >> a >> b) { cout << a + b << endl; } return 0; } ```