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. Java-将多线程停止的两种方法

    线程如何停止呢 stop方法过时了,看起描述发现,有其他解决方案. 线程结束:就是让线程任务代码执行完,run方法结束. run方法怎么结束呢? run方法中通常都定义循环,只要控制住循环就哦了. / ...

  2. 字符串匹配之KMP,C++实现

    文字介绍KMP我就不讲了,相信大家看了不少别的文章也没看懂,我肯定也不能用文字表达清楚. 最好的办法就是看严老师的视频,讲的很清晰. 请百度 KMP 严蔚敏: 在这里我用C++实现一下: #inclu ...

  3. 解决js中post提交数据并且跳转到指定页面的问题总结

    今天在开发中过程中遇到了这个问题,js中利用JQuery中的 $.post("url", id, function(){}); 这个方法是数据提交正常,但是后台处理完成之后跳转无法 ...

  4. [STM32F429-DISCO-HAL]2.先学会点亮LED和使用LCD。。。

      首先就简单的一秒闪烁一次LED灯,进而类比推理其他外设的配置过程.然后呢我们就用上LCD吧,毕竟这块板上占地面积最大的就是这个2.4'LCD了.   先贴出简洁的main函数.很干净,比较容易看懂 ...

  5. C++ Socket学习记录 -2

    WinSock TCP 编程流程 TCP通信,就像是固定电话,首先是要安装基站,然后是将电话号绑定到电话,然后拨号,接通之后说事,完事之后还要挂电话(甭管谁先挂). 1.初始化环境 使用函数 int ...

  6. 在Android中使用枚举注解而不是枚举

    Enums often require more than twice as much memory as static constants. You should strictly avoid us ...

  7. Eclipse快速补全行末分号

    Eclipse快速补全行末分号 Eclipse快捷键跳到行末补全分号 Eclipse快速结束当前语句(在行末加上分号,就是当前语句结束) Intellij IDEA 里是有快速补全分号的功能(快捷键: ...

  8. cvpr2017:branchout——基于CNN的在线集成跟踪

    1.引言 2017年CVPR上有不少关于跟踪的paper.CF方面最引人瞩目的应该是ECO了,CNN方面也有一些新的进展.Branchout是一个基于CNN用bagging集成的在线跟踪方法. con ...

  9. tensorflow笔记(二)之构造一个简单的神经网络

    tensorflow笔记(二)之构造一个简单的神经网络 版权声明:本文为博主原创文章,转载请指明转载地址 http://www.cnblogs.com/fydeblog/p/7425200.html ...

  10. java基础(数据类型,运算符)

    java基础之数据类型(变量) java中存在的数据有常量和变量 常量:在程序执行的过程中其值不可以发生改变 常量的分类 字面值常量 字面值常量的分类 常量 描述 字符串常量 用双引号括起来的内容 整 ...