1001.A+B Format (20)代码自查(补足版)
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)代码自查(补足版)的更多相关文章
- 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 ...
- 关于‘1001.A+B Format (20)’的解题报告
1001.A+B Format(20) 首先要感谢一下指导我github上传问题的小伙伴们,捣腾了一整天我终于摸到了一点门路,真的谢谢你们. 小豪的github 问题描述: Calculate a + ...
- "1001. A+B Format (20)" 解题报告
Github : git@github.com:Circlecos/object-oriented.git PDF Of Markdown : "1001. A+B Format (20)& ...
- 【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 ...
- 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 ...
- 1001. A+B Format (20) (%0nd)
1001. A+B Format (20) 时间限制 400 ms 内存限制 65536 kB 代码长度限制 16000 B 判题程序 Standard 作者 CHEN, Yue Calculate ...
- 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 ...
- 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 ...
- 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 ...
随机推荐
- Java Struts图片上传至指定文件夹并显示图片
继上一次利用Servlet实现图片上传,这次利用基于MVC的Struts框架,封装了Servlet并简化了JSP页面跳转. JSP上传页面 上传一定要为form加上enctype="mult ...
- IntelliJ IDEA(2017.2)安装和破解(转)
如果有一定的经济基础,请支持正版,这里提供破解方法. 一.下载并安装, IntelliJ IDEA的官网:https://www.jetbrains.com 二.破解. 百度下载一个 Jetbrain ...
- 原理Lambda表达式
http://www.kingreatwill.com/ (1)源起 .net的设计者发现在使用匿名方法时, 仍旧有一些多余的字母或单词的编码工作 比如delegate关键字 于是进一步简化了匿名方法 ...
- Entity Framework Core 2.0 新特性
本文翻译来自:https://docs.microsoft.com/en-us/ef/core/what-is-new/index 一.模型级查询过滤器(Model-level query filte ...
- angular学习(二)-- Directive
1.2 指令:Directive AngularJS 通过被称为 指令 的新属性来扩展 HTML, 具体表现形式一般为带有前缀 ng-xxx 的 HTML 属性. 指令的使用形式 ng-xxx 的属性 ...
- 前端到后台ThinkPHP开发整站(4)
今晚继续我的这个项目的开发,今晚也是写的不多,主要写了一个菜单管理功能的CURD方法,前端界面还没有进行编写. 菜单管理Model层的代码: <?php namespace Common\Mod ...
- 【IP限制】验证是否限制了境外IP访问权限
为啥要限制境外IP访问咱们的网站或者服务呢?怕泄漏了"机密"(好像都是我们在山寨别人,哪儿TM有机密,那叫"鸡贼") 好像国外的网站也没有限制咱大陆客去访问,反 ...
- 地铁间谍 洛谷 p2583
题目描述 特工玛利亚被送到S市执行一个特别危险的任务.她需要利用地铁完成他的任务,S市的地铁只有一条线路运行,所以并不复杂. 玛利亚有一个任务,现在的时间为0,她要从第一个站出发,并在最后一站的间谍碰 ...
- 从Google Play下载应用并不安全,上千款监视软件伪装其中
如果你认为在官方应用市场里下载app就觉得安全的话,小编可以负责任的回答你:"too young too simple,sometimes native" 今年4月,BankBot ...
- 【社交系统研发日记五】ThinkSNS+如何计算字符显示长度?
今天我们来聊一下可能很多人都会头疼的东西:显示长度. 需求是这样的,在字符的显示上,两个英文单词才占一个中文或者其他语言的显示长度.如下: 上面排的是两个英文字母,一个汉字,一个Emoji.你会发现, ...