需要C++写,如果可以,可以给我讲讲那个组数要怎么弄?
int t;
cin>>t;
for(int i=0;i<t;i++)
{
//这里计算
}
#include<iostream>
using namespace std;
int main()
{
int t;
cin>>t;
int arr[t][2];
for(int j=0;j<t;j++)
{
for(int i=0;i<2;i++)
{
cin>>arr[j][i] ;//这一步是输入数组。
}
}
for(int j=0;j<t;j++)
{
cout<<arr[j][0]+ arr[j][1]<<endl;//这一步让数组相加
}
return 0;
}
如果是OJ的话这样应该是能过的
#include<iostream>
using namespace std;
int main()
{
int T = 0, a = 0, b = 0;
cin >> T;
for (int i = 0; i < T; i++)
{
cin >> a >> b;
cout << a + b << endl;
}
return 0;
}
图片没传上