小周老师标准码风(以 P1001 为例)

· · 个人记录

看完给个赞和再走呗~~

#include<iostream>
#include<cstdio>
#include<cmath>
#include<string>
#include<cstring>
#include<algorithm>
#include<vector>
#include<map>
#include<unordered_map>
#include<set>
#include<unordered_set>
#include<vector>
#include<cstdlib>
#include<bitset>
#include<queue>
#include<deque>
#include<stack>
#include<list>

using namespace std;

inline void CharPut(char ThePutChar) { putchar(ThePutChar); fflush(stdout); }

template <typename type>
inline void ReadTheFirstAddend(type &TheFirstAddend) {
    TheFirstAddend = 0; bool flag = true; char ReadChar = getchar();
    while(ReadChar < '0' || ReadChar > '9') { if(ReadChar == '-') flag = false; ReadChar = getchar(); }
    while(ReadChar >= '0' && ReadChar <= '9') { TheFirstAddend = (TheFirstAddend << 1) + (TheFirstAddend << 3) + (ReadChar ^ '0'); ReadChar = getchar(); }
    if(!flag) TheFirstAddend = -TheFirstAddend;
    return;
}

template <typename type>
inline void ReadTheSecondAddend(type &TheSecondAddend) {
    TheSecondAddend = 0; bool flag = true; char ReadChar = getchar();
    while(ReadChar < '0' || ReadChar > '9') { if(ReadChar == '-') flag = false; ReadChar = getchar(); }
    while(ReadChar >= '0' && ReadChar <= '9') { TheSecondAddend = (TheSecondAddend << 1) + (TheSecondAddend << 3) + (ReadChar ^ '0'); ReadChar = getchar(); }
    if(!flag) TheSecondAddend = -TheSecondAddend;
    return;
}

int TheFirstAddend;

int TheSecondAddend;

int sum;

inline void read() {
    ReadTheFirstAddend(TheFirstAddend);
    ReadTheSecondAddend(TheSecondAddend);
    return;
}

inline void work() {
    sum = TheFirstAddend + TheSecondAddend;
    return;
}

template <typename type>
inline void WriteSum(type x) {
    if(x < 0) CharPut('-'), WriteSum(-x);
    else { if(x / 10) WriteSum(x / 10); CharPut('0' + x % 10); }
    return;
}

inline void print() {
    WriteSum(sum);
    return;
}

inline void finish() {
    exit(0);
}

int main() {
    read();
    work();
    print();
    finish(); 
}

看完给个赞和再走呗~~