L1-046 整除光棍 (20 分)
这题实际上是模拟除法;上马原课的时候领悟到了,hh
#includeusing namespace std; int main() { int x; cin >> x; int ans = 0, cnt = 0; while(ans < x) { ans = ans * 10 + 1; cnt++; } while(1) { cout << ans / x; ans = ans % x; if(ans == 0) break; ans = ans * 10 + 1; cnt++; } cout << ' ' << cnt; return 0; }