11118 번 : Bicycle puzzle 
 11118 번 
 11118 번 - Bicycle puzzle 
 1 초 256 MB 13 7 7 53 . 846 % 
 Per and Gunnar has found a wonderful online bicycle picture puzzle flash solitaire game , and since they are very competitive , they want to find out who is best . The purpose of the game is to descramble a picture of a bicycle . At the start of each game , the picture of the bicycle is cut into W times H equally sized rectangles and scrambled randomly . Then the player repeatedly chooses two arbitrary rectangles and swaps them . He continues to swap rectangles until the picture is complete again . The game keeps track of the number of swaps , which is the score for that particular playthrough . 
 Per quickly writes a program to find out the probability that he can beat Gunnar ’ s score ( assuming that all scrambled pictures are equally probable ) if he plays optimally . But he is not sure whether his program is correct and wants to verify its correctness by challenging you to write the same program . 
 0 < H ≤ 4 
 0 ≤ S ≤ W · H 
 When comparing two scores , the lowest one is best 
 For each scenario , output a line with the probability that Per beats Gunnar ’ s score . Format the probability as an irreducible fraction where the numerator and the denominator are separated by / . Output only the numerator if the answer is an integer . 
 Contest > IDI Open Contest > IDI Open 2009 B 번