2216 - A 2b
实验室里混入了一只2b,现在我们需要从众人之中将它分离出来,如你所想的那样,它的算术能力不是很强,所以MiaoWu出了一道算术题:计算 a+2*b 的值。
题目输入
第一行输入一个T,表示 T 组测试数据
每组测试包括两个数字 a,b (0<=a,b<=1000)
题目输出
对于每组数据,输出三个数,a,b,a+2b,两个数之间用空格隔开
输入/输出样例
题目输入
3 1 2 3 4 5 6
题目输出
1 2 5 3 4 11 5 6 17
C++解答
#include <cstdio> #include <algorithm> #include <cmath> #include <iostream> #include <cstring> using namespace std; int main(){ /*freopen("in.txt","r",stdin); freopen("out.txt","w",stdout);*/ int T,x,y; scanf("%d",&T); while(T--){ scanf("%d%d",&x,&y); printf("%d %d %d\n",x,y,x+2*y); } return 0; }