Online Judge | Problem Set | Authors | Online Contests | User | ||||||
---|---|---|---|---|---|---|---|---|---|---|
Web Board Home Page F.A.Qs Statistical Charts | Current Contest Past Contests Scheduled Contests Award Contest |
Language: Sheryl's Circuit II
Description After graduating from college, Sheryl intents to use her circuit to make money. (If you are not familiar with Sheryl’s circuit, turn to Problem 3605 for reference.) She attempts to develop her circuit into a periodic clock generator. The first thing Sheryl wants to know is how many rising edges and falling edges exist in the signal produced when the INPUT goes continuously from all 0s to all 1s. ((0, 0, 0... 0, 0) -> (0, 0, 0... 0, 1) -> (0, 0, 0... 1, 0) -> (0, 0, 0... 1, 1) -> ... -> (1, 1, 1... 1, 0) -> (1, 1, 1... 1, 1)) Figure 1 Consider the circuit showed in Figure 1, when the INPUT goes continuously from (0, 0, 0, 0) to (1, 1, 1, 1), the signal produced by the circuit is the sequence (0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0, 1) which consists of 3 rising edges and 2 falling edges respectively. Given Sheryl's circuit, your task is to calculate the number of rising edges and the number of falling edges. Since the answers might be very large, you are only required to output the numbers modulo 9973. Input There are multiple test cases. Output For each test case output the number of rising edges and the number of falling edges modulo 9973 in a separate line. Sample Input 1 4 1 0 1 Sample Output 3 2 Source |
[Submit] [Go Back] [Status] [Discuss]
All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator