摘要: 题目链接:https://atcoder.jp/contests/arc151/tasks/arc151_c 1 /* 2 博弈 3 归纳法,先开始处理单个情况,0 1是相对的 4 0....1:必败 5 0....0:必胜 策略:在0边上放1 6 ......:n%2=1必胜 策略:先手在中间放1 阅读全文
posted @ 2022-10-20 15:38 20kmのshimakaze 阅读(46) 评论(0) 推荐(0)
摘要: 题目描述 G 公司有 n 个沿铁路运输线环形排列的仓库,每个仓库存储的货物数量不等。如何用最少搬运量可以使 nn 个仓库的库存数量相同。搬运货物时,只能在相邻的仓库之间搬运。 输入格式 第一行一个正整数 nn,表示有 n 个仓库。 第二行 n 个正整数,表示 n 个仓库的库存量。 输出格式 输出最少 阅读全文
posted @ 2022-02-14 18:32 20kmのshimakaze 阅读(32) 评论(0) 推荐(0)
摘要: 1 #include<iostream> 2 using namespace std; 3 int a[2000005],n; 4 void slove() 5 { 6 cin>>n; 7 for(int i=1;i<=n;i++){ 8 cin>>a[i]; 9 } 10 if(a[1]!=n&& 阅读全文
posted @ 2021-11-26 14:32 20kmのshimakaze 阅读(35) 评论(0) 推荐(0)
摘要: 原题:https://codeforces.com/contest/1605/problem/A 代码: 1 #include<bits/stdc++.h> 2 using namespace std; 3 void slove() 4 { 5 int a[3]; 6 cin>>a[0]>>a[1] 阅读全文
posted @ 2021-11-14 00:02 20kmのshimakaze 阅读(31) 评论(0) 推荐(0)
摘要: 原题:https://codeforces.com/contest/1605/problem/B 代码: 1 #include<bits/stdc++.h> 2 #define N 1000006 3 using namespace std; 4 char ch[N]; 5 void solve() 阅读全文
posted @ 2021-11-13 23:58 20kmのshimakaze 阅读(55) 评论(0) 推荐(0)
摘要: bellman-ford: 1 #include<iostream> 2 #include<stdio.h> 3 #include<string> 4 #include<algorithm> 5 #include<cmath> 6 #include<vector> 7 using namespace 阅读全文
posted @ 2021-07-20 20:22 20kmのshimakaze 阅读(45) 评论(0) 推荐(0)
摘要: 我借着学的。 原链接:https://blog.csdn.net/ltrbless/article/details/87696372 1 #include<iostream> 2 #include<cstring> 3 #include<cstdio> 4 #include<cmath> 5 #in 阅读全文
posted @ 2021-07-19 11:15 20kmのshimakaze 阅读(57) 评论(0) 推荐(0)
摘要: 题目编号:UVA - 11624 ; https://vjudge.net/problem/UVA-11624#author=zmyhh 此题需要注意,不能无脑使用while(!r.empty()),只能让两个一步一步走。 1 #include<iostream> 2 #include<stdio. 阅读全文
posted @ 2021-07-16 10:18 20kmのshimakaze 阅读(30) 评论(0) 推荐(0)
摘要: 题目:https://www.luogu.com.cn/problem/P1102 原题要求A-B=C,可将其转化为A-C=B,放入map后将A的数组值,改为B数组值,再求B数组每一个值在map出现次数之和。 1 #include<iostream> 2 #include<cmath> 3 #inc 阅读全文
posted @ 2021-07-12 10:09 20kmのshimakaze 阅读(68) 评论(0) 推荐(0)
摘要: 树状数组: 1:单点增加,区间询问(前缀和) 1 #include<iostream> 2 using namespace std; 3 #define ll long long 4 int a[1000000];//原数组 5 int tre[1000000];//树状数组 6 int n; 7 阅读全文
posted @ 2021-06-29 20:28 20kmのshimakaze 阅读(50) 评论(0) 推荐(0)