如果我们用普通的快读快写,可以达到 40 ms
#include <iostream>
using namespace std;
inline int read(){
int f = 1,x = 0;
char c = getchar();
while(!isdigit(c)){
if(c == '-')
f = -1;
c = getchar();
}
while(isdigit(c)){
x = (x << 3) + (x << 1) + (c^48);
c = getchar();
}
x *= f;
return x;
}
inline void print(int x){
if(x < 0){
putchar('-');
x = -x;
}
if(x > 9) print(x/10);
putchar(x%10+48);
}
int main() {
int a = read(),b = read();
print(a+b);
return 0;
}
开启 O2 后可达到 32 ms
使用下面这个代码,可以到达极限 20 ms
var a, b: longint;
begin
readln(a,b);
writeln(a+b);
end.
那么是否可以突破 20 ms 呢