Submission
Status:
[PPPPPPPPPP]
Subtask/Task Score:
{100/100}
Score: 100
User: Bunkoblong
Problemset: ตรวจบัตรเครดิต
Language: cpp
Time: 0.003 second
Submitted On: 2025-10-02 17:03:56
#include<iostream>
#include<string>
using namespace std;
int main(){
string c;
while(cin>>c){
int n=0;
bool doubleDigit=false;
for(int i=c.size()-1;i>=0;i--){
int digit=c[i]-'0';
if(doubleDigit){
digit=digit*2;
if(digit>9){
digit=digit-9;
}
}
n+=digit;
doubleDigit= !doubleDigit;
}
if (n%10==0){
cout<<"yes";
} else{
cout<<"no";
}
}
}