一道acm题,Delete NumberTime Limit:1000MS Memory Limit:65536KTotal Submit:701 Accepted:129DescriptionGiven 2 integer number n and m.You can delete m digits from the number n,then number n changes to a new number n1.Tell me how to delete the number,
来源:学生作业帮助网 编辑:六六作业网 时间:2024/12/25 14:39:34
一道acm题,Delete NumberTime Limit:1000MS Memory Limit:65536KTotal Submit:701 Accepted:129DescriptionGiven 2 integer number n and m.You can delete m digits from the number n,then number n changes to a new number n1.Tell me how to delete the number,
一道acm题,
Delete Number
Time Limit:1000MS Memory Limit:65536K
Total Submit:701 Accepted:129
Description
Given 2 integer number n and m.You can delete m digits from the number n,then number n changes to a new number n1.Tell me how to delete the number,you can get the smallest one.
For example,
m:1 n:1456
n1 may be 145,156,146,456
the smallest one is 145.Then n1 should be 145.
Input
The input consists of T test cases.The number of them (T) is given on the first line of the input file.Each test case consists of one single line containing two integer number m(1
一道acm题,Delete NumberTime Limit:1000MS Memory Limit:65536KTotal Submit:701 Accepted:129DescriptionGiven 2 integer number n and m.You can delete m digits from the number n,then number n changes to a new number n1.Tell me how to delete the number,
1
2 178023
if (*(p-1)>*p&&n>0)
{
del (p-1);
n--;
}
……
if (*(p-1)>*p&&n>0)
{
del (p-1);
n--;
p=str+1;
}
不知道题目在那~没有测试~