骄傲的代价
来源:互联网 发布:io域名是什么意思 编辑:程序博客网 时间:2024/05/01 23:30
只想做个水题,没想到碰到了大数据模拟,真尼玛惨
题目链接
#include<iostream>#include<algorithm>#include<cstring>using namespace std;///大数据模拟int main(){ ios::sync_with_stdio(false); int T; string a, b; int c[100100]; while(cin>>T) { for(int j=1; j<=T; j++) { cin>>a>>b; int i; memset(c,0,sizeof(c)); int k1=a.size()-1; int k2=b.size()-1; int p=max(k1, k2); for(i=0; k1>=0; i++,k1--) { c[i]=a[k1]-'0'; } for(i=0; k2>=0; i++,k2--) { c[i]+=b[k2]-'0'; if(c[i]>=10) { c[i+1]++; c[i]-=10; } } while(c[i]!=0) { if(c[i]>=10) { c[i+1]++; c[i]-=10; } i++; } cout<<"Case "<<j<<":"<<endl; cout<<a<<" + "<<b<<" = "; if(c[p+1]!=0) cout<<c[p+1]; for(int i=p; i>=0; i--) cout<<c[i]; cout<<endl; if(j!=T) cout<<endl; } } return 0;}
0 0
- 骄傲的代价
- 骄傲的代价 BigInteger
- 骄傲的代价 oj
- 骄傲的代价
- 骄傲的代价
- sdut_java_骄傲的代价
- 骄傲的代价
- 骄傲的代价
- 骄傲的代价
- SDUT 2279 骄傲的代价
- 骄傲的代价 SDUT 2279
- 骄傲的代价(大数处理)
- Java sdut acm 2279 骄傲的代价
- java -- SDUT 2714 骄傲的代价
- 山西人的骄傲!!
- Vb程序员的骄傲
- 啄木鸟的骄傲
- 美利坚的骄傲
- Log4j日志框架介绍
- 记一次web前端开发经验(持续更。。)
- 期望、方差、协方差及相关系数的原理理解和计算
- Torch学习笔记
- C++ - PAT - 1050. 螺旋矩阵(25)
- 骄傲的代价
- 【CodeForces】701B - Cells Not Under Attack(思维)
- 初涉java(事件处理与事件监听)
- 4w5:第四周程序填空题3(二维数组的重载[][])
- win10安装sublime text 2
- <hdoj1285>确定比赛名次
- Asp.net 控件用法汇总-RadioButtonList、DropDownList、button、Checkbox...(续)
- Android-教你自作一个简单而又实用的流式Tag标签布局
- poj 1375