- 博客(17)
- 收藏
- 关注
原创 nyoj21三个水杯
三个水杯时间限制:1000 ms | 内存限制:65535 KB难度:4描述给出三个水杯,大小不一,并且只有最大的水杯的水是装满的,其余两个为空杯子。三个水杯之间相互倒水,并且水杯没有标识,只能根据给出的水杯体积来计算。现在要求你写出一个程序,使其输出使初始状态到达目标状态的最少次数。输入第一行一个整数N(0接下来每组测试数据有两行,第一行给出三
2014-10-31 21:06:46 247
原创 nyoj163phone list 字典树
Phone List时间限制:1000 ms | 内存限制:65535 KB难度:4描述Given a list of phone numbers, determine if it is consistent in the sense that no number is the prefix of another. Let's say the phone
2014-10-31 14:45:31 376
原创 nyoj90整数划分
整数划分时间限制:3000 ms | 内存限制:65535 KB难度:3描述将正整数n表示成一系列正整数之和:n=n1+n2+…+nk, 其中n1≥n2≥…≥nk≥1,k≥1。 正整数n的这种表示称为正整数n的划分。求正整数n的不 同划分个数。 例如正整数6有如下11种不同的划分: 6; 5+1; 4+2,4+1+1; 3+3,3
2014-10-30 19:39:37 371
原创 水池数目
//神坑的一道搜索水题,注意开始的时候初始化从1开始,不要从0开始#include #include int a[109][109];int b[109][109];//biao//int b[4][2] = {{-1, 0}, {1, 0}, {0, -1}, {0, 1}};void dfs(int x, int y){ b[x][y] = 1;
2014-10-27 08:00:12 312
原创 双循环链表
//nyoj511移动小球#include #include typedef struct node{ int data; struct node *pre, *rear;}Lnode;Lnode *creat_list(Lnode *head, int num){ Lnode *current, *phead; phead =
2014-10-26 17:50:06 361
原创 大数阶乘
//nyoj28已A /*#include #define MAX 10001int a[MAX];int main(){ int n, num, m, i, x, y, index; char ch; scanf("%d", &n); while(n--) { scanf("%d%d", &num, &m
2014-10-23 15:55:01 326
原创 递归之排列组合
//nyoj366D的小L//排列 /*#include #define MAX 10001int a[MAX];int main(){ int n, num, m, i, x, y, index; char ch; scanf("%d", &n); while(n--) { scanf("%d%d",
2014-10-17 19:30:46 568
原创 nyoj325zb的生日+邮票分你一半
zb的生日时间限制:3000 ms | 内存限制:65535 KB难度:2描述今天是阴历七月初五,acm队员zb的生日。zb正在和C小加、never在武汉集训。他想给这两位兄弟买点什么庆祝生日,经过调查,zb发现C小加和never都很喜欢吃西瓜,而且一吃就是一堆的那种,zb立刻下定决心买了一堆西瓜。当他准备把西瓜送给C小加和never的时候,遇到了一个难题,ne
2014-10-16 21:10:39 351
原创 nyoj58最少步数
#include #include #define INF 0xfffffffint maze[9][9]={ {1,1,1,1,1,1,1,1,1}, {1,0,0,1,0,0,1,0,1}, {1,0,0,1,1,0,0,0,1}, {1,0,1,0,1,1,0,1,1}, {1,0,0,0,0,1,0,0,1}, {1,1,0,1,0,1,0,0,1},
2014-10-16 19:54:30 403
原创 nyoj63小猴下落问题
#include int main(){ int h, num, i, leaf; scanf("%d%d", &h, &num); while(h != 0 && num != 0) { leaf = 1; for(i = 0; i { if(num % 2 != 0
2014-10-15 20:11:02 357
原创 nyoj756重建二叉树
#include int main(){ int h, num, i, leaf; scanf("%d%d", &h, &num); while(h != 0 && num != 0) { leaf = 1; for(i = 0; i { if(num % 2 != 0
2014-10-15 20:09:59 398
原创 nyoj76超级台阶
#include int main(){ int n, num, i, a[41] = {0, 0, 1, 2}; scanf("%d", &n); for(i = 4; i { a[i] = a[i - 1] + a[i - 2]; } while(n--) { scanf("%d
2014-10-14 15:02:07 353
原创 nyoj113
//很坑的水题#include #include int main(){ char ch[50]; int i, j; while(scanf("%s", ch) != EOF) { for(i = 0; ch[i+2] != 0; i++) { if(ch[i] == 'y' &
2014-10-05 21:00:50 305
原创 nyoj125盗梦空间
#include #include int main(){ int n, count, i, num, m, a; double time; scanf("%d", &n); char ch[10]; while(n--) { scanf("%d", &num); time = 0;
2014-10-05 20:25:50 374
原创 nyoj330
#include #include int str[100010];int main(){ int n, num, i, temp; scanf("%d", &n); while(n--) { scanf("%d", &num); /*for(i = 0; i str[i] =
2014-10-05 18:49:27 297
空空如也
空空如也
TA创建的收藏夹 TA关注的收藏夹
TA关注的人