Run ID | 作者 | 问题 | 语言 | 测评结果 | 分数 | 时间 | 内存 | 代码长度 | 提交时间 |
---|---|---|---|---|---|---|---|---|---|
133943 | baim. | 分发饼干 | C++ | 运行出错 | 0 | 0 MS | 248 KB | 539 | 2024-03-02 10:55:10 |
#include <iostream> #include <vector> #include <algorithm> using namespace std; int findContentChildren(vector<int>& g, vector<int>& s) { int count = 0, j = 0, i = 0; for (; i < s.size() && j < g.size();) { if (s[i] >= g[j]) { count++; j++; i++; } else { ++i; } } return count; } int main() { vector<int> vec1{ 1,2 }, vec2{ 1,2, 3 }; cout << findContentChildren(vec1, vec2); system("PAUSE"); return 0; }