摘要:PalindromesA regular palindrome is a string of numbers or letters that is the same forward as backward. For example, the string "ABCDEDCBA" is a palindrome because it is the same when the string is read from left to right as when the string is read from right to left.A mirrored string is a
阅读全文
摘要:Linear Cellular AutomataA biologist is experimenting with DNA modification of bacterial colonies being grown in a linear array of culture dishes. By changing the DNA, he is able ``program" the bacteria to respond to the population density of the neighboring dishes. Population is measured on a f
阅读全文
摘要:The Collatz SequenceAn algorithm given by Lothar Collatz produces sequences of integers, and is described as follows:Step 1:Choose an arbitrary positive integer A as the first item in the sequence.Step 2:If A = 1 then stop.Step 3:If A is even, then replace A by A / 2 and go to step 2.Step 4:If A is.
阅读全文
摘要:Hangman JudgeIn ``Hangman Judge,'' you are to write a program that judges a series of Hangman games. For each game, the answer to the puzzle is given as well as the guesses. Rules are the same as the classic game of hangman, and are given as follows:The contestant tries to solve to puzzle by
阅读全文
摘要:Triangle WaveIn this problem you are to generate a triangular wave form according to a specified pair of Amplitude and Frequency.Input and OutputThe input begins with a single positive integer on a line by itself indicating the number of the cases following, each of them as described below. This lin
阅读全文
摘要:Marvelous MazesYour mission, if you decide to accept it, is to create a maze drawing program. A maze will consist of the alphabetic characters A-Z, * (asterisk), and spaces.Input and OutputYour program will get the information for the mazes from the input file. This file will contain lines of charac
阅读全文
摘要:Rotating SentencesIn ``Rotating Sentences,'' you are asked to rotate a series of input sentences 90 degrees clockwise. So instead of displaying the input sentences from left to right and top to bottom, your program will display them from top to bottom and right to left.Input and OutputAs inp
阅读全文
摘要:Machined Surfaces An imaging device furnishes digital images of twomachined surfaces that eventually will be assembled in contact witheach other. The roughness of this final contact is to be estimated. A digital image is composed of the two characters, "X"and " " (space). There a
阅读全文
摘要:Kindergarten Counting GameEverybody sit down in a circle. Ok. Listen to me carefully.``Woooooo, you scwewy wabbit!''Now, could someone tell me how many words I just said?Input and OutputInput to your program will consist of a series of lines, each line containing multiple words (at least one
阅读全文
摘要:The DecoderWrite a complete program that will correctly decode a set of characters into a valid message. Your program should read a given file of a simple coded set of characters and print the exact message that the characters contain. The code key for this simple coding is a one for one character s
阅读全文
摘要:Problem AEcological PremiumInput: standard inputOutput: standard outputTime Limit: 1 secondMemory Limit: 32 MBGerman farmers are given a premium depending on the conditions at their farmyard. Imagine the following simplified regulation: you know the size of each farmer's farmyard in square meter
阅读全文
摘要:Problem BBack to High School PhysicsInput: standard inputOutput: standard outputA particle has initial velocity and constant acceleration. If its velocity after certain time is v then what will its displacement be in twice of that time?InputThe input will contain two integers in each line. Each line
阅读全文
摘要:Problem AHashmat the brave warrior Input: standard inputOutput: standard outputHashmat is a brave warrior who with his group of young soldiers moves from one place to another to fight against his opponents. Before fighting he just calculates one thing, the difference between his soldier number and t
阅读全文
摘要:1 #include <stdio.h> 2 #define MAXN 1000000 3 int a[MAXN] = { 0, 1, 2 }; 4 int getCycleLength(long long n) 5 { 6 if (n < MAXN && !a[n]) 7 return a[n] = getCycleLength(((n & 1) == 0) ? (n >> 1) : (3 * n + 1)) + 1; 8 else 9 if(n >= MAXN)10 return overBoundry(n);11 ...
阅读全文