武汉科技大学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 明天就要英语考试了,小明明正在挑灯夜 战背单词.小明明发现单词很难背,背一个忘一个.经过仔细研究,小明明发现单词难背的原因是因为某个字符的出现,破坏了整个单词的 ...
随机推荐
- The underlying provider failed on Open. EF
本地测试是可以的:但是放到服务器上就不行了: 报错:"The underlying provider failed on Open." 这一情况和我以前遇上的一次错误有点相似啊:都 ...
- C++11原子操作性能测试
测试结论是发现C++11原子操作在性能上,比以往用到的InterlockedIncrement或__sync_add_and_fetch性能上慢了1倍左右. 另外补充一点,在对原子变量进行比较的时候, ...
- jQuery plugin
SidebarJS http://makotot.github.io/sidebar/
- Android调用Asp.net Web Service示例
WebService代码: using System; using System.Collections.Generic; using System.Linq; using System.Web; u ...
- Delphi对ini文件的操作
一.INI文件的结构:; 注释[小节名]关键字=值 INI文件允许有多个小节,每个小节又允许有多个关键字, “=”后面是该关键字的值. 值的类型有三种:字符串.整型数值和布尔值.其中字符串存贮在INI ...
- 推送消息 相关公司 手机端分享http://mob.com/
信鸽 http://xg.qq.com/xg/pro/ctr_message 云巴 http://yunba.io/usercases/ 极光https://www.jpush.cn/ 手机端分享ht ...
- ObsoleteAttribute 可适用于除程序集、模块、参数或返回值以外的所有程序元素。 将元素标记为过时可以通知用户:该元素在产品的未来版本中将被移除。
官方文档:https://msdn.microsoft.com/zh-cn/library/system.obsoleteattribute(v=vs.110).aspx 备注 ObsoleteAtt ...
- Tomcat启动时报错:java.net.BindException: Permission denied <null>:80 【转载】
本文转载自: http://blog.sina.com.cn/s/blog_4550f3ca0101g37l.html 问题起因:做负载均衡时需要将Web工程与Wap工程同时部署在一台Suse服务 ...
- [Java] LinkedList / Queue - 源代码学习笔记
简单地画了下 LinkedList 的继承关系,如下图.只是画了关注的部分,并不是完整的关系图.本博文涉及的是 Queue, Deque, LinkedList 的源代码阅读笔记.关于 List 接口 ...
- 2015 GOOGLE I/O大会看点总结:新的开发工具及云端测试工具
http://ask.android-studio.org/?/article/48 尽管凌晨开始的主题演讲略显晦涩并继承了谷歌一贯的东一句西一句想起啥说啥的混乱风格,但期待用技术改变世界的技 ...