原创 Puzzle, ACM/ICPC World Finals 1993, UVa227

有一個5*5的網格,其中恰好有一個格子是空的,其他格子各有一個字母。一共有4種指令:A, B, L, R,分別表示把空格上、下、左、右的相鄰字母移到空格中。輸入初始網格和指令序列(以數字0結束),輸出指令執行完畢後的網格。如果有非法指令,應

原创 Digit Generator, ACM/ICPC Seoul 2005, UVa1583

For a positive integer N, the digit-sum of N is defined as the sum of N itself and its digits. When M is the digitsum of

原创 Digit Generator, ACM/ICPC Seoul 2005, UVa1583

For a positive integer N, the digit-sum of N is defined as the sum of N itself and its digits. When M is the digitsum of