武汉科技大学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 明天就要英语考试了,小明明正在挑灯夜 战背单词.小明明发现单词很难背,背一个忘一个.经过仔细研究,小明明发现单词难背的原因是因为某个字符的出现,破坏了整个单词的 ...
随机推荐
- Solr4.8.0源码分析(19)之缓存机制(二)
Solr4.8.0源码分析(19)之缓存机制(二) 前文<Solr4.8.0源码分析(18)之缓存机制(一)>介绍了Solr缓存的生命周期,重点介绍了Solr缓存的warn过程.本节将更深 ...
- jQuery插件infinitescroll参数【无限翻页】
转自:http://blog.163.com/penglie_520/blog/static/19440505020127255319862/ infinite-scroll-jquery 参数详解: ...
- 转一篇:Hyper-V和VMware的高可用实时迁移技术详解
ESX里以集群的ha.drs.dpm功能实现 HYPER-V里以集群+共享存储实现. ~~~~~~~~~~ 微软公司的Hyper-V虚拟化管理程序一经面世就引发了业界的普遍关注.本文意在对Hyper- ...
- ASP.NET MVC 5使用CrystalReport(水晶报表)
原文:ASP.NET MVC 5使用CrystalReport(水晶报表) http://downloads.businessobjects.com/akdlm/cr4vs2010/CRforVS ...
- 【HDOJ】1619 Unidirectional TSP
题目本身一点儿都不难,但是就是被字典序搞死了.写的挺麻烦,但是过了,逆向做好做一点儿. /* 1619 */ #include <cstdio> #include <cstring& ...
- 使用C#开发ActiveX控件 11
C#开发ActiveX控件 ActiveX 是一个开放的集成平台,为开发人员.用户和 Web生产商提供了一个快速而简便的在 Internet 和 Intranet 创建程序集成和内容的方法. 使用 ...
- Java---IO加强(1)
RandomAccessFile ★随机访问文件,自身具备读写的方法. new RandomAccessFile()之后,若文件不存在会自动创建,存在则不创建.--该类其实内部既封装了字节输入流,又封 ...
- Selenium webdirver 操作浏览器
打开浏览器 HtmlUnit Driver 优点:不会实际打开浏览器,运行速度很快. 缺点:对JavaScript的支持不够好,有时会捕获不到页面元素. 使用:WebDriver driver=new ...
- H5页开发规范/通用规范
兼容目标 主流移动设备:iPhone 4+ .三星.魅族.华为.红米.小米1S 以上及主流 Android 千元机型:请特别关注iPhone4/4s.魅族MX4.华为P6等机型 操作系统:iOS 7. ...
- 关于Web Api的HelpPage文档注释问题
之前使用Microsoft.AspNet.WebApi.HelpPage的时候,一直为返回对象的注释发愁,以为这是个BUG. 这个注释的解决办法其实要从其原理理解就明白了. 因为HelpPage是读取 ...