Codeforces Round #834 (Div. 3) D. Make It Round 我的方法是 先求出当末尾 1 , 2 , 3... 1,2,3... 1,2,3... 个 0 0 0 的需要的倍数,然后在依次扩大,lcm就是求最小倍数的数字,然后再每次一倍倍加即可,但是发现 l o n g long long l o n g long long 并不能满足我的需求, u n s i g n e d unsigned unsigned l o n g long long l o n g long long 即可。 #include<bits/stdc++.h> using namespace std; typedef unsigned long long ULL; int main() { int T;cin>>T; while(T--) { ULL n,m;cin>>n>>m; ULL sum2=1; ULL res=10; for(int i=1;;i++) { ULL sum1=lcm(res,n)/n; if(sum1>m) break; res*=10; sum2=sum1; } ULL sum=sum2; for(int i=1;;i++) { if(sum+sum2>m) break; sum+=sum2; } cout<<sum*n<<endl; } return 0; }