P10815 【模板】快速读入

@[wang6w6](/user/1051310) ~~求关~~ ```cpp #include<bits/stdc++.h> using namespace std; #define ll long long ll n,p; ll rd(){ ll f=1,x=0; char c=getchar_unlocked(); while(c<'0'||c>'9'){ if(c=='-') f=-1; c=getchar_unlocked(); } while(c>='0'&&c<='9'){ x=x*10+c-'0'; c=getchar_unlocked(); } return f*x; } ll out(ll x){ if(x<0){ putchar('-'); x=-x; } if(x>=10){ out(x/10); putchar(x%10+'0'); }else{ putchar(x+'0'); } } int main() { n=rd(),p=0; while(n--) { p+=rd(); } // cout<<p; out(p); return 0; } ```
by Yxy7952 @ 2024-09-20 09:33:38


@[wang6w6](/user/1051310)
by Yxy7952 @ 2024-09-20 09:40:09


注意用getchar_unlocked就刑 ```cpp #include<bits/stdc++.h> #define int long long namespace IO { #define int long long #define gh getchar_unlocked inline int read(){char ch=gh();int x=0;bool t=0;while(ch<'0'||ch>'9') t|=ch=='-',ch=gh();while(ch>='0'&&ch<='9') x=x*10+(ch^48),ch=gh();return t?-x:x;} inline char getc(){char ch=gh();while(ch<'a'||ch>'z') ch=gh();return ch;} inline void write(int x){if(x < 0){putchar('-');x = -x;}if(x > 9){write(x / 10);}putchar((x % 10 + '0'));} } using namespace IO; using namespace std; signed main(){ register int n,a,ans=0; n=read(); while(n--)a=read(),ans+=a; write(ans); } ``` @[wang6w6](/user/1051310)
by yzc001 @ 2024-09-20 09:46:55


@[Yxy7952](/user/936717) 请问我哪里错了
by wang6w6 @ 2024-09-20 09:46:57


@[wang6w6](/user/1051310) 不用快写,不用 long long,快读函数加 inline 即可通过
by Hagasei @ 2024-09-20 10:16:02


上面这二位是什么极品 \[汗\]
by Hagasei @ 2024-09-20 10:16:50


@[Hagasei](/user/383785) 感谢已AC
by wang6w6 @ 2024-09-20 10:29:33


点点关注谢谢 @[wang6w6](/user/1051310)
by Hagasei @ 2024-09-20 10:31:01


|