恒邪

上一页 1 ··· 6 7 8 9 10 11 12 13 下一页

2014年3月31日 #

hdu 1035 Robot Motion

摘要: 算是搜索题吧。。。。 1 /* 2 hdu 1035 Robot Motion 3 简单题 虽然代码有些长 但是写起来简单,不费脑子 4 */ 5 #include 6 #include 7 #include 8 using namespace std; 9 int p;10 int m,n;11 int a[15][15];12 char c[15][15];13 void fun(int x,int y)14 {15 p++;16 if(x=m) throw -2;//需先判断是否出界,否则WA17 if(y=n) throw -2;18 i... 阅读全文

posted @ 2014-03-31 19:52 恒邪 阅读(107) 评论(0) 推荐(0) 编辑

最大公约数求解

摘要: 方法一:辗转相除法优点:代码简单,容易写。缺点:开销大,用时间多。代码:int gcd(int a,int b){ return b==0?a:gcd(b,a%b);}方法二:二进制算法优点:速度快。主要思想:前提:a>b,分情况讨论:1.a和b均为偶数,gcd(a,b)=2*gcd(a/2,b/2);2.a为偶数b为奇数,gcd(a,b)=gcd(a/2,b);3.a和b均为奇数,gcd(a,b)=gcd(a-b,b)代码:int gcd(int a,int b){ int t=1,c,d; while(a!=b) { if(a>=1; ... 阅读全文

posted @ 2014-03-31 18:04 恒邪 阅读(170) 评论(0) 推荐(0) 编辑

2014年3月30日 #

[ACM] hdu 1465 不容易系列之一(错排复习)

摘要: 不容易系列之一Time Limit: 2000/1000 MS (Java/Others)Memory Limit: 65536/32768 K (Java/Others)Total Submission(s): 13415Accepted Submission(s): 5597Problem Description大家常常感慨,要做好一件事情真的不容易,确实,失败比成功容易多了!做好“一件”事情尚且不易,若想永远成功而总从不失败,那更是难上加难了,就像花钱总是比挣钱容易的道理一样。话虽这样说,我还是要告诉大家,要想失败到一定程度也是不容易的。比如,我高中的时候,就有一个神奇的女生,在英语考试 阅读全文

posted @ 2014-03-30 14:51 恒邪 阅读(168) 评论(0) 推荐(0) 编辑

2014年3月28日 #

[ACM] hdu 2082 找单词 (母函数)

摘要: Problem Description假设有x1个字母A, x2个字母B,..... x26个字母Z,同时假设字母A的价值为1,字母B的价值为2,..... 字母Z的价值为26。那么,对于给定的字母,可以找到多少价值#include using namespace std;int num[27];int c[60],temp[60];int main(){ int t;cin>>t; while(t--) { memset(c,0,sizeof(c)); memset(temp,0,sizeof(temp)); for(int i=1... 阅读全文

posted @ 2014-03-28 19:40 恒邪 阅读(129) 评论(0) 推荐(0) 编辑

2014年3月27日 #

[ACM] poj 1146 ID Codes(字符串的下一个排列)

摘要: DescriptionIt is 2084 and the year of Big Brother has finally arrived, albeit a century late. In order to exercise greater control over its citizens and thereby to counter a chronic breakdown in law and order, the Government decides on a radical measure--all citizens are to have a tiny microcomputer 阅读全文

posted @ 2014-03-27 12:39 恒邪 阅读(129) 评论(0) 推荐(0) 编辑

2014年3月26日 #

[ACM] hdu 2149 Public Sale (巴什博奕)

摘要: Public SaleTime Limit: 1000/1000 MS (Java/Others)Memory Limit: 32768/32768 K (Java/Others)Total Submission(s): 3396Accepted Submission(s): 2095Problem Description虽然不想,但是现实总归是现实,Lele始终没有逃过退学的命运,因为他没有拿到奖学金。现在等待他的,就是像FarmJohn一样的农田生涯。要种田得有田才行,Lele听说街上正在举行一场别开生面的拍卖会,拍卖的物品正好就是一块20亩的田地。于是,Lele带上他的全部积蓄,冲往拍卖 阅读全文

posted @ 2014-03-26 21:17 恒邪 阅读(148) 评论(0) 推荐(0) 编辑

[ACM] hdu 1846 Brave Game (巴什博奕)

摘要: Brave GameTime Limit: 1000/1000 MS (Java/Others)Memory Limit: 32768/32768 K (Java/Others)Total Submission(s): 5644Accepted Submission(s): 3748Problem Description十年前读大学的时候,中国每年都要从国外引进一些电影大片,其中有一部电影就叫《勇敢者的游戏》(英文名称:Zathura),一直到现在,我依然对于电影中的部分电脑特技印象深刻。今天,大家选择上机考试,就是一种勇敢(brave)的选择;这个短学期,我们讲的是博弈(game)专题;所以 阅读全文

posted @ 2014-03-26 20:33 恒邪 阅读(167) 评论(0) 推荐(0) 编辑

[ACM] hdu 1085 Holding Bin-Laden Captive! (母函数变形)

摘要: Holding Bin-Laden Captive!Time Limit: 2000/1000 MS (Java/Others)Memory Limit: 65536/32768 K (Java/Others)Total Submission(s): 13505Accepted Submission(s): 6094Problem DescriptionWe all know that Bin-Laden is a notorious terrorist, and he has disappeared for a long time. But recently, it is reported 阅读全文

posted @ 2014-03-26 20:19 恒邪 阅读(182) 评论(0) 推荐(0) 编辑

2014年3月25日 #

[ACM] hdu 1398 Square Coins (母函数)

摘要: Square CoinsTime Limit: 2000/1000 MS (Java/Others)Memory Limit: 65536/32768 K (Java/Others)Total Submission(s): 7452Accepted Submission(s): 5050Problem DescriptionPeople in Silverland use square coins. Not only they have square shapes but also their values are square numbers. Coins with values of al 阅读全文

posted @ 2014-03-25 20:55 恒邪 阅读(147) 评论(0) 推荐(0) 编辑

[ACM] hdu 1028 Ignatius and the Princess III (母函数)

摘要: Ignatius and the Princess IIITime Limit: 2000/1000 MS (Java/Others)Memory Limit: 65536/32768 K (Java/Others)Total Submission(s): 11475Accepted Submission(s): 8118Problem Description"Well, it seems the first problem is too easy. I will let you know how foolish you are later." feng5166 says. 阅读全文

posted @ 2014-03-25 20:29 恒邪 阅读(148) 评论(0) 推荐(0) 编辑

上一页 1 ··· 6 7 8 9 10 11 12 13 下一页

导航