码迷,mamicode.com
首页 > 其他好文 > 详细

My std

时间:2020-06-27 00:37:52      阅读:68      评论:0      收藏:0      [点我收藏+]

标签:include   names   this   stream   utc   date   min   static   detail   

update on 2020 02 14

code
#include<bits/stdc++.h>
namespace IO
{
	using namespace std;
	char buf[1<<22],Out[1<<22],*p1=buf,*p2=buf;
	int p3=-1,f=0;
	inline void file()
	{
		#ifdef NTFOrz
		freopen("file.in","r",stdin);
		#endif
	}
	inline char getchar()
	{
		return (p1==p2)&&(p2=(p1=buf)+fread(buf,1,1<<21,stdin),p1==p2)?EOF:*p1++;
	}
	inline void flush(){fwrite(Out,1,p3+1,stdout),p3=-1;}
	inline void check(){if (p3>(1<<21)) flush();}
	inline void putchar(char a){Out[++p3]=a;check();}
	inline void putline(string s)
	{
		int tmp=p3;
		while (p3-tmp<s.size()) putchar(s[p3-tmp]);
		putchar(‘\n‘);
	}
}
namespace my_std
{
    using namespace std;
    #define getchar IO::getchar
    #define putchar IO::putchar
    #define Re register
    #define rep(i,a,b) for (Re int i=(a);i<=(b);i++)
    #define drep(i,a,b) for (Re int i=(a);i>=(b);i--)
    #define repv(i,v) if (v.size()) rep(i,0,v.size()-1)
    #define drepv(i,v) if (v.size()) drep(i,v.size()-1,0)
    #define go(u) for (Re int i=head[(u)];i;i=e[i].nxt)
    #define pf printf
    #define writesp(x) write(x),putchar(‘ ‘),IO::check()
    #define writeln(x) write(x),putchar(‘\n‘),IO::check()
    #define mem(x,v) memset(x,v,sizeof(x))
    #define pb push_back
    #define NTF return
    #define AKIOI 0
    typedef long long ll;
    const int INF=0x7fffffff;
    inline int read()
    {
        int sum=0,f=0;
        char c=getchar();
        while (!isdigit(c))
        {
            f|=(c==‘-‘);
            c=getchar();
        }
        while (isdigit(c))
        {
            sum=(sum<<1)+(sum<<3)+(c^48);
            c=getchar();
        }
        return f?-sum:sum;
    }
    void write(int k)
    {
        if (k<0) putchar(‘-‘),k=-k;
        if (k>=10) write(k/10);
        putchar(k%10+48);
    }
    #define templ template<typename T>
    templ inline void chkmax(T &x,T y){if (x<y) x=y;}
    templ inline void chkmin(T &x,T y){if (x>y) x=y;}
}
using namespace my_std;

update on 2020 06 26

code
#include<bits/stdc++.h>
#define Re register
#define rep(i,a,b) for (Re int i=(a);i<=(b);i++)
#define drep(i,a,b) for (Re int i=(a);i>=(b);i--)
using namespace std;
typedef long long ll;
inline void setfile()
{
	#ifdef stO_PBNTF_Orz
	freopen("file.in","r",stdin);
	#endif
}
struct istream
{
	char buf[1<<22],*p1=buf,*p2=buf;
	inline char getchar() {return (p1==p2)&&(p2=(p1=buf)+fread(buf,1,1<<21,stdin),p1==p2)?EOF:*p1++;}
	template <typename T> inline void read(T &x)
	{
		x=0;int f=0;char c=getchar();
		while (!isdigit(c)) f|=(c==‘-‘),c=getchar();
		while (isdigit(c)) x=(x<<1)+(x<<3)+(c^48),c=getchar();
		x=f?-x:x;
	}
	inline bool useless(char c) {return !c||c==‘ ‘||c==‘\n‘;}
	istream& operator >> (char &c) {while (useless(c)) c=getchar();return *this;}
	istream& operator >> (char *ch)
	{
		int cnt=-1;char c=getchar();
		while (useless(c)) c=getchar();
		while (!useless(c)) ch[++cnt]=c,c=getchar();
		return *this;
	}
	istream& operator >> (int &x) {read(x);return *this;}
	istream& operator >> (ll &x) {read(x);return *this;}
}in;
struct ostream
{
	char buf[1<<22],stk[1<<10];int p=-1;
	inline void flush() {fwrite(buf,1,p+1,stdout),p=-1;}
	~ostream() {flush();}
	inline void putchar(char c) {buf[++p]=c;}
	template <typename T> inline void write(T x)
	{
		static int top=0;
		if (x<0) putchar(‘-‘),x=-x;
		while (stk[++top]=x%10+‘0‘,x>=10) x/=10;
		while (top) putchar(stk[top--]);
		if (p>(1<<21)) flush();
	}
	ostream& operator << (char c) {putchar(c);return *this;}
	ostream& operator << (char *c) {rep(i,0,(int)(strlen(c))-1) putchar(c[i]);return *this;}
	ostream& operator << (string s) {rep(i,0,(int)(s.size())-1) putchar(s[i]);return *this;}
	ostream& operator << (int x) {write(x);return *this;}
	ostream& operator << (ll x) {write(x);return *this;}
}out;

未完待续

My std

标签:include   names   this   stream   utc   date   min   static   detail   

原文地址:https://www.cnblogs.com/ZHANG-SHENG-HAO/p/13196697.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!