随笔分类 -  搜索

上一页 1 2
NYOJ-488 素数环
摘要:素数环时间限制:1000 ms | 内存限制:65535 KB难度:2描述有一个整数n,把从1到n的数字无重复的排列成环,且使每相邻两个数(包括首尾)的和都为素数,称为素数环。为了简便起见,我们规定每个素数环都从1开始。例如,下图就是6的一个素数环。输入有多组测试数据,每组输入一个n(0<n<20),n=0表示输入结束。输出每组第一行输出对应的Case序号,从1开始。如果存在满足题意叙述的素数环,从小到大输出。否则输出No Answer。样例输入6830样例输出Case 1:1 4 3 2 5 61 6 5 2 3 4Case 2:1 2 3 8 5 6 7 41 2 5 8 3 阅读全文
posted @ 2012-08-15 09:06 可笑痴狂 阅读(4583) 评论(0) 推荐(1)
NYOJ-58 最小步数
摘要:最少步数时间限制:3000 ms | 内存限制:65535 KB难度:4描述这有一个迷宫,有0~8行和0~8列:1,1,1,1,1,1,1,1,11,0,0,1,0,0,1,0,11,0,0,1,1,0,0,0,11,0,1,0,1,1,0,1,11,0,0,0,0,1,0,0,11,1,0,1,0,1,0,0,11,1,0,1,0,1,0,0,11,1,0,1,0,0,0,0,11,1,1,1,1,1,1,1,10表示道路,1表示墙。现在输入一个道路的坐标作为起点,再如输入一个道路的坐标作为终点,问最少走几步才能从起点到达终点?(注:一步是指从一坐标点走到其上下左右相邻坐标点,如:从(3,1 阅读全文
posted @ 2012-08-14 23:06 可笑痴狂 阅读(1112) 评论(0) 推荐(0)
POJ-1011 Sticks
摘要:SticksTime Limit: 1000MSMemory Limit: 10000KTotal Submissions: 99807Accepted: 22696DescriptionGeorge took sticks of the same length and cut them randomly until all parts became at most 50 units long. Now he wants to return sticks to the original state, but he forgot how many sticks he had originally 阅读全文
posted @ 2012-08-14 22:06 可笑痴狂 阅读(4804) 评论(0) 推荐(3)
POJ-1164 The Castle ------------DFS
摘要:The CastleTime Limit: 1000MSMemory Limit: 10000KTotal Submissions: 5536Accepted: 3116Description 1 2 3 4 5 6 7 ############################# 1 # | # | # | | # #####---#####---#---#####---# 2 # # | # # # # # #---#####---#####---#####---# 3 # | |... 阅读全文
posted @ 2012-08-14 17:30 可笑痴狂 阅读(439) 评论(0) 推荐(0)
NYOJ-19 擅长排列的小明 -----回溯
摘要:擅长排列的小明时间限制:1000 ms | 内存限制:65535 KB难度:4描述小明十分聪明,而且十分擅长排列计算。比如给小明一个数字5,他能立刻给出1-5按字典序的全排列,如果你想为难他,在这5个数字中选出几个数字让他继续全排列,那么你就错了,他同样的很擅长。现在需要你写一个程序来验证擅长排列的小明到底对不对。输入第一行输入整数N(1<N<10)表示多少组测试数据,每组测试数据第一行两个整数 n m (1<n<9,0<m<=n)输出在1-n中选取m个字符进行全排列,按字典序全部输出,每种排列占一行,每组数据间不需分界。如样例样例输入23 14 2样例输出 阅读全文
posted @ 2012-08-13 22:00 可笑痴狂 阅读(297) 评论(1) 推荐(0)
NYOJ-366 D的小L 全排列
摘要:D的小L时间限制:4000 ms | 内存限制:65535 KB难度:2描述 一天TC的匡匡找ACM的小L玩三国杀,但是这会小L忙着哩,不想和匡匡玩但又怕匡匡生气,这时小L给匡匡出了个题目想难倒匡匡(小L很D吧),有一个数n(0<n<10),写出1到n的全排列,这时匡匡有点囧了,,,聪明的你能帮匡匡解围吗?输入第一行输入一个数N(0<N<10),表示有N组测试数据。后面的N行输入多组输入数据,每组输入数据都是一个整数x(0<x<10)输出按特定顺序输出所有组合。特定顺序:每一个组合中的值从小到大排列,组合之间按字典序排列。样例输入223样例输出1221123 阅读全文
posted @ 2012-08-02 20:58 可笑痴狂 阅读(502) 评论(0) 推荐(0)
POJ 3278 Catch That Cow
摘要:Catch That CowTime Limit: 2000MSMemory Limit: 65536KTotal Submissions: 30924Accepted: 9536DescriptionFarmer John has been informed of the location of a fugitive cow and wants to catch her immediately. He starts at a point N (0 ≤ N ≤ 100,000) on a number line and the cow is at a point K (0 ≤ K ≤ 100, 阅读全文
posted @ 2012-07-30 09:22 可笑痴狂 阅读(2696) 评论(1) 推荐(0)
HDOJ 1372 Knight Moves
摘要:Knight MovesTime Limit: 2000/1000 MS (Java/Others)Memory Limit: 65536/32768 K (Java/Others)Total Submission(s): 3340Accepted Submission(s): 2087Problem DescriptionA friend of you is doing research on the Traveling Knight Problem (TKP) where you are to find the shortest closed tour of knight moves th 阅读全文
posted @ 2012-07-25 11:46 可笑痴狂 阅读(523) 评论(0) 推荐(0)
HDOJ-1142 A Walk Through the Forest
摘要:A Walk Through the ForestTime Limit: 2000/1000 MS (Java/Others)Memory Limit: 65536/32768 K (Java/Others)Total Submission(s): 3140Accepted Submission(s): 1147Problem DescriptionJimmy experiences a lot of stress at work these days, especially since his accident made working difficult. To relax after a 阅读全文
posted @ 2012-07-22 22:22 可笑痴狂 阅读(304) 评论(0) 推荐(0)
六月月赛F题
摘要:题目信息:The GeoSurvComp geologic survey company is responsible for detecting underground oil deposits. GeoSurvComp works with one large rectangular region of land at a time, and creates a grid that divides the land into numerous square plots. It then analyzes each plot separately, using sensing equipme 阅读全文
posted @ 2012-06-23 13:01 可笑痴狂 阅读(351) 评论(0) 推荐(0)
HDOJ-1010 Tempter of the Bone
摘要:Tempter of the BoneTime Limit: 2000/1000 MS (Java/Others)Memory Limit: 65536/32768 K (Java/Others)Total Submission(s): 35460Accepted Submission(s): 9511Problem DescriptionThe doggie found a bone in an ancient maze, which fascinated him a lot. However, when he picked it up, the maze began to shake, a 阅读全文
posted @ 2012-06-22 17:16 可笑痴狂 阅读(1105) 评论(0) 推荐(0)
HDOJ-1312 Red and Black
摘要:题目链接:http://acm.hdu.edu.cn/showproblem.php?pid=1312 1 //DFS 2 #include<iostream> 3 int count,m,n; 4 int dir[4][2]={-1,0,1,0,0,-1,0,1}; 5 char map[21][21]; 6 void DFS(int i,int j) 7 { 8 if(i<=0||i>m||j<=0||j>n) 9 return;10 for(int k=0;k<4;++k)11 if(i+dir[k][0]>0&&i+dir 阅读全文
posted @ 2012-06-21 17:14 可笑痴狂 阅读(245) 评论(0) 推荐(0)
HDOJ-1232 畅通工程
摘要:畅通工程Time Limit: 4000/2000 MS (Java/Others)Memory Limit: 65536/32768 K (Java/Others)Total Submission(s): 15547Accepted Submission(s): 7974Problem Description某省调查城镇交通状况,得到现有城镇道路统计表,表中列出了每条道路直接连通的城镇。省政府“畅通工程”的目标是使全省任何两个城镇间都可以实现交通(但不一定有直接的道路相连,只要互相间接通过道路可达即可)。问最少还需要建设多少条道路? Input测试输入包含若干测试用例。每个测试用例的第1行给 阅读全文
posted @ 2012-06-14 10:32 可笑痴狂 阅读(291) 评论(0) 推荐(0)
HDOJ-1016 Prime Ring Problem
摘要:Prime Ring ProblemTime Limit: 4000/2000 MS (Java/Others)Memory Limit: 65536/32768 K (Java/Others)Total Submission(s): 12758Accepted Submission(s): 5785Problem DescriptionA ring is compose of n circles as shown in diagram. Put natural number 1, 2, ..., n into each circle separately, and the sum of nu 阅读全文
posted @ 2012-06-11 23:05 可笑痴狂 阅读(224) 评论(0) 推荐(0)
HDOJ-1269 迷宫城堡
摘要:迷宫城堡Time Limit: 2000/1000 MS (Java/Others)Memory Limit: 65536/32768 K (Java/Others)Total Submission(s): 2944Accepted Submission(s): 1264Problem Description为了训练小希的方向感,Gardon建立了一座大城堡,里面有N个房间(N<=10000)和M条通道(M<=100000),每个通道都是单向的,就是说若称某通道连通了A房间和B房间,只说明可以通过这个通道由A房间到达B房间,但并不说明通过它可以由B房间到达A房间。Gardon需要请 阅读全文
posted @ 2012-06-06 23:01 可笑痴狂 阅读(283) 评论(0) 推荐(0)
nyoj-27 水池数目
摘要:水池数目时间限制:3000ms |内存限制:65535KB难度:4描述南阳理工学院校园里有一些小河和一些湖泊,现在,我们把它们通一看成水池,假设有一张我们学校的某处的地图,这个地图上仅标识了此处是否是水池,现在,你的任务来了,请用计算机算出该地图中共有几个水池。输入第一行输入一个整数N,表示共有N组测试数据每一组数据都是先输入该地图的行数m(0<m<100)与列数n(0<n<100),然后,输入接下来的m行每行输入n个数,表示此处有水还是没水(1表示此处是水池,0表示此处是地面)输出输出该地图中水池的个数。要注意,每个水池的旁边(上下左右四个位置)如果还是水池的话的话, 阅读全文
posted @ 2012-06-04 12:41 可笑痴狂 阅读(509) 评论(0) 推荐(0)
NYOJ-42 一笔画问题
摘要:一笔画问题时间限制:3000ms |内存限制:65535KB难度:4描述zyc从小就比较喜欢玩一些小游戏,其中就包括画一笔画,他想请你帮他写一个程序,判断一个图是否能够用一笔画下来。规定,所有的边都只能画一次,不能重复画。输入第一行只有一个正整数N(N 3 #include 4 int p[1005],visit[1005],G[1005][1005]; 5 int point,line; 6 7 void DFS(int i) 8 { 9 int v=i;10 visit[i]=1;11 for(v=0;v 2 #include 3 #include 4 5 ... 阅读全文
posted @ 2012-06-04 12:33 可笑痴狂 阅读(926) 评论(0) 推荐(0)

上一页 1 2