武汉科技大学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 明天就要英语考试了,小明明正在挑灯夜 战背单词.小明明发现单词很难背,背一个忘一个.经过仔细研究,小明明发现单词难背的原因是因为某个字符的出现,破坏了整个单词的 ...
随机推荐
- Caffe Python特征抽取
Caffe Python特征抽取 转载 http://www.cnblogs.com/louyihang-loves-baiyan/ Caffe大家一般用到的深度学习平台都是这个,关于Caffe的训练 ...
- 自然语言处理(1)之NLTK与PYTHON
自然语言处理(1)之NLTK与PYTHON 题记: 由于现在的项目是搜索引擎,所以不由的对自然语言处理产生了好奇,再加上一直以来都想学Python,只是没有机会与时间.碰巧这几天在亚马逊上找书时发现了 ...
- CentOS 6.x 下Postfix和dovecot邮件服务安装和基本配置
1 卸载sendmail [root@mail~]# pstree | grep sendmail [root@mail~]# service sendmail stop [root@mail~]# ...
- 转:Git_Windows 系统下Git安装图解
原文地址:http://blog.csdn.net/jiguanghoverli/article/details/7902791 Windows 系统下Git安装图解 简单来说Git是一个免费的.开源 ...
- 002 Spring Restful案例
1:工程结构 需要注意的是需要额外导入以下三个包: jackson-annotations-2.6.1.jar jackson-core-2.6.1.jar jackson-databind-2.6. ...
- Macro Substitution
看<C程序设计语言>(英文版)学到的两个用法. 两个很简单的宏用法. #的用法: if, however, a parameter name is preceded by a # in t ...
- POJ 1502 MPI Maelstrom( Spfa, Floyd, Dijkstra)
题目大意: 给你 1到n , n个计算机进行数据传输, 问从1为起点传输到所有点的最短时间是多少, 其实就是算 1 到所有点的时间中最长的那个点. 然后是数据 给你一个n 代表有n个点, 然后给你一 ...
- C# .NET开发Oracle数据库应用程序
.NET Framework访问Oracle数据库至少有两种方式,一种是利用微软提供的ADO.NET,另一种是利用Oracle提供的ODP.NET. 安装VS的时候会附带ADO.NET,安装Oracl ...
- mklink命令转移win7系统盘文件夹users和programdata(附xp的方法)
mklink命令转移win7系统盘文件夹users和programdata(附xp的方法) 使用mklink命令转移文件夹清理臃肿的c盘 (一) 我的 ...
- 酷派D530刷机指引
酷派D530是我的第一台智能手机,刚入手的时候是挺激动的,什么Root啦,精简系统删官方应用啦,app2sd啦,杂七杂八的应用装了一堆,折腾得不亦乐乎.但过了那个热度之后,现在我对于智能手机的要求还是 ...