快读快写 O3 优化

模板:

code:

 1 #include<bits/stdc++.h>
 2 #pragma GCC optimize(3)
 3 
 4 using namespace std;
 5 
 6 
 7 inline int read(){
 8     int x=0,f=1;char ch=getchar();
 9     while(!isdigit(ch)){if(ch=='-')f=-1;ch=getchar();}
10     while(isdigit(ch)){x=(x<<1)+(x<<3)+(ch^48);ch=getchar();}
11     return x*f;
12 }
13 inline void write(int x)
14 {
15     if(x<0)x=-x,putchar('-');
16     if(x>9)write(x/10);
17     putchar(x%10+'0');
18 }
19 int main()
20 {
21 
22     return 0;
23 }

 

快读:

 

1 inline int read(){
2     int x=0,f=1;char ch=getchar();
3     while(!isdigit(ch)){if(ch=='-')f=-1;ch=getchar();}
4     while(isdigit(ch)){x=(x<<1)+(x<<3)+(ch^48);ch=getchar();}
5     return x*f;
6 }

 

快写:

1 inline void write(int x)
2 {
3     if(x<0)x=-x,putchar('-');
4     if(x>9)write(x/10);
5     putchar(x%10+'0');
6 }

 

 

O3优化:

 

1 #pragma GCC optimize(3)

 

 

 

 

 

 当然在NOIP竞赛(现在叫CSP)中不允许使用O3优化

原文链接: https://www.cnblogs.com/nlyzl/p/11568765.html

欢迎关注

微信关注下方公众号,第一时间获取干货硬货;公众号内回复【pdf】免费获取数百本计算机经典书籍

    快读快写 O3 优化

原创文章受到原创版权保护。转载请注明出处:https://www.ccppcoding.com/archives/303139

非原创文章文中已经注明原地址,如有侵权,联系删除

关注公众号【高性能架构探索】,第一时间获取最新文章

转载文章受原作者版权保护。转载请注明原作者出处!

(0)
上一篇 2023年2月15日 下午11:58
下一篇 2023年2月16日 上午12:02

相关推荐