d235: Q10929: You can say 11

zerojudge網址:https://zerojudge.tw/ShowProblem?problemid=d235

作業上傳:http://203.68.236.9/problem/a0364

內容 :

你的任務是,給你一個正整數 N,判定它是否是 11 的倍數。

輸入說明 :

每列資料有一個正整數N,N 最大可能到 1000 位數。

若 N = 0 代表輸入結束

輸出說明 :

對每個輸入的數,輸出是否為 11 的倍數。輸出格式請參考 Sample Output。

範例輸入 :

112233

30800

2937

323455693

5038297

112234

0

範例輸出 :

112233 is a multiple of 11.

30800 is a multiple of 11.

2937 is a multiple of 11.

323455693 is a multiple of 11.

5038297 is a multiple of 11.

112234 is not a multiple of 11.

提示 :

出處 :

ACM 10929 (管理:pcsh710742)

解題策略

數字的奇數位的數字和與偶數位的數字和相減,若是11的倍數就是11的倍數。

C++程式碼

Python程式碼