P10993 题解

· · 题解

思路

首先将 a 乘上 37

然后取 a 的末位,即为 x

然后拆位,判断是是否满足每一位都等于 x

AC CODE

#include<bits/stdc++.h>
using namespace std;
int read(){int x=0;char f=1,ch=getchar();while(ch<'0'||ch>'9'){if(ch=='-')f=-1;ch=getchar();}while(ch>='0'&&ch<='9')x=x*10+ch-'0',ch=getchar();return x*f;}

int main(){
    int n=read()*37;
    int x=n%10;n/=10;
    while(n){
        int temp=n%10;
        if(temp!=x)
            return printf("No\n"),0;
        n/=10;
    }
    printf("Yes\n");
    return 0;
}