缺省源

c++ 版

#include<bits/stdc++.h>
using namespace std;
using llt=long long;
using llf=long double;
using ull=unsigned long long;
#define Ct const
#define endl '\n'
#define Il __always_inline
#define For(i,a,b,c) for(int i=(a);i<=(b);i+=(c))
#define For_(i,a,b,c) for(int i=(a);i>=(b);i-=(c))
#define For_it(i,a,b) for(auto i=(a);i!=(b);++i)
#ifdef LOCAL
	FILE *InFile=freopen("in_out/in.in","r",stdin),*OutFile=freopen("in_out/out.out","w",stdout);
#else
	FILE *InFile=stdin,*OutFile=stdout;
#endif

int main(){
	ios::sync_with_stdio(false),cin.tie(nullptr),cout.tie(nullptr);
	
}

json 版

{
	"#include": {
		"prefix": "#include",
		"body": [
			"#include<bits/stdc++.h>",
			"using namespace std;",
			"using llt=long long;",
			"using llf=long double;",
			"using ull=unsigned long long;",
			"#define Ct const",
			"#define endl '\\n'",
			"#define Il __always_inline",
			"#define For(i,a,b,c) for(int i=(a);i<=(b);i+=(c))",
			"#define For_(i,a,b,c) for(int i=(a);i>=(b);i-=(c))",
			"#define For_it(i,a,b) for(auto i=(a);i!=(b);++i)",
			"#ifdef LOCAL",
			"\tFILE *InFile=freopen(\"in_out/in.in\",\"r\",stdin),*OutFile=freopen(\"in_out/out.out\",\"w\",stdout);",
			"#else",
			"\tFILE *InFile=stdin,*OutFile=stdout;",
			"#endif",
			"",
			"int main(){",
			"\tios::sync_with_stdio(false),cin.tie(nullptr),cout.tie(nullptr);",
			"\t$0",
			"}",
		],
	}
}

快捷键:

在 keybindings.json 中写入:

// Place your key bindings in this file to override the defaults
[
    {
        "key": "ctrl+numpad0",
        "command": "workbench.action.terminal.focus"
    },
    {
        "key": "ctrl+numpad1",
        "command": "workbench.action.focusFirstEditorGroup"
    }
]

设置:

在 settings.json 中写入:

{
	"editor.fontSize": 16,
	"files.autoSave": "afterDelay",
	"files.autoSaveDelay": 100,
	"editor.cursorSmoothCaretAnimation": "on",
	"workbench.list.smoothScrolling": true,
	"editor.smoothScrolling": true,
	"terminal.integrated.smoothScrolling": true,
	"editor.cursorBlinking": "smooth",
	"editor.cursorStyle": "underline",
	"editor.fontFamily": "'Jetbrains Mono', 'monospace', monospace",
	"editor.fontLigatures": true,
	"editor.bracketPairColorization.enabled": true,
	"editor.guides.bracketPairs": true,
	"workbench.colorCustomizations": {
		"editorBracketHighlight.foreground1": "#9999ff",
		"editorBracketHighlight.foreground2": "#66ccff",
		"editorBracketHighlight.foreground3": "#ffd479",
		"editorBracketHighlight.foreground4": "#9999ff",
		"editorBracketHighlight.foreground5": "#66ccff",
		"editorBracketHighlight.foreground6": "#ffd479",
		"editorBracketHighlight.unexpectedBracket.foreground": "#ee0000"
	},
	"indentRainbow.colors": [
		"#9999ff10",
		"#66ccff10",
		"#ffd47910"
	],
	"C_Cpp.clang_format_style": "{BasedOnStyle: LLVM, UseTab: Never, IndentWidth: 4, TabWidth: 4, BreakBeforeBraces: Attach, AllowShortIfStatementsOnASingleLine: true, IndentCaseLabels: true, ColumnLimit: 0, AccessModifierOffset: -4, NamespaceIndentation: All, FixNamespaceComments: false ,AllowShortCaseLabelsOnASingleLine: true,AllowShortLoopsOnASingleLine: true,AllowShortBlocksOnASingleLine: true}",
	"editor.formatOnSave": false,
	"editor.formatOnPaste": false,
	"editor.formatOnType": false,
	"[dockercompose]": {
		"editor.tabSize": 4,
		"editor.insertSpaces": false
	},
	"[yaml]": {
		"editor.tabSize": 4,
		"editor.insertSpaces": false
	},
	"editor.insertSpaces": false,
	"[makefile]": {
		"editor.insertSpaces": false
	},
	"editor.tokenColorCustomizations": {
		"variables": "#d4d4d4",
	},
	"C_Cpp.errorSquiggles": "Disabled",
	// "C_Cpp.intelliSenseEngine": "Tag Parser",
	// "C_Cpp.workspaceParsingPriority": "medium"
}

run

#include<bits/stdc++.h>
using namespace std;
string O=" -O2",F="",C=" -std=c++14",x;
int main(int argv,char *argc[]){
	x=argc[1]; int pos=2;
	while(pos<argv){
		if(!strcmp(argc[pos],"-O")) O=" -O"+string(argc[++pos]);
		else if(!strcmp(argc[pos],"-F")) F=" -fsanitize=address,undefined -g";
		else if(!strcmp(argc[pos],"-C")) C=" -std=c++"+string(argc[++pos]);
		++pos;
	}
	system(("gnome-terminal --geometry 80x24+530+400 -- bash -c \"g++ "+x+".cpp -o "+x+O+C+F+" -DLOCAL && time ./"+x+"; read -s -n1 -p \"按任意键继续:\" \"").c_str());
}

字体下载

插件下载

5k's


旧的(更多功能也更长):

#include<bits/stdc++.h>
using namespace std;
using llt=long long;
using llf=long double;
using ull=unsigned long long;
#define For(i,a,b,c) for(int i=(a);i<=(b);i+=(c))
#define For_(i,a,b,c) for(int i=(a);i>=(b);i-=(c))
#define For_it(i,a,b) for(auto i=(a);i!=(b);++i)
namespace Fast_IO{
#ifdef ONLINE_JUDGE
    FILE *Fin(stdin), *Fout(stdout);
#else
    FILE *Fin(fopen("in_out/in.in","r")), *Fout(fopen("in_out/out.out","w"));
#endif // File
#ifdef USE_C_PUT
    #define Debug fwrite(buf,1,p,fp),p=0
    #define printf(s,args...) fprintf(Fast_IO::Fout,s,##args)
    #define puts(a) fputs(a,Fast_IO::Fout)
#else
    #define Debug
#endif // C_output
    class qistream{
    private: 
        static constexpr size_t SIZE=1<<20,BLOCK=64; FILE *fp; char buf[SIZE]; int p; bool End;
        void flush(){if(p+BLOCK>=SIZE) memmove(buf,buf+p,SIZE-p),fread(buf+SIZE-p,1,p,fp),p=0;}
        char getch(){flush(); return buf[p++];} qistream &Set_End(){return End=0,*this;}
    public:
        qistream(FILE *_fp=stdin):End(1),fp(_fp),p(0){fread(buf+p,1,SIZE-p,fp);}
        qistream &operator>>(char &str){str=getch(); while(isspace(str))str=getch(); return str<=0?Set_End():*this;} 
        template<class T>
        typename enable_if<is_integral<T>::value|is_same<T,__int128_t>::value,qistream>::type &operator>>(T &x){
            x=0; flush(); bool flag=false; for(;!isdigit(buf[p]);++p){if(buf[p]<=0) return Set_End(); flag=buf[p]=='-';}
            for(;isdigit(buf[p]);++p) x=x*10+buf[p]-'0'; x=flag?-x:x; return*this;
        } template <class T> typename enable_if<is_floating_point<T>::value,qistream>::type &operator>>(T &x){
            x=0; flush(); T unit = 1.0; bool flag=false;
            for(;!isdigit(buf[p]);++p){if(buf[p]<=0) return Set_End(); flag=buf[p]=='-';}
            for(;isdigit(buf[p]);++p) x=x*10+buf[p]-'0';
            if (buf[p]=='.') for(++p;isdigit(buf[p]);++p) x+=(unit*=0.1)*(buf[p]-'0'); x=flag?-x:x; return *this;
        } qistream &operator>>(char *str){
            char ch=getch(); while(ch<=' '){if(ch<=0) return Set_End(); ch=getch();}
            int i; for(i=0;ch>' ';++i,ch=getch()) str[i]=ch; str[i]='\0'; return*this;
        } qistream &operator>>(string& str){
            str.clear(); char ch=getch(); while(ch<=' '){if(ch<=0) return Set_End(); ch=getch();}
            while(ch>' ') str.push_back(ch),ch=getch(); return*this;
        } operator bool(){return End;}
        friend qistream &getline(qistream& in,string& s){
            s.clear(); char c=in.getch(); if(c<=0) return in.Set_End();
            while(c!='\n'&&c>0) s.push_back(c),c=in.getch(); return in;
        }
    }cin(Fin);
    class qostream{
        static constexpr size_t SIZE=1<<20,BLOCK=64,FLSIZE=64; FILE *fp; char buf[SIZE]; int p;
        char flbuf[FLSIZE]; int prec; unsigned long long flen;
        void flush(){if(p+BLOCK>=SIZE) fwrite(buf,1,p,fp),p=0;} void putch(const char& ch){flush();buf[p++]=ch;}
    public:
        void Set_Persicion(const size_t& x){prec=x;flen=(unsigned long long)(pow(10,x));}
        qostream(FILE *_fp=stdout,const size_t& p=6):fp(_fp),p(0){Set_Persicion(p);} ~qostream(){fwrite(buf, 1, p, fp);}
        template<class T>
        typename enable_if<is_integral<T>::value|is_same<T,__int128_t>::value,qostream>::type &operator<<(T x){
            int len=0; flush(); x<0?(x=-x,buf[p++]='-'):0; do buf[p+len]=x%10+'0',x/=10,++len; while(x);
            for(int i=0,j=len-1;i<j;++i,--j) swap(buf[p+i],buf[p+j]); p+=len; Debug; return*this;
        } template<class T> typename enable_if<is_floating_point<T>::value,qostream>::type &operator<<(T x){
            int len=0; flush(); x<0?(x=-x,buf[p++]='-'):0; x*=flen; unsigned long long ret=x;
            if(x-ret>=0.4999999999) ++ret; if(ret) do flbuf[len++]=ret%10+'0',ret/=10; while(ret);
            if(len>prec){do buf[p++]=flbuf[--len]; while(len>prec); buf[p++]='.';} else{buf[p++]='0',buf[p++]='.';
            for(size_t i=prec-len;i--;) buf[p++]='0';} do buf[p++]=flbuf[--len]; while(len); Debug; return*this;
        }
        qostream &operator<<(const char& x){putch(x); Debug; return*this;}
        qostream &operator<<(const char *str){while(*str) putch(*str++); Debug; return*this;}
        qostream &operator<<(const string& str){return *this<<str.c_str();}
    }cout(Fout);
#define cin Fast_IO::cin
#define cout Fast_IO::cout
#define endl '\n'
}
namespace exIO{
    bool read(char* s){return bool(cin>>s);} void write(char* s){cout<<s;}
    template<class T> bool read(T& x){return bool(cin>>x);} template<class T> void write(T x){cout<<x;}
    template<class T,class... Args> bool read(T& x,Args&... args){return bool(read(x)|read(args...));}
    template<class T=int> T read(){T a; read(a); return a;}
    template<class T> void Write(T x){write(x),cout<<' ';}
    void Write(char c){write(c);if(c!='\n') cout<<' ';}
    void Write(char *c){write(c);if(c[strlen(c)-1]!='\n') cout<<' ';}
    void Write(string &c){write(c);if(c[c.size()-1]!='\n') cout<<' ';}
    void Write(const char *c){write(c);if(c[strlen(c)-1]!='\n') cout<<' ';}
    template<class T,class... Args> void write(T x,Args... args){write(x);write(args...);}
    template<class T,class... Args> void Write(T x,Args... args){Write(x);Write(args...);}
} using namespace exIO;

int main(){
    
}

json 版

{
	"#include": {
		"prefix": "#include",
		"body": [
			"#include<bits/stdc++.h>",
			"using namespace std;",
			"using llt=long long;",
			"using llf=long double;",
			"using ull=unsigned long long;",
			"#define Ct const",
			"#define For(i,a,b,c) for(int i=(a);i<=(b);i+=(c))",
			"#define For_(i,a,b,c) for(int i=(a);i>=(b);i-=(c))",
			"#define For_it(i,a,b) for(auto i=(a);i!=(b);++i)",
			"namespace Fast_IO{",
			"#ifdef ONLINE_JUDGE",
			"\tFILE *Fin(stdin), *Fout(stdout);",
			"#else",
			"\tFILE *Fin(fopen(\"in_out/in.in\",\"r\")), *Fout(fopen(\"in_out/out.out\",\"w\"));",
			"#endif // File",
			"#ifdef USE_C_PUT",
			"\t#define Debug fwrite(buf,1,p,fp),p=0",
			"\t#define printf(s,args...) fprintf(Fast_IO::Fout,s,##args)",
			"\t#define puts(a) fputs(a,Fast_IO::Fout)",
			"#else",
			"\t#define Debug",
			"#endif // C_output",
			"\tclass qistream{",
			"\tprivate: ",
			"\t\tstatic constexpr size_t SIZE=1<<20,BLOCK=64; FILE *fp; char buf[SIZE]; int p; bool End;",
			"\t\tvoid flush(){if(p+BLOCK>=SIZE) memmove(buf,buf+p,SIZE-p),fread(buf+SIZE-p,1,p,fp),p=0;}",
			"\t\tchar getch(){flush(); return buf[p++];} qistream &Set_End(){return End=0,*this;}",
			"\tpublic:",
			"\t\tqistream(FILE *_fp=stdin):End(1),fp(_fp),p(0){fread(buf+p,1,SIZE-p,fp);}",
			"\t\tqistream &operator>>(char &str){str=getch(); while(isspace(str))str=getch(); return str<=0?Set_End():*this;} ",
			"\t\ttemplate<class T>",
			"\t\ttypename enable_if<is_integral<T>::value|is_same<T,__int128_t>::value,qistream>::type &operator>>(T &x){",
			"\t\t\tx=0; flush(); bool flag=false; for(;!isdigit(buf[p]);++p){if(buf[p]<=0) return Set_End(); flag=buf[p]=='-';}",
			"\t\t\tfor(;isdigit(buf[p]);++p) x=x*10+buf[p]-'0'; x=flag?-x:x; return*this;",
			"\t\t} template <class T> typename enable_if<is_floating_point<T>::value,qistream>::type &operator>>(T &x){",
			"\t\t\tx=0; flush(); T unit = 1.0; bool flag=false;",
			"\t\t\tfor(;!isdigit(buf[p]);++p){if(buf[p]<=0) return Set_End(); flag=buf[p]=='-';}",
			"\t\t\tfor(;isdigit(buf[p]);++p) x=x*10+buf[p]-'0';",
			"\t\t\tif (buf[p]=='.') for(++p;isdigit(buf[p]);++p) x+=(unit*=0.1)*(buf[p]-'0'); x=flag?-x:x; return *this;",
			"\t\t} qistream &operator>>(char *str){",
			"\t\t\tchar ch=getch(); while(ch<=' '){if(ch<=0) return Set_End(); ch=getch();}",
			"\t\t\tint i; for(i=0;ch>' ';++i,ch=getch()) str[i]=ch; str[i]='\\0'; return*this;",
			"\t\t} qistream &operator>>(string& str){",
			"\t\t\tstr.clear(); char ch=getch(); while(ch<=' '){if(ch<=0) return Set_End(); ch=getch();}",
			"\t\t\twhile(ch>' ') str.push_back(ch),ch=getch(); return*this;",
			"\t\t} operator bool(){return End;}",
			"\t\tfriend qistream &getline(qistream& in,string& s){",
			"\t\t\ts.clear(); char c=in.getch(); if(c<=0) return in.Set_End();",
			"\t\t\twhile(c!='\\n'&&c>0) s.push_back(c),c=in.getch(); return in;",
			"\t\t}",
			"\t}cin(Fin);",
			"\tclass qostream{",
			"\t\tstatic constexpr size_t SIZE=1<<20,BLOCK=64,FLSIZE=64; FILE *fp; char buf[SIZE]; int p;",
			"\t\tchar flbuf[FLSIZE]; int prec; unsigned long long flen;",
			"\t\tvoid flush(){if(p+BLOCK>=SIZE) fwrite(buf,1,p,fp),p=0;} void putch(const char& ch){flush();buf[p++]=ch;}",
			"\tpublic:",
			"\t\tvoid Set_Persicion(const size_t& x){prec=x;flen=(unsigned long long)(pow(10,x));}",
			"\t\tqostream(FILE *_fp=stdout,const size_t& p=6):fp(_fp),p(0){Set_Persicion(p);} ~qostream(){fwrite(buf, 1, p, fp);}",
			"\t\ttemplate<class T>",
			"\t\ttypename enable_if<is_integral<T>::value|is_same<T,__int128_t>::value,qostream>::type &operator<<(T x){",
			"\t\t\tint len=0; flush(); x<0?(x=-x,buf[p++]='-'):0; do buf[p+len]=x%10+'0',x/=10,++len; while(x);",
			"\t\t\tfor(int i=0,j=len-1;i<j;++i,--j) swap(buf[p+i],buf[p+j]); p+=len; Debug; return*this;",
			"\t\t} template<class T> typename enable_if<is_floating_point<T>::value,qostream>::type &operator<<(T x){",
			"\t\t\tint len=0; flush(); x<0?(x=-x,buf[p++]='-'):0; x*=flen; unsigned long long ret=x;",
			"\t\t\tif(x-ret>=0.4999999999) ++ret; if(ret) do flbuf[len++]=ret%10+'0',ret/=10; while(ret);",
			"\t\t\tif(len>prec){do buf[p++]=flbuf[--len]; while(len>prec); buf[p++]='.';} else{buf[p++]='0',buf[p++]='.';",
			"\t\t\tfor(size_t i=prec-len;i--;) buf[p++]='0';} do buf[p++]=flbuf[--len]; while(len); Debug; return*this;",
			"\t\t}",
			"\t\tqostream &operator<<(const char& x){putch(x); Debug; return*this;}",
			"\t\tqostream &operator<<(const char *str){while(*str) putch(*str++); Debug; return*this;}",
			"\t\tqostream &operator<<(const string& str){return *this<<str.c_str();}",
			"\t}cout(Fout);",
			"#define cin Fast_IO::cin",
			"#define cout Fast_IO::cout",
			"#define endl '\\n'",
			"}",
			"namespace exIO{",
			"\tbool read(char* s){return bool(cin>>s);} void write(char* s){cout<<s;}",
			"\ttemplate<class T> bool read(T& x){return bool(cin>>x);} template<class T> void write(T x){cout<<x;}",
			"\ttemplate<class T,class... Args> bool read(T& x,Args&... args){return bool(read(x)|read(args...));}",
			"\ttemplate<class T=int> T read(){T a; read(a); return a;}",
			"\ttemplate<class T> void Write(T x){write(x),cout<<' ';}",
			"\tvoid Write(char c){write(c);if(c!='\\n') cout<<' ';}",
			"\tvoid Write(char *c){write(c);if(c[strlen(c)-1]!='\\n') cout<<' ';}",
			"\tvoid Write(string &c){write(c);if(c[c.size()-1]!='\\n') cout<<' ';}",
			"\tvoid Write(const char *c){write(c);if(c[strlen(c)-1]!='\\n') cout<<' ';}",
			"\ttemplate<class T,class... Args> void write(T x,Args... args){write(x);write(args...);}",
			"\ttemplate<class T,class... Args> void Write(T x,Args... args){Write(x);Write(args...);}",
			"} using namespace exIO;",
			"",
			"int main(){",
			"\t$0",
			"}"
		],
	}
}

jijidawang's 资料




posted @ 2023-11-07 18:59  xrlong  阅读(108)  评论(0编辑  收藏  举报