1001.A+B Format (20)代码自查(补足版)

谢谢畅畅酱的提醒,发现了代码中的不足,把变量名更改成更合理的名字,并且把注释也换成英文啦!

栋哥提供的代码自查的方式也帮助了我发现很多代码中的不足,一些边界问题上的处理,自己也补足了很多。重新更新了一下git,也发现提交时需要注意的问题。这里是我的

git

打算更新版本时,无法commit的一个问题Another git process seems to be running in this repository, e.g.

an editor opened by 'git commit'. Please make sure all processes

are terminated then try again. If it still fails, a git process

may have crashed in this repository earlier:

remove the file manually to continue.

通过万能的搜索引擎,也是查到通过rm -f ./.git/index.lock这个命令结束进程,即可继续提交啦!

#include<stdio.h>
int main()
{
int a,b,sum,d,e,u,digit,j,w=0,l[10]={0};
digit=1;
scanf("%d%d",&a,&b);
sum=a+b;
if(sum<0)
{
sum=-sum;
printf("-");
}
d=sum;
while(d>0)
{
d=d/10;
digit=digit+1;
}
digit=digit-1;
if(sum==0)
digit=digit+1;
for(j=0;j<digit;j++)
{
e=sum%10;
l[digit-j]=e;
sum=sum/10;
}
u=digit%3;
for(j=1;j<=u;j++)
printf("%d",l[j]);
if(digit==3)
{
for(j=1;j<=3;j++)
printf("%d",l[j]); //3 digits
}
while(digit>3&&u<digit)
{
if(u!=0)
printf(",");
for(j=1;j<=3;j++)
printf("%d",l[u+j]);
u=u+3;
} return 0;
}

1001.A+B Format (20)代码自查(补足版)的更多相关文章

  1. 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 ...

  2. 关于‘1001.A+B Format (20)’的解题报告

    1001.A+B Format(20) 首先要感谢一下指导我github上传问题的小伙伴们,捣腾了一整天我终于摸到了一点门路,真的谢谢你们. 小豪的github 问题描述: Calculate a + ...

  3. "1001. A+B Format (20)" 解题报告

    Github : git@github.com:Circlecos/object-oriented.git PDF Of Markdown : "1001. A+B Format (20)& ...

  4. 【PAT】1001. A+B Format (20)

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

  5. PAT-PAT (Advanced Level) Practise 1001. A+B Format (20) 【二星级】

    题目链接:http://www.patest.cn/contests/pat-a-practise/1001 题面: 1001. A+B Format (20) Calculate a + b and ...

  6. 1001. A+B Format (20) (%0nd)

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

  7. PAT 甲级 1001 A+B Format (20)(20 分)

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

  8. PAT 甲级1001 A+B Format (20)(C++ -思路)

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

  9. PAT (Advanced Level) Practice 1001 A+B Format (20 分) 凌宸1642

    PAT (Advanced Level) Practice 1001 A+B Format (20 分) 凌宸1642 题目描述: Calculate a+b and output the sum i ...

随机推荐

  1. numastat的理解

    numa的统计数据及理解如下, [root@localhost kernel]# numastat                     node0           node1numa_hit ...

  2. Linux下ftp的安装配置

    1.查看ftp包是否可用yum list | grep vsftpd 2.安装ftpyum install vsftpd 3.启动systemctl start vsftpd 4.开机启动chkcon ...

  3. 有关XSS的一个系列教程

    在乌云发现了一个有关XSS的教程,目前有21篇,够我慢慢儿学的了. 这个系列教程的地址:http://www.wooyun.org/whitehats/心伤的瘦子/page/1 几个常见的语句 < ...

  4. javascript+HTMl5游戏下载,开发一个都能月薪上万!舅服你

    HTML5时代已经到来许久了,你是否已经掌握了那么一点呢?今天小编给大家讲讲h5的折叠多设备.跨平台特性, 即用HTML5制作游戏.相比flash,HTML5更加灵活方便,随着浏览器技术的不断升级,H ...

  5. Vue过渡效果之CSS过渡

    前面的话 Vue 在插入.更新或者移除 DOM 时,提供多种不同方式的应用过渡效果.本文将从CSS过渡transition.CSS动画animation及配合使用第三方CSS动画库(如animate. ...

  6. Windows 程序注册成服务的方法

    Windows 程序注册成服务的方法 将windows 程序注册成服务这个是很多后台程序需要实现的功能,注册成服务后,你的程序就可以像windows 服务一样随系统启动,并且隐藏你的控制台界面.下面介 ...

  7. 【社交系统研发日记五】ThinkSNS+如何计算字符显示长度?

    今天我们来聊一下可能很多人都会头疼的东西:显示长度. 需求是这样的,在字符的显示上,两个英文单词才占一个中文或者其他语言的显示长度.如下: 上面排的是两个英文字母,一个汉字,一个Emoji.你会发现, ...

  8. 如何输入EOF

    很多线上笔试的编程题要求能循环处理多个case,需使用while(scanf("%s",tmp)!=EOF)语句.EOF表示文件结束符,但是在本机的编译环境中,如何在控制台输入EO ...

  9. 为什么新生代内存需要有两个Survivor区

    转载自:http://blog.csdn.net/antony9118/article/details/51425581 在JVM的新生代内存中,为什么除了Eden区,还要设置两个Survivor区? ...

  10. 20个开发人员非常有用的Java功能代码

    本文将为大家介绍20个对开发人员非常有用的Java功能代码.这20段代码,可以成为大家在今后的开发过程中,Java编程手册的重要部分. 1. 把Strings转换成int和把int转换成String ...