HDU1013 Digital Roots

輸入結束條件爲0; #include <iostream> using namespace std; int main() { int n = -1; while (cin>>n && n!=0) { int sum = 0; int root = 0; do { while(n) { sum += n%10; n /= 10; } root = sum; n = root; sum = 0; /
相關文章
相關標籤/搜索