上一页 1 ··· 9 10 11 12 13 14 15 16 17 ··· 32 下一页
摘要: 二分搜索 推下方程把前半部分去掉 /* Zeolim - An AC a day keeps the bug away */ //pragma GCC optimize(2) #include <cstdio> #include <iostream> #include <cstdlib> #incl 阅读全文
posted @ 2018-11-13 11:32 张浦 阅读(84) 评论(0) 推荐(0) 编辑
摘要: 观察易得 1.质数无1和自身外的因子 且只有本身既质又因 按题意直接一步减自身至零 2.若N是偶数则一直减2直到0 所有质数都是奇数 奇数减奇数易得偶数 再回到条件2 一步到位 所以操作次数不会太多 线筛打表 结合1 2 暴力模拟即可 /* Zeolim - An AC a day keeps th 阅读全文
posted @ 2018-11-13 11:29 张浦 阅读(141) 评论(0) 推荐(0) 编辑
摘要: 贪心 因字典序位越靠前权越大 从初始位置枚举此位后一位向后与原串比较字典序 若小则为最优 输出结束 /* Zeolim - An AC a day keeps the bug away */ //pragma GCC optimize(2) #include <cstdio> #include <i 阅读全文
posted @ 2018-11-13 11:22 张浦 阅读(84) 评论(0) 推荐(0) 编辑
摘要: 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) 阅读全文
posted @ 2018-11-12 21:29 张浦 阅读(87) 评论(0) 推荐(0) 编辑
摘要: Conscription Time Limit: 1000MS Memory Limit: 65536K Total Submissions: 17473 Accepted: 6058 Description Windy has a country, and he wants to build an 阅读全文
posted @ 2018-11-09 10:54 张浦 阅读(90) 评论(0) 推荐(0) 编辑
摘要: 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( 阅读全文
posted @ 2018-11-04 17:52 张浦 阅读(76) 评论(0) 推荐(0) 编辑
摘要: 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 = 阅读全文
posted @ 2018-11-02 11:40 张浦 阅读(112) 评论(0) 推荐(0) 编辑
摘要: //进阶指南版 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 阅读全文
posted @ 2018-11-01 09:58 张浦 阅读(101) 评论(0) 推荐(0) 编辑
摘要: 链接:https://www.nowcoder.com/acm/contest/214/F 来源:牛客网 时间限制:C/C++ 1秒,其他语言2秒 空间限制:C/C++ 131072K,其他语言262144K 64bit IO Format: %lld 题目描述 clccle是个蒟蒻,她经常会在学校 阅读全文
posted @ 2018-10-20 21:42 张浦 阅读(130) 评论(0) 推荐(0) 编辑
摘要: 1.字符串分割函数substr string st = *it; len = st.length(); for(int j = 1; j < len - 1; j++) { fst = st.substr(0, j); 字符串.substr(开始地址, 抽取宽度) lst = st.substr(j 阅读全文
posted @ 2018-10-18 21:08 张浦 阅读(229) 评论(0) 推荐(0) 编辑
上一页 1 ··· 9 10 11 12 13 14 15 16 17 ··· 32 下一页