Submission
Status:
[PPPPPPPPPP]
Subtask/Task Score:
{100/100}
Score: 100
User: new2
Problemset: ตรวจบัตรเครดิต
Language: cpp
Time: 0.002 second
Submitted On: 2025-12-18 18:28:35
#include <bits/stdc++.h>
using namespace std;
int main(){
string n;
cin >> n;
int last = n[15] - '0';
int ans = 0;
for (int i = 0; i <= 14; i++){
int t = n[i] - '0';
if (i % 2 == 0) {
t *= 2;
if (t >= 10) {
ans += (t/10) + (t%10);
}
else ans += t;
}
else ans += t;
}
if (((10-(ans%10))%10) == last) cout << "yes";
else cout << "no";
}