Run ID | 作者 | 问题 | 语言 | 测评结果 | 分数 | 时间 | 内存 | 代码长度 | 提交时间 |
---|---|---|---|---|---|---|---|---|---|
133917 | baim. | 分发饼干 | C++ | 编译错误 | 0 | 0 MS | 0 KB | 506 | 2024-03-02 10:36:34 |
#include<bits/stdc++.h> using namespace std; int main() { int g,int s; Arrays.sort(g); Arrays.sort(s); int i = 0; int j = 0; int res = 0; while(i<g.length&&j<s.length){ if(s[j]>=g[i]){//如果当前饼干满足当前孩子的需求,则res++,并取下一个孩子 res++; i++; } j++;//无论满足或不满足都要取下一个饼干 } cout<<res; }