#39328: c++ ac


yp11251120@yphs.tp.edu.tw (708-43劉濟緯)

學校 : 臺北市私立延平高級中學
編號 : 237257
來源 : [203.72.178.1]
最後登入時間 :
2024-04-18 17:28:22
d124. 3的倍数 | From: [118.150.212.230] | 發表日期 : 2024-02-06 20:54


#include <bits/stdc++.h>
using namespace std;
int main()
{
    string a;
    int b=0;
    while(cin>>a)
    {
        for(int i=0; i<a.length(); i++)
        {
            b+=a[i]-'0';
        }
        if(b==0) cout<<"yes"<<endl;
        else if(b%3==0) cout<<"yes"<<endl;
        else cout<<"no"<<endl;
        b=0;
    }


}

 
ZeroJudge Forum