UVA-11344 - The Huge One
19 May 2018
- UVa Online Judge 解題結果請於 Submit 後,參閱 uHunt。
- 如果你有任何建議與指教,歡迎於下方留言一起討論喔!
- 本題選為「20161004 大學程式能力檢定 CPE」題目。
題意概要
試求一個大整數是否能被一個正整數集和中的所有數字整除,集合中的數字範圍: - 。
- 分析:本題為模擬「大數除法」,大數部分記得以「字串 (或字元陣列)」的方式存取。模擬的方式請參考 我的程式 中的
wonderful()
函式。
Input
First line of input data contains number (). Then tests follow each described on two lines. First line of each test case contains number . Second line contains the number of elements in a set followed by a space and the numbers in the set. Numbers of this set are separated by a space character.
Output
Output one line for each test case: M - Wonderful.
, if the number is wonderful or M - Simple.
if it is not. Replace character with the corresponding number. Refer output data for details.
Sample Input
4
0
12 1 2 3 4 5 6 7 8 9 10 11 12
379749833583241
1 11
3909821048582988049
1 7
10
3 1 2 9
Sample Output
0 - Wonderful.
379749833583241 - Wonderful.
3909821048582988049 - Wonderful.
10 - Simple.