大佬求调!
查看原帖
大佬求调!
1153753
Illustrious000楼主2024/10/7 21:34

P1708 [入门赛 #21] 星云 hard ver.

#include<iostream>
using namespace std;
int x,n,m,a=1,b,e,f;
int main(){
    cin>>x;
    while(x!=0){
        cin>>n>>m;
        for(int i=1;i<=n;i++){
            a*=10;
        }
        for(int i=1;i<=a;i++){
            e=0;
            b=i;
            while(b){
                e+=b%10;
                b/=10;
            }
            if(e<=m){
                f++;
            }
        }
        cout<<f-1<<endl;
        x-=1;
    }
    return 0;
}

可关uwu

2024/10/7 21:34
加载中...