TOJ 4493 Remove Digits 贪心】的更多相关文章

4493: Remove Digits Description Given an N-digit number, you should remove K digits and make the new integer as large as possible. Input The first line has two integers N and K (N不大于500000). The next line has a N-digit number with no leading zero. Ou…
4493: Remove Digits 时间限制(普通/Java):1000MS/3000MS     内存限制:65536KByte 总提交: 329            测试通过:77 描述 Given an N-digit number, you should remove K digits and make the new integer as large as possible. 输入 The first line has two integers N and K (1 ≤ K<N≤…
描述 Given an N-digit number, you should remove K digits and make the new integer as large as possible. 输入 The first line has two integers N and K (1 ≤ K<N≤500000).The next line has a N-digit number with no leading zero. 输出 Output the largest possible…
  Product of digits  For a given non-negative integer number N , find the minimal natural Q such that the product of all digits of Q is equal N . Input The first line of input contains one positive integer number, which is the number of data sets. Ea…
这道题目有人用DFS.有人用DP 我觉得还是最简单的贪心解决也是不错的选择. Ok,不废话了,这道题目的意思就是 原先存在一个严格递增的Arrary_A,然后Array_A[i] 的每位之和为Array_B[i] 现在给你一个Array_B, 让你在条件: Array_A[len] Minimize 下求出次数组 (当然我们很容易得出,如果Array_A[len] 不是最小化的,那么答案有无穷多,随意暴力一下都可以) 所以这题没有那么暴力= = 解题思路: 首先求出Array_B[i] 和 Ar…
题意:给你一个正整数\(n\),每次可以对\(n\)加一,问最少操作多少次是的\(n\)的所有位数之和不大于\(s\). 题解:\(n\)的某个位置上的数进位,意味这后面的位置都可以被更新为\(0\),所以我们从高位往低位记录一个\(sum\),然后根据情况判断即可. 代码: int t; int s; ll n; char str[N]; int main() { //ios::sync_with_stdio(false);cin.tie(0);cout.tie(0); t=read(); w…
The number 3797 has an interesting property. Being prime itself, it is possible to continuously remove digits from left to right, and remain prime at each stage: 3797, 797, 97, and 7. Similarly we can work from right to left: 3797, 379, 37, and 3. Fi…
A. Div. 64 time limit per test 1 second memory limit per test 256 megabytes input standard input output standard output Top-model Izabella participates in the competition. She wants to impress judges and show her mathematical skills. Her problem is f…
组件如下: 对计算类型的说明如下: The table below contains descriptions associated with the calculator step: Function Description Required fields Set field to constant A Create a field with a constant value. A Create a copy of field A Create a copy of a field with t…
A. Div. 64 time limit per test 1 second memory limit per test 256 megabytes input standard input output standard output Top-model Izabella participates in the competition. She wants to impress judges and show her mathematical skills. Her problem is f…