救命!我的代码被大芬污染导致90ptsWA!求调
查看原帖
救命!我的代码被大芬污染导致90ptsWA!求调
1207677
MassPoint楼主2024/8/18 19:57

代码:

#include<bits/stdc++.h>
using namespace std;
int m,k;
queue <unsigned long long> q;
bool vis[114514];
int main(){
    cin>>k>>m;
    for(int i=1;i<k;i++) q.push(i),vis[i]=true;
    while(!q.empty()){
        unsigned long long u=q.front();q.pop();
        for(int i=0;i<k;i++){
            unsigned long long v=u*10+i;
            if(v%m==0){
                cout<<v;
                return 0;
            }
            if(!vis[v%m])   vis[v%m]=true,q.push(v);
        }
    }
    return 0;
}

提交记录qwq

2024/8/18 19:57
加载中...