解题 UVA 10035

来源:互联网 发布:高斯朴素贝叶斯算法 编辑:程序博客网 时间:2024/05/13 19:57

一个非常简单的高精度题目。某人Blog里面写,他用10min就写完了……我花了1h……而且代码里面有Bug,debug再次用去0.5h。

 

一定要在写之前注意程序整体的逻辑性。一次做对,比做完之后再Debug,要省很多事。

 

如果有人也搜索到了这里,说明你也在做这个题目,而且有bug……这是可能的Test Cases:

 

/* test cases:
Input:
9090 10
0 0

Correct Output:
1 carry operation.

999 1
1 999
9999 0
0 9999
9989 1
9090 10
12300 78900
256789012 321098765
0 0

correct output:
3 carry operations.
3 carry operations.
No carry operation.
No carry operation.
1 carry operation.
1 carry operation.
2 carry operations.
2 carry operations.
*/

 

如果以上的Test Cases都通过了,那么,要对自己有信心!看看是不是多打、少打换行,句号之类。

同时,注意在 “No”/“1 carry”的情况,operation单数;其他情况复数。

我最后发现,原来一直WA是因为,忘记打句号了……

 

AC Code:

原创粉丝点击