![](https://img-blog.csdnimg.cn/20201014180756930.png?x-oss-process=image/resize,m_fixed,h_64,w_64)
水题
文章平均质量分 71
zhengnanlee
这个作者很懒,什么都没留下…
展开
-
poj3122
初级题目就是水啊。。这个水二分~ #include #include #include using namespace std; #define eps 1e-6 #define pi acos(-1.0) int main() { int t; cin >> t; while (t--) {原创 2013-10-04 17:39:23 · 1023 阅读 · 0 评论 -
LA4356
la上不去了,给杭电的链接: http://acm.hdu.edu.cn/showproblem.php?pid=2469 要去上课了,题解先不写了- - #include #include #include #include #include using namespace std; #define pi acos(-1.0) typedef struct point原创 2013-05-15 09:07:03 · 1079 阅读 · 0 评论 -
UVa10391
http://uva.onlinejudge.org/index.php?option=com_onlinejudge&Itemid=8&page=show_problem&category=15&problem=1332&mosmsg=Submission+received+with+ID+11760306 思路很简单,写博客目的是记住find、substr的用法 #include #i原创 2013-05-14 19:40:03 · 826 阅读 · 0 评论 -
UVa11300
中位数思想,证明详见: http://blog.csdn.net/zhengnanlee/article/details/8915098 注意是对谁排序,要搞清楚金钱的来源和去向- - #include #include #include using namespace std; #define mytype long long int mytype b[100001原创 2013-05-11 20:33:08 · 978 阅读 · 0 评论 -
校赛C题题解
http://acm.sdut.edu.cn/sdutoj/problem.php?action=showproblem&problemid=2617 思想是向中位数移动。详见代码,下面是证明(即为何向中位数移动总和最少) 抽象,并普遍化: 证明,一条直线,以中点为圆心和以非中点为圆心,旋转,求各点旋转路径之和。 法一:在直角坐标系下, 对于任意一点,其移动距原创 2013-05-11 19:11:42 · 2399 阅读 · 0 评论 -
UVa11292
好久没有写博客和结题报告等等了,数据结构基本弄完了,但知识点还需要题目来巩固。 以后按照训练指南的顺序开始做题。 http://uva.onlinejudge.org/index.php?option=com_onlinejudge&Itemid=8&page=show_problem&problem=2267 思想很简单,按照直径和战士能力由小到大排序,然后从第一只头开始遍历,原创 2013-05-06 17:24:53 · 1163 阅读 · 3 评论 -
poj2454
我不会告诉你我对我自己的想法笑了一下午的。。 #include #include #include #include using namespace std; typedef struct select { int id; int num; }sel; bool comp(sel a, sel b) { re原创 2013-10-10 17:44:57 · 1528 阅读 · 0 评论 -
poj2265
斜坐标系,注意找规律。说明在代码里。 #include #include using namespace std; #define eps 1e-6 #define zero(x) (((x)>0?(x):-(x)) int direct[6][2] = { { 0, 1 }, { -1, 1 }, { -1, 0 }, { 0, -1原创 2013-10-12 17:14:27 · 1286 阅读 · 0 评论 -
poj2388
为什么这能出现在训练计划里面而不是水题里面! 据说水题能赚访问量? #include #include #include using namespace std; int main() { int n; while (cin >> n) { vectorint>v; for (int原创 2013-11-24 00:47:22 · 1099 阅读 · 0 评论 -
poj2965
放到枚举里面了,拿位运算做比较方便。 #include using namespace std; #define ROW 4 int main() { bool HANDLES[ROW][ROW] = {false}; char handle; for(int i = 0; i < ROW; ++i) { for(int j = 0; j原创 2014-01-17 09:18:50 · 1051 阅读 · 0 评论 -
poj3292
打一下表,预处理一下,没有什么难度了。 #include "iostream" using namespace std; #define MAXN 1000005 int h[MAXN]; void hnumbers() { memset(h, 0, sizeof(h)); for (int i = 5; i <= 1000001; i += 4) {原创 2014-01-17 21:02:57 · 1443 阅读 · 0 评论 -
省赛1B题
http://acm.sdut.edu.cn/sdutoj/problem.php?action=showproblem&problemid=2159 set是集合,查找lower_bound,复杂度log2(N)+1 http://www.cplusplus.com/reference/algorithm/lower_bound/ 不必开数组,也开不开。 #include #i原创 2013-05-18 19:14:34 · 1086 阅读 · 1 评论 -
SDUTOJ 1500
看义杰MLE,然后就写了个,transform。。省事很多了 http://acm.sdut.edu.cn/sdutoj/problem.php?action=showproblem&problemid=1500 #include #include #include #include #include using namespace std; int main() {原创 2013-05-22 21:07:07 · 1657 阅读 · 2 评论 -
UVa11136
搞不懂Submission Error是什么类型的错误。。。 http://uva.onlinejudge.org/index.php?option=com_onlinejudge&Itemid=8&page=show_problem&problem=2077 #include #include #include using namespace std; int main原创 2013-05-24 12:02:08 · 1904 阅读 · 0 评论 -
poj1068
#include #include using namespace std; int a[101]; int main() { int n,m,bf,x,t; cin>>t; while(t--) { cin>>n; bf=0; memset(a,0,sizeof(a)); while(n--)原创 2013-08-05 20:27:08 · 86 阅读 · 0 评论 -
poj3295
本题虽然简单,但是利用了编译原理里面的自顶向下方法来设计语法树,递归求解。 例如:对于逻辑表达式A&B|C,得到以下输出 A B C A&B|C 0 0 0 0 0 0 1 1 0 1 0 0 0 1 1 1 1 0 0 0 1 0 1 1 1 1 0 1 1 1 1 1 逻辑表达式支持:常量(只有0原创 2013-08-05 15:28:31 · 1742 阅读 · 0 评论 -
poj1753
复杂度不高 #include #include #include using namespace std; int array[5][5],t[5][5]; int bit[5]; void Getbit(int i) { int t=4; while(i!=0) { bit[t]=i%2; i=i/2; t--;原创 2013-08-05 10:02:30 · 1027 阅读 · 0 评论 -
poj2993 poj2669
扯淡题。 2993 #include #include #include #include using namespace std; char map[10][10]; int main() { string waste1, s1, s2,waste2; cin>>waste1; bool fla=true; if (waste1 == "White:") { ci原创 2013-07-30 15:18:52 · 1276 阅读 · 0 评论 -
poj2586
这哪是贪心啊。。 直接上代码 #include int main() { int s, d, re; while(scanf("%d%d",&s, &d)!=EOF) { if(4*s-d<0) re=10*s-2*d; else if(3*s-2*d<0) re原创 2013-07-29 15:01:25 · 1208 阅读 · 0 评论 -
poj1328
贪心。 一开始的思路: 图中ABCD为海岛的位置。假设本题半径为2(符合坐标系),那么A点坐标为(1,1)以此类推。 在题中,记录每个点的坐标,并把一个点新加一个标记变量以标记是否被访问过。 首先以A为圆心,r为半径做圆,交x轴与E1(右)点,做出如图中绿色虚线圆。然后以E1为圆心,半径为r做圆。看此时下一点(B)是否在该圆中。如果在,那么将该点标记变量变为true,再判下一点(C原创 2013-07-29 11:15:41 · 15357 阅读 · 16 评论 -
训练计划,水题
http://poj.org/problem?id=2017 #include using namespace std; int main() { ios::sync_with_stdio(false); int n; while(cin>>n && n != -1) { int s, t; int sum = 0;原创 2013-06-17 16:55:23 · 1058 阅读 · 1 评论 -
HDU2529
仅以此文怀念高中时代,还有那次高考。 http://acm.hdu.edu.cn/showproblem.php?pid=2529 设出手速度与水平方向夹角为theta,由水平方向和垂直方向速度分解得(H为最大高度): 消去t,得: 三角代换得: 故形成tan(theta)的一元二次方程: 故最大值: 所以不难写出代码。晚上再码,该原创 2013-06-01 09:28:22 · 1432 阅读 · 0 评论 -
SDUT网络赛
只写三个题,一个是飞行棋(期望DP),super prime(引申连续数字和等于一个数的问题)和Dota人王之战 一,飞行棋: http://acm.sdut.edu.cn/sdutoj/problem.php?action=showproblem&problemid=2503 思想如下: 首先明白什么叫数学期望。http://en.wikipedia.org/wiki/Mathema原创 2013-05-26 23:06:26 · 1326 阅读 · 0 评论 -
省赛2D题
http://acm.sdut.edu.cn/sdutoj/problem.php?action=showproblem&problemid=2167 因为所有客户资料是与账户名挂钩的,所以以一个map做映射,做账户名和一个结构体的映射,结构体是cipher(string)和balance(int)。 #include #include #include #include u原创 2013-05-25 21:10:15 · 860 阅读 · 0 评论 -
Recent Contest #1(Mar 18-Mar24, 2014)
http://acm.hust.edu.cn/vjudge/contest/view.action?cid=42423#overview A水题不述 B题是重点 公式不难想: 直接算肯定坑爹,有三种优化方法: 1、巧妙地乘法: double calc(int n, double p) { double ans = n * p; double temp =原创 2014-03-25 21:11:27 · 1366 阅读 · 0 评论