社区讨论

一个充分利用O2优化的好方法

P1001A+B Problem参与者 4已保存回复 3

讨论操作

快速查看讨论及其快照的属性,并进行相关操作。

当前回复
3 条
当前快照
1 份
快照标识符
@miykduz5
此快照首次捕获于
2025/12/09 20:36
3 个月前
此快照最后确认于
2025/12/10 12:44
3 个月前
查看原帖
CPP
#include <bits/stdc++.h>
#define int long long
using namespace std;

inline int read() {
	int c = 0, x = 1;
	char ch = getchar();

	while (ch < '0' || ch > '9') {
		if (ch == '-') {
			x = -1;
		}
		ch = getchar();
	}

	while (ch >= '0' && ch <= '9') {
		c = c * 10 + ch - '0';
		ch = getchar();
	}

	return c * x;
}

signed main() {
	int a = read(), b = read(), f = 0;

	for (int i = 0; i < a + (int)1e18; i++) {
		f++;
	}
	for (int i = 0; i < b + (int)1e18; i++) {
		f++;
	}

	cout << f - (int)2e18;

	return 0;
}
(O2会将这种for循环直接优化掉)

回复

3 条回复,欢迎继续交流。

正在加载回复...