杭電oj 1095和1096

1095:

#include<iostream>
using namespace std;

int main()
{
	int a,b;
	while(cin>>a>>b)
	{
		cout<<a+b<<endl<<endl;
	}
	return 0;
 } 

1096:

#include<iostream>
using namespace std;

int main()
{
	int n;
	cin>>n;
	while(n--)
	{
			int t,m,sum=0;
			cin>>m;
			for(int i=0;i<m;i++)
			{
				cin>>t;
				sum+=t;
			}
			
			if(n==0)
				cout<<sum<<endl;
			else
				cout<<sum<<endl<<endl;
		}
		
	return 0;
}

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章