编程语言单选难度 3真题改编 · 2023
480. def foo(a, b=2, *args, **kwargs):
print(a, b, args, kwargs)
foo(1, 3, 4, 5, x=6, y=7)
执行以上代码的输出结果为()
练习本题 ›
编程语言单选难度 3真题改编 · 2024
487. 下面 C++ 程序的运行结果为()
#include <iostream>
#include <vector>
#include <algorithm>
using namespace std;
bool cmp(pair<int, int> a, pair<int, int> b) {
return a.second < b.second;
}
int main() {
std::vector<std::pair<int, int>> v_p;
v_p.emplace_back(1, 2);
v_p.emplace_back(2, 1);
v_p.emplace_back(3, 4);
v_p.emplace_back(4, 3);
sort(v_p.begin(), v_p.end(), cmp);
for (auto t : v_p)
{
std::cout << t.first << " " << t.second << std::endl;
}
return 0;
}
练习本题 ›