Submission
Status:
[PPPPPPPPPP]
Subtask/Task Score:
{100/100}
Score: 100
User: 666whynot
Problemset: บาร์โค้ด
Language: cpp
Time: 0.002 second
Submitted On: 2025-07-28 12:52:21
#include <bits/stdc++.h>
using namespace std;
int main(){
ios::sync_with_stdio(false);cin.tie(0);
string s;cin >> s;
int n = s.size();
vector<int> a(n);
int ans = 0;
for(int i=0;i<n;i++){
a[i] = s[i] - '0';
}
for(int i=1;i<n;i += 2){
ans += a[i];
}
ans *= 3;
for(int i=2;i<n;i += 2){
ans += a[i];
}
ans += a[0];
if(ans % 10 == 0) cout << "YES";
else cout << "NO";
}