题目链接:https://vjudge.net/contest/28079#problem/M 题目大意: 一个边界长为L宽为W的平面同时发射n个台球,运动K秒,台球碰到桌面及两(多)个台球相撞情况如下图所示,求K秒后这n个球的位置(要排序,依次按横纵坐标升序): 解题思路:其实跟以前的经典题蚂蚁爬木棍是一样的,总结为以下几点: ①两(多)球相撞的情况可以忽略,因为两球撞击后可以看作两个球按原来的方向运动只是序号换了一下而已,多球同理. ③碰壁时反向 ②可以把横纵坐标分开计算,这样就很明了了,可…
链接: https://vjudge.net/problem/LightOJ-1323 题意: You are given a rectangular billiard board, L and W be the length and width of the board respectively. Unlike other billiard boards it doesn't have any pockets. So, the balls move freely in the board. A…
1.LightOJ 1245   Harmonic Number (II)   数学题 2.总结:看了题解,很严谨,但又确实恶心的题 题意:求n/1+n/2+....+n/n,n<=2^31. #include<iostream> #include<cstring> #include<cmath> #include<queue> #include<algorithm> #include<cstdio> #define max(a…
题目链接:https://vjudge.net/contest/28079#problem/P 题目大意:给你数组A[]以及如下所示的函数f: long long f( int A[], int n ) { // n = size of A long long sum = 0; for( int i = 0; i < n; i++ ) for( int j = i + 1; j < n; j++ ) sum += A[i] - A[j]; return sum; } 有两个操作:0  x  v…
题目链接:https://vjudge.net/contest/28079#problem/Q 题目大意:题目描述很长很吓人,大概的意思就是有n个坐标代表n个人的位置,每个人听力都是一样的,每人发出一枪,然后每个人给出一个数字表示听到的枪响次数,汇总为结果,结果有很多种(因为不知道人的听力极限范围),问有几种一致的结果(每个人的答案都是不矛盾的). 解题思路:就是判断一下人和人之间的距离有多少种+1,直接计算所有人之间距离排序去重+1就好了. 代码: #include<iostream> #i…
题目链接:http://lightoj.com/volume_showproblem.php?problem=1245 题意就是求 n/i (1<=i<=n) 的取整的和这就是到找规律的题, i     1  2   3   4   5   6   7    8 a    8  4   2   2   1   1   1    1 你可以多写几组你会发现 有8-4个1:4-2个2:...其他例子也是这样: 当n = 10时 n/1 = 10, n/2 = 5说明(5, 10]这个前开后闭的区间…
http://lightoj.com/volume_showproblem.php?problem=1336 Sigma Function Time Limit:2000MS     Memory Limit:32768KB     64bit IO Format:%lld & %llu Submit Status Practice LightOJ 1336 Description Sigma function is an interesting function in Number Theor…
Couple doubi 题目链接: http://acm.hust.edu.cn/vjudge/contest/121334#problem/D Description DouBiXp has a girlfriend named DouBiNan.One day they felt very boring and decided to play some games. The rule of this game is as following. There are k balls on th…
Couple doubi Time Limit:1000MS     Memory Limit:32768KB     64bit IO Format:%I64d & %I64u Submit Status Practice HDU 4861 Description DouBiXp has a girlfriend named DouBiNan.One day they felt very boring and decided to play some games. The rule of th…
题意: 一根长度为len的木棍上有n仅仅蚂蚁.蚂蚁们都以1cm/s的速度爬行;假设一仅仅蚂蚁爬到了木棍的端点,那么他就会掉下去;假设两仅仅蚂蚁碰到一起了,他们就会掉头往相反方向爬行.输入len和n仅仅蚂蚁的初始位置(以左端点为原点).问:全部蚂蚁都掉下木棍的最短时间和最长时间(蚂蚁初始爬行方向是不定的). 思路: 最短时间是非常显然的,仅仅要靠近左端点的蚂蚁都往左端点爬,靠近右端点的蚂蚁都往右端点爬,时间就能最短;最短时间是全部蚂蚁离他较近端点距离的最大值. 对于最长时间我实在是没想到.后面看例…