首页 > 其他分享 >【板子】快读/快写

【板子】快读/快写

时间:2024-01-26 21:13:15浏览次数:23  
标签:ch 板子 isdigit flag && ans 快读 getchar

//double快读
inline void Readouble(double &ans)
{
	ans=0;
	double y=1.0;
	bool flag=0;
	char ch=getchar();
	while(!isdigit(ch) && ~ch)
	{
		flag|=(ch=='-');
		ch=getchar();
	}
	while(isdigit(ch) && ~ch)
	{
		ans=ans*10+(ch^48);
		ch=getchar();
	}
	ch=getchar();
	while(isdigit(ch) && ~ch)
	{
		y/=10;
		ans+=y*(ch^48);
		ch=getchar();
	}
	if(flag) ans=-ans;
}

//整形快读
#define ll __int128
inline void Read(ll &ans)
{
	ans=0;
	bool flag=0;
	char ch=getchar();
	while(!isdigit(ch) && ~ch)
	{
		flag|=(ch=='-');
		ch=getchar();
	}
	while(isdigit(ch) && ~ch)
	{
		ans=ans*10+(ch^48);
		ch=getchar();
	}
	if(flag) ans=-ans;
}

//整形快写
char c[105];
inline void Write(ll x)
{
	int len=0;
	if(x<0) putchar('-'),x=-x;
	while(x) 
	{
		c[++len]=x%10;
		x/=10;
	}
	while(len)
	{
		putchar(c[len]^48);
		len--;
	}
}

标签:ch,板子,isdigit,flag,&&,ans,快读,getchar
From: https://www.cnblogs.com/yeyou26/p/17990727

相关文章

  • 【板子】快速排序
    #include<bits/stdc++.h>usingnamespacestd;inta[114514];voidQuicksort(intl,intr);intmain(){freopen("working.in","r",stdin);freopen("working.out","w",stdout);intn;cin>>n;......
  • 【板子】归并排序
    #include<bits/stdc++.h>usingnamespacestd;constintN=1e6+6;intn;inta[N];intb[N];voidMergesort(intl,intr);longlongcnt;intmain(){freopen("working.in","r",stdin);freopen("working.out",&......
  • 【板子】树状数组(BIT)
    //lg1908求逆序对//Copyrightyeyou26#include<bits/stdc++.h>usingnamespacestd;#definelllonglongconstintN=(int)1e6+6;llsum;intn;structData{intorigin;intls;intid;}data[N];boolcmporigin(Datax,Datay){r......
  • 【板子】强连通分量(SCC)
    //强连通分量//lg2863求强连通分量的数量#include<bits/stdc++.h>usingnamespacestd;constintN=(int)2e4+4;intwhere[N];//这个点在哪个scc里intscccnt;intsccsize[N];intlow[N],dfn[N],idx;boolinstk[N];stack<int>stk;vector<int>e[N];intn,m;......
  • 【板子】字符串哈希
    //lgp3370//Copyrightyeyou26#include<bits/stdc++.h>usingnamespacestd;#defineullunsignedlonglongstrings;intn;constullp=998244353;ullnow_hash;ullv[100005];intcnt;intans;voidget_hash();voiddo_compare();voidinit()......
  • 【板子】字符串最小表示法
    //lgp1368//Copyrightyeyou26#include<bits/stdc++.h>usingnamespacestd;longlonga[600005];intn;voidinit();voidsolve(){inti=1,j=2,k=0;while(i<=n&&j<=n){k=0;while(a[i+k]==a[j+k]&&am......
  • 【板子】KMP
    //lgp3375//Copyrightyeyou26#include<bits/stdc++.h>usingnamespacestd;charp[1000005],s[1000005];intlenp,lens;intlst[1000005];voidinit();voidpre_work();voidkmp();voidout_put();intmain(){freopen("working.in",&qu......
  • 一些神奇の小公式&板子
    一些神奇の小公式$n$以内的质数个数为:​ $n/\logn*\sqrt{n}$$n$个点的距离平方和:​ $n*(\sumx_i+\sumy_i)-[(\sumx_i)^2+(\sumy_i)^2]$一些神奇の板子万年不变万能(火车)头#include<algorithm>#include<iostream>#include<string.h>#include<stdio.h>#inc......
  • 板子集合
    tarjan点击查看代码//缩点voidtarjan(intu){dfn[u]=low[u]=++t;s[++top]=u;vis[u]=1;for(inti=0;i<g[u].size();++i){intv=g[u][i];if(!dfn[v]){tarjan(v);low[u]=min(low[u],low[v]);}elseif(vis[v])low[u]=......
  • 如何区别随身WiFi板子是什么芯片
    新上车的朋友可以看看,中兴微的板子上面都有zxlc,高通骁龙的一般都会有骁龙字样,一般主芯片会大一点放了几张板子的图片,让大家区别一下。这个是中兴微一定要把屏蔽罩打开,才能看到这个是高通骁龙的410......