题意:给你一个n(0~1e6),前提是n不能被2和5整除,再给你一个10以内的数m,要求输出只由m组成的数(这个数能被n整除)的位数。

其实题目很简单,模拟一下我们用的笔算除法的过程就好了,只要保证数字不溢出就好,但菜鸡的我竟然没有第一时间想到。。。麻打麻打打内,哎~

 1 #include<iostream>
 2 #include<cstdio>
 3 #include<cstring>
 4 #include<cmath>
 5 #define LL long long
 6 using namespace std;
 7 
 8 int main()
 9 {
10     //ios::sync_with_stdio(false);
11     LL t;
12     scanf("%lld",&t);
13     LL ans=0;
14     for(int i=1;i<=t;i++)
15     {
16         ans=1;
17         LL n,m; 
18         scanf("%lld %lld",&n,&m);
19         LL tt=m;
20         while(m%n!=0)
21         {
22             m%=n;
23             m=m*10+tt;
24             
25             ans++;
26         }
27         printf("Case %d: %d\n",i,ans);
28     //    cout<<"Case "<<i<<": "<<ans<<endl;
29     }
30 }