https://github.com/UNWILL2LOSE/object-oriented 解题思路 目标: *首先运算要求实现输入2个数后,输出类似于银行的支票上的带分隔符规则的数字. 代码实现思路 1.首先输入2个数字,进行相加,记为sum. 2.然后判断正负,决定是否输出"-".并且将负数变为整数. 3.定义i,循环从个位到最高位,把各个位的数取出来,存储在数组中 4.此时的i对应就是sum的位数,然后判断 *如果位数小于等于3,直接输出sum *否则,对i取3的余数,记为ke…
Github : git@github.com:Circlecos/object-oriented.git PDF Of Markdown : "1001. A+B Format (20)" 解题报告 问题描述 Calculate a + b and output the sum in standard format -- that is, the digits must be separated into groups of three by commas (unless there…
https://github.com/031502316a/object-oriented/tree/master/1001 ---恢复内容开始--- 1.解题思路 一开始见到题目时,感觉难的就是输出的格式. 见到这种中间插入其他东西的时候,第一个想到的就是字符串. 但是由于字符串运用不好,所以想了会觉得难弄,就放弃了这个想法. 于是一开始打了串代码,大致的想法就是,加完后判断,如果小于1000,就直接输出,如果是在1000到1000000之间的话,那就取相加数的后3位(通过取余数的方式),再除…
代码入口(https://github.com/NSDie/object-oriented) 这题的解题思路我有两个: 第一个是两个数字相加然后判断位数,因为题目限制了范围1000000的绝对值以内嘛,然后又要求没3位加一个逗号,那么就可以分三种情况讨论: 1.位数n<=3 直接输出 2.位数n>3&&n<=6 输出大于3的位数的数字 然后逗号 接着输出最后三位 3.位数n>6 输出第七位(题目最大也就2000000)输出逗号 输出六五四位 输出逗号输出最后三位.…
1. 作业链接 2. 解题的思路过程 首先这是道简单的计算题,要求计算a+b的值. 看初值条件,将a和b的取值限制在一个区间内. 本题难点和重点是如何把输出值形成题目要求的格式. 因为负数可通过在前面加上负号来达到成为正数的目的,所以下面我们只需要解决0-1000000区间内的输出情况. 每三位数要用一个逗号隔开,逗号可通printf语句来实现.因为在0-1000000范围内,输出逗号数有一个.两个和零个三种情况,分开讨论. 将所有情况考虑完毕,对照题目要求看是否有漏掉的细节条件,检查完毕后运行…
1001.A+B Format (20)代码自查(补足版) 谢谢畅畅酱的提醒,发现了代码中的不足,把变量名更改成更合理的名字,并且把注释也换成英文啦! 栋哥提供的代码自查的方式也帮助了我发现很多代码中的不足,一些边界问题上的处理,自己也补足了很多.重新更新了一下git,也发现提交时需要注意的问题.这里是我的 git 打算更新版本时,无法commit的一个问题Another git process seems to be running in this repository, e.g. an ed…
1001 A+B Format (20)(20 分) Calculate a + b and output the sum in standard format -- that is, the digits must be separated into groups of three by commas (unless there are less than four digits). Input Each input file contains one test case. Each case…
1001 A+B Format (20)(20 分) Calculate a + b and output the sum in standard format -- that is, the digits must be separated into groups of three by commas (unless there are less than four digits). Input Each input file contains one test case. Each case…
1001. A+B Format (20) 时间限制 400 ms 内存限制 65536 kB 代码长度限制 16000 B 判题程序 Standard 作者 CHEN, Yue Calculate a + b and output the sum in standard format -- that is, the digits must be separated into groups of three by commas (unless there are less than four d…
1001.A+B Format(20) 首先要感谢一下指导我github上传问题的小伙伴们,捣腾了一整天我终于摸到了一点门路,真的谢谢你们. 小豪的github 问题描述: Calculate a + b and output the sum in standard format -- that is, the digits must be separated into groups of three by commas (unless there are less than four digi…