|
@@ -0,0 +1,185 @@
|
|
|
+# a+b(1)
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+```cpp
|
|
|
+#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)
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+```cpp
|
|
|
+#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)
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+```cpp
|
|
|
+#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)
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+```cpp
|
|
|
+#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)
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+```cpp
|
|
|
+#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)
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+```cpp
|
|
|
+#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)
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+```cpp
|
|
|
+#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;
|
|
|
+}
|
|
|
+```
|
|
|
+
|
|
|
+```cpp
|
|
|
+#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
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+```cpp
|
|
|
+#include <bits/stdc++.h>
|
|
|
+using namespace std;
|
|
|
+
|
|
|
+int main() {
|
|
|
+ long long a, b;
|
|
|
+ while (cin >> a >> b) {
|
|
|
+ cout << a + b << endl;
|
|
|
+ }
|
|
|
+ return 0;
|
|
|
+}
|
|
|
+```
|
|
|
+
|