HDU5514 Frogs】的更多相关文章

/* HDU5514 Frogs http://acm.hdu.edu.cn/showproblem.php?pid=5514 容斥原理 * * */ #include <cstdio> #include <cmath> #include <algorithm> //#define test using namespace std; const long long Nmax=1e5; long long n,m,a[Nmax]; long long book[Nmax]…
The greatest common divisor GCD(a,b) of two positive integers a and b,sometimes written (a,b),is the largest divisor common to a and b,For example,(1,2)=1,(12,18)=6.  (a,b) can be easily found by the Euclidean algorithm. Now Carp is considering a lit…
题意是给出n个m的约数,问[0,m-1]中至少被其中一个约数整除的整数和.(n<=10000,m<=1000000000) 直接容斥的话,是2^n再拖个log的复杂度,加上当前的数大于m时直接跳出了剪枝,或许会小一点. 但是有一个很重要的性质:我们容斥中所有计算过贡献的数,都是m的因数.换言之,我们计算贡献的数的个数是及其有限的,故可以计算出所有因数贡献的系数. 我们给所有因数赋予互不重叠的“贡献”,定义为所有能被其整除但不能被其他大于它的因数整除的数的和.这种贡献是我们用来表示答案的组成的,…
题目链接: 传送门 Frogs' Neighborhood Time Limit: 5000MS     Memory Limit: 10000K Description 未名湖附近共有N个大小湖泊L1, L2, ..., Ln(其中包括未名湖),每个湖泊Li里住着一只青蛙Fi(1 ≤ i ≤ N).如果湖泊Li和Lj之间有水路相连,则青蛙Fi和Fj互称为邻居.现在已知每只青蛙的邻居数目x1, x2, ..., xn,请你给出每两个湖泊之间的相连关系. Input 第一行是测试数据的组数T(0…
F. Frogs and mosquitoes time limit per test 2 seconds memory limit per test 512 megabytes input standard input output standard output There are n frogs sitting on the coordinate axis Ox. For each frog two values xi, ti are known — the position and th…
Frogs' Neighborhood Time Limit: 5000MS   Memory Limit: 10000K Total Submissions: 7920   Accepted: 3392   Special Judge Description 未名湖附近共有N个大小湖泊L1, L2, ..., Ln(其中包括未名湖),每个湖泊Li里住着一只青蛙Fi(1 ≤ i ≤ N).如果湖泊Li和Lj之间有水路相连,则青蛙Fi和Fj互称为邻居.现在已知每只青蛙的邻居数目x1, x2, ..…
Frogs Time Limit: 20 Sec Memory Limit: 256 MB 题目连接 http://acm.hdu.edu.cn/showproblem.php?pid=5514 Description There are m stones lying on a circle, and n frogs are jumping over them.The stones are numbered from 0 to m−1 and the frogs are numbered fro…
http://poj.org/problem?id=1659 Frogs' Neighborhood Time Limit: 5000MS   Memory Limit: 10000K Total Submissions: 6050   Accepted: 2623   Special Judge Description 未名湖附近共有N个大小湖泊L1, L2, ..., Ln(其中包括未名湖),每个湖泊Li里住着一只青蛙Fi(1 ≤ i ≤ N).如果湖泊Li和Lj之间有水路相连,则青蛙Fi和…
Frogs' Neighborhood Time Limit: 5000MS   Memory Limit: 10000K Total Submissions: 6076   Accepted: 2636   Special Judge Description 未名湖附近共有N个大小湖泊L1, L2, ..., Ln(其中包括未名湖),每个湖泊Li里住着一只青蛙Fi(1 ≤i ≤ N).如果湖泊Li和Lj之间有水路相连,则青蛙Fi和Fj互称为邻居.现在已知每只青蛙的邻居数目x1,x2, ...,…
题目链接 F. Frogs and mosquitoes time limit per test 2 seconds memory limit per test 512 megabytes input standard input output standard output There are n frogs sitting on the coordinate axis Ox. For each frog two values xi, ti are known — the position a…