多数据处理——T
Time Limit : 3000/1000ms (Java/Other) Memory Limit : 65535/32768K (Java/Other)
Total Submission(s) : 79 Accepted Submission(s) : 63
Font: Times New Roman | Verdana | Georgia
Font Size: ← →
Problem Description
第二类:先输入T,确定有多少组数据
处理方式,使用while循环,没处理一组数据,T的值减少1,直到T为0程序结束,while循环可以看C++教材学习,在这里只知道怎么用来处理输入也可以
int main()
{
int t;
cin >> t;
while( t-- ) {
//program
}
return 0;
}
结合上述信息,解决以T标志的多输入a+b问题
处理方式,使用while循环,没处理一组数据,T的值减少1,直到T为0程序结束,while循环可以看C++教材学习,在这里只知道怎么用来处理输入也可以
int main()
{
int t;
cin >> t;
while( t-- ) {
//program
}
return 0;
}
结合上述信息,解决以T标志的多输入a+b问题
Input
输入第一行是一个T,表示有T组数据( 1 <= T <= 20 )
The first line of the input contains an integer T(1<=T<=20) which means the number of test cases.
接下来T行,每行包含两个整数a,b ( 1 <= a, b <= 10 )
The first line of the input contains an integer T(1<=T<=20) which means the number of test cases.
接下来T行,每行包含两个整数a,b ( 1 <= a, b <= 10 )
Output
对于每组数据,输出a+b的值
Sample Input
2 1 2 3 4
Sample Output
3 7