武汉科技大学ACM :1002: A+B for Input-Output Practice (II)
Problem Description
Your task is to Calculate a + b.
Input
Input contains an integer N in the first line, and then N lines follow. Each line consists of a pair of integers a and b, separated by a space, one pair of integers per line.
Output
For each pair of input integers a and b you should output the sum of a and b in one line, and with one line of output for each line in input.
Sample Input
2
1 5
10 20
Sample Output
6
30
#include<iostream>
#include<string>
using namespace std;
int main()
{
int n,a,b;
int sum;
string result;
char s[];
cin>>n;
for(int i=;i<n;i++)
{
cin>>a;
cin>>b;
sum = a+b;
sprintf(s, "%d",sum);//将整数转为字符串型
result += s;
result += "\n";
}
cout<<result;
return ;
}
武汉科技大学ACM :1002: A+B for Input-Output Practice (II)的更多相关文章
- 武汉科技大学ACM :1001: A+B for Input-Output Practice (I)
Problem Description Your task is to Calculate a + b. Too easy?! Of course! I specially designed the ...
- 武汉科技大学ACM :1008: A+B for Input-Output Practice (VIII)
Problem Description Your task is to calculate the sum of some integers. Input Input contains an inte ...
- 武汉科技大学ACM :1007: A+B for Input-Output Practice (VII)
Problem Description Your task is to Calculate a + b. Input The input will consist of a series of pai ...
- 武汉科技大学ACM :1006: A+B for Input-Output Practice (VI)
Problem Description Your task is to calculate the sum of some integers. Input Input contains multipl ...
- 武汉科技大学ACM :1005: A+B for Input-Output Practice (V)
Problem Description Your task is to calculate the sum of some integers. Input Input contains an inte ...
- 武汉科技大学ACM :1004: A+B for Input-Output Practice (IV)
Problem Description Your task is to Calculate the sum of some integers. Input Input contains multipl ...
- 武汉科技大学ACM :1003: A+B for Input-Output Practice (III)
Problem Description Your task is to Calculate a + b. Input Input contains multiple test cases. Each ...
- 武汉科技大学ACM:1006: 我是老大
Problem Description 今年是2021年,正值武汉科技大学 ACM俱乐部成立10周年.十周年庆祝那天,从ACM俱乐部走出去的各路牛人欢聚一堂,其乐融融.庆祝晚会上,大家纷纷向俱乐部伸出 ...
- 武汉科技大学ACM:1005: Soapbear and Honey
Problem Description Soapbear is the mascot of WHUACM team. Like other bears, Soapbear loves honey ve ...
- 武汉科技大学ACM:1002: 华科版C语言程序设计教程(第二版)例题6.6
Problem Description 明天就要英语考试了,小明明正在挑灯夜 战背单词.小明明发现单词很难背,背一个忘一个.经过仔细研究,小明明发现单词难背的原因是因为某个字符的出现,破坏了整个单词的 ...
随机推荐
- 用JvisualVM监视远程tomcat
在tomcat的catcalina.sh 中java_opts 环境变量中添加以下参数: -Dcom.sun.management.jmxremote -Dcom.sun.management.jmx ...
- RR 和RC隔离问题
Sesssion 1: mysql> select @@tx_isolation; +-----------------+ | @@tx_isolation | +--------------- ...
- 【HDOJ】3587 NUDOTA
字符串模拟水题. /* 3587 */ #include <iostream> #include <cstdio> #include <cstring> #incl ...
- 最短路算法模板合集(Dijkstar,Dijkstar(优先队列优化), 多源最短路Floyd)
再开始前我们先普及一下简单的图论知识 图的保存: 1.邻接矩阵. G[maxn][maxn]; 2.邻接表 邻接表我们有两种方式 (1)vector< Node > G[maxn]; 这个 ...
- 【转】带checkbox的ListView实现(二)——自定义Checkable控件的实现方法
原文网址:http://blog.csdn.net/harvic880925/article/details/40475367 前言:前一篇文章给大家展示了传统的Listview的写法,但有的时候我们 ...
- delphi调用java编写的webservice
delphi调用java编写的webservice JAVApojo: public class GroupInfo implements Serializable{ private stati ...
- C++: Command Line Processing
Save this code here for studying and using it. Surce code is here. CmdLine.h File #pragma once #incl ...
- Linux下的memset函数
函数原型 void *memset(void *s, int c, size_t n); 函数功能 将以s为首的存储空间前n字节空间全部替换为参数c指定的数据. 返回值 更新后的首地址s. 头文件 # ...
- sql server 2005中IMAGE类型的BUG问题
目的:在sql server 2005数据库上筛选出那些有照片的员工 由于客户之前的数据库是sql server 2000,定义的photo字段的数据类型为image, 在sql 2005数据库上,用 ...
- max key length is 1000 bytes
ALTER TABLE ad_keyword_brand ADD CONSTRAINT w1 UNIQUE (keyword,adasin,brand,page_position,country,ad ...