跳到正文

个人记录

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

不知名用户约 4 分钟
原文
文章信息与版本

文章信息

收录
2025年12月12日
更新
2026年2月2日
篇幅
约 4 分钟

版本

  1. v2当前
  2. v1

看完给个赞和再走呗~~

C++
#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();
}

看完给个赞和再走呗~~

原文