#28123: CPP


11030067@mail.hpsh.tp.edu.tw (和平110級鄧雨珊)

學校 : 臺北市立和平高級中學
編號 : 163096
來源 : [61.64.210.174]
最後登入時間 :
2022-10-23 16:54:59
d235. 10929 - You can say 11 -- UVa10929 | From: [219.85.131.7] | 發表日期 : 2021-11-14 22:37

#include <iostream>
using namespace std;

int main(){
string s;
while (cin >> s){
if (s[0]=='0'){
break;
}
long long sum=0;
int sng=1;
for (int i=0; i<s.size(); i++){
sum+=sng*(s[i]-'0');
sng*=-1;
}
if (sum%11==0){
cout << s <<" is a multiple of 11.\n";
}
else {
cout << s <<" is not a multiple of 11.\n";
}
}
}
 
ZeroJudge Forum