#include<cstdio>
#include<cstring>
using namespace std; char s[10]; int main()
{
int a,b;
while(scanf("%d%d",&a,&b)==2)
{
memset(s,0,sizeof(s));
a=a+b;
if(a==0)
{
printf("0\n");
continue;
}
int aa=a;
b=0;
if(a<0)
{
a=-a;
}
while(a)
{
int r=a%10;
s[b++]=('0'+r);
a=a/10;
}
if(aa<0)
{
printf("-"); }
for(int i=b-1; i>=0; i--)
{
if(i==0)
printf("%c\n",s[i]);
else
printf("%c",s[i]);
if(i%3==0&&i!=0)
printf(",");
} }
return 0;
}

PAT 1001. A+B Format(水题)的更多相关文章

  1. PAT 1001. A+B Format 解题

    GitHub PDF 1001. A+B Format (20) Calculate a + b and output the sum in standard format -- that is, t ...

  2. 2014百度之星资格赛 1001:Energy Conversion(水题,逻辑题)

    Energy Conversion Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 32768/32768 K (Java/Others ...

  3. pat 1001 A+B Format

    题目链接:传送门 题目简述: 1. 给定两个整数值a,b: 2.范围-1000000 <= a, b <= 1000000: 3.按指定格式输出结果 例:-100000 9 输出: -99 ...

  4. PAT 1001 A+B Format (20分) to_string()

    题目 Calculate a+b and output the sum in standard format -- that is, the digits must be separated into ...

  5. caioj 1001: [视频]实数运算1[水题]

    题意:输入两个实数a和b,输出它们的和 题解:简单题不写题解了-- 代码: #include <cstdio> double a, b; int main() { while (~scan ...

  6. URAL 1001 Reverse Root(水题?)

    The problem is so easy, that the authors were lazy to write a statement for it! Input The input stre ...

  7. PAT 1001 A+B Format (20 point(s))

    题目: 我一开始的思路是: 用math.h中的log10函数来计算位数(不建议这么做,因为会很慢,而且会出一点别的问题): 用pow函数根据要插入分号的位置来拆分a+b成一个个数字(例如res / p ...

  8. PAT甲 1001. A+B Format (20) 2016-09-09 22:47 25人阅读 评论(0) 收藏

    1001. A+B Format (20) 时间限制 400 ms 内存限制 65536 kB 代码长度限制 16000 B 判题程序 Standard 作者 CHEN, Yue Calculate ...

  9. 1001 字符串“水”题(二进制,map,哈希)

    1001: 字符串“水”题 时间限制: 1 Sec  内存限制: 128 MB提交: 210  解决: 39[提交][状态][讨论版] 题目描述 给出一个长度为 n 的字符串(1<=n<= ...

随机推荐

  1. jquery导出Excel表格

    1.引用js插件 <script src="tableExport.js"></script> <script src="jquery.ba ...

  2. 图文详解前端CSS中的Grid布局,你真的可以5分钟掌握

    前言 网站的布局是一个网站设计的根本,CSS的Grid布局已经成为了未来网站布局的基本方式. 今天这篇文章我们通过图文,一起看看如何自己实现Grid布局方式. CSS 第一个Grid布局 首先我们看看 ...

  3. docker环境准备及理论

    1.预热 内核运行在内核空间,进程运行在用户空间,linux进程特性:父进程负责子进程的创建和回收,白发人送黑发人.容器就是为了保护它里面的内容物,不受其他容器干扰,也不去干扰其他容器.容器让进程认为 ...

  4. [POI2014]Beads

    题目大意: 有$n(n\leq10^6)$种颜色,第$i$种颜色有$c_i(\sum c_i\leq10^6)$个,指定第一个颜色为$a$,最后一个颜色为$b$,问对于一个长度为$m=\sum c_i ...

  5. centos安装postgresql-10及操作

    安装postgresql: Linux启动: service postgresql start 创建用户: createuser username 创建数据库: createdb dbname -O ...

  6. 【MySQL性能优化】MySQL常见SQL错误用法

    https://yq.aliyun.com/articles/72501?utm_content=m_14899

  7. Android Linux内核编译

    平台: Wind7_64 + Ubuntu12_04_64 + VMware 这里以Android5.0为例: Android5.0 可以到这里下载:115网盘礼包码:5lbd7crtk1wzhttp ...

  8. win2008 安装 配置 mysql

    安装的是windows Server 2008 R2 操作系统  按照国际管理,安装了数据库 MYSQL 5.0.    一路顺利,可以通过外部连接MYSQL的时候出现了问题,无论如何也连接不上  发 ...

  9. frp -- proxy name [ssh] is already in use

  10. mongodb修改器(转)

    MongoDB 修改器 对文档中的某些字段进行更新 $inc 专门用来增加(或减少)数字的,只能用于整数,长整数或双精度浮点型的值$inc键的值必须为数字,不能使用字符串,数组或其他非数字的值如果键不 ...