zoukankan      html  css  js  c++  java
  • 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;
    }
    
  • 相关阅读:
    20161101学习笔记
    20161031学习笔记
    20161028学习笔记
    20161027学习笔记
    ReentrantLock Condition
    ReentrantLock 重入锁
    CountDownLatch用法与原理
    场景化解释 AQS原理
    Atomic
    多线程工具类
  • 原文地址:https://www.cnblogs.com/tomvii/p/6350126.html
Copyright © 2011-2022 走看看