题意: 给你 N,K 输出 KKKK.....KK能整除 N, 输出 K 的个数, (最小)
基础数学, 取摸运算即可。
#include<bits/stdc++.h> using namespace std; typedef long long LL; int main() { int t; scanf("%d",&t); for(int kase = 1; kase <= t; ++kase) { LL n, w; scanf("%lld %lld",&n, &w); LL cnt = 1, ret = w % n; while(ret) { ret = ((ret * 10) % n + (w % n)) % n; cnt ++; //cout << ret << endl; } printf("Case %d: %lld\n",kase, cnt); } }
原文:http://www.cnblogs.com/aoxuets/p/4917830.html