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