摘要:
问题描述:输入两数,统计两数相加的进位个数My Code://精简代码#include<iostream>using namespace std;int main(){ int a, b, c, cnt; while(cin >> a >> b) { c = cnt = 0; while(a || b) { c = ((a%10 + b%10 + c) > 9) ? 1 : 0; cnt += c; a /= 10; b /= 10; } ... 阅读全文
摘要:
问题描述:输入两数,统计两数相加的进位个数My Code://精简代码#include<iostream>using namespace std;int main(){ int a, b, c, cnt; while(cin >> a >> b) { c = cnt = 0; while(a || b) { c = ((a%10 + b%10 + c) > 9) ? 1 : 0; cnt += c; a /= 10; b /= 10; } ... 阅读全文
|