
EOJ
文章平均质量分 81
rgtjf
这个作者很懒,什么都没留下…
展开
-
EOJ gauss
#include #include #include using namespace std;#define maxn 100#define fabs(x) ((x)>0?(x):-(x))#define eps 1e-10int gauss_cpivot(int n,double a[][maxn], double b[]){ int i,j,k,row; double m原创 2013-07-06 16:03:15 · 499 阅读 · 0 评论 -
EOJ 1095 Guess the Number
http://acm.cs.ecnu.edu.cn/problem.php?problemid=1095From:http://blog.sina.com.cn/s/blog_4d88e9860100b6dk.html一开始看到这道题,想都没想就用了大数来做,为了防止超时,我还用了二分,刷的时候也是二分,但是还是TLE,后来同学提示我,可以用数字的位数来判断,于是时间又减少不少转载 2013-07-24 21:23:47 · 504 阅读 · 0 评论 -
EOJ 2525 Light Switching
http://acm.cs.ecnu.edu.cn/problem.php?problemid=2525题意:给一排灯操作,0,s, e表示改变编号从s到e的灯的状态,1,s,e表示查询编号s到e的亮的盏数。线段树,查询区间,更新区间。#include #include #include #include using namespace std;#define ls(p) p原创 2013-07-25 23:14:34 · 710 阅读 · 0 评论 -
Coins 系列
3011一:dfs + 剪枝1.直接切去当前sum+以后的所有值,如果小于k的话,就不要往下走了。2.直接切去当前sum>k的值,也不要往下走了。3,数组按从大到小排序(很强的一个优化)。二:分成左半边,右半边的所有可能值,然后二分找就行了。3008 完全背包,具体见背包九讲。3009分组背包,状态压缩(状态转移应该很好推的!原创 2013-08-28 16:17:19 · 616 阅读 · 2 评论 -
EOJ 1255
#include #include #include using namespace std;const int maxn = 115;int dp[maxn][maxn];int path[maxn][maxn];char s[maxn];void dfs( int st,int t ){ if( st>t ) return ; if( st==t ){ if( s[st原创 2013-08-30 18:12:31 · 501 阅读 · 0 评论 -
EOJ 2103 小强寻宝I
http://acm.cs.ecnu.edu.cn/problem.php?problemid=2103WAT^T 不知道为什么#include #include #include using namespace std;const int maxn = 1005;int n,p;struct node{ int to; int next;}e[maxn];i原创 2013-07-11 22:36:12 · 656 阅读 · 0 评论 -
EOJ 1161 数学几何
http://acm.cs.ecnu.edu.cn/problem.php?problemid=1161 题意:很晦涩!说的是正多边形的台球,我球必须经过每条边后折射回来后还能撞到原来的边。 分析:很容易想到镜像对称。写起来不方便,看图片吧原创 2013-12-01 22:26:33 · 560 阅读 · 0 评论 -
EOJ 2141
题意说上下电梯,现在已知n个人等着做楼梯原创 2014-05-09 09:41:02 · 545 阅读 · 0 评论 -
ECNU第三届程序设计竞赛解题报告
A 找祖先 大水题,求最小公倍数 B 电梯停靠这次坑了无数人的题,被时限卡得跟什么似的。设上了x次,下了y次,上去是u层,下来时d层,最后停靠在t层,那么x+y =n t=ux-dy把1式x=n-y代入2式,得t+dn=(u+d)x,所以t原创 2014-05-12 10:05:35 · 650 阅读 · 0 评论 -
EOJ 1200 聪明的张小强 大数
http://acm.cs.ecnu.edu.cn/problem.php?problemid=1200题意:A+B大数加法#include#include#include#includeusing namespace std;//compare比较函数:相等返回0,大于返回1,小于返回-1int compare(string str1,string str2){原创 2013-06-30 11:39:38 · 987 阅读 · 0 评论 -
EOJ 2112 WYI & EOJ 2113 WYII
http://acm.cs.ecnu.edu.cn/problem.php?problemid=2112http://acm.cs.ecnu.edu.cn/problem.php?problemid=2113题意:背包问题,只不过数据范围变了。假定V为容量,ti为每个物品的重量,ki为价值,求能获得的最大价值。(一)2112 V特别大,n大,sum(k)比较小。改为原创 2013-07-05 09:19:26 · 588 阅读 · 0 评论 -
EOJ 1084 一条直线上?
http://acm.cs.ecnu.edu.cn/problem.php?problemid=1084 题意:给出一系列点,求最多有几个点共线。 思路1:TLE枚举两个点,然后判断剩下的点在不在该直线上。注意斜率无穷大(两点式可以解决该问题)。#includeconst int MAX = 701;int main(){ int t; while(scanf("原创 2013-06-30 10:43:19 · 611 阅读 · 0 评论 -
EOJ 1839 表达式(数据结构) & EOJ 1003
http://acm.cs.ecnu.edu.cn/problem.php?problemid=1839表达式求值:带负号#include #include #include using namespace std;char mid[505],pos[505];int icp(char c){ switch(c) { case '*': case '/':return原创 2013-07-06 12:18:53 · 797 阅读 · 0 评论 -
EOJ 1094 Prime Judge
http://acm.cs.ecnu.edu.cn/problem.php?problemid=1094题意:判断素数。TLE #include #include using namespace std;const int maxn = 1000005;int a[maxn];vector v;void init(){ a[0] = 1; a[1] = 1原创 2013-06-22 22:06:36 · 710 阅读 · 0 评论 -
EOJ 1076 纯粹好玩 输入各种重定向
#include#include#includeusing namespace std;template inline T& RD(T &x){ char c; for (c = getchar(); c < '0'; c = getchar()); x = c - '0'; for (c = getchar(); '0' <= c && c <= '9'; c = getchar原创 2013-07-11 22:49:03 · 734 阅读 · 0 评论 -
EOJ 2106 小强寻宝
http://acm.cs.ecnu.edu.cn/problem.php?problemid=2106贪心假设当前要到高度为y的点,那么从现在已知的没有连两条边的的点中找一个最差的点进行#include #include #include #include using namespace std;struct node{ int x,y;}e[100005];原创 2013-07-11 18:26:51 · 677 阅读 · 0 评论 -
EOJ 1019 着弹点
http://acm.cs.ecnu.edu.cn/problem.php?problemid=1019题意:给n(4 显然,最远点对一定在它们的凸包上。所以这个题目其实就是求凸包,然后枚举凸包上的所有点对,找出最远的。 WA~~找不出哪儿错了#include#include#include#includeusing namespace std;const int原创 2013-06-30 19:27:04 · 607 阅读 · 0 评论 -
EOJ 1835 梦乡
http://acm.cs.ecnu.edu.cn/problem.php?problemid=1835连续拿掉n位数的前任意位都是质数的n位数#include#include#include#include#includeusing namespace std;//typedef long long __int64;const int s[]={2,7,61};/*c原创 2013-06-23 16:52:27 · 512 阅读 · 0 评论 -
EOJ 2112 WYI
http://acm.cs.ecnu.edu.cn/problem.php?problemid=2112 题意:花费时间做题获得相应的知识,即总时间获得价值最大,背包,但本题的容量太大,变为获得价值i,需要花费的最少时间,状态方程为:f[v] = min{f[v-k]+t, f[v]} ; 初始状态:f[0] = 0, 其他为 inf ;#include #include原创 2013-06-29 21:51:35 · 621 阅读 · 0 评论 -
ECNU第四届程序设计竞赛解题报告
A rxms喜欢玩耍占坑。。。B rxms爱吃糖给定序列A[],1e5个元素求min(max1≤i≤N)x∗A[i])min\left( max_ { 1\le i \le N) } x \ast A[i] \right)构建字典树,构建完了之后,对于根节点,假如0,1都有,说明x的这一位取0,则以1为根节点的子树肯定小于以0为根节点的子树;x的这一位取1,则以0为根节点的子树肯定小于以1为根节点的原创 2015-05-31 19:29:47 · 769 阅读 · 0 评论