摘要: #include <stdio.h> #include <string.h> #define MaxInt 0x3f3f3f3f 阅读全文
posted @ 2016-05-15 21:42 Hutonm 阅读(243) 评论(0) 推荐(0) 编辑
摘要: 1 #include"cstdio" 2 #include"cstring" 3 #include"algorithm" 4 using namespace std; 5 int n;//菜的数量 6 int greens[1000+5]; 7 int m;//卡上余额 8 int main(){ 9 while(scanf("%d",&n)==1&&n){//输入菜... 阅读全文
posted @ 2016-05-10 20:00 Hutonm 阅读(626) 评论(0) 推荐(0) 编辑
摘要: 1 #include"cstring" 2 #include"cstdio" 3 const int maxn=100+5; 4 int nux[maxn]; 5 int nua[maxn];//解的集合 6 int t;//t为和 7 int n;//n为元素个数 8 bool flag;//判断是否有解 9 void dfs(int sum,int... 阅读全文
posted @ 2016-05-10 14:16 Hutonm 阅读(116) 评论(0) 推荐(0) 编辑
摘要: 1 #include"cstring" 2 #include"cstdio" 3 const int maxn=20+5; 4 char tile[maxn][maxn];//方块格子 5 int m,n,idx[maxn][maxn];//m行n列 ,idx判断是否访问过 6 int a[]={-1,0,1,0}; 7 int b[]={0,-1,0,1};//移动 8 ... 阅读全文
posted @ 2016-05-09 18:58 Hutonm 阅读(128) 评论(0) 推荐(0) 编辑
摘要: 1 #include"iostream" 2 #include"cstring" 3 using namespace std; 4 #define MAXN 20+5 5 int C[MAXN][MAXN]; 6 int vis[MAXN]; 7 int N; 8 int ans; 9 void dfs(int id,int data){ 10 vis[id]=1; 1... 阅读全文
posted @ 2016-05-09 12:15 Hutonm 阅读(149) 评论(0) 推荐(0) 编辑
摘要: 题目链接:http://poj.org/problem?id=1753 题目概述:有4*4的正方形,每个格子要么是黑色,要么是白色,当把一个格子的颜色改变(黑->白或者白->黑)时,其周围上下左右(如果存在的话)的格子的颜色也被反转,问至少反转几个格子可以使4*4的正方形变为纯白或者纯黑? 阅读全文
posted @ 2016-05-08 20:42 Hutonm 阅读(309) 评论(0) 推荐(0) 编辑
摘要: 1 #include"iostream" 2 using namespace std; 3 int kuaisuqiumo(int a,int b,int c){ 4 int ans = 1; 5 a = a % c; 6 while(b>0){ 7 if(b % 2 == 1) 8 ans = (ans * a) ... 阅读全文
posted @ 2016-05-08 20:41 Hutonm 阅读(171) 评论(0) 推荐(0) 编辑
摘要: 原题链接:http://acm.nyist.net/JudgeOnline/problem.php?pid=115 阅读全文
posted @ 2016-05-08 20:38 Hutonm 阅读(273) 评论(0) 推荐(0) 编辑
摘要: 快速幂在算指数时是很高效的,他的基本原理是二进制。 如果要算 2^5,可以直接2*2*2*2*2 但是如果要算 3^999,指数N太大,计算太慢,所以有一种快速的解法。 @@@@@@@@@@@@@@@@@@@@@@@@ 以3^21为例。 2^21=(2^16)×(2^4)×(2^1) 21的二进制可 阅读全文
posted @ 2016-04-25 22:53 Hutonm 阅读(758) 评论(0) 推荐(0) 编辑
摘要: 1 #include"iostream" 2 #include"malloc.h" 3 #include"queue" 4 using namespace std; 5 #define MAX 50 6 typedef struct node{ 7 int adjvex; //拎接点域 8 struct node *next; //链域 ... 阅读全文
posted @ 2016-04-22 00:25 Hutonm 阅读(266) 评论(0) 推荐(0) 编辑