02 2012 档案
摘要:DescriptionOn Planet MM-21, after their Olympic games this year, curling is getting popular. But the rules are somewhat different from ours. The game is played on an ice game board on which a square mesh is marked. They use only a single stone. The purpose of the game is to lead the stone from the s
阅读全文
摘要:DescriptionThe cornfield maze is a popular Halloween treat. Visitors are shown the entrance and must wander through the maze facing zombies, chainsaw-wielding psychopaths, hippies, and other terrors on their quest to find the exit.One popular maze-walking strategy guarantees that the visitor will ev
阅读全文
摘要:Description 给定一个m × n (m行, n列)的迷宫,迷宫中有两个位置,gloria想从迷宫的一个位置走到另外一个位置,当然迷宫中有些地方是空地,gloria可以穿越,有些地方是障碍,她必须绕行,从迷宫的一个位置,只能走到与它相邻的4个位置中,当然在行走过程中,gloria不能走到迷宫外面去。令人头痛的是,gloria是个没什么方向感的人,因此,她在行走过程中,不能转太多弯了,否则她会晕倒的。我们假定给定的两个位置都是空地,初始时,gloria所面向的方向未定,她可以选择4个方向的任何一个出发,而不算成一次转弯。gloria能从一个位置走到另外一个位置吗?Input 第
阅读全文
摘要:DescriptionMany geometry(几何)problems were designed in the ACM/ICPC. Andnow, I also prepare a geometry problem for this final exam. According to theexperience of many ACMers, geometry problems are always much trouble, but thisproblem is very easy, after all we are now attending an exam, not a contest
阅读全文
摘要:DescriptionBackgroundThe knight is getting bored of seeing the same black and white squares again and again and has decided to make a journeyaround the world. Whenever a knight moves, it is two squares in one direction and one square perpendicular to this. The world of a knight is the chessboard he
阅读全文
摘要:Description在N*N的方格棋盘放置了N个皇后,使得它们不相互攻击(即任意2个皇后不允许处在同一排,同一列,也不允许处在与棋盘边框成45角的斜线上。你的任务是,对于给定的N,求出有多少种合法的放置方法。Input共有若干行,每行一个正整数N≤10,表示棋盘和皇后的数量;如果N=0,表示结束。Output共有若干行,每行一个正整数,表示对应输入行的皇后的不同放置数量。Sample Input1850Sample Output19210 题目链接:http://acm.hdu.edu.cn/showproblem.php?pid=2553 DFS+回溯 低效:#include<std
阅读全文
摘要:跟风发个这种蛋疼文体。普通程序员void swap(int &a,int &b){ int temp; temp=a; a=b; b=temp;}文艺程序员void swap(int &a,int &b){ a=a^b; b=a^b; a=a^b;}2B程序员void swap(int a,int b){ int temp; temp=a; a=b; b=temp;}希望能引起广大苦逼的正在学或者已经学过c++人的共鸣和会心一笑吧。。
阅读全文
摘要:DescriptionThere is a rectangular room, covered with square tiles. Each tile is colored either red or black. A man is standing on a black tile. From a tile, he can move to one of four adjacent tiles. But he can't move on red tiles, he can move only on black tiles.Write a program to count the num
阅读全文

浙公网安备 33010602011771号