题意:输入a,b,x,y,a,b分别是两人的步数(每a块砖,刷一次),则有一些砖被两人同时刷到了,问[x,y]区间内有多少块砖同时被两人刷到. 分析:就是求[x,y]中有多少个能把a,b的最小公倍数lcm=a*b/gcd(a,b)整除的数字. 求出[x,y]区间上出现的第一个和最后一个满足条件的数字 l,r ,那么答案就是(r-l)/lcm+1. #include<cstdio> #include<cmath> int gcd(int a,int b) { ) return a;…
传送门:http://acm.hdu.edu.cn/showproblem.php?pid=6467 简单数学题 Time Limit: 4000/2000 MS (Java/Others)    Memory Limit: 65536/65536 K (Java/Others)Total Submission(s): 308    Accepted Submission(s): 150 Problem Description 已知 F(n)=∑i=1n(i×∑j=inCij) 求 F(n) m…
简单数学题 Time Limit: 4000/2000 MS (Java/Others)    Memory Limit: 65536/65536 K (Java/Others)Total Submission(s): 580    Accepted Submission(s): 257 Problem Description 已知 F(n)=∑i=1n(i×∑j=inCij) 求 F(n) mod 1000000007   Input 多组输入,每组输入占一行,包含一个整数n(1 <= n <…
Discrete Function There is a discrete function. It is specified for integer arguments from 1 to N (2 ≤ N ≤ 100000). Each value of the function is longint (signed long in C++). You have to find such two points of the function for which all points betw…
5773. [NOIP2008模拟]简单数学题 (File IO): input:math.in output:math.out Time Limits: 1000 ms  Memory Limits: 262144 KB  Detailed Limits   Goto ProblemSet Description       话说, 小X是个数学大佬,他喜欢做数学题.有一天,小X想考一考小Y.他问了小Y一道数学题.题目如下:      对于一个正整数N,存在一个正整数T(0<T<N),使得…
Description       话说, 小X是个数学大佬,他喜欢做数学题.有一天,小X想考一考小Y.他问了小Y一道数学题.题目如下:      对于一个正整数N,存在一个正整数T(0<T<N),使得…
题意:固定起点是0,给出一个序列表示n个点,所有点都在一条直线上,其中每个元素代表了从起点到这个点所走的距离.已知路过某个点不算到达这个点,则从起点出发,到达所有点的方案有许多种.求所有方案走的总路程/方案数,输出分子.分母,要求不含约数. e.g:n=3 {2,3,5},{2,3,5}{2,5,3}{3,2,5}{3,5,2}{5,2,3}{5,3,2},总路程(5+7+7+8+9+8)=44,答案44/6=22/3,输出“22 3”. 分析: 1.以n=3序列{a1,a2,a3}为例,实际上…
题目链接:http://codeforces.com/contest/460/problem/A A. Vasya and Socks time limit per test 1 second memory limit per test 256 megabytes input standard input output standard output Vasya has n pairs of socks. In the morning of each day Vasya has to put o…
geometry  Accepts: 324  Submissions: 622  Time Limit: 2000/1000 MS (Java/Others)  Memory Limit: 65536/65536 K (Java/Others) Problem Description There is a point PP at coordinate (x,y)(x,y). A line goes through the point, and intersects with the posti…
题目链接:http://codeforces.com/problemset/problem/1108/D time limit per test 1 secondmemory limit per test 256 megabytesinput standard inputoutput standard output You have a garland consisting of n lamps. Each lamp is colored red, green or blue. The colo…