随笔分类 - Codeforcres
摘要:A. Magical Sticks 思路: 尽可能的凑成长度为$n$的木棍,答案为$(n+1)/2$ #include<iostream> #include<algorithm> using namespace std; int main() { int t; cin>>t; while(t--){
阅读全文
摘要:链接:https://codeforces.com/contest/1359 A. Berland Poker 题意: 现在有$n$张牌,$m$张王,共有$k$个人,每个人分得$\frac{k}{n}$张牌,你的得分是你手中王牌的个数减去其余人中拥有最多王牌的个数,求最大得分 思路: 分类讨论一下即
阅读全文
摘要:A. Ichihime and Triangle 题意: 已知$ a ≤ x ≤ b ,b ≤ y ≤ c , c ≤ z ≤ d $,让你确定 $x , y , z$ 使其构成三角形的三条边 思路: 直接令三条边长为$ b , c , d $即可 #include<bits/stdc++.h> t
阅读全文
摘要:A. Filling Diamonds 题意:问 $n$个菱形方块拼成所示的钻石的方案 思路:很明显的是每个图形中有$n$个站着的菱形,选择其中一个其他都会变成躺着的,因此答案为$ n $ #include<iostream> #include<cstdio> using namespace std
阅读全文
摘要:目录: 31.1025D. Recovering BST(区间DP) 32.1187E. Tree Painting(换根DP) 33.23B. Party(思维) 34.1062B.Math(唯一分解性定理) 35.340D. Bubble Sort Graph(DP) 36.922C. Cave
阅读全文
摘要:目录: 1.CodeCraft-20 (Div. 2) 3.4 2.Codeforces Round #626 (Div2) 3.7 3.2020 SWJTU-ICPC Training Round #1(13年浙江省赛) 3.8 4. Educational Codeforces Round 83
阅读全文
摘要:目录: 16.91B.Queue(树状数组/线段树) 17.431C.K-Tree(树形DP+容斥) 18.1084D. The Fair Nut and the Best Path(树形DP) 19.1187C. Vasya And Array(构造) 20.768B. Code For 1(分治
阅读全文
摘要:A. Add Odd or Subtract Even 思路: 相同直接为0,如果两数相差为偶数就为2,奇数就为1 #include<iostream> #include<algorithm> using namespace std; int main(){ int kk; scanf("%d",&
阅读全文
摘要:A. Cow and Haybales 思路: 在任何时候,最理想的做法是将最近的一堆草垛从桩1移到左侧。 因此,每天,我们都可以从左到右遍历一堆桩,并将我们看到的第一个草垛移近。 如果某个时候所有干草捆都堆放在第1堆中,我们可以早点停下来 #include<cstdio> #include<cst
阅读全文
摘要:A. Two Rabbits 思路: 很明显,如果(y-x)%(a+b)==0的话ans=(y-x)/(a+b),否则就为-1 #include<iostream> #include<algorithm> using namespace std; const int maxn = 100000+5;
阅读全文
摘要:A. Three Strings #include<iostream> #include<algorithm> using namespace std; int main(){ int t; scanf("%d",&t); while(t--){ string a,b,c; cin>>a>>b>>c
阅读全文
摘要:A. Array with Odd Sum 题意: 给一个数组,你可以无限次将某个位置上的数变成一个其他位置上的数,问是否可以通过操作使该数组的和变成奇数 思路: 如果数组的和原本就为奇数,直接输出YES。否则,如果我们有最少一个奇数与一个偶数的时候也可以 #include<iostream> #i
阅读全文
摘要:A. Even But Not Even 题意: 定义一个数所有位置的和为偶数它本身不为偶数的数为ebne,现在给你一个数字字符串,你可以删除任意位置上的数字使其变为ebne输出任意改变后的结果,如果不能则输出-1 思路: 比赛的时候分类讨论过的。。。真是愚蠢至极妈的 其实只要看字符串中奇数的个数就
阅读全文
摘要:A. Display The Number 题意: 告诉你摆出每个数字需要的火柴数,现在给你n跟火柴问能摆出的最大数字是多少 思路: ①当n为奇数:7111.. ②当n为偶数:1111.. #include<iostream> #include<algorithm> #include<cstring
阅读全文
摘要:题意: 给你四个数a,b,c,d,n.问你是否能将n拆成三个数A,B,C,使得A+a=B+b=C+c。 思路: 先计算三个数的差值的绝对值abs,如果abs大于n则肯定不行,如果小于n,还需判断(n-abs)%3是否为0,不为0则不行。 #include<iostream> #include<alg
阅读全文

浙公网安备 33010602011771号