Educational Codeforces Round 56 Solution】的更多相关文章

A. Dice Rolling 签到. #include <bits/stdc++.h> using namespace std; int t, n; int main() { scanf("%d", &t); while (t--) { scanf("%d", &n); ) puts("); else { ; res += n / ; printf(); } } ; } B. Letters Rearranging 签到. #…
题目链接: https://codeforces.com/contest/1093/problem/G 题目: 题意: 在k维空间中有n个点,每次给你两种操作,一种是将某一个点的坐标改为另一个坐标,一种操作是查询[l,r]中曼哈顿距离最大的两个点的最大曼哈顿距离. 思路: 对于曼哈顿距离,我们将其绝对值去掉会发现如下规律(以二维为例): 故这题我们可以用线段树来维护[l,r]中上述每种情况的最大值和最小值,用二进制来枚举xy的符号(1为正,0为负),最后答案是 每种情况中区间最大值-区间最小值…
传送门:http://codeforces.com/contest/1093/problem/D D. Beautiful Graph time limit per test 2 seconds memory limit per test 256 megabytes input standard input output standard output You are given an undirected unweighted graph consisting of nn vertices a…
题目链接:https://codeforces.com/contest/1093 A. Dice Rolling 题意: 有一个号数为2-7的骰子,现在有一个人他想扔到几就能扔到几,现在问需要扔多少次,能使扔出的总和等于xi. 题解: 由于是special judge,模拟一下搞搞就行了= = 代码如下: #include <bits/stdc++.h> using namespace std; int main(){ int t; cin>>t; int n; while(t--…
给你一个无向图 以及点的个数和边  每个节点只能用1 2 3 三个数字 求相邻 两个节点和为奇数   能否构成以及有多少种构成方法 #include<bits/stdc++.h> using namespace std; #define LL long long #define maxn 300005 ; vector<int>q[maxn]; LL fa[maxn],sumx,sumy; ; LL poww(LL a,LL b){ LL ans = ; while(b){ ){…
涨rating啦.. 不过话说为什么有这么多数据结构题啊,难道是中国人出的? A - Dice Rolling 傻逼题,可以用一个三加一堆二或者用一堆二,那就直接.. #include<cstdio> #include<cstring> #include<algorithm> #include<queue> #include<set> #include<map> #include<vector> #include<c…
A:签到. B:仅当只有一种字符时无法构成非回文串. #include<iostream> #include<cstdio> #include<cmath> #include<cstdlib> #include<cstring> #include<algorithm> using namespace std; #define ll long long #define N 1010 ')) c=getchar();return c;}…
F - Vasya and Array dp[ i ][ j ] 表示用了前 i 个数字并且最后一个数字是 j 的方案数. dp[ i ][ j ] = sumdp [i - 1 ][ j ], 这样的话会有不合法的方案算进去,而且不合法的方案只有 i - len + 1 到 i 这一段相同才会 出现, 所以如果 i - len + 1 到 i 可以变成一样的话要减去 sumdp[ i - len ] - dp[ i - len ][ j ] #include<bits/stdc++.h> #…
A. Find Divisible 签到. #include <bits/stdc++.h> using namespace std; int t, l, r; int main() { scanf("%d", &t); while (t--) { scanf("%d%d", &l, &r); printf(); } ; } B. Substring Removal 签到. #include <bits/stdc++.h&g…
A. Minimum Integer 签到. #include <bits/stdc++.h> using namespace std; #define ll long long ll l, r, d; int main() { int t; scanf("%d", &t); while (t--) { scanf("%lld%lld%lld", &l, &r, &d); if (d < l) printf(&quo…