
cf题解
文章平均质量分 58
CofDoria
这个作者很懒,什么都没留下…
展开
-
Codeforces Round #784 (Div. 4)题解 (第一次AK cf (XD
虽然是Div.4,但是第一次AK,还是有点小激动A. Division?模拟#include <bits/stdc++.h>using namespace std;string f(int n) { if (n <= 1399) return "Division 4"; if (n <= 1599) return "Division 3"; if (n <= 1899) return "Division 2"; return "Di.原创 2022-04-22 00:13:09 · 604 阅读 · 0 评论 -
2021-2022 ICPC, NERC, Northern Eurasia Onsite C,D,L题解
题目链接 https://codeforces.com/contest/1666文章目录C Connect the PointsD Deletive EditingL LabyrinthC Connect the Points题意给出三个点,找任意条平行x轴或y轴线段,使得线经过3个点,且线段长度和最小。思路手玩可以发现,线段和最长可以不超过3点x坐标最大差值加上3点y坐标最大差值,所以我们可以找到y坐标第二大的点,过它作一条从x最小值到x最大值的平行x轴线段,然后从另外两个点作到这个线段的垂线原创 2022-04-14 00:19:11 · 2088 阅读 · 1 评论 -
Codeforces Round #735 (Div. 2) C. Mikasa 题解
C. Mikasa 传送门Accepted code#include <bits/stdc++.h>using namespace std;#define ll long longvoid print(int i) { int ok = 0; if(i & 1) ok = 1; if(i >> 1) print(i >> 1); printf("%d", ok);}ll t, n, m;ll ans = 0;原创 2021-07-30 09:49:22 · 224 阅读 · 0 评论 -
Codeforces Round #731 (Div. 3) A - D 题解
A.Shortest Path with Obstacle思路起点、终点和障碍在同一直线,且障碍在起点终点之间则要多走 222 步绕开障碍Accepted code#include <bits/stdc++.h>using namespace std;int t;int sx, sy, fx, fy, tx, ty;int main() { scanf("%d", &t); while (t--) { scanf("%d%d", &am原创 2021-07-11 01:18:26 · 332 阅读 · 0 评论 -
Educational Codeforces Round 105 (Rated for Div. 2) B. Berland Crossword 题解
题意给出五个数 n,U,R,D,Ln,U,R,D,Ln,U,R,D,L,代表一个 n×nn \times nn×n 的网格最上层黑格个数(U)(U)(U),最右列的黑格个数(R)(R)(R),最下层的黑格个数(D)(D)(D)和最左列的黑格个数(L)(L)(L)。求这样的网格是否存在。思路对四个角的网格的所有可能判定是否存在。四个角的网格所有可能的枚举可以用 bitsetbitsetbitset 来实现。Accepted code/* * @Autor: CofDoria * @Date: 2原创 2021-03-06 14:42:22 · 165 阅读 · 0 评论 -
Educational Codeforces Round 103 (Rated for Div. 2) 【A,B,C】题解
EDU Round 103 Div.2A K-divisible Sum题意输入 nnn 和 kkk,要求设计由 nnn 个正整数相加成一个数,且这个数是 kkk 的倍数,同时要求这 nnn 个正整数的最大值尽可能小,并输出这个最大值。思路首先是 k≤nk≤nk≤n 的情况,当 k≤nk≤nk≤n 且 nnn % k==0k==0k==0,nnn 全设为 111,即可满足条件。若无法除尽,则给多个元素加 111,将和增至 kkk 的两倍。其次是 k>nk>nk>n 的情况,当原创 2021-01-30 12:59:02 · 410 阅读 · 0 评论 -
Codeforces Round #662 (Div. 2) [ A , B ] 题解报告
文章目录A. Rainbow Dash, Fluttershy and Chess ColoringInputOutputExampleinputoutputNote思路my Accepted codeB. Applejack and StoragesInputOutputExampleinputoutputNote思路my Accepted code[contest link]A. Rainbow Dash, Fluttershy and Chess ColoringOne evening Rain原创 2020-08-08 11:41:37 · 422 阅读 · 0 评论 -
Codeforces Round #653 (Div. 3) [A,B,C,D,E1] 题解报告
A. Required RemainderYou are given three integers x,y and n. Your task is to find the maximum integer k such that 0≤k≤n that kmodx=y, where mod is modulo operation. Many programming languages use percent operator % to implement it.In other words, with gi原创 2020-07-08 20:16:02 · 498 阅读 · 0 评论 -
Educational Codeforces Round 90 (Rated for Div. 2) [A,B,C]
A. Donut ShopsThere are two rival donut shops.The first shop sells donuts at retail: each donut costs a dollars.The second shop sells donuts only in bulk: box of b donuts costs c dollars. So if you want to buy x donuts from this shop, then you have to b原创 2020-07-06 17:58:28 · 310 阅读 · 0 评论 -
Codeforces Global Round 9 [A,C]
目录A. Sign FlippingInputOutputExampleinputoutputNote题意思路my Accepted codeC. Element ExterminationInputOutputExampleinputoutputNote题意思路myAccepted code[官方英文题解][比赛传送门]A. Sign FlippingYou are given n integers a1,a2,…,an, where n is odd. You are allowed to fl原创 2020-07-05 14:00:29 · 572 阅读 · 0 评论 -
Codeforces Round #654 (Div. 2) [D - Grid-00100] 题解
[原题传送门]题意给你一个n和一个k,都为整数,需要你设计一个n*n的01矩阵,由0和1组成,该矩阵的和为k同时规定,称该矩阵为Amax(R)为该矩阵的行之和最大值,min(R)为行之和的最小值max(C)为该矩阵列之和的最大值,min(C)为列之和的最小值f(A)=(max(R)-min(R))2+(max(C)-min(C))2要求输出矩阵A的最小f(A)及f(A)最小时的矩阵A思路由于f(A)的计算特性,需要每行每列都平均分到差不多的1对于矩阵中的1可以依照以下方式摆放:先依原创 2020-07-02 01:58:09 · 230 阅读 · 0 评论 -
Codeforces Round #654 (Div. 2) [B - Magical Calendar] 题解
[原题传送门]题意Alice有很多种日历,这些日历的不同之处在于一周的天数不一样(即日历的宽度不同),Alice想要从日历的某一天开始用记号笔连续画n天,而她拥有宽度1到r的日历,且每一种都有无穷本,请问Alice可以画出几种形状?思路通过小规模穷举可以发现:而在宽度小于n的日历中,在每种日历上可以涂鸦出的形状的个数都是该种日历的宽度当r大于等于n时,使用宽度大于等于n的日历所涂鸦的形状都是行数为1、列数为n的长方形,所以r>=n时,可以画出1+2+……+n-1+1种形状,即n/2*(原创 2020-07-02 01:17:26 · 187 阅读 · 0 评论 -
Codeforces Round #654 (Div. 2) [A. Magical Sticks] 题解
[原题传送门]题意给你一个数字n,你可以用数字集1-n任意组合,组合后的数字放入数字集中,同时组合后的数字同样可以再次组合。求问该数字集1-n经过组合(也可以不组合)最多可以得出几个相同的数字。思路若n为1或2时,无法组合,也没有相同的数字,所以输出1n为奇数时,n不组合,n-1与1组合,n-2与2组合…… 以此类推可得最多相同数字的个数为(n-1)/2+1n为偶数时,n与1组合,n-1与2组合……以此类推可得最多相同数字的个数为n/2my Accepted code#include &原创 2020-07-02 00:55:29 · 198 阅读 · 0 评论 -
Codeforces Round #651 (Div. 2) [A-C]
[传送门]A. Maximum GCDLet’s consider all integers in the range from 1 to n (inclusive).Among all pairs of distinct integers in this range, find the maximum possible greatest common divisor of integers in pair. Formally, find the maximum value of gcd(a,b),原创 2020-06-21 01:29:19 · 300 阅读 · 0 评论 -
Codeforces Round #650 (Div. 3) (A-D)
A. Short SubstringsAlice guesses the strings that Bob made for her.At first, Bob came up with the secret string a consisting of lowercase English letters. The string a has a length of 2 or more characters. Then, from string a he builds a new string b and原创 2020-06-18 22:54:58 · 832 阅读 · 0 评论 -
Codeforces #642(div3) [C. Board Moves]
原题链接:https://codeforces.com/contest/1353/problem/C题意给你一个大小为n*n的板,其中n为奇数。最初,板上的每个单元都有一个数据.一次移动中,你可以将单元(i,j)中的数据转移到以下单元中:(i−1,j−1);(i−1,j);(i−1,j+1);(i,j−1);(i,j+1);(i+1,j−1);(i+1,j);(i+1,j+1);同时,你的数据只能在n*n的板内移动,一个单元也可以储存多个数据.现在需要你求出,最少经过多少.原创 2020-05-15 10:44:45 · 257 阅读 · 0 评论 -
Codeforces #639(div2) [C. Hilbert’s Hotel]
Codeforces #639(div2) [C. Hilbert’s Hotel]原题链接:https://codeforces.com/contest/1345/problem/C题意有无限个房间和无限位客人,最初每位客人都有一个房间.给你一个长度为n的数组:{a0,a1,a3,…,an-2,an-1},然后对于任意整数k,房间k的客人被转移至房间__k+ak mod n __.在转移过程后,如果每间房间仍然都只有一位客人,输出YES.相对的,如果出现空房即出现房间有多位客人,输出NO原创 2020-05-11 22:54:52 · 181 阅读 · 0 评论 -
Codeforces #639(div2) [B. Card Constructions]
Codeforces #639(div2) [B. Card Constructions]题意你有n张扑克牌 你需要用这n张扑克牌不断搭出如下图的__最高__扑克金字塔,直到搭不出扑克金字塔。现在需要你求出这n张扑克牌按此规则可以搭出的扑克金字塔的个数输入输入一个t(1<=t<=1000),代表t组数据每组数据有一个n(1<=n<=1e9),代表该次你拥...原创 2020-05-07 12:05:35 · 332 阅读 · 0 评论