各种非算法模板
无限栈:
-Wl,--stack=998244353
lemon SPJ:
1 #include <bits/stdc++.h> 2 3 using namespace std; 4 5 ifstream fin,fout,fstd; 6 ofstream fscore,freport; 7 // 注意定义 8 9 double judge() 10 { 11 /* 12 关于读入与输出:与cin/cout类似 13 Eg. 14 fin >> x; //从输入文件里读入x 15 freport << "too young too simple sometimes naive."; //提示错因 16 */ 17 18 freport << "AC"; 19 return 1; 20 } 21 22 int main(int argc, char *argv[]) 23 { 24 fin.open(argv[1]); 25 fout.open(argv[2]); 26 fstd.open(argv[3]); 27 fscore.open(argv[5]); 28 freport.open(argv[6]); 29 30 int score = atoi(argv[4]); 31 fscore << score * judge() << endl; 32 33 fin.close(); 34 fout.close(); 35 fstd.close(); 36 fscore.close(); 37 freport.close(); 38 return 0; 39 }
要么放在data下,要么在lemon的里面加上文件夹前缀,形如 D1T1\spj.exe
linux对拍:后缀是.sh,运行命令是 sh ***.sh
#!/bin/bash while true; do ./make ./my ./right if diff my.out right.out; then printf "AC " else printf "WA\n" exit 0 fi done
fread:更快的快读(只能读文件)
inline char gc() {
static char *p1, *p2, s[N];
if(p1 == p2) p2 = (p1 = s) + fread(s, 1, N, stdin);
return (p1 == p2) ? EOF : *p1++;
}
template <class T> inline void read(T &x) { x = 0; char c = gc();
bool f = 0; while(c < '0' || c > '9') {
if(c == '-') f = 1;
c = gc();
} while(c >= '0' && c <= '9') { x = x * 10 + c - 48; c = gc(); }
if(f) x = (~x) + 1; return; }
代码标准开头:
/** * There is no end though there is a start in space. ---Infinity. * It has own power, it ruins, and it goes though there is a start also in the star. ---Finite. * Only the person who was wisdom can read the most foolish one from the history. * The fish that lives in the sea doesn't know the world in the land. * It also ruins and goes if they have wisdom. * It is funnier that man exceeds the speed of light than fish start living in the land. * It can be said that this is an final ultimatum from the god to the people who can fight. * * Steins;Gate */