版本比较
码风训练
正文
增加 21 行删除 31 行
12345678910111213141516171819206722232425262728293031323334891011121314151617181920212223246 行未改动31323334353637383940414232 行未改动75767778897980818283104 行未改动全部展开188189190191202192193194195196382 行未改动全部展开579580581582593583584585586587811 行未改动全部展开# 缺省源使用
使用以下缺省源。
```cpp#include<iostream>#include<cstdio>#include<cstring>#include<string>#include<cmath>#include<iomanip>#include<algorithm>#include<set>#include<vector>#include<map>#include<queue>#include<stack>#include<limits.h>#include<list>#include<typeinfo>#include<bits/stdc++.h>using namespace std;template < typename T > void IntRead(T &a) { a = 0; unsigned long long A = 0; bool sign = 0; char ch = getchar(); while(!(ch >= 48 && ch <= 57) && ch != EOF) { if(ch == '-') sign = 1; ch = getchar(); } while(ch >= 48 && ch <= 57) { A = (A << 1) + (A << 3) + (ch - 48); ch = getchar(); } a = A; if(sign) a = -a; }template < typename T > void IntWrite(T a) { char st[40]; int top = 0; if(a < 0) { putchar('-'); a *= -1; } unsigned long long A = a; do { st[++top] = (A % 10 + 48); A /= 10; } while(A != 0); while(top != 0) putchar(st[top--]); }template < typename T > void read(T &a) { if(typeid(a) == typeid(char)) cin >> a; else if(typeid(a) == typeid(unsigned char)) cin >> a; else if(typeid(a) == typeid(short)) scanf("%hd" , &a); else if(typeid(a) == typeid(unsigned short)) scanf("%hu" , &a); else if(typeid(a) == typeid(int)) scanf("%d" , &a); else if(typeid(a) == typeid(unsigned int)) scanf("%u" , &a); else if(typeid(a) == typeid(long)) scanf("%ld" , &a); else if(typeid(a) == typeid(unsigned long)) scanf("%lu" , &a); else if(typeid(a) == typeid(long long)) scanf("%lld" , &a); else if(typeid(a) == typeid(unsigned long long)) scanf("%llu" , &a); else if(typeid(a) == typeid(float)) scanf("%f" , &a); else if(typeid(a) == typeid(double)) scanf("%lf" , &a); else if(typeid(a) == typeid(long double)) scanf("%Lf" , &a); else cin >> a; }template < typename T > void readarray(T a[] , int start , int len) { for(int i = start ; i < start + len ; read(a[i]) , i++); }template < typename T , typename ... L > void read(T &a , L && ... b) { read(a); read(b ...); }template < typename T > void print(T a) { if(typeid(a) == typeid(char)) cout << a; else if(typeid(a) == typeid(unsigned char)) cout << a; else if(typeid(a) == typeid(short)) printf("%hd" , a); else if(typeid(a) == typeid(unsigned short)) printf("%hu" , a); else if(typeid(a) == typeid(int)) printf("%d" , a); else if(typeid(a) == typeid(unsigned int)) printf("%u" , a); else if(typeid(a) == typeid(long)) printf("%ld" , a); else if(typeid(a) == typeid(unsigned long)) printf("%lu" , a); else if(typeid(a) == typeid(long long)) printf("%lld" , a); else if(typeid(a) == typeid(unsigned long long)) printf("%llu" , a); else if(typeid(a) == typeid(float)) printf("%f" , a); else if(typeid(a) == typeid(double)) printf("%lf" , a); else if(typeid(a) == typeid(long double)) printf("%Lf" , a); else cout << a; }template < typename T , typename ... L > void print(T a , L ... b) { print(a); print(b ...); }template < typename T , typename L > void printarray(T a[] , int start , int len , L x) { for(int i = start ; i < start + len ; print(a[i] , x) , i++); }template < typename T > void printsp(T a) { print(a); print(' ');}template < typename T , typename ... L > void printsp(T a , L ... b) { printsp(a); printsp(b ...); }template < typename T > void printnl(T a) { print(a); print('\n');}template < typename T , typename ... L > void printnl(T a , L ... b) { printnl(a); printnl(b ...); }long long ksm(long long a , long long b , long long p , long long ans = 1) { while(b) { if(b & 1) (ans *= a) %= p; (a *= a) %= p; b >>= 1; } return ans; }#define _ template#define __ typename_<__ T>void read(T &a){cin>>a;}_<__ T>void readarray(T a[],int S,int L){for(int i=S;i<S+L;read(a[i]),i++);}_<__ T,__ ... L>void read(T &a,L && ... b){read(a);read(b ...);}_ < __ T >void print(T a) { cout << a; }_<__ T,__ ... L>void print(T a,L ... b){print(a);print(b ...);}_<__ T,__ L>void printarray(T a[],int S,int L,L x){for(int i=S;i<S+L;print(a[i],x),i++);}_<__ T>void printsp(T a){ print(a);print(' ');}_<__ T,__ ... L>void printsp(T a,L ... b){printsp(a);printsp(b ...);}_<__ T>void printnl(T a){print(a);print('\n');}_<__ T,__ ... L>void printnl(T a,L ... b)printnl(a);printnl(b ...);}long long ksm(long long a,long long b,long long p,long long ans=1){while(b){if(b&1)(ans*=a)%=p;(a*=a)%=p;b>>=1;}return ans;}signed main(){ return 0;}6 行未改动大部分情况下均需要加上空格,但 ``` if() ``` 和 ``` for() ``` 等没有空格。
``` pair < int , int > ``` 等使用小于号和大于号定义的数据结构,其他如 ``` map ```、``` set ```、``` vector ``` 等,在小于号和大于号左右、英文逗号左右均加入空格,嵌套时规则不变,遇到小括号和中括号时不加空格。
# 换行使用
不要出现单独一行空行。
# 大括号使用
除了缺省源过长导致的压行之外,左右大括号均独立成行。只要是 ``` if() ```、``` for() ```、``` while() ```、函数定义、结构体定义等地方,即使内部是单行内容,也需要写大括号,并独立成行。
32 行未改动 for(int j = 1 ; j <= c.m ; j++) { for(int k = 1 ; k <= a.m ; k++) { c.a[i][j] += a.a[i][k] * b.a[k][j] % mod; c.a[i][j] += a.a[i][k] * b.a[k][j] % mod; } c.a[i][j] %= mod; } }104 行未改动全部展开signed main(){ matrix a; read(n , k); n *= 10; n *= 10; for(int i = 1 ; i <= n / 10 ; i++) // 拆边 { for(int j = 1 ; j < 10 ; j++) {382 行未改动全部展开 { now.goal = Bob_[now.ID][ii].ID; return ; } } } }}void Alice_common_A(character &now) // Alice 的角色 now 普攻{811 行未改动全部展开