P1056 [NOIP 2008 普及组] 排座椅 - 洛谷#include bits/stdc.h using namespace std; const int MAX 1010; struct node { int index; int cnt; } row[MAX], col[MAX]; bool cmpByCount(const node x, const node y) { return x.cnt y.cnt; } bool cmpByIndex(const node x, const node y) { return x.index y.index; } int main() { int m, n, k, l, d; if (!(cin m n k l d)) return 0; for (int i 1; i m; i) row[i].index i; for (int i 1; i n; i) col[i].index i; while (d--) { int x, y, p, q; cin x y p q; if (x p) { col[min(y, q)].cnt; } else { row[min(x, p)].cnt; } } sort(row 1, row m, cmpByCount); sort(row 1, row k 1, cmpByIndex); for (int i 1; i k; i) { cout row[i].index (i k ? : ); } cout endl; sort(col 1, col n, cmpByCount); sort(col 1, col l 1, cmpByIndex); for (int i 1; i l; i) { cout col[i].index (i l ? : ); } cout endl; return 0; }P1226 【模板】快速幂 - 洛谷#include bits/stdc.h using namespace std; typedef long long LL; LL a,b,p; LL qpow(LL a,LL b,LL c) { LL ret 1; while(b) { if(b1) ret ret * a % p; a a * a % p; b 1; } return ret; } int main() { cin a b p; printf(%lld^%lld mod %lld%lld,a,b,p,qpow(a,b,p)); return 0; }P10446 64位整数乘法 - 洛谷#include bits/stdc.h using namespace std; typedef long long LL; LL a,b,p; //快速乘的模板 LL qmul(LL a,LL b,LL p) { LL sum 0; while(b) { if(b1) sum (sum a)%p; a (a a)%p; b 1; } return sum; } int main() { cin a b p; cout qmul(a,b,p) endl; return 0; }#include bits/stdc.h //离散化模版一排序 去重 二分查找离散之后的结果 using namespace std; const int N 1e5 10; int n; int a[N]; int pos; int disc[N]; //二分x的位置 int find(int x) { int l 1,r pos; while(l r) { int mid (l r)/2; if(disc[mid] x) r mid; else l mid 1; } return l; } int main() { cin n; for(int i 1;i n;i) { cin a[i]; disc[pos] a[i]; } //离散化 sort(disc 1,disc 1 pos); pos unique(disc 1,disc 1 pos) - (disc 1); for(int i 1;i n;i) { cout a[i] 离散化之后 find(a[i]) endl; } return 0; }离散化模板#include bits/stdc.h //离散化模版一排序 哈希表去重以及记录最终的位置 using namespace std; const int N 1e5 10; int n; int a[N]; int pos; int disc[N]; unordered_mapint,int id; //二分x的位置 int main() { cin n; for(int i 1;i n;i) { cin a[i]; disc[pos] a[i]; } //离散化 sort(disc 1,disc 1 pos); int cnt 0; for(int i 1;i pos;i) { int x disc[i]; if(id.count(x)) continue; cnt; id[x] cnt; } for(int i 1;i n;i) { cout a[i] 离散化之后 id[a[i]] endl; } return 0; }
3种策略管理Playnite便携版:从基础部署到高级维护的完整指南 【免费下载链接】Playnite Video game library manager with support for wide range of 3rd party libraries and game emulation support, providing one unified interface for your games. 项目地址…