poj 1825 Ants 水题】的更多相关文章

Ants Time Limit: 1000MS   Memory Limit: 30000K Total Submissions: 10722   Accepted: 4752 Description An army of ants walk on a horizontal pole of length l cm, each with a constant speed of 1 cm/s. When a walking ant reaches an end of the pole, it imm…
以下是poj百道水题,新手可以考虑从这里刷起 搜索1002 Fire Net1004 Anagrams by Stack1005 Jugs1008 Gnome Tetravex1091 Knight Moves1101 Gamblers1204 Additive equations 1221 Risk1230 Legendary Pokemon1249 Pushing Boxes 1364 Machine Schedule1368 BOAT1406 Jungle Roads1411 Annive…
题意:找到一段数字里最大值和最小值的差 水题 #include<cstdio> #include<iostream> #include<algorithm> #include<cstring> #include<cmath> #include<queue> using namespace std; ; const int INF=0x3f3f3f3f; int n,m,t; ; ],dpMIN[MAXN][]; int mm[MAXN…
一.Description As part of an arithmetic competency program, your students will be given randomly generated lists of from 2 to 15 unique positive integers and asked to determine how many items in each list are twice some other item in the same list. Yo…
Going Home Time Limit: 1000MS   Memory Limit: 65536K Total Submissions: 15944   Accepted: 8167 Description On a grid map there are n little men and n houses. In each unit time, every little man can move one unit step, either horizontally, or vertical…
题目 http://poj.org/problem?id=1837 题意 单组数据,有一根杠杆,有R个钩子,其位置hi为整数且属于[-15,15],有C个重物,其质量wi为整数且属于[1,25],重物与重物之间,钩子与钩子之间彼此不同.忽略杠杆及重心的影响,有多少种方式使得全部重物都挂上钩子(某些钩子可能挂若干个重物)后杠杆平衡? 思路 由于状态比较小,即使n的五次方也足以承受,而且任意时刻杠杆的状态在[-15 * 25 * 20, 15 * 25 * 20]之间,所以可以直接穷举状态. 感想…
大概题意就是求\(1 \le i,j \le n\)的\(gcd(i,j) = 1\)的个数+2(对于0的特判) 正解应该是欧拉函数或者高逼格的莫比乌斯反演 但数据实在太水直接打表算了 /*H E A D*/ bool GCD[1002][1002]; inline int gcd(int a,int b){return b?gcd(b,a%b):a;} int main(){ rep(i,1,1000) rep(j,1,1000) GCD[i][j]=bool(gcd(i,j)==1); in…
题目链接 卡了一下精度和内存. #include <cstdio> #include <cstring> #include <string> #include <cmath> #include <iostream> #include <algorithm> using namespace std; #define eps 1e-8 #define N 1000001 #define LL __int64 ] = {-,,,-,,,-,…
题意: 找出这些串中最长的公共子串(长度≥3),如果长度相同输出字典序最小的那个. 分析: 用库函数strstr直接查找就好了,用KMP反而是杀鸡用牛刀. #include <cstdio> #include <cstring> ][], sub[]; ], l; int cmp(int p1, int p2) { ; i < l; ++i) ][p1 + l] > a[][p2 + l]) return p2; return p1; } int main(void)…
[题意简述]:给出我们钉子个数与半径,让我们求出缠绕在钉子上的绳子有多长. [分析]:从题目中我们能够看出,绳子长度的和等于每两个钉子的距离的和加上接触在钉子上的绳子的长度,不难发现这部分长度事实上就等于钉子的周长. 见代码: #include<iostream> #include<cmath> using namespace std; #define Pi 3.1415//这个精度要尽量高! 也能够用4.0*atan(1.0) double s(double x1,double…