基本輸入輸出練習 hdu1089-1096
阿新 • • 發佈:2017-05-30
div ima tool -- process roc 技術 n) acm
杭電ACM
剛開始 別心急 可以參照別人的代碼 但是仙女你一定要自己敲一遍阿!!!
blingbling
// 1089
- #include<iostream>
- using namespace std;
- int main()
- {
- int n,m,s;
- while(cin>>n>>m)
- {
- s=n+m;
- cout<<s<<endl;
- }
- return 0;
- }
//1090
- #include<iostream>
- using namespace std;
- int main()
- {
- int n,a,b;
- cin>>n;
- while(n--)
- {
- cin>>a>>b;
- cout<<a+b<<endl;
- }
- return 0;
- }
//1091
- #include<iostream>
- using namespace std;
- int main()
- {
- int n,m;
- while(cin>>n>>m && (n!=0||m!=0))
- {
- cout<<n+m<<endl;
- }
- return 0;
- }
//1092
- #include<iostream>
- using namespace std;
- int main()
- {
- int n,m,sum;
- while(cin>>n&&n!=0)
- {
- sum=0;
- while(n--)
- {
- cin>>m;
- sum=sum+m;
- }
- cout<<sum<<endl;
- }
- return 0;
- }
//1093
- #include<iostream>
- using namespace std;
- int main()
- {
- int n,s,m,sum;
- cin>>n;
- while(n--)
- {
- sum=0;
- cin>>m;
- while(m--)
- {
- cin>>s;
- sum=sum+s;
- }
- cout<<sum<<endl;
- }
- return 0;
- }
//1094
- #include<iostream>
- using namespace std;
- int main()
- {
- int n,m,sum;
- while(cin>>n)
- {
- sum=0;
- while(n--)
- {
- cin>>m;
- sum=sum+m;
- }
- cout<<sum<<endl;
- }
- return 0;
- }
//1095
- #include<iostream>
- using namespace std;
- int main()
- {
- int n,m;
- while(cin>>n>>m)
- {
- cout<<n+m<<endl<<endl;
- }
- return 0;
- }
//1096
#include<iostream>
using namespace std;
int main() {
int N; cin >> N;
while (N--) {
int M,temp,sum = 0;
cin >> M;
while (M--) {
cin >> temp;
sum += temp;
}
if (N > 0)
cout << sum << endl << endl;
else
cout << sum << endl;
}
return 0;
}
基本輸入輸出練習 hdu1089-1096