标签:ble ref ace itemid note processor stdio.h pos any
题意:求出多少个1组成的数字能整除n
思路:一位位去取模。记录答案就可以
代码:
#include <stdio.h>
#include <string.h>
int n;
int main() {
while (~scanf("%d", &n)) {
int ans = 1;
int now = 1;
while (now) {
now = (now * 10 + 1) % n;
ans++;
}
printf("%d\n", ans);
}
return 0;
}
标签:ble ref ace itemid note processor stdio.h pos any
原文地址:http://www.cnblogs.com/llguanli/p/6888953.html