This is an A+B Problem
Time Limit: 1000 ms Memory Limit: 65536 KiB
Problem Description
As usual, there will be an A+B problem in warming up, this problem is:
Given two integers A and B, your job is to calculate the sum of A + B.
Given two integers A and B, your job is to calculate the sum of A + B.
Input
There are several test cases, For each test case:
There are two integers A, B for each case (0 ≤ A , B < 101000).
There are two integers A, B for each case (0 ≤ A , B < 101000).
Output
For each test case, output one line containing the result of A+B.
Sample Input
1 2 11111111111 11111111111
Sample Output
3 22222222222
提示:这个题看似非常简单,其实他说是A+B Problem,但是其实看样例就满满的恶意,10的1000次方,用long long也过不了,
所以这不是一个简单的A+B Problem,所以这道题要用到大数模拟,即用字符串数组模拟来完成两数相加的操作。
代码实现如下(g++):
#include <bits/stdc++.h> using namespace std; char s1[1010]; char s2[1010]; int ab[1010];//因为是1000次方,所以只需开1010的数组即可 int main() { int i,j; int len1,len2,a,b; memset(s1,'