A + B Problem HDU - 1000(語法練習題)
Calculate
A + B.
Input
Each line will contain two integers
A and
B. Process to end of file.
Output
For each case, output
A + B in one line.
Sample Input
1 1
Sample Output
2
題目分析:
本題的重點是能多次輸入資料實現運算,並不是輸入一次,運算一次就退出程式了。
程式說明:
把cin>>a>>b當成while函式的引數就可以實現要求了,因為cin遇到輸入終止的時候會返回一個0,而while遇到0時就會退出迴圈。
程式實現:
#include <iostream>
using namespace std;
int main()
{
int a, b;
while (cin >> a >> b)
{
cout << a + b << endl;
}
}
相關推薦
A + B Problem HDU - 1000(語法練習題)
Calculate A + B. Input Each line will contain two integers A and B. Process to end of file. Output For each case, output
A + B Problem HDU - 1000(水題)
Problem Description: Calculate A + B. Input:Each line will contain two integers A and B. Process to end of file. Output:For each case, output
A + B Problem HDU - 1000
Text Reverse Time limit 1000 ms Memory limit 32768 kB OS Windows Problem Description Calculate A + B. Input Each line will contain two integer
[Luogu 1919]【模板】A*B Problem升級版(FFT快速傅裏葉)
vector sample lex cstring 模板 rip putc -s and Description 給出兩個n位10進制整數x和y,你需要計算x*y。 Input 第一行一個正整數n。 第二行描述一個位數為n的正整數x。 第三行描述一個位數為n的正整數y
洛谷P1919 【模板】A*B Problem升級版(FFT快速傅裏葉)
題目 計算 printf n) freopen sam 升級 double 輸入輸出格式 題目描述 給出兩個n位10進制整數x和y,你需要計算x*y。 輸入輸出格式 輸入格式: 第一行一個正整數n。 第二行描述一個位數為n的正整數x。 第三行描述一個位數為n的
luogu P1919 【模板】A*B Problem升級版(FFT快速傅裏葉)
type -i OS source a* ++ urn CP AS 模板 嗯 做多項式乘法,進位 沒了 #include<cmath> #include<cstdio> #include<cstring> #include<a
洛谷P1919 【模板】A*B Problem升級版(FFT)
targe 空間 break 這就是 bre color show print lex 傳送門 話說FFT該不會真的只能用來做這種板子吧…… 我們把兩個數字的每一位都看作多項式的系數 然後這就是一個多項式乘法 上FFT就好了 然後
HDU-2000 ASCII碼排序(語法練習題)
ASCII碼排序 Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 65536/32768 K (Java/Others) Total Submission(s): 236447 Accepted Submission(s): 93
A+B Problem _ C++(嘿嘿)
題目背景 作為所有程式語言的最“難”(一點也不難是假的)的一道題,曾近難倒了許多“大佬”,本次提供幾種“簡單”演算法(嘿嘿); 題目描述 a+b problem; 輸入輸出格式 輸入格式: 分兩行輸入a,b<=10^500; 輸出格式:
洛谷 P1919 【模板】A*B Problem升級版(FFT快速傅立葉)
題目來源 吐槽下P3803都是紫題... 真心好寫,本想一遍過的...但是 我真是太菜了... 1 #include<bits/stdc++.h> 2 using namespace std; 3 const int MAXN=200000; 4 const dou
洛谷 P1919 【模板】A*B Problem升級版(FFT快速傅裏葉)
urn == mes span operator scanf spa a* printf 題目來源 吐槽下P3803都是紫題... 真心好寫,本想一遍過的...但是 我真是太菜了... 1 #include<bits/stdc++.h> 2
bzoj3212: Pku3468 A Simple Problem with Integers(線段樹)
while printf scan font geo main post align sim 3212: Pku3468 A Simple Problem with Integers 題目:傳送門 題解: 感謝Rose_max大佬的傾情相
PAT甲級 1002 A+B for Polynomials (25)(25 分)
pac list i++ lease find and for pan put 1002 A+B for Polynomials (25)(25 分) This time, you are supposed to find A+B where A and B are
B - Cube HDU - 1220 (數學計數)
printf 怎麽 多少 思路 出現 頂點 沒有 fine define 題意:一個邊長為N的正方體,切割成N*N*N個單位正方體,問有多少對正方體之間有0個,2個公共點。 思路:因為正方體之間出現公共點的情況有0,2,4. 那麽直接正面求,肯定不好求,那麽先求出有4個公共
1065 A+B and C (64bit) (20 分)
1065 A+B and C (64bit) (20 分) 程式碼 c++版 #include <bits/stdc++.h> using namespace std; int main() { long long a, b, c, sum; int n; ci
POJ 3468 A Simple Problem with Integers(線段樹)
truct fin clas define class 基本 open urn display 題目鏈接:A Simple Problem with Integers 題意:N個數字,M次操作;操作分為兩種,第一種將$[L,R]$區間內的每個數都加上C,第二種為求$[L,
CodeForces-266A Stones on the Table(語法練習題)
Stones on the Table time limit per test2 seconds memory limit per test256 megabytes inputstandard input outputstandard output There are n stones
Stones on the Table CodeForces - 266A(語法練習題)
There are n stones on the table in a row, each of them can be red, green or blue. Count the minimum number of stones to take from the table so tha
String Task CodeForces - 118A(語法練習題)
紀念第一條部落格 Petya started to attend programming lessons. On the first lesson his task was to write a simple program. The program was supposed to do
java-1011 A+B和C (15)(15 分)
一、題幹 1011 A+B和C (15)(15 分) 給定區間[-2^31^, 2^31^]內的3個整數A、B和C,請判斷A+B是否大於C。 輸入格式: 輸入第1行給出正整數T(<=10),是測試用例的個數。隨後給出T組測試用例,每組佔一行,順序給出A、B和