随笔分类 -  部分算法

摘要:Argestes and Sequence Time Limit: 5000/2500 MS (Java/Others) Memory Limit: 32768/32768 K (Java/Others) Total Submission(s): 566 Accepted Submission(s): 142 Problem Description Argestes h... 阅读全文
posted @ 2014-10-01 23:17 ForeverEnjoy 阅读(408) 评论(0) 推荐(0)
摘要:Tree Time Limit: 1000MS Memory Limit: 30000K Total Submissions: 16172 Accepted: 5272 Description Give a tree with n vertices,each edge has a length(po 阅读全文
posted @ 2014-09-20 10:09 ForeverEnjoy 阅读(172) 评论(0) 推荐(0)
摘要:12745 Wishmaster view code#include #include #include #include using namespace std; typedef long long ll; const int N = 200010; const int M = Nn?x-n:x+n; if(mark[ano]) return false; if(mark... 阅读全文
posted @ 2014-08-22 20:52 ForeverEnjoy 阅读(235) 评论(0) 推荐(0)
摘要:uva 6757 Cup of CowardsCup of Cowards (CoC) is a role playing game that has 5 different characters (Mage, Tank, Fighter,Assassin and Marksman). A team ... 阅读全文
posted @ 2014-08-21 21:06 ForeverEnjoy 阅读(385) 评论(0) 推荐(0)
摘要:这题是混合路的欧拉路径问题。 1.判断图的连通性,若不连通,无解。 2.给无向边任意定向,计算每个结点入度和出度之差deg[i]。deg[i]为奇数的结点个数只能是0个或2个,否则肯定无解。 3.(若存在2个deg[i]为奇数的结点,则在两点连一条流量为1的边,方向任意)设立源点s和汇点t(自己另外 阅读全文
posted @ 2014-08-18 10:30 ForeverEnjoy 阅读(260) 评论(0) 推荐(0)
摘要:Cool Points We have a circle of radius R and several line segments situated within the circumference of this circle. Let’s define a cool point to be a 阅读全文
posted @ 2014-08-10 10:47 ForeverEnjoy 阅读(160) 评论(0) 推荐(0)
摘要:Crime and PunishmentTime Limit:500MS Memory Limit:65536KB 64bit IO Format:%I64d & %I64uDescriptionBackgroundPetty bureaucrat Victor Thiefton was dispo... 阅读全文
posted @ 2014-08-04 13:48 ForeverEnjoy 阅读(212) 评论(0) 推荐(0)
摘要:C - 纪念SlingShot Description 已知 F(n)=3 * F(n-1)+2 * F(n-2)+7 * F(n-3),n>=3,其中F(0)=1,F(1)=3,F(2)=5,对于给定的每个n,输出F(0)+ F(1)+ …… + F(n) mod 2009。 Input 第一行是 阅读全文
posted @ 2014-07-29 17:21 ForeverEnjoy 阅读(231) 评论(0) 推荐(0)
摘要:The Monocycle Time Limit: 3000MS64bit IO Format: %lld & %llu [Submit] [Go Back] [Status] Description Problem A: The Monocycle A monocycle is a cycle t 阅读全文
posted @ 2014-04-29 23:19 ForeverEnjoy 阅读(218) 评论(0) 推荐(0)
摘要:Problem 2150 Fire Game Problem Description Fat brother and Maze are playing a kind of special (hentai) game on an N*M board (N rows, M columns). At th 阅读全文
posted @ 2014-03-30 21:06 ForeverEnjoy 阅读(922) 评论(0) 推荐(0)
摘要:Labeling Balls Time Limit: 1000MS Memory Limit: 65536K Total Submissions: 9641 Accepted: 2636 Description Windy has N balls of distinct weights from 1 unit to N units. Now he tries to label ... 阅读全文
posted @ 2014-03-30 00:20 ForeverEnjoy 阅读(175) 评论(0) 推荐(0)
摘要:Can you solve this equation? Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 32768/32768 K (Java/Others) Total Submission(s): 7156 Accepted Submi 阅读全文
posted @ 2014-03-18 22:52 ForeverEnjoy 阅读(194) 评论(0) 推荐(0)
摘要:Stockbroker Grapevine Time Limit: 1000MS Memory Limit: 10000K Description Stockbrokers are known to overreact to rumours. You have been contracted to develop a method of spreading disinformation... 阅读全文
posted @ 2014-03-13 00:00 ForeverEnjoy 阅读(191) 评论(0) 推荐(0)
摘要:1003 - Drunk PDF (English) Statistics Forum Time Limit: 2 second(s) Memory Limit: 32 MB One of my friends is always drunk. So, sometimes I get a bit confused whether he is drunk or not.... 阅读全文
posted @ 2014-03-10 23:59 ForeverEnjoy 阅读(344) 评论(0) 推荐(0)
摘要:比如乘法AB一、1)用A的第1行各个数与B的第1列各个数对应相乘后加起来,就是乘法结果中第1行第1列的数;//1=1*0+1*12)用A的第1行各个数与B的第2列各个数对应相乘后加起来,就是乘法结果中第1行第2列的数;//3=1*2+1*13)用A的第1行各个数与B的第3列各个数对应相乘后加起来,就是乘法结果中第1行第3列的数;//5=1*3+1*2依次进行,(直到)用A的第1行各个数与B的第末列各个数对应相乘后加起来,就是乘法结果中第1行第末列的的数,二、1)用A的第2行各个数与B的第1列各个数对应相乘后加起来,就是乘法结果中第2行第1列的数;//0=2*0+0*12)用A的第2行各个数与B 阅读全文
posted @ 2014-03-10 00:28 ForeverEnjoy 阅读(250) 评论(0) 推荐(0)
摘要:Drying Time Limit: 2000MS Memory Limit: 65536K Description It is very hard to wash and especially to dry clothes in winter. But Jane is a very smart g 阅读全文
posted @ 2014-03-09 01:13 ForeverEnjoy 阅读(309) 评论(0) 推荐(0)
摘要:1: #include 2: #include 3: using namespace std; 4: const int maxn=10000; 5: int a[maxn],n; 6: 7: int Partition(int l,int r) 8: { 9: int key=a[l]; 10: while(l=key) r--; 13: a[l]=a[r]; 14: while(l<r&&a[l]<=key) l++; 15: a[r]=a[l]; 16: } 1... 阅读全文
posted @ 2014-03-08 11:42 ForeverEnjoy 阅读(1229) 评论(0) 推荐(0)
摘要:#include #include void f(int n,int *a,int cur){ int i,j; if(cur==n) { for(i=0;i<n;i++) printf("%d ",a[i]); printf("\n"); } else for(i=1;i<=n;i++) { int ok=1; for(j=0;j<cur;j++) if(a[j]==i) ok=0; if(ok) { a[cur]=i; f(n,a,cur+1); } }}int main() { int n,i,a[11]; scanf(" 阅读全文
posted @ 2014-01-28 11:14 ForeverEnjoy 阅读(152) 评论(0) 推荐(0)