标签:技术 seq warnings order fine set else while turn
1 #pragma warning(disable:4996) 2 #define _CRT_SECURE_NO_WARNINGS 3 4 #include <iostream> 5 #include <algorithm> 6 #include <cmath> 7 #include <vector> 8 #include <map> 9 #include <set> 10 #include <unordered_set> 11 #include <unordered_map> 12 #include <queue> 13 #include <cmath> 14 #include <string> 15 #define INFINITE 2000000000 16 using namespace std; 17 18 19 int main() { 20 int n, p; 21 cin >> n >> p; 22 long long int v[100001]; 23 for (int i = 0; i < n; ++i) { 24 cin >> v[i]; 25 } 26 sort(v, v+n); 27 int len = 0; 28 int i = 0, j = 0; 29 while (i < n && j < n) { 30 if (v[j] <= p * v[i]) { 31 len = max(len, j - i + 1); 32 ++j; 33 } 34 else { 35 ++i; 36 } 37 } 38 cout << len; 39 return 0; 40 }
标签:技术 seq warnings order fine set else while turn
原文地址:https://www.cnblogs.com/2020R/p/14483135.html