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;
    }
    
  • 相关阅读:
    分布式事务基本概念
    rocketmq源码分析3-consumer消息获取
    Mac下的Eclipse不能记住工作空间问题
    rocketmq源码分析2-broker的消息接收
    rocketmq源码分析1-benchmark学习
    metrics
    slf4j与logback对接是如何将日志写到控制台的
    Spring AOP
    hibernate数据库连接池,常用配置
    动态代理
  • 原文地址:https://www.cnblogs.com/tomvii/p/6350126.html
Copyright © 2011-2022 走看看