上一页 1 ··· 5 6 7 8 9 10 11 12 13 ··· 20 下一页
摘要: https://ac.nowcoder.com/acm/contest/4853/C #include <bits/stdc++.h> using namespace std; #define int long long const int maxn = 1e3 + 5; const int mod 阅读全文
posted @ 2020-03-28 09:57 Hazelxcf 阅读(154) 评论(0) 推荐(0) 编辑
摘要: 我们按位考虑,那么每一位的贡献就是在二进制下这一位在n个数中出现的次数的平方乘上二进制的系数。 #include <bits/stdc++.h> using namespace std; #define int long long const int maxn = 1e5 + 5; int n, a 阅读全文
posted @ 2020-03-28 09:10 Hazelxcf 阅读(139) 评论(0) 推荐(0) 编辑
摘要: https://www.acwing.com/problem/content/description/98/ 假设有A,B,C,D四个,在A上有n个。要移动到D上 在4塔的情况下 先移动i个到B上,在移动剩下的n - i个到D上(此时是在3塔的情况下) #include <bits/stdc++.h 阅读全文
posted @ 2020-03-27 18:25 Hazelxcf 阅读(162) 评论(0) 推荐(0) 编辑
摘要: https://www.luogu.com.cn/problem/P1760 用递归计算移动容易超时,借助公式 2^n - 1当数据太大时,公式无效,算不出大数例如: #include <bits/stdc++.h> using namespace std; int n; stringstream 阅读全文
posted @ 2020-03-27 18:24 Hazelxcf 阅读(129) 评论(0) 推荐(0) 编辑
摘要: 给一个数字n,然后n行,每行给出一个数字 (在1-n之间) 求最少的操作次数 n - 最长的连续上升子序列 这道题应该做出来,毕竟之前类似的做过,难过。。。。 #include <bits/stdc++.h> using namespace std; #define int long long co 阅读全文
posted @ 2020-03-26 21:13 Hazelxcf 阅读(103) 评论(0) 推荐(0) 编辑
摘要: PN分析 P点:即必败点,某玩家位于该点,只要对方无误,则必败; N点:即必胜点,某玩家位于该点,只要自己无误,则必胜。 三个定理: 1.所有终结点都是必败点P; 2.所有一步能走到必败点P的就是N点; 3.通过一步操作只能到N点的就是P点 HDU 2147 当 n 和m 全为奇数时,是必败点 Ba 阅读全文
posted @ 2020-03-26 08:22 Hazelxcf 阅读(338) 评论(0) 推荐(0) 编辑
摘要: http://acm.hdu.edu.cn/showproblem.php?pid=1907 这个题在原来的基础上,加了一个条件,如果谁拿了最后一个,就被认为是输了 如果都是1的话,根据奇偶性来分,输出 拿的最后一个的 另一方 否则的话,还是我们印象中的NIM博弈 #include <bits/st 阅读全文
posted @ 2020-03-25 20:55 Hazelxcf 阅读(133) 评论(0) 推荐(0) 编辑
摘要: #include <bits/stdc++.h> using namespace std; const int maxn = 1e5 + 5; int n; int a[maxn] = {0,1},s[maxn]; int num = 1,alen = 1,jin = 1,slen = 1; int 阅读全文
posted @ 2020-03-25 07:59 Hazelxcf 阅读(385) 评论(0) 推荐(0) 编辑
摘要: https://vjudge.net/problem/POJ-2315 #include <iostream> #include <cstring> #include <cmath> #include <cstdio> #include <algorithm> using namespace std 阅读全文
posted @ 2020-03-24 16:06 Hazelxcf 阅读(279) 评论(0) 推荐(0) 编辑
摘要: A 不相邻的k个奇数相加是否等于n 第一次读错题了,忽略了distinct(不同的) 判断奇偶性 n 是否 k * k; 因为 偶数= 偶数个奇数相加 奇数 = 奇数个奇数 偶数 - 偶数 = 偶数 奇数- 奇数= 偶数 选择的k个奇数 最小的值1 + 3 + 5 + ....+ (2 k - 1) 阅读全文
posted @ 2020-03-24 13:13 Hazelxcf 阅读(163) 评论(0) 推荐(0) 编辑
上一页 1 ··· 5 6 7 8 9 10 11 12 13 ··· 20 下一页