| # | Problem | Pass Rate (passed user / total user) |
|---|---|---|
| 12156 | a + b = c |
|
| 12157 | Pascal's Triangle Generator |
|
Description
This is a practice for Online Judge.
The following is an example C++ solution.
#include <iostream>
#include <sstream>
#include <string>
using namespace std;
string _OJINPUT_ =
"5\n"
"8467 -9959\n"
"-3500 -3666\n"
"5724 9169\n"
"-642 1478\n"
"-5536 -3038\n";
int main()
{
#ifndef ONLINE_JUDGE
stringstream ss;cin.rdbuf(ss.rdbuf());ss<<_OJINPUT_;
#endif
int n, a, b;
cin >> n;
for(int i=0; i<n; i++) {
cin >> a >> b;
cout << a << " + " << b << " = " << (a+b) << endl;
}
return 0;
}
Input
The first number is the number of integer pairs.
The following lines are the integer pairs, one pair per line.
Output
For each integer pair, please calculate its sum and print out the result in the "a + b = c" form.
Sample Input Download
Sample Output Download
Tags
Discuss
Description
Please write a program to generator Pascal's Triangles.
Input
The first integer is the number of Pascal's Triangles we want to generate.
The following integers are the required heights of of the Pascal's Triangles, respectively.
Output
The generated Pascal's Triangles.