02 2022 档案
摘要:高精度模板,现在有__int128,能不用高精度就不用吧。 /** 整数高精度 */ ///继承vector解决位数限制(当前最大位数是9倍整型最大值),操作方便(注意size()返回无符号长整型,尽量不要直接把size放入表达式) struct Huge_Int :vector<long long
阅读全文
摘要:快读快写模板,加速输入输出。 #include <iostream> using namespace std; template<class T> inline void read(T &val) { T x = 0, f = 1;char c = getchar(); while (c < '0'
阅读全文
摘要:快速排序模板。 #include <iostream> using namespace std; int a[100000+7]; void quick_sort(int l,int r){ int i = l,j = r; int mid = a[(l+r)/2]; while(i<=j) { w
阅读全文
摘要:题目 P1179 [NOIP2010 普及组] 数字统计 题目描述 请统计某个给定范围[L,R]的所有整数中,数字2出现的次数。 比如给定范围[2,22],数字2在数2中出现了1次,在数12中出现1次,在数20中出现1次,在数21中出现>1次,在数22中出现2次,所以数字2在该范围内一共出现了6次。
阅读全文