memset 填 0x3f 得到几

👁️ 1 人浏览 💬 0 人评论 ❤️ 添加收藏

竞赛里常用 0x3f 当「无穷大」。

运行下面这段程序:

#include <algorithm>
#include <iostream>
#include <string>
#include <vector>
using namespace std;
#include <cstring>

int main() {
    int a[3];
    memset(a, 0x3f, sizeof a);
    cout << a[0] << endl;
}

(本题用 g++ -std=c++17 -O0 编译。)

提交你的答案
请登录后提交答案。
去登录
代码编辑器
Ctrl + Enter 运行
本次输入:
输出:

                        
👩‍🏫
AI
💬 题目评论

全部评论