Codeforces Round #665 (Div. 2) 题解 写得有点晚了,估计都官方题解看完切掉了,没人看我的了qaq. 目录 Codeforces Round #665 (Div. 2) 题解 A - Distance and Axis B - Ternary Sequence C - Mere Array D - Maximum Distributed Tree E - Divide Square F - Reverse and Swap A - Distance and Axis…
Codeforces Round #198 (Div. 2) 昨天看到奋斗群的群赛,好奇的去做了一下, 大概花了3个小时Ak,我大概可以退役了吧 那下面来稍微总结一下 A. The Wall Iahub and his friend Floyd have started painting a wall. Iahub is painting the wall red and Floyd is painting it pink. You can consider the wall being mad…
[Codeforces Round #672 (Div. 2) A - C1 ] 题目链接# A. Cubes Sorting 思路: " If Wheatley needs more than \(\frac{n \cdot (n-1)}{2}-1\) exchange operations, he won't do this boring work." 例如:5,4,3,2,1 我们需要移动4+3+2+1=10次,也就是\(\frac{n \cdot (n-1)}{2}\)次,所以…
A. Distance and Axis 题目:http://codeforces.com/contest/1401/problem/A 题解:对于n来说分两种情况,一是奇数,二则是偶数 ①奇数:对于k来说如果是奇数且小于等于他,ans=0:若k是奇数并且大于n,则ans=k-n:若k是偶数并且k<n,那么ans=1:若k为偶数并且k>n,则ans=k-n ②偶数:若k为偶数并且k<=n,则ans=0:若k为偶数并且k>n,则ans=k-n:若k为奇数并且k<n,则ans=1…
contest链接:https://codeforces.com/contest/1283 A. Minutes Before the New Year 题意:给一个当前时间,输出离第二天差多少分钟 思路:略 AC代码: #include<iostream> #include<vector> #include<algorithm> #include<cmath> #include<cstring> using namespace std; ; ;…
题目: http://codeforces.com/contest/1011/problem/D This is an interactive problem. Natasha is going to fly to Mars. Finally, Natasha sat in the rocket. She flies, flies... but gets bored. She wishes to arrive to Mars already! So she decides to find som…
题目 http://codeforces.com/contest/1011/problem/C Natasha is going to fly on a rocket to Mars and return to Earth. Also, on the way to Mars, she will land on n−2n−2 intermediate planets. Formally: we number all the planets from 11 to nn. 11 is Earth, n…
接着是C,D的题解 C. Tourist Problem Iahub is a big fan of tourists. He wants to become a tourist himself, so he planned a trip. There are n destinations on a straight road that Iahub wants to visit. Iahub starts the excursion from kilometer 0. The n destina…
A. Circle of Students 题目:https://codeforces.com/contest/1203/problem/A 题意:一堆人坐成一个环,问能否按逆时针或者顺时针正好是 1-n的顺序 思路:水题,把数组开两倍,或者标记当前位置都可以 #include<bits/stdc++.h> #define maxn 100005 #define mod 1000000007 using namespace std; typedef long long ll; int…
我果然还是太菜了,就写了两道题....真是水死了.... A The Miracle and the Sleeper 简化题意:给定\(l,r\),求\(a\)%\(b\)的最大值,其中\(r>=a>=b>=l\). 这里规定了是大的数模小的数,考虑选定一个\(b\),显然\(a\)必须比他大,则b%b=0,(b+1)%b=1,(b+2)%b=2...(2b-1)%b=b-1,之后就又从0开始到b-1,显然若\(2b-1<=r\)的话我们就能取到在模b的意义下的最大值,还有的是我们…
A.Slightly Decreasing Permutations Permutation p is an ordered set of integers p1, p2, ..., pn, consisting of n distinct positive integers, each of them doesn't exceed n. We'll denote the i-th element of permutation p as pi. We'll call number n th…
A. Colorful Stones (Simplified Edition) time limit per test 2 seconds memory limit per test 256 megabytes input standard input output standard output There is a sequence of colorful stones. The color of each stone is one of red, green, or blue. You a…
突然发现上一场没有写,那就补补吧 本来这场应该5题的,结果一念之差E fail了 A. Serval and Bus 基本数学不解释,假如你没有+1 -1真的不好意思见人了 #include<cstdio> #include<iostream> #include<cstring> #include<cstdlib> #include<algorithm> #include<cmath> using namespace std; con…
我就做了前两题,第一题第一次vp就把我搞自闭跑路了,第二题第二次又把我搞自闭了 A. As Fast As Possible 细节题 #include<cstdio> #include<iostream> #include<cstring> #include<cstdlib> #include<algorithm> #include<cmath> using namespace std; int n,k; double L,v1,v2…
A:sort以后求差值最小 ]; int main() { int n,m; cin>>n>>m; ; i < m ; i++) cin>>a[i]; sort(a,a+m); int mm = INF; ; i+n- < m ; i++) mm = min(mm,a[i+n-]-a[i]); cout<<mm<<endl; ; } B:求屏幕黑框占屏幕的几分之几 . 求LCM后的差值 LL gcd(LL a,LL b){ retur…