簡單題:Your task is to Calculate a + b.
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<stdio.h>
using namespace std;
int main(void)
{
int n,x,y;
scanf("%d",&n);
while(n--)
{
if(scanf("%d%d",&x,&y)!=EOF)
printf("%d\n",x+y);
}
return 0;
}
如果輸入的終止條件不是n,而是輸入了0 0,那麼程式碼就變成了下面這樣:
#include<iostream> #include<stdio.h> using namespace std; int main(void) { int x,y; while(scanf("%d%d",&x,&y) &&(x!=0 || y!=0)) { printf("%d\n",x+y); } return 0; }
相關推薦
簡單題: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, sepa
Git報錯:Your branch is ahead of 'origin/master' by 1 commit
remote 倉庫 mas orm like mes reset director gin . commit之後,用git status,打印信息為: # On branch master # Your branch is ahead of ‘origin/maste
ACM第一期練習題第一小題:String Task
click here to have a try Time limit 2000ms Memory limit 262144KB 題目原題: Petya started to attend programming lessons. On the first lesson his task
Your Secret Weapons to Becoming a 10X Developer
Or how to become one of those highly-paid “10x Rockstar Ninja” developers companies love to hire.It doesn’t matter if you’re working on a side hustle or if
PAT——乙級1022:D進位制的A+B &乙級1037:在霍格沃茨找零錢
1022 D進位制的A+B (20 point(s)) 輸入兩個非負 10 進位制整數 A 和 B (≤230−1),輸出 A+B 的 D (1&
Which CRO tool to choose-A/B, Multivariate, or AI-powered?
Getting started with conversion rate optimization (CRO) is no simple task. It involves a lot of ideation, data analysis, and website designing among oth
題目描述:給定一個字串,求出其所有可能的字元組合. 比如:abc 其所有組合是:a,b,c,ab,ac,bc,abc
/* 題目描述:給定一個字串,求出其所有可能的字元組合. 比如:abc 其所有組合是:a,b,c,ab,ac,bc,abc 是遞迴的思想:首先你拿到的是abc,你可以依次打印出去掉c,b,a的組合:ab,ac,bc 然後遞迴用這些子串去調動這個函式,比如ab:依次去掉b,
使用Java語言,使用System.in輸入以下各個變數的值,並按照公式計算得出結果。 公式為: 4/3*(r+34)-9*(a+b*c)+(3+d*(2+a))/(a+b*d)
public class Demo2 { /** * @param args */ /* * 根據題目要求,編寫程式完成相應要求: 使用Java語言,使
Calculate A + B.
Problem Description Calculate A + B. Input Each line will contain two integers A and B. Process to end of file. Output For each case, o
opencms 安裝出現以下的問題:Your 'max_allowed_packet' variable is set to less than 16777216 Byte (16MB).
var 錯誤 lease -s byte csdn oss mysq nts 一、問題 在安裝opencms是會出現例如以下錯誤: MySQL system variable ‘max_allowed_packet‘ is set to 1048576 Byte (1M
杭電acm 1084 What Is Your Grade? 比較考人的簡單題
#include <iostream> #include <cstdio> #include <algorithm> #include <cstring>
No new migrations found. Your system is up-to-date.處理
span system 記錄 new blog 相關操作 處理 style date 顯然是migrations表中存儲的相關操作記錄了,刪除就好了!!! No new migrations found. Your system is up-to-date.處理
[BestCoder Round #3] hdu 4907 Task schedule (模擬簡單題)
using mes family set key problem 占用 時間 task Task schedule Problem Description 有一臺機器,而且給你這臺機器的工作表。工作表上有n個任務,機器在ti時間運行第i個任務,1秒就可以完畢
uva 10474 Where is the Marble?(簡單題)
content mil stdlib.h std lib [0 數據 main pre 我非常奇怪為什麽要把它歸類到回溯上,明明就是簡單排序,查找就OK了。wa了兩次,我還非常不解的懷疑了為什麽會 wa,原來是我居然把要找的數字也排序了,當時僅僅是想著能快一點查找。所以
Android 提示: The connection to adb is down, and a severe error has occured.
又一 rac 重新啟動 clip 手機 text track bsp 列表 今天早上打開Eclipse,一直提示 The connection to adb is down, and a severe error has occured,無法執行程序。重新啟動Eclip
Mysql連接報錯:1130-host ... is not allowed to connect to this MySql server如何處理
nmp mage htm 庫服務器 strong 所在 conn bsp -1 這個問題是因為在數據庫服務器中的mysql數據庫中的user的表中沒有權限(也可以說沒有用戶),下面將記錄我遇到問題的過程及解決的方法。 在搭建完LNMP環境後用Navicate連接出錯
pom.xml報錯:web.xml is missing and <failOnMissingWebXml> is set to true
-i 成了 tro pom inf esc 方法 target targe 出現這個錯誤的原因是Maven不支持缺少web.xml的web項目 解決方法 添加Web模塊,對項目右鍵->Java EE Tools->Generate Deployment
git pull遇到錯誤:error: Your local changes to the following files would be overwritten by merge:
覆蓋 eset class 代碼更新 hang err ast div clas 今天用git pull將服務器的代碼拉到本地時,遇到錯誤,Your local changes to the following files would be overwritten by
安裝tensorflow遇到:Your CPU supports instructions that this TensorFlow binary was not compiled to use
pil 屏蔽警告 block 問題 方法 imp 計算 body fma 為了提升CPU計算速度的。若你有支持cuda的GPU,則可以忽略這個問題,因為安裝SSE4.1, SSE4.2, AVX, AVX2, FMA, 僅僅提升CPU的運算速度(大概有3倍)。 解決方法:
解決錯誤:Your ApplicationContext is unlikely to start due to a @ComponentScan of the default package.
context 錯誤 com sta spa can src 直接 代碼 原因是代碼直接放在默認包裏邊,比如src\main\java目錄下 應該在src\main\java下建立子目錄,比如src\main\java\com\test 這樣的話,代碼就在com.tes