0分求助
查看原帖
0分求助
760018
蟋蟀喵~~STLlover楼主2023/5/13 14:26
#include <bits/stdc++.h>
using namespace std;
int n,k,t;
string m;
int main(){
    cin >> n;
    for(int i = 1; i <= n; i++){
        cin >> m >> k;
        for(int j = 1; j <= m.size(); j++){
        	if(m[j] - 48){
        		t++;
			}
		}
        if(t < k){
            cout << -1;
            continue;
        }
        for(int j = 1; j <= k; j++){
            cout << 9;
        }
        for(int j = 1; j < m.size(); j++){
            cout << 0;
        }
        cout << "\n";
    }
    return 0;
}
2023/5/13 14:26
加载中...