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. 开机出现Oxc000000e故障的解决方法

    Oxc000000e故障 故障表现:开机时不能正常地登录系统,而是直接弹出图2所示的Oxc000000e故障提示. 原因分析:由于安装或卸载某些比较特殊的软件,往往会对Win7的引导程序造成非常严重的 ...

  2. FPGA功能仿真,门级仿真,后仿真的区别

    前言 分清楚各种仿真间的关系,工具采用quartus prime16.0,仿真工具采用modelsim10 ae版:项目:led_display; 流程 1.RTL行为级仿真:也叫功能仿真,这个阶段的 ...

  3. 局部加权回归LOWESS

    1. LOWESS 用kNN做平均回归: \[ \hat{f(x)} = Ave(y_i | x_i \in N_k(x)) \] 其中,\(N_k(x)\)为距离点x最近k个点组成的邻域集合(nei ...

  4. android 适配器 BaseAdapter 的学习

    昨天晚上看了下ArrayAdapter,和SimpleAdapter,今天早上起来看完了球赛,又继续要开始学习了,适配器除了前面的两种,还有一种常用的就是BaseAdapter,他是一个抽象类.事实上 ...

  5. Weex入门指南

    背景 由于公司项目需要,需求变化频繁,计划总改不上变化,由于app更新版本周期长,不能很好应对这种变化,正在此前提下热修复和热更新技术也有了发展的空间,不管热修复还是热更新,都是对app内容或者逻辑的 ...

  6. canvas标签的使用

    <!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8&quo ...

  7. 关于Filter

    [1].关于Filter Filter简介: Filter翻译为中文是过滤器的意思. Filter是JavaWeb的三大web组件之一Servlet.Filter.Listener Filter的作用 ...

  8. 80C51学习 流水灯

    /* c语言常用预处理命令 1.#define使用 #define A PO 后面不用加分号. #define PI 3.14 2.循环左移右移函数 _crol_(a,b)循环左移函数,a是左移的值, ...

  9. 【Centos7】安装nginx

    1.安装必要的rpm yum -y install make zlib zlib-devel gcc-c++ libtool openssl openssl-devel 2.安装PCRE  :  作用 ...

  10. DRAM(MT48LC8M32B2)学习

    Micron公司,型号为MT48LC8M32B2的DRAM,其86PIN的 TSOP封装引脚定义 Micron公司,型号为MT48LC8M32B2的DRAM,其86PIN的 TSOP封装引脚定义如上图 ...