
--------模板题------
文章平均质量分 68
chen_zan_yu
一生所爱
展开
-
--------map-----
B - Linear Algebra Test StatementsDr. Wail is preparing for today's test in linear algebra course. The test's subject is Matrices Multiplication.Dr. Wail has n matrices, such that the size of t...原创 2018-08-30 22:05:40 · 136 阅读 · 0 评论 -
A. Packets
题目链接:http://codeforces.com/problemset/problem/1037/A其实这是幼儿园高中数论题。楼下题解已经讲的非常清楚了,最优解肯定是每次都使用 2^n2n 取到,那么可以优化代码如下:考虑ansans作为我们的答案,显然2^{ans} \leq n \leq 2^{ans + 1}2ans≤n≤2ans+1,那么答案ans = \log_2n + ...原创 2018-09-09 23:27:55 · 906 阅读 · 0 评论 -
A - 单源最大权路径
有一棵由N个结点构成的树,每一条边上都有其对应的权值。现在给定起点,求从该点出发的一条路径(至少有一条边)使得这条路径上的权值之和最大,并输出这个最大值。Input第一行一个正整数T,代表数据组数。每组数据第一行两个正整数n(2<=n<=10^5),s(1<=s<=n),分别表示树结点数目以及给定的起点,点的编号从1至N。接下来M行,每行三个整数x,y,z,(1&l...原创 2018-09-06 13:14:48 · 189 阅读 · 0 评论 -
H - Genta Game
StatementsKojima Genta is one of the best friends of Conan, and the fattest one!Everyone believes that Genta is just thinking about food. So, he wants to prove the opposite. So, his friends challe...原创 2018-09-05 13:13:10 · 200 阅读 · 0 评论 -
D - Dice Game
StatementsA dice is a small cube, with each side having a different number of spots on it, ranging from 1 to 6.Each side in the dice has 4 adjacent sides that can be reached by rotating the dice (...原创 2018-08-31 18:06:45 · 611 阅读 · 0 评论 -
E - Group work
Recent studies in Education show great pedagogical benefits of working in groups, especially in the freshman and sophomore years in high school. Different groups of various sizes are great and allow s...原创 2018-08-27 21:12:21 · 295 阅读 · 0 评论 -
尺取法
尺取法今天要分享的例题和尺取法有关。如下 题目描述:给一个长度为 n 的整型数组,要求在这个数组中找出一个最长的连续片段,满足该片段中包含不同数字的个数不超过 k 。输入格式:第一行给出两个整型数字 n 和 k ,n 和 k 均不超过 5 * 1e5,第二行给出 n 个整型数字,数字均不超过 1e6 。 有两点需要注意 要求找到的这个片段必须是连续的,中间不能断开...原创 2018-08-28 20:45:45 · 432 阅读 · 0 评论 -
F - Building Numbers
StatementsIn this problem, you can build a new number starting from 1, by performing the following operations as much as you need:Add 1 to the current number. Add the current number to itself (i....原创 2018-08-30 23:32:47 · 208 阅读 · 0 评论 -
求long long 指数的模板
H - Eyad and Math GyStatementsEyad was given a simple math problem, but since he is very bad at math he asked you to help him.Given 4 numbers, a, b, c, and d. Your task is to find whether ab is ...原创 2018-08-30 14:52:55 · 195 阅读 · 0 评论 -
B. Obtaining the String
题目链接:http://codeforces.com/problemset/problem/1015/B 题目大意: 给你两个字符串s、t,长度均为n,你每次只能将si-1与si交换位置,如果最终能将s交换成为t,则输出最小的交换次数,否则输出-1 思路:使用贪心的思想即可。 从1到n枚举t的每一位,若ti!=si,则寻找sj(j>i)于ti相同,若...原创 2018-09-10 23:29:23 · 180 阅读 · 0 评论