11 2018 档案
摘要:这个最暴力的想法就是暴力模拟算出详细值加set去重 时间复杂度空间复杂度过大。 所以需要对值进行映射,再用set去重 映射方式很多,比较方便的是取对数 logn(a ^ b) = b * logn(a) n可以取 e->log() 10->log10() 2->log2() 因为取了对数肯定会有误差
阅读全文
摘要:D. Cutting Out time limit per test 3 seconds memory limit per test 256 megabytes input standard input output standard output You are given an array ss
阅读全文
摘要:数组开太大 memset超时好几发 N方枚举+前缀标记 一顿操作 /* Zeolim - An AC a day keeps the bug away */ //pragma GCC optimize(2) #include <cstdio> #include <iostream> #include
阅读全文
摘要:二分搜索 推下方程把前半部分去掉 /* Zeolim - An AC a day keeps the bug away */ //pragma GCC optimize(2) #include <cstdio> #include <iostream> #include <cstdlib> #incl
阅读全文
摘要:观察易得 1.质数无1和自身外的因子 且只有本身既质又因 按题意直接一步减自身至零 2.若N是偶数则一直减2直到0 所有质数都是奇数 奇数减奇数易得偶数 再回到条件2 一步到位 所以操作次数不会太多 线筛打表 结合1 2 暴力模拟即可 /* Zeolim - An AC a day keeps th
阅读全文
摘要:贪心 因字典序位越靠前权越大 从初始位置枚举此位后一位向后与原串比较字典序 若小则为最优 输出结束 /* Zeolim - An AC a day keeps the bug away */ //pragma GCC optimize(2) #include <cstdio> #include <i
阅读全文
摘要:1.1从有序数组中查找某值 //数组长 目标值 int n, k; int arr[n]; void solve() { sort(arr, arr + n); int fst = -1, lst = n, mid; while(lst - fst > 1) { mid = (fst + lst)
阅读全文
摘要:Conscription Time Limit: 1000MS Memory Limit: 65536K Total Submissions: 17473 Accepted: 6058 Description Windy has a country, and he wants to build an
阅读全文
摘要:void re(int &x) { x = 0; char s = getchar(); while(s < '0' || s > '9') s = getchar(); while(s >= '0' && s <= '9') { x = x * 10 + s - '0'; s = getchar(
阅读全文
摘要:1.gcd ll gcd(ll a, ll b) { return b ? gcd(b, a % b) : a; } 2.扩展gcd )extend great common divisor ll exgcd(ll l, ll r, ll &x, ll &y) { if(r == 0) { x =
阅读全文
摘要://进阶指南版 struct HEAP { ll heap[MAXN], len; HEAP() { memset(heap, 0, sizeof(ll) * MAXN); len = 0; } void up(int now) { while(now > 1) { if(heap[now] < h
阅读全文

浙公网安备 33010602011771号