CF
卐邾翊
能不能拿个牌?
展开
-
Codeforces Round #789 (Div. 2)(A-D)
Codeforces Round #789 (Div. 2)A. Tokitsukaze and All Zero Sequence一个小小的思维贪心,很容易知道如果有0,直接用0去和其他数处理,如果没有就先创造一个#include <bits/stdc++.h>using namespace std;#define int long longconst int M = 1e9 + 7;const int N = 2e6 + 9;int a[N];signed main(){原创 2022-05-09 22:09:58 · 173 阅读 · 0 评论 -
Codeforces Round #781 (Div. 2)(A-D)
A. GCD vs LCM#include<bits/stdc++.h>using namespace std;#define int long longsigned main(){ int t; cin>>t; while (t--) { int n; cin>>n; cout<<n-3<<" "<<1<<" "<<1<<" "<<1<<endl原创 2022-04-09 16:15:12 · 337 阅读 · 0 评论 -
1622C. Set or Decrease
C. Set or Decrease一道思维题#include <bits/stdc++.h>using namespace std;#define int long longconst int N = 2e5+7;int a[N];signed main(){ int t; cin>>t; while (t--) { int n,k,sum = 0; cin>>n>>k; for (int i=0;i<n;i++)原创 2022-03-25 15:05:30 · 256 阅读 · 0 评论 -
1634D. Finding Zero
D. Finding Zero构造,我们设a,b,c里面有最大值和最小值在这里插入代码片,然后再从中找到二者#include<bits/stdc++.h>using namespace std;const int N = 2e6+7;int ask(int a,int b,int x){ cout<<"? "<<a<<" "<<b<<" "<<x<<endl; cin>>x; ret原创 2022-03-22 13:56:45 · 143 阅读 · 0 评论 -
1634C. OKEA
C. OKEA一道简单的数学问题,一行只能有奇数或者偶数,进行判断就行了#include<bits/stdc++.h>using namespace std;const int N=1e6;int main(){ int t,n,k; cin>>t; while (t--&&cin>>n>>k) { int cnt = (n*k+1)/2;//奇数的数量 if (cnt%k==0) { cout<&原创 2022-03-19 21:24:02 · 194 阅读 · 0 评论 -
1641B. Repetitions Decoding
B. Repetitions Decoding一个写起来繁琐一点的构造,主要是要记录到哪了。#include<bits/stdc++.h>using namespace std;const int N=1e6;int t,n,a[N],p[N],v,l,r,A[N],B[N],c,q[N],s;void T(int x,int y){ A[++c]=x,B[c]=y;//A存储地方,B存储数值 for(int i=n;i>x;i--) a[i+2]=a[i]; a原创 2022-03-19 20:22:25 · 1031 阅读 · 0 评论 -
1612D. X-Magic Pair
D. X-Magic Pair一道数学题,我们让a>=b,那么如果x在a到a%b之间就可以通过a-n*b得到然后辗转相余#include <bits/stdc++.h>using namespace std;#define int long longconst int mod = 998244353;const int N = 2e5 + 9;map<int, int> mp;signed main(){ int t; cin >&g原创 2022-03-18 22:09:21 · 277 阅读 · 0 评论 -
1644E. Expand the Path
E. Expand the Path一道灯下黑的题目。我们很显然知道,要让每个列的上限最小,下限最大(同理计算行也可以)。所以图形应该是一个中心对称图形所以空白部分是一个矩形(除了一开始的地方),但是还要加上一开始的部分。#include <bits/stdc++.h>using namespace std;#define int long longstring str;signed main(){ int t; cin>>t; whil原创 2022-03-18 16:21:17 · 342 阅读 · 0 评论 -
1506G. Maximize the Remaining String
G. Maximize the Remaining String贪心,放置时,如果前面一个小比他小,并且后面还有,那么就把前面的删除#include <bits/stdc++.h>using namespace std;const int N = 3e5 + 3;#define int long longstring str;char ans[N];map<char,int>mp,vis;signed main(){ int t; cin>原创 2022-03-17 21:53:48 · 219 阅读 · 0 评论 -
1560F1. Nearest Beautiful Number (easy version)
F1. Nearest Beautiful Number (easy version)预处理加二分#include <bits/stdc++.h>using namespace std;const int N = 3e5 + 3;#define int long longset<int>cun1,cun2;signed main(){ //单个 for (int i=1;i<=9;i++) { int res = 0;原创 2022-03-17 17:46:16 · 262 阅读 · 0 评论 -
1388C. Uncle Bogdan and Country Happiness
C. Uncle Bogdan and Country Happiness纯纯DFS#include <bits/stdc++.h>using namespace std;const int N = 1e5 + 3;#define int long longint a[N], b[N], c[N];vector<int> cun[N];int vis[N];int ff = 1;void DFS(int x){ int res = 0; int原创 2022-03-17 00:47:51 · 181 阅读 · 0 评论 -
1359C. Mixing Water
C. Mixing Water一个简单的思维。因为是一隔一的,所以要么热水多放一个,要么冷水和热水一样多。设热水与要求的差为cou1,冷水与要求的差为cou2。所以我们先考虑两种情况:1,cou1大于cou2,那么肯定是要么只放两个,或者一个热水正好。2,cou2大于cou1,那么每次加两个就是减小热水和要求的差值,那么减到多少合适呢? 这时就要判断一下了,这里也是容易错的地方。 因为判断是平均值的差,所以记得转换成double型求平均值。#include <bits/st原创 2022-03-15 15:17:46 · 407 阅读 · 0 评论 -
Codeforces Round #756 (Div. 3)
Codeforces Round #756 (Div. 3)A. Make Even思路:如果末尾是偶数,不需要操作;如果开头是偶数,一次操作,即全翻转;如果开头和末尾都是 奇数,判断里面是否有偶数,如果没有,无法操作,如果有,需要两次操作。#include <bits/stdc++.h>#define int long long#define PII pair<int, int>#define endl "\n"#define fast ios_bas原创 2021-12-29 22:18:38 · 500 阅读 · 0 评论 -
Codeforces Round #739 (Div. 3) (A-E)没有D
Codeforces Round #739 (Div. 3)A#include <bits/stdc++.h>using namespace std;signed main(){ int t; cin>>t; while (t--) { int k,cou = 0; cin>>k; for (int i=1;;i++) { if (i%3==0原创 2021-08-19 21:16:23 · 59 阅读 · 0 评论 -
Codeforces Round #738 (Div. 2)(A-C)
Codeforces Round #738 (Div. 2)A#include <bits/stdc++.h>using namespace std;signed main(){ int t; cin>>t; while (t--) { int n,a[101],b[101]; for (int i=0;i<50;i++) b[i] = 1; cin>>n; i原创 2021-08-16 01:25:58 · 50 阅读 · 0 评论 -
Codeforces Round #736 (Div. 2)(B-C)
Codeforces Round #736 (Div. 2)花了十分钟帮朋友写了B,C就睡觉了,自己没打B先看上,再看左后看右#include <iostream>#include <cstring>#include <algorithm>using namespace std;#define int long longsigned main(){ int t; cin>>t; while (t--) {原创 2021-08-02 22:33:51 · 56 阅读 · 0 评论 -
Educational Codeforces Round 112 (Rated for Div. 2)(A-D)
Educational Codeforces Round 112 (Rated for Div. 2)A我写的挺烦的,其实判断一下奇偶数和有没有a>0就行 #include <bits/stdc++.h> using namespace std; #define int long long signed main() { int t; cin>>t; while (t--)原创 2021-08-01 14:44:33 · 47 阅读 · 0 评论 -
Codeforces Round #735 (Div. 2)(A-D)没有B
Codeforces Round #735 (Div. 2)A一道小思维题#include <bits/stdc++.h>using namespace std;#define int long longconst int N = 1000100;int a[N];signed main(){ int t; cin>>t; while(t--) { int n; cin>>n;原创 2021-07-30 02:46:21 · 61 阅读 · 0 评论 -
Codeforces Global Round 15 (A-D)没有C
A太简单,写完删了B我写的繁了,但是意思是这么个意思,就遍历打擂台一样,找到最后的胜者,然后在遍历一遍找是不是最厉害的#include <bits/stdc++.h>using namespace std;#define int long longint op[200095][16];signed main(){ int t; cin >> t; while (t--) { int n; cin >> n; int k = -1;原创 2021-07-26 18:20:01 · 77 阅读 · 0 评论 -
Codeforces Round #734 (Div. 3) (A-D1)
A太简单了,写完就删了B1#include <bits/stdc++.h>using namespace std;#define int long longsigned main(){ int t; cin >> t; while (t--) { int ch[33]; memset(ch, 0, sizeof(ch)); string str; cin >> str; for (int i = 0; i < str.le原创 2021-07-24 23:18:50 · 67 阅读 · 0 评论 -
Harbour.Space Scholarship Contest 2021-2022 (open for everyone, rated, Div. 1 + Div. 2)(A - D)
A太简单了,写完就删了B有很多人暴力搜,或者其他方法,样例不严谨过了,然后就被hack了#include<bits/stdc++.h>#define int long longusing namespace std;signed main(){ int t; cin>>t; while (t--) { string str,s,KK; cin>>str; cin>>原创 2021-07-23 16:11:51 · 76 阅读 · 0 评论 -
VK Cup 2021 - Elimination (Engine) A-D
A. Binary DecimalLet’s call a number a binary decimal if it’s a positive integer and all digits in its decimal notation are either 0 or 1. For example, 1010111 is a binary decimal, while 10201 and 787788 are not.Given a number n, you are asked to represe原创 2021-07-18 20:52:20 · 326 阅读 · 3 评论 -
Codeforces Round #732 (Div. 2)
A. AquaMoon and Two ArraysAquaMoon and Cirno are playing an interesting game with arrays. Cirno has prepared two arrays a and b, both consist of n non-negative integers. AquaMoon can perform the following operation an arbitrary number of times (possibly z原创 2021-07-12 21:42:27 · 215 阅读 · 0 评论 -
D. Solve The Maze Codeforces Round #648 (Div. 2)
D. Solve The MazeVivek has encountered a problem. He has a maze that can be represented as an n×m grid. Each of the grid cells may represent the following:Empty — ‘.’Wall — ‘#’Good person — ‘G’Bad person — ‘B’The only escape from the maze is at cell原创 2021-06-19 20:21:50 · 98 阅读 · 0 评论 -
C. Rotation Matching Codeforces Round #648 (Div. 2)
C. Rotation MatchingAfter the mysterious disappearance of Ashish, his two favourite disciples Ishika and Hriday, were each left with one half of a secret message. These messages can each be represented by a permutation of size n. Let’s call them a and b.原创 2021-06-19 20:18:18 · 82 阅读 · 0 评论 -
B. Trouble Sort Codeforces Round #648 (Div. 2)
B. Trouble SortAshish has n elements arranged in a line.These elements are represented by two integers ai — the value of the element and bi — the type of the element (there are only two possible types: 0 and 1). He wants to sort the elements in non-decre原创 2021-06-19 20:14:33 · 85 阅读 · 0 评论 -
A. Matrix Game Codeforces Round #648 (Div. 2)
A. Matrix GameAshish and Vivek play a game on a matrix consisting of n rows and m columns, where they take turns claiming cells. Unclaimed cells are represented by 0, while claimed cells are represented by 1. The initial state of the matrix is given. Ther原创 2021-06-19 20:09:50 · 75 阅读 · 0 评论 -
C. Challenging Cliffs Codeforces Round #726 (Div. 2)
C. Challenging CliffsYou are a game designer and want to make an obstacle course. The player will walk from left to right. You have n heights of mountains already selected and want to arrange them so that the absolute difference of the heights of the firs原创 2021-06-19 20:08:13 · 146 阅读 · 0 评论 -
B. Bad Boy Codeforces Round #726 (Div. 2)
B. Bad BoyRiley is a very bad boy, but at the same time, he is a yo-yo master. So, he decided to use his yo-yo skills to annoy his friend Anton.Anton’s room can be represented as a grid with n rows and m columns. Let (i,j) denote the cell in row i and co原创 2021-06-19 20:06:35 · 149 阅读 · 0 评论 -
A. Arithmetic Array Codeforces Round #726 (Div. 2)
A. Arithmetic ArrayAn array b of length k is called good if its arithmetic mean is equal to 1. More formally, ifb1+⋯+bkk=1.Note that the value b1+⋯+bkk is not rounded up or down. For example, the array [1,1,1,2] has an arithmetic mean of 1.25, which is原创 2021-06-19 20:04:14 · 193 阅读 · 0 评论 -
C. Number of Pairs
C. Number of PairsYou are given an array a of n integers. Find the number of pairs (i,j) (1≤i<j≤n) where the sum of ai+aj is greater than or equal to l and less than or equal to r (that is, l≤ai+aj≤r).For example, if n=3, a=[5,1,2], l=4 and r=7, then原创 2021-06-12 17:18:44 · 791 阅读 · 0 评论 -
B. Friends and Candies
B. Friends and CandiesPolycarp has n friends, the i-th of his friends has ai candies. Polycarp’s friends do not like when they have different numbers of candies. In other words they want all ai to be the same. To solve this, Polycarp performs the followin原创 2021-06-11 13:52:56 · 242 阅读 · 0 评论 -
A. Stone Game
A. Stone GamePolycarp is playing a new computer game. This game has n stones in a row. The stone on the position i has integer power ai. The powers of all stones are distinct.Each turn Polycarp can destroy either stone on the first position or stone on t原创 2021-06-11 13:51:55 · 211 阅读 · 0 评论 -
D. Omkar and Medians
D. Omkar and MediansUh oh! Ray lost his array yet again! However, Omkar might be able to help because he thinks he has found the OmkArray of Ray's array. The OmkArray of an array a with elements a1,a2,…,a2k−1, is the array b with elements b1,b2,…,bk such原创 2021-06-09 18:43:42 · 175 阅读 · 0 评论 -
C. Diluc and Kaeya
C. Diluc and KaeyaThe tycoon of a winery empire in Mondstadt, unmatched in every possible way. A thinker in the Knights of Favonius with an exotic appearance.This time, the brothers are dealing with a strange piece of wood marked with their names. This原创 2021-06-07 19:31:37 · 212 阅读 · 1 评论 -
A. Omkar and Bad Story
A. Omkar and Bad Story contestA. Omkar and Bad Storytime limit per test2 secondsmemory limit per test256 megabytesinputstandard inputoutputstandard outputOmkar has received a message from Anton saying "Your story for problem A is confusing. Just make原创 2021-06-07 17:58:54 · 180 阅读 · 0 评论 -
B. Sifid and Strange Subsequences
B. Sifid and Strange SubsequencesA sequence (b1,b2,…,bk) is called strange, if the absolute difference between any pair of its elements is greater than or equal to the maximum element in the sequence. Formally speaking, it’s strange if for every pair (i,j原创 2021-05-25 16:25:42 · 248 阅读 · 0 评论 -
Codeforces Round #719 (A-C)
第一题题意:就是不能回去:#include<iostream>using namespace std;int main(){ int t; cin>>t; while (t--){ int n,ch[1001]={0}; cin>>n; string str; cin>>str; bool flag = true; ch[str[0]]++; for (int i=1;i<n;i++){ if (str[i原创 2021-05-06 08:59:46 · 54 阅读 · 1 评论 -
B. The Cake Is a Lie
题意:从(1,1)走到他给的点,只能向上和向右。int cou =0;如果向上就cou+=x;,如果向右就cou+=y;题解:最大的cou是两条直线。最小的cou是一直转弯。注意点:如果x>y 先走x;反之亦反;#include<iostream>using namespace std;int maxn(int x,int y){ int xx=1,yy=1,cou=0; while (xx<x){ cou+=yy; xx++; } while (yy<原创 2021-05-01 15:03:06 · 112 阅读 · 0 评论 -
A. Red and Blue Beans
题意:红豆子和绿豆子分在不同的篮子里。问最小的最大差是能不能比给的d小。方法:尽可能用更多的篮子里。#include<iostream>using namespace std;int main(){ double a,b,k; int n; cin>>n; for (int i=0;i<n;i++){ cin>>a>>b>>k; if (a>b){ if (a/b-1<=k) cout<<原创 2021-05-01 14:25:50 · 203 阅读 · 0 评论