随笔分类 -  ACM

摘要:我写的,第二个样例不对,感觉按照题目说的写出来 #include <bits/stdc++.h> using namespace std; const int maxn = 1e5 + 10; int t,n,m,k,a[maxn],b[maxn]; int c; int main() { //fr 阅读全文
posted @ 2020-04-14 11:24 Hazelxcf 阅读(193) 评论(0) 推荐(0)
摘要:https://codeforces.com/contest/1335 C n个数字选取一部分分为数量相等的两组,一组全部一样,另一组都不一样 求最大的元素个数 #include<bits/stdc++.h> using namespace std; map<int, int> mp; int t; 阅读全文
posted @ 2020-04-14 07:56 Hazelxcf 阅读(116) 评论(0) 推荐(0)
摘要:https://codeforces.com/contest/1339 B题 题意很简单, 排序之后,中间两项的绝对值是最小的,输出l,r的顺序 #import<bits/stdc++.h> using namespace std; int i, k, n, t, a[100005]; int ma 阅读全文
posted @ 2020-04-13 08:10 Hazelxcf 阅读(157) 评论(0) 推荐(0)
摘要:https://vjudge.net/contest/367733#problem/B 一样的代码,自己的错了,难受 dalaode #include <iostream> #include<queue> #include<algorithm> #include<string.h> #include 阅读全文
posted @ 2020-04-12 13:19 Hazelxcf 阅读(164) 评论(0) 推荐(0)
摘要:#include <iostream> #include <cstring> #include <cstdio> #include <algorithm> using namespace std; int n,k; char ch[10][10]; long long ans; int vis[10 阅读全文
posted @ 2020-04-12 09:56 Hazelxcf 阅读(152) 评论(0) 推荐(0)
摘要:https://www.luogu.com.cn/problem/P2599 全部不为1的时候 如果面临两部分相等,那么后手赢 否则先手赢 #include<bits/stdc++.h> using namespace std; int t,n,a1,an,c; int main() { //fre 阅读全文
posted @ 2020-04-11 20:03 Hazelxcf 阅读(173) 评论(0) 推荐(0)
摘要:http://acm.hdu.edu.cn/showproblem.php?pid=1045 #include <bits/stdc++.h> using namespace std; int n; char ch[10][10]; int dp[4][2] = {-1,0,1,0,0,-1,0,1 阅读全文
posted @ 2020-04-11 18:22 Hazelxcf 阅读(153) 评论(0) 推荐(0)
摘要:http://acm.hdu.edu.cn/showproblem.php?pid=1728 要注意题目给的输入顺序, dfs里面第三条如果不共线并且相应步数已经到了的话 #include <bits/stdc++.h> using namespace std; int t,m,n,k,x1,yy1 阅读全文
posted @ 2020-04-11 16:49 Hazelxcf 阅读(137) 评论(0) 推荐(0)
摘要:网址 想说一下昨晚的cf吧 A t组样例,n * m 要求黑格(周围至少有一个白格)比白格(周围至少有一个黑格)多一个 最笨的就是想跟着题意走,把所有的格一分为二(巴拉巴拉) 似乎也不太好实现 实际上让第一个格为白色 其他的为黑色 本题OK 了 B t组样例,n数据个数,接下来两行分别是ab数组 其 阅读全文
posted @ 2020-04-09 11:21 Hazelxcf 阅读(155) 评论(0) 推荐(0)
摘要:https://vjudge.net/problem/POJ-3723 n个女的,m个男的,选择一个战士需要花费10000,如果有亲密关系,需要花费10000-d; 花费最小 用了cin加了优化超时了,后来改了scanf之后答案错误 后来把e等从0开始(下标) 过了 #include <iostre 阅读全文
posted @ 2020-04-06 17:39 Hazelxcf 阅读(170) 评论(0) 推荐(0)
摘要:https://vjudge.net/problem/POJ-3255 #include <iostream> #include <cstring> #include <queue> #include <vector> using namespace std; typedef pair<int, i 阅读全文
posted @ 2020-04-06 15:51 Hazelxcf 阅读(121) 评论(0) 推荐(0)
摘要:#include <bits/stdc++.h> using namespace std; #define int long long const int mod = 100001; string str; int s,sj,g; int ans; signed main(){ ios::sync_ 阅读全文
posted @ 2020-04-03 20:39 Hazelxcf 阅读(181) 评论(0) 推荐(0)
摘要:https://www.luogu.com.cn/problem/P1638 #include <bits/stdc++.h> using namespace std; #define int long long const int maxn = 1e6 + 10; int n,m; int a[m 阅读全文
posted @ 2020-04-02 10:47 Hazelxcf 阅读(209) 评论(0) 推荐(0)
摘要:第一次接触这个概念还是去年暑假,当时做一个题,说到了尺取法,当时只是觉得尺取尺取嘛,很简单的,然后也就没有然后了,到了今天才发现,自己有多么菜。好了,不说废话了,(虽然我也不是觉得前面是废话)开始今天的主题吧! https://www.nowcoder.com/discuss/180336?type 阅读全文
posted @ 2020-04-02 10:34 Hazelxcf 阅读(147) 评论(0) 推荐(0)
摘要: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 阅读(161) 评论(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 阅读(166) 评论(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 阅读(132) 评论(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 阅读(105) 评论(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 阅读(346) 评论(0) 推荐(0)