A. DZY Loves Physics time limit per test 1 second memory limit per test 256 megabytes input standard input output standard output DZY loves Physics, and he enjoys calculating density. Almost everything has density, even a graph. We define the density…
题目链接:Codeforces 444A DZY Loves Physics 题目大意:给出一张图,图中的每一个节点,每条边都有一个权值.如今有从中挑出一张子图,要求子图联通,而且被选中的随意两点.假设存在边,则一定要被选中.问说点的权值和/边的权值和最大是多少. 解题思路:是图论中的一个结论,最多两个节点.所以枚举两条边就能够了.我简单的推了一下,2个点的情况肯定比3个点的优. 如果有3个点a,b,c,权值分别为A,B.C 现a-b,b-c边的权值分别为u.v 那么对于两点的情况有A+Bu,B…
题目链接: 传送门 DZY Loves Chemistry time limit per test1 second     memory limit per test256 megabytes Description DZY loves Physics, and he enjoys calculating density. Almost everything has density, even a graph. We define the density of a non-directed gr…
目录 @description@ @solution@ @accepted code@ @details@ @description@ 给定一个 n 点 m 边的图,边有边权,点有点权. 找到一个连通的诱导子图(选中的点之间的边必须选,选中的边的端点必须选),使得这个子图的密度最大. 密度的定义为:如果边权和为 0,则密度 = 0:否则密度 = 点权和 / 边权和. Input 第一行两个空格隔开的整数 n (1 ≤ n ≤ 500), m (1 ≤ m ≤ n*(n-1)/2). 第二行 n…
A. DZY Loves Physics time limit per test 1 second memory limit per test 256 megabytes input standard input output standard output DZY loves Physics, and he enjoys calculating density. Almost everything has density, even a graph. We define the density…
A. DZY Loves Physics 题目连接: http://codeforces.com/contest/444/problem/A Description DZY loves Physics, and he enjoys calculating density. Almost everything has density, even a graph. We define the density of a non-directed graph (nodes and edges of th…
转载请注明出处:http://blog.csdn.net/u012860063/article/details/37509207 题目链接:http://codeforces.com/contest/445/problem/C ----------------------------------------------------------------------------------------------------------------------------------------…
题目链接: 传送门 DZY Loves Chemistry time limit per test:1 second     memory limit per test:256 megabytes Description DZY loves chemistry, and he enjoys mixing chemicals. DZY has n chemicals, and m pairs of them will react. He wants to pour these chemicals…
B. DZY Loves FFT time limit per test 1 second memory limit per test 256 megabytes input standard input output standard output DZY loves Fast Fourier Transformation, and he enjoys using it. Fast Fourier Transformation is an algorithm used to calculate…
DZY loves colors, and he enjoys painting. On a colorful day, DZY gets a colorful ribbon, which consists of n units (they are numbered from 1 to n from left to right). The color of thei-th unit of the ribbon is i at first. It is colorful enough, but w…
A. DZY Loves Hash time limit per test 1 second memory limit per test 256 megabytes input standard input output standard output DZY has a hash table with p buckets, numbered from 0 to p - 1. He wants to insert n numbers, in the order they are given, i…
A. DZY Loves Chessboard time limit per test 1 second memory limit per test 256 megabytes input standard input output standard output DZY loves chessboard, and he enjoys playing with it. He has a chessboard of n rows and m columns. Some cells of the c…
转载请注明出处:http://blog.csdn.net/u012860063? viewmode=contents 题目链接:http://codeforces.com/problemset/problem/445/A DZY loves chessboard, and he enjoys playing with it. He has a chessboard of n rows and m columns. Some cells of the chessboard are bad, oth…
B. DZY Loves Chemistry time limit per test 1 second memory limit per test 256 megabytes input standard input output standard output DZY loves chemistry, and he enjoys mixing chemicals. DZY has n chemicals, and m pairs of them will react. He wants to…
A. DZY Loves Hash time limit per test 1 second memory limit per test 256 megabytes input standard input output standard output DZY has a hash table with p buckets, numbered from 0 to p - 1. He wants to insert n numbers, in the order they are given, i…
B. DZY Loves Strings time limit per test 1 second memory limit per test 256 megabytes input standard input output standard output DZY loves collecting special strings which only contain lowercase letters. For each lowercase letter c DZY knows its val…
[链接] 我是链接,点我呀:) [题意] 题意 [题解] 两个点的子图他们的"密度"是比所有联通生成子图都要大的 "只要胆子大,遇到什么问题都不怕!" [代码] #include <bits/stdc++.h> #define rep1(i,a,b) for (int i = a;i <= b;i++) #define rep2(i,a,b) for (int i = a;i>= b;i--) #define ll long long usi…
以下部分来自:http://www.cnblogs.com/zhuohan123/p/3726306.html 此证明有误. DZY系列. 这题首先是几个性质: 1.所有球质量相同,碰撞直接交换速度,而球又没有编号,那么就可以直接视作两个球没有碰撞. 2.所有的方向.初始位置都没有任何用处. 然后就是速度的问题了,根据题设 a⋅v=C   与这几个方程联立   a⋅v=C s=v·t; vt2=v02+2·a·s   解这个方程组,可以得到 vt=√(2·C·t+v02) 决定了,我们只需要找到…
考虑两个质量均为m,速度分别v1.v2的小球发生完全弹性碰撞的影响: 由动能守恒得: $\frac{1}{2}mv_1^2+\frac{1}{2}mv_2^2=\frac{1}{2}mv_1'^2+\frac{1}{2}mv_2'^2$$v_1^2+v_2^2=v_1'^2+v_2'^2$ 由动量守恒得: $mv_1+mv_2=mv_1'+mv_2'$$v_1+v_2=v_1'+v_2'$$v_1^2+v_2^2+2v_1v_2=v_1'^2+v_2'^2+2v_1'v_2'$ 所以 $v_1v…
题目传送门 话说这道题不分析样例实在是太亏了...结论题啊... 但是话说回来不知道它是结论题的时候会不会想到猜结论呢...毕竟样例一.二都有些特殊. 观察样例发现选中的子图都只有一条边. 于是猜只有一条边的时候解最优. 飞快地写个暴力,然后和结论对拍,然后假装这个结论是对的,然后就$AC$了(大雾 还是证明一下这个结论吧: 用反证法. 设这样三个点的点权分别为$A$,$B$,$C$,两条边的边权为$n$,$m$ 假设子图中有$A,B,C$三个点比只有两个点更优. 也就是三个点都选的答案比只选$…
DZY Loves Physics time limit per test 1 second memory limit per test 256 megabytes input standard input output standard output DZY loves Physics, and he enjoys calculating density. Almost everything has density, even a graph. We define the density of…
DZY Loves Chemistry time limit per test 1 second memory limit per test 256 megabytes input standard input output standard output DZY loves chemistry, and he enjoys mixing chemicals. DZY has n chemicals, and m pairs of them will react. He wants to pou…
C. DZY Loves Fibonacci Numbers time limit per test 4 seconds memory limit per test 256 megabytes input standard input output standard output In mathematical terms, the sequence Fn of Fibonacci numbers is defined by the recurrence relation F1 = 1; F2 …
DZY Loves Balls Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 65536/65536 K (Java/Others) Total Submission(s): 807    Accepted Submission(s): 439 Problem Description There are n black balls and m white balls in the big box. Now, DZY starts…
Portal Description 给出一个\(n(n\leq3\times10^5)\)个数的序列,进行\(m(m\leq3\times10^5)\)次操作,操作有两种: 给区间\([L,R]\)加上一个斐波那契数列,即\(\{a_L,a_{L+1},...,a_R\} \rightarrow \{a_L+F_1,a_{L+1}+F_2,...,a_R+F_{R-L+1}\}\) 询问区间\([L,R]\)的和,对\(10^9+9\)取模. 斐波那契数列:\(F_1=1,F_2=2\)且满足…
//yy:那天考完概率论,上网无聊搜个期望可加性就搜到这题,看到以后特别有亲和感,挺有意思的. hdu5194 DZY Loves Balls [概率论 or 搜索] 题意: 一个盒子里有n个黑球和m个白球[n,m≤12].每次随机从盒子里取走一个球,取了n+m次后,刚好取完.现在用一种方法生成了一个随机的01串S[1…(n+m)],如果第i次取出的球是黑色的,那么S[i]=1,如果是白色的,那么S[i]=0.求'01'在S串中出现的期望次数. 题解: 求出在第i个位置上出现0,第i+1个位置上…
题目:DZY Loves Fibonacci Numbers 题意比較简单,不解释了. 尽管官方的题解也是用线段树,但还利用了二次剩余. 可是我没有想到二次剩余,然后写了个感觉非常复杂度的线段树,还是mark一下吧. 我是这样考虑这个问题的,首先准备三个数组F,G,K,功能后面解释. 然后对它们有这样一个计算: F[0] = G[0] = 0; F[1] = 1; G[1] = 0; K[0] = 1; K[1] = 0; for(int i=2; i<N; i++){ F[i] = (F[i-…
C. DZY Loves Colors time limit per test 2 seconds memory limit per test 256 megabytes input standard input output standard output DZY loves colors, and he enjoys painting. On a colorful day, DZY gets a colorful ribbon, which consists of n units (they…
题目 Source http://codeforces.com/problemset/problem/444/C Description DZY loves colors, and he enjoys painting. On a colorful day, DZY gets a colorful ribbon, which consists of n units (they are numbered from 1 to n from left to right). The color of t…
A. DZY Loves Chessboard time limit per test 1 second memory limit per test 256 megabytes input standard input output standard output DZY loves chessboard, and he enjoys playing with it. He has a chessboard of n rows and m columns. Some cells of the c…