F.A.Q
Hand In Hand
Online Acmers
Problem Archive
Realtime Judge Status
Authors Ranklist
 
     C/C++/Java Exams     
ACM Steps
Go to Job
Contest LiveCast
ICPC@China
Best Coder beta
VIP | STD Contests
    DIY | Web-DIY beta
Author ID 
Password 
 Register new ID

Circle

Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 65536/65536 K (Java/Others)
Total Submission(s): 1036    Accepted Submission(s): 350


Problem Description
$\ \ \ \ $Satiya August is in charge of souls.

$\ \ \ \ $He finds $n$ souls,and lets them become a circle.He ordered them to play Joseph Games.The souls will count off from the soul $1$.The soul who is numbered $k$ will be taken out,and will not join in the game again.

$\ \ \ \ $Now Satiya August has got the sequence in the Out Ordered,and ask you the smallest $k$.If you cannot give him a correct answer,he will kill you!
 

Input
$\ \ \ \ $The first line has a number T,means testcase number.

$\ \ \ \ $Each test,first line has a number $n$.

$\ \ \ \ $The second line has $n$ numbers,which are the sequence in the Out Ordered**(The person who is out at $ai_{th}$ round was numbered $i$)**.

$\ \ \ \ $The sequence input must be a permutation from $1$ to $n$.

$\ \ \ \ 1\le T \le 10,2 \le n \le 20$.
 

Output
$\ \ \ \ $For each case,If there is a eligible number $k$,output the smallest $k$,otherwise,output¡±Creation August is a SB!¡±.
 

Sample Input
1 7 7 6 5 4 3 2 1
 

Sample Output
420
 

Source
 

Statistic | Submit | Discuss | Note
Hangzhou Dianzi University Online Judge 3.0
Copyright © 2005-2024 HDU ACM Team. All Rights Reserved.
Designer & Developer : Wang Rongtao LinLe GaoJie GanLu
Total 0.000000(s) query 1, Server time : 2024-06-22 04:15:42, Gzip enabled