各种非算法模板

无限栈:

-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
 */

cpp template:

c++ template
#include <bits/stdc++.h>
namespace NameSpace {
#define forson(x, i, y) for(int i = e[x], y = edge[i].v; i; i = edge[i].nex, y = edge[i].v)
typedef long long LL;
typedef unsigned long long uLL;
typedef long double LD;
const double PI = 3.1415926535897932384626;
inline char gc() {
#ifdef __LLOCAL__
    return getchar();
#endif
    static char buf[100000], *p1 = buf, *p2 = buf;
    if(p1 == p2) {
        p2 = (p1 = buf) + fread(buf, 1, 100000, stdin);
    }
    return (p1 == p2) ? EOF : *p1++;
}

template <typename T>
inline void read(T& x) {
    x = 0;
    char c(gc());
    int f(1);
    while(c < '0' || c > '9') {
        if(c == '-') {
            f = -1;
        }
        else if(c == EOF) {
            break;
        }
        c = gc();
    }
    while(c >= '0' && c <= '9') {
        x = x * 10 + c - '0';
        c = gc();
    }
    x *= f;
}

template <typename T>
inline T Abs(T x) {
    return x < 0 ? -x : x;
}
template <typename T>
inline T Max(T a, T b) {
    return (a > b) ? a : b;
}
template <typename T>
inline T Min(T a, T b) {
    return (a < b) ? a : b;
}
template <typename T>
inline int sgn(T x) {
    if(Abs(x) < (1e-10))
        return 0;
    return (x > 0) ? 1 : (-1);
}

inline bool IsCh(char c) {
    return ('a' <= c && c <= 'z') || ('A' <= c && c <= 'Z');
}
inline bool IsNum(char c) {
    return ('0' <= c && c <= '9');
}

int rd() {
    static int t = 0;
    if(t == 0) {
        srand(time(0));
        t = 1;
    }
    return ((((int)rand()) << 16) ^ rand());
}
long long RD() {
    return (((long long)rd() << 32) ^ rd());
}
int rd(int l, int r) {
    return rd() % (r - l + 1) + l;
}
long long RD(long long l, long long r) {
    return RD() % (r - l + 1) + l;
}

inline int read(char* s) {
    char c(gc());
    int top(0);
    while(c == ' ' || c == '\n') {
        c = gc();
    }
    while(c != ' ' && c != '\n' && c != EOF) {
        s[top++] = c;
        c = gc();
    }
    s[top] = 0;
    return top;
}

inline LL read() {
    static LL x;
    read(x);
    return x;
}

int main() {
    return 0;
}
#undef forson
}  // NameSpace end

int main() {
    return NameSpace::main();
}

rust template:

Rust template
 mod oiread {
    use std::{
        io::{stdin, Read},
        ops::{Add, Mul, Neg},
    };

    pub fn next() -> u8 {
        let mut a = stdin().lock();
        let mut c = [0u8];
        match a.read(&mut c) {
            Ok(0) => b'\n', // End Of File
            Ok(1) => c[0],
            _ => panic!(),
        }
    }
    pub fn get_char() -> char {
        next().into()
    }
    pub fn read_inum<T>() -> T
    where
        T: Add<Output = T> + Mul<Output = T> + From<u8> + Neg<Output = T>,
    {
        let mut ans: T = T::from(0);
        let mut flag = false;
        let mut c = next();
        while c < b'0' || c > b'9' {
            if c == b'-' {
                flag = true;
            }
            c = next();
        }
        while c >= b'0' && c <= b'9' {
            ans = ans * T::from(10) + T::from(c - b'0');
            c = next();
        }
        if flag {
            -ans
        } else {
            ans
        }
    }
    pub fn read_unum<T>() -> T
    where
        T: Add<Output = T> + Mul<Output = T> + From<u8>,
    {
        let mut ans: T = T::from(0);
        let mut c = next();
        while c < b'0' || c > b'9' {
            c = next();
        }
        while c >= b'0' && c <= b'9' {
            ans = ans * T::from(10) + T::from(c - b'0');
            c = next();
        }
        ans
    }
    pub fn read_i64() -> i64 {
        read_inum::<i64>()
    }
    pub fn read_u64() -> u64 {
        read_unum::<u64>()
    }
    pub fn read_str() -> String {
        let mut res = String::new();
        let mut c = next();
        while c == b' ' || c == b'\n' || c == b'\r' {
            c = next();
        }
        while c != b' ' && c != b'\n' && c != b'\r' {
            res.push(c as char);
            c = next();
        }
        res
    }
    pub fn read_u8s() -> Vec<u8> {
        let mut res = Vec::new();
        let mut c = next();
        while c == b' ' || c == b'\n' || c == b'\r' {
            c = next();
        }
        while c != b' ' && c != b'\n' && c != b'\r' {
            res.push(c);
            c = next();
        }
        res
    }
}

fn main() {

}

end

posted @ 2018-10-11 15:23  huyufeifei  阅读(332)  评论(0)    收藏  举报
试着放一个广告栏(虽然没有一分钱广告费)

『Flyable Heart 応援中!』 HHG 高苗京铃 闪十PSS 双六 電動伝奇堂 章鱼罐头制作组 はきか 祝姬 星降夜