为什么超快读会 RE?
  • 板块P1001 A+B Problem
  • 楼主WMY_
  • 当前回复13
  • 已保存回复13
  • 发布时间2024/12/9 20:56
  • 上次更新2024/12/10 12:30:57
查看原帖
为什么超快读会 RE?
1211668
WMY_楼主2024/12/9 20:56
#include <iostream>

using namespace std;

char buf[1 << 20], *_now = buf, *_end = buf;
#define getchar() (_now == _end && (_end = (_now = buf) + fread(buf, 1, 1 << 20, stdin), _now == _end) ? EOF : *_now++)

int input() {
    int x = 0, f = 1;
    char ch = getchar();
    while (isdigit(ch) ^ 1) {
        if (ch == '-') f = -1;
        ch = getchar();
    }
    while (isdigit(ch)) {
        x = x * 10 + ch - '0';
        ch = getchar();
    }

    return x * f;
}

void solve() {
    int A = input(), B = input();
    cout << A + B << "\n";
}

int main() { solve(); }
2024/12/9 20:56
加载中...