红桃J

用心写好每行完美的代码,远比写一堆更有价值

  博客园 :: 首页 :: 博问 :: 闪存 :: 新随笔 :: 联系 :: 订阅 订阅 :: 管理 ::

2014年8月28日

摘要: #includeusing namespace std;int map[21][21];int d[21][21];int N, M;int dp(int i, int j){ if(d[i][j]!=0) return d[i][j]; if(i==N-1&&j==M-1... 阅读全文
posted @ 2014-08-28 13:55 红桃J 阅读(230) 评论(0) 推荐(0) 编辑

摘要: 本来是个很水的DP,结果被自己的代码习惯给打败了代码: 1 #include 2 #include 3 #include 4 5 using namespace std; 6 7 typedef struct rectangle 8 { 9 int x;10 int y;11 }... 阅读全文
posted @ 2014-08-28 11:37 红桃J 阅读(265) 评论(0) 推荐(0) 编辑

2014年8月27日

摘要: 建立一个新端口的命令打开:SSH Secure Shell在里面键入:vncserver在键入:vncpasswd然后填写密码,确认密码即可。这个New 'tcm:2(wyy)'就是说在wyy账号下开通了一个端口号为2的端口。此时在打开TightVNC 在小黑框内键入eclipse就打开了eclip... 阅读全文
posted @ 2014-08-27 15:31 红桃J 阅读(150) 评论(0) 推荐(0) 编辑

摘要: 首先说贪心算法并不能一定得到一个问题的最优解,但会议安排问题恰好能得到最优解,也就是说能通过贪心算法求出正确结果。会议安排问题:有多个会议要举办,但现在的可用场地只有一个,举办方想用这个场地举办尽可能多的会议,求哪些会议可以在此举办。会议都有一个开始时间和一个结束时间start[i],end[i]。 阅读全文
posted @ 2014-08-27 15:22 红桃J 阅读(338) 评论(0) 推荐(0) 编辑

摘要: 题目代码到是不难但是很难想通题目的解决方法。#includeusing namespace std;int person[110];int main(){ int n,m; while(cin>>n>>m) { memset(person,0,sizeof(perso... 阅读全文
posted @ 2014-08-27 14:16 红桃J 阅读(325) 评论(0) 推荐(0) 编辑

摘要: 对比一下代码的书写差距:我的代码: 1 #include 2 3 using namespace std; 4 5 int a[6]; 6 int b[6]; 7 int v[3]; //访问标记 8 9 bool judge(int i, int j)10 {11 if(a[i]=... 阅读全文
posted @ 2014-08-27 00:51 红桃J 阅读(2672) 评论(3) 推荐(0) 编辑

2014年8月25日

摘要: 这个题真的很水,但我竟然连错,在此警醒自己!!!写代码改了东边,忘了西边,“认真”这两个字又被我吃了,打脸啪啪啪啪。#includeusing namespace std;int gcd(int a, int b){ int t; while(b) { t = a; ... 阅读全文
posted @ 2014-08-25 16:51 红桃J 阅读(136) 评论(0) 推荐(0) 编辑

摘要: 这题其实就是快速求一个高次幂的模。这是题目的答案#include#includeusing namespace std;int a[45002];int b[45002];int mod(int a, int b, int c){ int z = 1; while(b) { ... 阅读全文
posted @ 2014-08-25 12:32 红桃J 阅读(139) 评论(0) 推荐(0) 编辑

2014年8月21日

摘要: 学习链接:http://www.cnblogs.com/frog112111/archive/2012/08/19/2646012.html先来学习一下什么是欧几里得算法:欧几里得原理是:两个整数a ,b的公约数等于b ,a%b这两个数的公约数。即gcd(a,b)=gcd(b,a%b),他们的任何公... 阅读全文
posted @ 2014-08-21 21:45 红桃J 阅读(168) 评论(0) 推荐(0) 编辑

2014年8月20日

摘要: 一定要相信水题真的很水POJ-2546 1 #include 2 #include 3 #include 4 5 using namespace std; 6 7 #define PI acos(double(-1)) 8 9 int main()10 {11 double x1, y... 阅读全文
posted @ 2014-08-20 22:24 红桃J 阅读(147) 评论(0) 推荐(0) 编辑