#46338: cpp ans


1130335@stu.wghs.tp.edu.tw (Quincy)

學校 : 臺北市私立薇閣高級中學
編號 : 294858
來源 : [60.248.154.139]
最後登入時間 :
2025-09-19 12:47:48

#include <iostream>
using namespace std;

int main() 
{
  string s;
  int slen;
  while(cin>>s){
    if(s=="0")break;
    slen=s.length();
    int k=0;
    for(int i=0;i<slen;i++){
      int n = s[i]-'0';
      if(i%2==0){k=k+n;}
      else{k=k-n;}
    }
    if(k%11==0){cout<<s<<" is a multiple of 11."<<endl;}
    else{cout<<s<<" is not a multiple of 11."<<endl;}
  }
    return 0;
}