这个题目真心赞,入门经典啊!O(∩_∩)O哈哈哈~
hdu 1089
#include <iostream> #include <stdio.h> #include <string> #include <cstring> #include <ctype.h> using namespace std; int main() { int a,b; while(cin>>a>>b) { cout<<a+b<<endl; } return 0; }hdu 1090
#include <iostream> #include <stdio.h> #include <string> #include <cstring> #include <ctype.h> using namespace std; int main() { int n; cin>>n; while(n--) { int a,b; cin>>a>>b; cout<<a+b<<endl; } return 0; }
#include <iostream> using namespace std; int main() { int a,b; while(cin>>a>>b&&a+b) {cout<<a+b<<endl;} return 0; }
#include <iostream> using namespace std; int main() { int i,n,a[10000]; while(cin>>n&&n) { int sum=0; for(i=0;i<n;i++) {cin>>a[i]; sum+=a[i];} cout<<sum<<endl;} return 0; }
#include <iostream> using namespace std; int main() { int i,n,a[10000],t; cin>>t; while(t--&&cin>>n&&n) { int sum=0; for(i=0;i<n;i++) {cin>>a[i]; sum+=a[i];} cout<<sum<<endl;} return 0; }
#include <iostream> using namespace std; int main() { int i,n,a[10000]; while(cin>>n) { int sum=0; for(i=0;i<n;i++) {cin>>a[i]; sum+=a[i];} cout<<sum<<endl;} return 0; }
#include <iostream> using namespace std; int main() { int a,b; while(cin>>a>>b) {cout<<a+b<<endl<<endl;} return 0; }
#include <iostream> using namespace std; int main() { int i,n,a[10000],t; cin>>t; while(cin>>n&&t--) { int sum=0; for(i=0;i<n;i++) {cin>>a[i]; sum+=a[i];} cout<<sum<<endl; if(t) cout<<endl;} return 0; }