1001. A+B Format (20)
来源:互联网 发布:jsp中调用java方法 编辑:程序博客网 时间:2024/05/17 23:14
点击打开链接
#include <cstdio>#define MAX 1000010char pro[MAX];char res[2*MAX];int main(){freopen("in.txt","r",stdin);int a,b;while(scanf("%d %d",&a,&b)!=EOF){int c=a+b;if(c!=0){int flag=1;if(c<0){flag=0;c=0-c;}int cnt=0;while(c!=0){pro[cnt++]=(c%10)+'0';c/=10;}int cc=cnt;int tmp=cnt;tmp=cnt/3;cc+=tmp;if(cnt%3==0 && tmp!=0){cc--;}res[cc--]='\0';for(int i=0;i<cnt;i++){if(i%3==0 && i!=0){res[cc--]=',';res[cc--]=pro[i];}else{res[cc--]=pro[i];}}if(!flag){printf("-");}puts(res);}else{printf("0\n");}}return 0;}
0 0
- 1001. A+B Format (20)
- 1001. A+B Format (20)
- 1001. A+B Format (20)
- 1001. A+B Format (20)
- 1001. A+B Format (20)
- 1001. A+B Format (20)
- 1001. A+B Format (20)
- 1001. A+B Format (20)
- 1001. A+B Format (20)
- 1001. A+B Format (20)
- 1001. A+B Format (20)
- 1001. A+B Format (20)
- 1001. A+B Format (20)
- 1001. A+B Format (20)
- 1001. A+B Format (20)
- 1001. A+B Format (20)
- 1001. A+B Format (20)
- 1001. A+B Format (20)
- 解决myeclipse10.x的Servers产生的at com.genuitec.eclipse.ast.deploy.core.Deployment.<init>(Unknown Source)
- 欢迎使用CSDN-markdown编辑器
- 【问题收录】ubuntu下weka链接mysql数据库
- 定义 & 声明
- 多表连接的三种方式详解 HASH JOIN MERGE JOIN NESTED LOOP
- 1001. A+B Format (20)
- Maven学习笔记(六)m2eclipse的安装
- OpenCV Using Python——加载和显示图像
- 网络操作与AFNetworking
- POJ Dungeon Master 2251
- 如何将FTP默认在文件浏览器下打开!
- java之注解、枚举理解(高效java之注解、枚举)
- 探索Material Design
- 黑马程序员--java学习总结(2)