跳到正文

剪贴板

剪贴板 9xcy6boi

原文
剪贴板信息

剪贴板信息

收录
更新

I_am_kunzi 的缺省源

  • IntRead 可以读入单个整形元素;

  • IntWrite 可以输出单个整形元素;

  • read 可以读入不定项元素,例如 read(a , b);

  • readarray 可以读入数组,三个参数分别代表数组名、起始项、长度,例如 readarray(a , 1 , n);

  • print 可以输出不定项元素,例如 print(a , ’ ’ , b , ‘\n’);

  • printarray 可以输出数组,四个参数分别代表数组名、起始项、长度、每个元素中间隔开的字符,例如 printarray(a , 1 , n , ‘\n’);

  • printsp 可以输出不定项元素,中间以空格隔开,例如 printsp(a , b);

  • printnl 可以输出不定项元素,中间以换行隔开,例如 printnl(a , b);

  • ksm 用来求快速幂,三个参数 a,b,pa , b , p 代表求 ab mod p a ^ b \bmod p,ansans 不用管,例如 ksm(2 , 998244351 , 998244353);

  • 更多功能开发中

C++
#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>
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; }
signed main()
{
	return 0;
}