为什么?

P1001 A+B Problem

Always_Remember_It @ 2024-11-29 17:33:49


#include <bits/stdc++.h>
using namespace std;
#define int long long
signed main(){
    for(int i=1;i<=10000000000;i++);
    int a,b;cin>>a>>b;
    cout<<a+b<<endl;
    return 0;
}

我在测1s最多跑多少数据时,加到10^10还能过,这是什么道理?(顺便问一下CCF机子一秒最多能跑多少

by sjh0626 @ 2024-11-29 17:40:12

@Always_Remember_It O2玄学吧


by YYCk @ 2024-11-29 17:43:18

仅仅只做这么基础的纯加法,这是机子可以承受的,建议实战还是用1e8


by 张景奕 @ 2024-11-29 17:44:28

@Always_Remember_It for(int i=1;i<=10000000000;i++);被编译器开O2删掉了


by DANNNqwq @ 2024-11-29 17:45:29

@Always_Remember_It
1e10爆int了


by SegmentTree_ @ 2024-11-29 17:45:33

@Always_Remember_It 被O2优化优化掉了,把O2关了就T了。


by liuyuxiaozaizai @ 2024-11-29 17:46:20

@Always_Remember_It 不爆int吗?


by Always_Remember_It @ 2024-11-29 21:02:34

@liuyuxiaozaizai define了


by Always_Remember_It @ 2024-11-29 21:03:01

@DANNNqwq 你棕了


by DANNNqwq @ 2024-11-29 21:07:24

@Always_Remember_It ?


by liuyuxiaozaizai @ 2024-11-29 21:50:36

@Always_Remember_It当我没说


| 下一页