上一页 1 ··· 22 23 24 25 26 27 28 29 30 ··· 44 下一页
摘要: 题目链接又是一个变量敲错,错了10次,这是搞毛线啊。。。对spfa不熟,一直以为模版敲错了。。。终于,在大家的帮助下找到那个sb错误,从下午一直搞到晚上。。。这个题还是很经典的,有向图里,找每一个点到x的最小环。先正向建图再反向建图,两遍spfa。 1 #include <cstdio> 2 #include <cstring> 3 #include <cmath> 4 #include <queue> 5 using namespace std; 6 #define N 2000000 7 int p1[1011][1011],p2[1011] 阅读全文
posted @ 2012-11-07 20:37 Naix_x 阅读(153) 评论(0) 推荐(0) 编辑
摘要: 本来以为是一个好高深的DP的,看了看数据范围,枚举啊。。。n和m分不清了,错了好几次,以后用题目里面的变量,养成好习惯。。。 1 /* 2 ID: cuizhe 3 LANG: C++ 4 TASK: holstein 5 */ 6 #include <cstdio> 7 #include <cstring> 8 #include <cmath> 9 #include <algorithm>10 using namespace std;11 int o[21],c[30],p[20][40],t[30],an[21];12 int main()1 阅读全文
posted @ 2012-11-06 15:14 Naix_x 阅读(136) 评论(0) 推荐(0) 编辑
摘要: 很不错的一个题。开始自己想了一个策略,然后写了150+代码。。。WA后,发现策略可能有问题,貌似有更简单的办法,自己想的策略是错的,敲的各种if else,想清楚再写啊。。。这个题目应该算是贪心把。 1 /* 2 ID: cuizhe 3 LANG: C++ 4 TASK: sort3 5 */ 6 #include <cstdio> 7 #include <cstring> 8 #include <cmath> 9 #include <algorithm>10 using namespace std;11 int p[1011],o[4];12 阅读全文
posted @ 2012-11-06 09:04 Naix_x 阅读(174) 评论(0) 推荐(0) 编辑
摘要: 水题,尼玛,数组开大不给MLE,来了个看不懂的错误,不就多申请点内存了嘛。。。 1 /* 2 ID: cuizhe 3 LANG: C++ 4 TASK: frac1 5 */ 6 #include <cstdio> 7 #include <cstring> 8 #include <cmath> 9 #include <algorithm>10 using namespace std;11 struct node12 {13 int a,b;14 double x;15 } p[160*160+1];16 int cmp(const node & 阅读全文
posted @ 2012-11-05 20:35 Naix_x 阅读(160) 评论(0) 推荐(0) 编辑
摘要: 刚POJ水到100了,哎呀,爆水的题目,没太看懂的题意,实在是快点想秒了这个水题,看了看DISCUSS,就给水过了,掉人品啊。。。 区域赛完了真是感觉没啥事干了,这几天想了好多,想想比赛的过程,想想以后,想了很多。不过好像总体上感觉是玩的时间比较多。。。课还是在混日子,听也听不懂,自己正在自学C++,这个要好好搞一下。最近真的是无聊了,只是刷usaco解闷,在宿舍玩dota,想想大二上快过了一半了,匆匆的就快过年了。学acm真的是一年了,现在依旧啥也不会的状态,几何数论图论基本上在文盲的状态,组合dp搜索基本上是似懂非懂,当然也应该有自信,付出努力必定会有收获。 以后做题计划就是POJ... 阅读全文
posted @ 2012-11-05 20:07 Naix_x 阅读(143) 评论(0) 推荐(0) 编辑
摘要: 感觉代码大体写的还行,就是BUG太多了。。。特别注意输出的优先级,然后了 1 /* 2 ID: cuizhe 3 LANG: C++ 4 TASK: castle 5 */ 6 #include <cstdio> 7 #include <cstring> 8 #include <cmath> 9 using namespace std;10 int p[60][61],o[60][60][5],key[61][61],num,n,m;11 int f[3501];12 int a[4] = {0,-1,0,1};13 int b[4] = {-1,0,1,0 阅读全文
posted @ 2012-11-05 11:50 Naix_x 阅读(126) 评论(0) 推荐(0) 编辑
摘要: 题目链接第一眼看到这个题问题的时候觉得是水DP啊,状态转移很容易看出来dp[i][j] = sum(dp[i-1][j-k]) (0<=k<=p),dp[i][j]前i个人,已经分了j个糖果的方案。大约O(n^3)的复杂度,我就交了,果断TLE,然后想了想把枚举k给优化掉,O(n^2)复杂度,目测应该没有问题了把。。。结果还是TLE了,无语,一看数据10000组。。。这个题目正解应该是容斥原理,有一篇论文中有提到。论文里有讲解,不过好像太精简了。。。看了好一会,才能理解。先考虑n个糖果分给m个人,相当于n个糖果中间插入m-1块板,所以就是在m+n-1个位置中选m-1个位置,方案数为 阅读全文
posted @ 2012-11-04 21:30 Naix_x 阅读(223) 评论(0) 推荐(0) 编辑
摘要: 皇后问题。。。打了一下13的表,水过。USACO第一单元终于给刷完了。上图。 1 /* 2 ID: cuizhe 3 LANG: C++ 4 TASK: checker 5 */ 6 #include <cstdio> 7 #include <cstring> 8 #include <cmath> 9 #include <algorithm>10 using namespace std;11 int r[31],c[31],lr[31],lc[31],n,num;12 void dfs(int x,int y,int step)13 {14 in 阅读全文
posted @ 2012-11-03 15:32 Naix_x 阅读(219) 评论(0) 推荐(0) 编辑
摘要: 手贱,一个地方敲错,浪费时间了。 1 /* 2 ID: cuizhe 3 LANG: C++ 4 TASK: sprime 5 */ 6 #include <cstdio> 7 #include <cstring> 8 #include <cmath> 9 #include <algorithm>10 using namespace std;11 #define N 100000112 long long p[300001];13 int o[N],prim[100001],num,len,n;14 int judge(int x)15 {16 阅读全文
posted @ 2012-11-02 17:34 Naix_x 阅读(165) 评论(0) 推荐(0) 编辑
摘要: 本来想筛选素数的。。。交了之后发现复杂度也太高了。。。可耻的看了一下hint,然后就各种for枚举了每一位了。.。 1 /* 2 ID: cuizhe 3 LANG: C++ 4 TASK: pprime 5 */ 6 #include <cstdio> 7 #include <cstring> 8 #include <cmath> 9 #include <algorithm> 10 using namespace std; 11 #define N 1000001 12 bool p[N]; 13 int prim[100000],num; 1 阅读全文
posted @ 2012-11-02 16:53 Naix_x 阅读(162) 评论(0) 推荐(0) 编辑
摘要: 经典的数字三角形 1 /* 2 ID: cuizhe 3 LANG: C++ 4 TASK: numtri 5 */ 6 #include <cstdio> 7 #include <cstring> 8 #include <cmath> 9 #include <algorithm>10 using namespace std;11 #define LL long long12 int dp[1001][1001];13 int main()14 {15 int i,j,n;16 freopen("numtri.in",&quo 阅读全文
posted @ 2012-11-02 09:53 Naix_x 阅读(139) 评论(0) 推荐(0) 编辑
摘要: 以前做过类似的,写的很复杂,搞了一晚上。。2Y。 1 /* 2 ID: cuizhe 3 LANG: C++ 4 TASK: milk3 5 */ 6 #include <cstdio> 7 #include <cstring> 8 #include <cmath> 9 #include <algorithm> 10 using namespace std; 11 #define LL long long 12 int p[31][31][31]; 13 int qua[1000],qub[1000],quc[1000]; 14 int o[10 阅读全文
posted @ 2012-11-01 22:20 Naix_x 阅读(214) 评论(0) 推荐(0) 编辑
摘要: 好纠结的。。。复杂度很高,开始的方法太暴力了,后来搞了一个 快了一点的枚举办法,水过了。。 1 /* 2 ID: cuizhe 3 LANG: C++ 4 TASK: ariprog 5 */ 6 #include <cstdio> 7 #include <cstring> 8 #include <cmath> 9 #include <algorithm>10 #include <ctime>11 using namespace std;12 #define LL long long13 int p[1250001],o[125000 阅读全文
posted @ 2012-11-01 18:42 Naix_x 阅读(154) 评论(0) 推荐(0) 编辑
摘要: 过程是曲折的,代码是恶心的。无视把。。。和翻棋子游戏差不多,每种方式至多翻3次,然后在数据帮助下,终于A了。 1 /* 2 ID: cuizhe 3 LANG: C++ 4 TASK: clocks 5 */ 6 #include <cstdio> 7 #include <cstring> 8 #include <cmath> 9 using namespace std; 10 #define LL long long 11 LL ans; 12 int p[10][10],que[100],o[11]; 13 int judge() 14 { 15 int 阅读全文
posted @ 2012-11-01 11:52 Naix_x 阅读(239) 评论(0) 推荐(0) 编辑
摘要: 题目链接以前想了好久的一个问题,没想到热身赛又出了,果断悲剧啊。。。看了一下题解,应该反着推啊。。。不联通的图可以分为两个部分k个结点联通,剩下n-k结点随便排列就好,这个图一定是不连通的。然后沿着这个思路做就可以写出递推式,这个题目需要高精度,java也太不熟了,语法都不不会。。 1 import java.io.*; 2 import java.math.*; 3 import java.util.*; 4 import java.text.*; 5 public class Main 6 { 7 public static void main(String[] args) 8 ... 阅读全文
posted @ 2012-11-01 09:52 Naix_x 阅读(234) 评论(0) 推荐(0) 编辑
上一页 1 ··· 22 23 24 25 26 27 28 29 30 ··· 44 下一页