#include<iostream>
#include<stack>
using namespace std;
int main(void){
long long int A,B,ans;
cin>>A>>B;
ans = A+B;
if( ans == 0 )
cout<<ans<<endl;
else {
stack<char> st;
int f = 1;
if( ans < 0 ){
ans=-ans;
f = 0;
}
while( ans ){
int mod = ans%10;
ans/=10;
st.push(mod);
}
if( !f )
cout<<"-"<<endl;
while( !st.empty()){
printf("%d\n",st.top());
st.pop();
}
}
return 0;
}
7-4 古风A+B (15分)
给定两个绝对值不超过 109 的整数 A 和 B,计算它们的和 A+B 是非常简单的事,但要将和这个数字按照中国古风从上到下竖着输出,就不是那么简单了吧?
输入格式:
输入在一行中给出 2 个绝对值不超过 109 的整数 A 和 B,其间以空格分隔。
输出格式:
将 A+B 数值的每一位从上到下竖着输出。如果是负数,那么负号占第 1 行,其它数字不用输出符号。
输入样例:
-6666 233
输出样例:
-
6
4
3
3