PAT 甲级 1085. Perfect Sequence (25)
2017-10-05 18:07
369 查看
Given a sequence of positive integers and another positive integer p. The sequence is said to be a "perfect sequence" if M <= m * p where M and m are the maximum and minimum numbers in the sequence, respectively.
Now given a sequence and a parameter p, you are supposed to find from the sequence as many numbers as possible to form a perfect subsequence.
Input Specification:
Each input file contains one test case. For each case, the first line contains two positive integers N and p, where N (<= 105) is the number of integers in the sequence, and p (<= 109) is the
parameter. In the second line there are N positive integers, each is no greater than 109.
Output Specification:
For each test case, print in one line the maximum number of integers that can be chosen to form a perfect subsequence.
Sample Input:
Sample Output:
Now given a sequence and a parameter p, you are supposed to find from the sequence as many numbers as possible to form a perfect subsequence.
Input Specification:
Each input file contains one test case. For each case, the first line contains two positive integers N and p, where N (<= 105) is the number of integers in the sequence, and p (<= 109) is the
parameter. In the second line there are N positive integers, each is no greater than 109.
Output Specification:
For each test case, print in one line the maximum number of integers that can be chosen to form a perfect subsequence.
Sample Input:
10 8 2 3 20 4 5 1 6 7 8 9
Sample Output:
8
Given a sequence of positive integers and another positive integer p. The sequence is said to be a "perfect sequence" if M <= m * p where M and m are the maximum and minimum numbers in the sequence, respectively.
Now given a sequence and a parameter p, you are supposed to find from the sequence as many numbers as possible to form a perfect subsequence.
Input Specification:
Each input file contains one test case. For each case, the first line contains two positive integers N and p, where N (<= 105) is the number of integers in the sequence, and p (<= 109) is the parameter. In the second line there are N positive integers, each is no greater than 109.
Output Specification:
For each test case, print in one line the maximum number of integers that can be chosen to form a perfect subsequence.
Sample Input:
10 8 2 3 20 4 5 1 6 7 8 9Sample Output:
8
相关文章推荐
- 1070. Mooncake (25)-PAT甲级真题
- PAT 甲级-1003. Emergency (25)
- 浙江大学PAT_甲级_1071. Speech Patterns (25)
- PAT甲级 1006.Sign In and Sign Out(25) 题目翻译与答案
- 浙江大学PAT_甲级_1070. Mooncake (25)
- PAT(甲级)1012. The Best Rank (25)
- 1040. Longest Symmetric String (25)-PAT甲级真题
- 1083. List Grades (25)-PAT甲级真题
- 1033. To Fill or Not to Fill (25) PAT 甲级
- PAT 甲级 1010.Radix (25)
- 1002. A+B for Polynomials (25) PAT甲级刷题
- 1013. Battle Over Cities (25)-PAT甲级真题(图的遍历,统计强连通分量的个数,dfs)
- 浙江大学PAT_甲级_1094. The Largest Generation (25)
- PAT甲级1036. Boys vs Girls (25)
- 1033. To Fill or Not to Fill (25)-PAT甲级真题(贪心算法)
- PAT甲级1002. A+B for Polynomials (25)
- 【PAT甲级】【C++】1007. Maximum Subsequence Sum (25)
- 【PAT甲级】1063. Set Similarity (25)
- PAT 甲级 1006. Sign In and Sign Out (25)
- PAT 甲级 1029. Median (25)