https://codeforces.com/contest/1328/problem/E 题目所描述的是一棵树,题中已明示1为root结点。 题目可以转化为,是否存在一条路径,满足集合中的k个点到路径的距离小于等于1? 思路: 1.首先倍增离线预处理出结点深度,便于后续在线询问LCA 2.对于每次 ...
分类:
其他好文 时间:
2020-03-29 01:40:42
阅读次数:
93
"CF1324A Yet Another Tetris Problem" 长度为n的数组a中有一组数,可以任意使其中一项+2,问能否使a中所有项的值相同。 感觉div.3的题目更多地在考简化问题的能力……比如原题目以俄罗斯方块作背景,让我想到的是能不能消除所有方块,导致代码很难写。但如果像上述一样简 ...
分类:
其他好文 时间:
2020-03-29 01:16:57
阅读次数:
71
https://codeforces.com/contest/1328/problem/F 首先把a数组处理成pair对(num,cnt),表示数字num有cnt个,然后按num升序排序离散化一下。 对于一个数x,若想使得小于x的数字都变成x,必须先把所有小于x的数变成x-1,然后再+1变成x。 同 ...
分类:
编程语言 时间:
2020-03-29 01:15:50
阅读次数:
94
Allocation 题意:n(1e5)个数,选出尽可能多的数使他们总和小于等于b。 思路:排序,尽可能取小。 1 #include<bits/stdc++.h> 2 #define LL long long 3 #define dl double 4 void rd(int &x){ 5 x=0; ...
分类:
其他好文 时间:
2020-03-28 23:32:23
阅读次数:
106
a=eval(input()) b=eval(input()) if b!=0: print("{}".format(round(a/b,2))) else: print("除零错误") ...
分类:
其他好文 时间:
2020-03-28 23:25:06
阅读次数:
63
https://codeforces.com/contest/1328/problem/E E. Tree Queries You are given a rooted tree consisting of nn vertices numbered from 11 to nn. The root o ...
分类:
其他好文 时间:
2020-03-28 22:01:47
阅读次数:
177
四舍五入的数学原理介绍:对正数a.x:如果0.x<0.5,即舍去。四舍五入结果为:a 如果0.x>=0.5,即进位。四舍五入结果为:a+1对负数,先转化为正数,四舍五入之后,转化结果再取负。调用C++自带函数round:写头文件#include<math.h>使用int round(double x ...
分类:
编程语言 时间:
2020-03-28 21:36:24
阅读次数:
84
1、创建django项目 $ django-admin startproject DailyFresh 2、进入项目目录 $ cd DailyFresh 3、启动项目 $ python manage.py runserver Watching for file changes with StatRe ...
分类:
其他好文 时间:
2020-03-28 21:35:42
阅读次数:
100
description you are given an array and you are asked to make $k$ elements of it equal after some operations. you can make one of the following operati ...
分类:
其他好文 时间:
2020-03-28 20:20:02
阅读次数:
99
CF Round 629 A.数学 给定a,b,现在问你最小让a加多少使得a能被b整除,可以为0 即算(b (a%b))%b B.数学 给定n和k 问以n 2个a和2个b组成的串中,以字典序升序排列,问第k个是几 这个有点类似康托展开,这个简化了很多 首先考虑第一个b,它处在从左往右数第p位,那么无 ...
分类:
其他好文 时间:
2020-03-28 16:09:31
阅读次数:
65