2019年07月14日04時23分48秒に更新されたバージョンを表示しています.
最新のページはこちらをご覧ください.
LeetCode Biweekly Contest 4
問題文
省略
省略
#include<bits/stdc++.h>
using namespace std;
int cnt[100000];
class Solution{
public:
bool canDivideIntoSubsequences(vector<int>& nums, int K){
int N=nums.size(), i;
for(i=0;i<100000;i++){
cnt[i] = 0;
}
for(i=0;i<N;i++){
cnt[nums[i]-1]++;
}
for(i=0;i<100000;i++){
if(cnt[i]*K > N){
return false;
}
}
return true;
}
}
;
// cLay varsion 20190714-1
// --- original code ---
// int cnt[1d5];
//
// class Solution {
// public:
// bool canDivideIntoSubsequences(vector<int>& nums, int K) {
// int i, N = nums.size();
// rep(i,1d5) cnt[i] = 0;
// rep(i,N) cnt[nums[i]-1]++;
// rep(i,1d5) if(cnt[i]*K > N) return false;
// return true;
// }
// };
//
// {
// // main関数を適当に処理する
// }
Current time: 2024年05月11日23時57分10秒
Last modified: 2019年07月14日04時23分48秒 (by laycrs)
Tags: Competitive_Programming_Incomplete LeetCode
トップページに戻る
Logged in as: unknown user (not login)