跳到正文

题解

题解:AT_arc224_a [ARC224A] Attach 00

New_Int约 3 分钟
原文
文章信息与版本

文章信息

发布
2026年7月13日
收录
2026年7月18日
更新
2026年11月14日
篇幅
约 3 分钟

版本

  1. v1当前

注意到 100∗k100*k 一定符合条件,所以 nn 不会超过 100∗k100*k

暴力枚举即可

C++
#include <unordered_map>
#include <algorithm>
#include <iostream>
#include <utility>
#include <cstring>
#include <vector>
#include <bitset>
#include <string>
#include <stack>
#include <queue>
#include <cmath>
#include <map>
#include <set>

#define ios ios::sync_with_stdio(0);cin.tie(0);cout.tie(0);
#define c1(x) __builtin_popcount(x)
#define ri register
#define il inline
#define uint unsigned long long
#define lowbit(x) x&-x
#define int long long
#define i128 __int128
#define pb push_back
#define db double

using namespace std;

typedef pair<int,int> pii;
typedef pair<db,db> pdd;

template<class T> 
void read(T &a,bool f=0,char ch=getchar()) 
{
    for(a=0;ch<'0'||ch>'9';ch=getchar()) ch=='-' ?f=1:0;
    for(;ch>='0'&&ch<='9';ch=getchar()) a=(a<<3)+(a<<1)+(ch-'0');
    a=f?-a:a;
}

template<class T,class... Y>
void read(T &t,Y &... a) 
{ 
    read(t);read(a...); 
}

int count0(int x)
{
    int res=0;
    vector<int> v;
    while(x)
    {
        v.pb(x%10);
        x/=10; 
    }
    for(int i=0;i<v.size();i++)
    {
        if(v[i]!=0) continue;
        int j=i;
        while(j+1<v.size()&&v[j+1]==0) j++;
        res=max(res,j-i+1);
        i=j;
    }
    return res;
}

signed main()
{
    int T;
    cin>>T;
    while(T--)
    {
        int k;
        cin>>k;
        for(int j=1;j<=100;j++)
        {
            if(count0(j*k)>=2)
            {
                cout<<j*k<<"\n";
                break;
            }
        }
    }
    return 0;
}
原文