90pts求调(壶关)
查看原帖
90pts求调(壶关)
995569
L__B楼主2025/7/26 22:50
#include<bits/stdc++.h>
using namespace std;
int n,p,a,b,t,s;
int main(){
    scanf("%d%d",&n,&p);
    a=pow(10,n-1),b=pow(10,n);
    for(int i=a;i<b;i++){
        t=i,s=0;
        while(t) s+=t%10,t/=10;
        if(s%p==0){
            printf("%d",i);
            break;
        }
    }
    return 0;
}
2025/7/26 22:50
加载中...