- 博客(12)
- 收藏
- 关注
原创 一个很奇怪的bug
#include<stdio.h>int main(){ return 0;}代码就是最简单的那种,但是一直报错:有没有了解的大佬教一下
2022-04-03 15:27:35 228
原创 次短路草稿
草稿草稿原题链接#include<iostream>#include<cstdio>#include<cstring>#include<algorithm>#include<queue>#include<vector>#include<cmath>using namespace std;struct edge { int v, w;};struct node { int u, d; bool
2021-07-18 18:19:19 104
原创 Codeforces Round #721 (Div. 2)
A题传送门从这次开始不放原题了。题目大意:寻找一个最大的数字t<=x,使给定的x做x&(x-1)&…&t=0解题思路:思考&运算的特点,这位上有一个0,那么结果相应的位上就是0,那么思考一下最难变成0的位是哪个,很明显,一定是最高位的1,那么我们要把它变成0,并且还需要最大值,那么最后的答案一定形如01111…111这样的数字,也就是我们只需要把原数字x的位数求出来,最后的答案就是2^(cnt-1) - 1.代码如下:#include<iostrea
2021-05-21 11:24:09 123
原创 n段码
n段码 【问题描述】 小K要用n段数码管来表示一种特殊的符号(n取1,2,3,4,5,6,7),n段数码管就对应着有n个发光二极管。上图给出了n段码数码管的一个图示,数码管中一共有n 段可以发光的二极管以7段码为例,上图二极管分别标记为0,1,2,3,4,5,6。小K要选择一部分二极管(至少要有一个)发光来表达符号。在设计字符的表达时,要求所有发光的二极管是连成一片的,发光记为1,不发光记为0. 例如:1 发光,其他二极管不发光可以用来表达一种符号(0 1 0 0 0 0 0)。 例如:2 发光,其他二
2021-04-22 15:34:33 552
原创 Codeforces Round #710 (Div. 3)
下次不熟悉的东西不要用1506A - Strange TablePolycarp found a rectangular table consisting of n rows and m columns. He noticed that each cell of the table has its number, obtained by the following algorithm “by columns”:cells are numbered starting from one;cells ar
2021-03-26 10:42:01 354 2
原创 Codeforces Round #708 (Div. 2)
A题传送门A. MeximizationYou are given an integer n and an array a1,a2,…,an. You should reorder the elements of the array a in such way that the sum of MEX on prefixes (i-th prefix is a1,a2,…,ai) is maximized.Formally, you should find an array b1,b2,…,bn, su
2021-03-18 12:06:46 385
原创 Educational Codeforces Round 105 (Rated for Div. 2)
AA. ABC StringYou are given a string a, consisting of n characters, n is even. For each i from 1 to n ai is one of ‘A’, ‘B’ or ‘C’.A bracket sequence is a string containing only characters “(” and “)”. A regular bracket sequence is a bracket sequence th
2021-03-03 19:52:09 230 1
原创 Codeforces Round #704 (Div. 2)
继续上次的cf坑AA. Three swimmersThree swimmers decided to organize a party in the swimming pool! At noon, they started to swim from the left side of the pool.It takes the first swimmer exactly a minutes to swim across the entire pool and come back, exactly b
2021-02-24 15:20:22 255
原创 Codeforces Round #703 (Div. 2)
继续上次开的坑A题传送门You have n stacks of blocks. The i-th stack contains hi blocks and it’s height is the number of blocks in it. In one move you can take a block from the i-th stack (if there is at least one block) and put it to the i+1-th stack. Can you make t
2021-02-20 12:36:45 275
原创 Codeforces Round #702 (Div. 3)
开坑,为了防止继续当鸽子,决定把每次cf比赛的题解都发上来,不管是自己做出来的也好,还是看完别人代码做出来的也好,还是对着代码一行行看出来的也好,总之都要写题解,写题解的目的并不是为了应付,而是为了让自己对这些题目的理解更深入。如果是暴力的题目,就会加快自己写代码的速度。如果是算法的题目,就会帮助自己复习算法。如果是思维题,就会锻炼自己的思维方式。好了,废话少叙:开始今天的cf旅程A题传送门第一题A. Dense ArrayPolycarp calls an array dense if t
2021-02-18 00:08:26 385 2
原创 二分模板
本博客干货满满,请放心食用。整数二分模板:当check(mid)返回真时,mid属于左边的情况: `int bsearch_1(int l, int r){ while (l < r) { int mid = l + r >> 1; if (check(mid)) r = mid; else l = mid + 1; } return l;}当check(mid)返回真时,mid属于右边的情
2021-02-15 13:01:29 96
原创 第一篇博客
二分在除夕和春节刷题的我,,????,终于是搞懂了一点点二分的东西,也是今天才知道自己是完全一点都不会二分。先放题目链接:https://vjudge.net/contest/422493#problem/B题目大意:已知有n个元素的数组,求,每对元素的差(全部取绝对值)的中位数。看到这个题目,正常人首先应该会想到,这题和二分有关系?难道这个不是把差值的数组求出来,然后sort排个序就好了的事情?然后回头看了看数据范3 ≤ N ≤ 1,00,000,N最大是1e5,也就是如果要两两算差值,计算的次数
2021-02-13 00:06:39 2501 6
空空如也
空空如也
TA创建的收藏夹 TA关注的收藏夹
TA关注的人