Analysis of the real questions of the Institute of Electronics C/C++ Programming Level Examination in March 2021 (Level 5)

All real questions of C/C++ level exam (Level 1~8)・Click here

Question 1: Smallest new integer

Given a positive decimal integer n (0 < n < 1000000000), the number in each digit is not 0. The number of digits in n is m. Now remove k bits (0<k < m) from m bits. What is the minimum generated new integer? For example: n = 9128456, k = 2, then the minimum generated new integer is 12456
Time limit: 1000
Memory limit: 65536
Input
The first line t, means there are t sets of data; Next, t lines, each line represents a set of test data, each set of test data contains two numbers n, k.
Output
t lines, each line has a number, representing the smallest integer obtained by removing k bits from n.
Sample input
2
9128456 2
1444 3
Sample output
12456
1

Answer:

//参考答案
#include<stdio.h>
#include<string.h>

int main() {
    int t, k;
    char a[200]

Guess you like

Origin blog.csdn.net/gozhuyinglong/article/details/134840905