摘要:Shuffle'm UpTime Limit:1000MSMemory Limit:65536KTotal Submissions:3016Accepted:1381DescriptionA common pastime for poker players at a poker table is to shuffle stacks of chips. Shuffling chips is performed by starting with two stacks of poker chips,S1andS2, each stack containingCchips. Each stac
阅读全文
随笔分类 - POJ
POJ solutions
摘要:Prime PathTime Limit:1000MSMemory Limit:65536KTotal Submissions:5585Accepted:3219DescriptionThe ministers of the cabinet were quite upset by the message from the Chief of Security stating that they would all have to change the four-digit room numbers on their offices.— It is a matter of security to
阅读全文
摘要:#include<iostream>#include<cstdio>using namespace std;int n;long long int q[9999999];void BFS(){ int front,rear; front=rear=0; q[rear]=1; rear++; long long int top; while(rear>front) { top = q[front]; if(top%n==0){ break; } top *= 10; q[rear++]=top; q[rear++]=top+1; front++; } printf(
阅读全文
摘要:Catch That CowTime Limit:2000MSMemory Limit:65536KTotal Submissions:22900Accepted:7027DescriptionFarmer John has been informed of the location of a fugitive cow and wants to catch her immediately. He starts at a pointN(0 ≤N≤ 100,000) on a number line and the cow is at a pointK(0 ≤K≤ 100,000) on the
阅读全文
摘要:Curling 2.0Time Limit:1000MSMemory Limit:65536KTotal Submissions:5175Accepted:2130DescriptionOn 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. The
阅读全文
摘要:Children of the Candy CornTime Limit:1000MSMemory Limit:65536KTotal Submissions:4901Accepted:2212DescriptionThe 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 t
阅读全文
摘要:棋盘问题Time Limit:1000MSMemory Limit:10000KTotal Submissions:11037Accepted:5405Description在一个给定形状的棋盘(形状可能是不规则的)上面摆放棋子,棋子没有区别。要求摆放时任意的两个棋子不能放在棋盘中的同一行或者同一列,请编程求解对于给定形状和大小的棋盘,摆放k个棋子的所有可行的摆放方案C。Input输入含有多组测试数据。每组数据的第一行是两个正整数,n k,用一个空格隔开,表示了将在一个n*n的矩阵内描述棋盘,以及摆放棋子的数目。 n <= 8 , k <= n当为-1 -1时表示输入结束。随后的n
阅读全文
摘要:Dungeon MasterTime Limit:1000MSMemory Limit:65536KTotal Submissions:8802Accepted:3431DescriptionYou are trapped in a 3D dungeon and need to find the quickest way out! The dungeon is composed of unit cubes which may or may not be filled with rock. It takes one minute to move one unit north, south, ea
阅读全文
摘要:A Knight's JourneyTime Limit:1000MSMemory Limit:65536KTotal Submissions:14310Accepted:4766DescriptionBackgroundThe 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 o
阅读全文
摘要:Colored SticksTime Limit:5000MSMemory Limit:128000KTotal Submissions:19454Accepted:5083DescriptionYou are given a bunch of wooden sticks. Each endpoint of each stick is colored with some color. Is it possible to align the sticks in a straight line such that the colors of the endpoints that touch are
阅读全文
摘要:A Bug's LifeTime Limit:10000MSMemory Limit:65536KTotal Submissions:16957Accepted:5446DescriptionBackgroundProfessor Hopper is researching the sexual behavior of a rare species of bugs. He assumes that they feature two different genders and that they only interact with bugs of the opposite gender
阅读全文
摘要:Wireless NetworkTime Limit:10000MSMemory Limit:65536KTotal Submissions:10043Accepted:4245DescriptionAn earthquake takes place in Southeast Asia. The ACM (Asia Cooperated Medical team) have set up a wireless network with the lap computers, but an unexpected aftershock attacked, all computers in the n
阅读全文
摘要:Cube StackingTime Limit:2000MSMemory Limit:30000KTotal Submissions:11443Accepted:3804Case Time Limit:1000MSDescriptionFarmer John and Betsy are playing a game with N (1 <= N <= 30,000)identical cubes labeled 1 through N. They start with N stacks, each containing a single cube. Farmer John asks
阅读全文
摘要:Navigation NightmareTime Limit:2000MSMemory Limit:30000KTotal Submissions:2033Accepted:848Case Time Limit:1000MSDescriptionFarmer John's pastoral neighborhood has N farms (2 <= N <= 40,000), usually numbered/labeled 1..N. A series of M (1 <= M < 40,000) vertical and horizontal roads
阅读全文
摘要:Find them, Catch themTime Limit:1000MSMemory Limit:10000KTotal Submissions:16443Accepted:4809DescriptionThe police office in Tadu City decides to say ends to the chaos, as launch actions to root up the TWO gangs in the city, Gang Dragon and Gang Snake. However, the police first needs to identify whi
阅读全文
摘要:The SuspectsTime Limit:1000MSMemory Limit:20000KTotal Submissions:10794Accepted:5120DescriptionSevere acute respiratory syndrome (SARS), an atypical pneumonia of unknown aetiology, was recognized as a global threat in mid-March 2003. To minimize transmission to others, the best strategy is to separa
阅读全文
摘要:Is It A Tree?Time Limit:1000MSMemory Limit:10000KTotal Submissions:10943Accepted:3762DescriptionA tree is a well-known data structure that is either empty (null, void, nothing) or is a set of one or more nodes connected by directed edges between nodes satisfying the following properties.There is exa
阅读全文
摘要:食物链Time Limit:1000MSMemory Limit:10000KTotal Submissions:22186Accepted:6379Description动物王国中有三类动物A,B,C,这三类动物的食物链构成了有趣的环形。A吃B, B吃C,C吃A。现有N个动物,以1-N编号。每个动物都是A,B,C中的一种,但是我们并不知道它到底是哪一种。有人用两种说法对这N个动物所构成的食物链关系进行描述:第一种说法是"1 X Y",表示X和Y是同类。第二种说法是"2 X Y",表示X吃Y。此人对N个动物,用上述两种说法,一句接一句地说出K句话,这K
阅读全文
摘要:Ubiquitous ReligionsTime Limit:5000MSMemory Limit:65536KTotal Submissions:13962Accepted:6676DescriptionThere are so many different religions in the world today that it is difficult to keep track of them all. You are interested in finding out how many different religions students in your university b
阅读全文
摘要:Fence RepairTime Limit:2000MSMemory Limit:65536KTotal Submissions:10913Accepted:3459DescriptionFarmer John wants to repair a small length of the fence around the pasture. He measures the fence and finds that he needsN(1 ≤N≤ 20,000) planks of wood, each having some integer lengthLi(1 ≤Li≤ 50,000) uni
阅读全文

浙公网安备 33010602011771号