Online JudgeProblem SetAuthorsOnline ContestsUser
Web Board
Home Page
F.A.Qs
Statistical Charts
Problems
Submit Problem
Online Status
Prob.ID:
Register
Update your info
Authors ranklist
Current Contest
Past Contests
Scheduled Contests
Award Contest
User ID:
Password:
  Register

Re:上海热身赛的题目

Posted by snuc at 2006-10-17 16:35:24
In Reply To:上海热身赛的题目 Posted by:snuc at 2006-10-17 16:34:34
Problem B
Binary string representing different numbers
Time Limit:10000MS Memory Limit:50000K
Description
Given m=2, we have the binary string 0011. If we let the head and end connected, we obtain a loop. Now
we get m elements from some position clockwise or counterclockwise. Then we start from the next
position. We obtain 4 strings of length 2: 00,01, 11, 10. They represent the decimal numbers 0, 1, 3, 2.
For m=3, we obtain the string 00010111 of length 8. By getting strings of length 3, we also obtain 8
decimal numbers 0, 1, 2, 5, 5, 7, 6, 4.
Now your job is to display such string with least order among the strings of length 2m.
Input
The first row of the input is a number n.
The next m rows are m numbers, one number m on each row, (0<m<=3).
Output
The output will consist of two lines for each line of input. You should print the words "m=#:", where # is
the serial number of the testing data. on the first line. Then print the required string of length 2m.
Sample Input
23
Sample Output
m=2:
0011
m=3:
00010111

Followed by:

Post your reply here:
User ID:
Password:
Title:

Content:

Home Page   Go Back  To top


All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator