跳到正文

题解

题解:P10993 【MX-J3-T0】 37

chenlc约 1 分钟
原文
文章信息与版本

文章信息

发布
2025年9月19日
收录
2025年12月12日
更新
2026年11月17日
篇幅
约 1 分钟
题目
P10993

版本

  1. v1当前

思路

这道题算出 37×a37\times a,在遍历 37×a37\times a 的每一个位上的数是否相等。如果每一个位上的数都相等,输出 Yes,否则输出 No。

代码

C++
#include <bits/stdc++.h>
using namespace std;
int main(){
	int a;
	cin >> a;
	int num = a * 37;
	string s = to_string(num);
	for(int i = 1; i < s.size(); i++){
		if(s[i] != s[i - 1]){
			cout << "No" << endl;
			return 0;
		}
	}
	cout << "Yes" << endl;
}
原文