LeetCode Weekly Contest 183
問題文
省略
省略
C++に変換後のコードはこちら
#define main dummy_main
{}
#undef main
class Solution {
public:
vector<int> minSubsequence(vector<int>& A) {
int tot, now = 0, N = A.size();
vector<int> res;
sort(A.begin(), A.end());
tot = sum(A(N));
rrep(i,N) if(now <= tot){
res.push_back(A[i]);
now += A[i];
tot -= A[i];
}
return res;
}
};
Current time: 2024年05月08日23時53分37秒
Last modified: 2020年04月10日06時28分21秒 (by laycrs)
Tags: Competitive_Programming_Incomplete LeetCode
トップページに戻る
Logged in as: unknown user (not login)