标签:style http color os io line
题目大意:给出n,问说者少要多少为1才可以整除n。
解题思路:等于是高精度取模,直到余数为0为止。
#include <cstdio>
#include <cstring>
int main () {
int n;
while (scanf("%d", &n) == 1) {
int ans = 1, c = 1;
while (c) {
c = (c * 10 + 1) % n;
ans++;
}
printf("%d\n", ans);
}
return 0;
}
uva 10127 - Ones(数论),布布扣,bubuko.com
标签:style http color os io line
原文地址:http://blog.csdn.net/keshuai19940722/article/details/36409825