简单题。

#include<iostream>
#include<cstring>
#include<cmath>
#include<algorithm>
#include<cstdio>
using namespace std; int a,b,tot,cnt;
int u[];
char ans[]; int main()
{
while(~scanf("%d%d",&a,&b))
{
a=a+b;
if(a==)
{
printf("0\n");
continue;
}
int tmp=abs(a);
tot=,cnt=;
while(tmp) u[tot++]=tmp%,tmp=tmp/; for(int i=; i<tot; i++)
{
ans[cnt++]=u[i]+'';
if((i+)%==&&tot-i!=) ans[cnt++]=',';
}
if(a<) ans[cnt++]='-';
for(int i=cnt-; i>=; i--) printf("%c",ans[i]);
printf("\n");
}
return ;
}

PAT (Advanced Level) 1001. A+B Format (20)的更多相关文章

  1. PAT (Advanced Level) Practice 1046 Shortest Distance (20 分) 凌宸1642

    PAT (Advanced Level) Practice 1046 Shortest Distance (20 分) 凌宸1642 题目描述: The task is really simple: ...

  2. PAT (Advanced Level) Practice 1042 Shuffling Machine (20 分) 凌宸1642

    PAT (Advanced Level) Practice 1042 Shuffling Machine (20 分) 凌宸1642 题目描述: Shuffling is a procedure us ...

  3. PAT (Advanced Level) Practice 1041 Be Unique (20 分) 凌宸1642

    PAT (Advanced Level) Practice 1041 Be Unique (20 分) 凌宸1642 题目描述: Being unique is so important to peo ...

  4. PAT (Advanced Level) Practice 1015 Reversible Primes (20 分) 凌宸1642

    PAT (Advanced Level) Practice 1015 Reversible Primes (20 分) 凌宸1642 题目描述: A reversible prime in any n ...

  5. PTA (Advanced Level) 1001 A+B Format

    1001 A+B Format Calculate a+b and output the sum in standard format -- that is, the digits must be s ...

  6. PAT (Advanced Level) Practise - 1096. Consecutive Factors (20)

    http://www.patest.cn/contests/pat-a-practise/1096 Among all the factors of a positive integer N, the ...

  7. PAT (Advanced Level) Practice 1152 Google Recruitment (20 分)

    In July 2004, Google posted on a giant billboard along Highway 101 in Silicon Valley (shown in the p ...

  8. PAT (Advanced Level) 1054. The Dominant Color (20)

    简单题 #include<cstdio> #include<cstring> #include<cmath> #include<vector> #inc ...

  9. PAT (Advanced Level) 1027. Colors in Mars (20)

    简单题. #include<cstdio> #include<cstring> #include<cmath> #include<algorithm> ...

随机推荐

  1. kubernetes 留言版DEMO

    kubernates hello world1 关闭防火墙 $systemctl disable firewalld $systemctl stop firewalld 2 安装etcd 和 kube ...

  2. Mysql找回root密码

    1.停止数据库服务 service mysql stop 2.修改my.cnf 添加skip-grant-tables 3.重启数据库 service mysql restart 4.修改root密码 ...

  3. Mybatis——helloWorld级程序

    <?xml version="1.0" encoding="UTF-8"?> <!DOCTYPE configuration PUBLIC & ...

  4. cssText笔记

    style.cssText 用来获取/设置元素的样式 设置: <div id= "a" style= "background: red;"> doc ...

  5. HDU 1022 Train Problem I 用栈瞎搞

    题目大意:有n辆火车,按一定的顺序进站(第一个字符串顺序),问是否能按规定的顺序出站(按第二个字符串的顺序出去),如果能输出每辆火车进出站的过程. 题目思路:栈的特点是先进后出,和题意类似,还有有一种 ...

  6. 快学Scala-第三章 数组相关操作

    知识点: 1.定长数组 Array val nums = new Array[Int](10) //10个整数的数组,所有元素初始化为0 val a = new Array[String](10) / ...

  7. linux 查看进程 和 杀死进程

    ps ax 显示当前系统进程的列表 PID TTY      STAT   TIME COMMAND ps aux 显示当前系统进程详细列表以及进程用户 USER       PID %CPU %ME ...

  8. 2016.10.08--Intel Code Challenge Final Round--D. Dense Subsequence

    time limit per test 2 seconds memory limit per test 256 megabytes input standard input output standa ...

  9. struts2+ajax实现异步验证

    由于老师布置作业的需要,在添加管理员的时候,要实现验证添加的管理员的用户名是否在数据库中已经存在,然后再客户端给用户一个提示.我首先想到的就是利用ajax实现异步验证技术,由于利用的ssh框架,所以在 ...

  10. Bootstrap学习 - JavaScript插件

     模态框 <div class="modal" id="myModal" tabindex="-1" role="dialo ...