teacher_code_c/优秀正整数.cpp

58 lines
1.2 KiB
C++

//#include <iostream>
//#include <cmath>
//#include <vector>
//using namespace std;
//
//const long long MOD = 998244353;
//
//// 计算一个数各位数字之和
//long long digitSum(long long a) {
// long long sum = 0;
// while (a != 0) {
// sum += a % 10;
// a /= 10;
// }
// return sum;
//}
//
//// 判断一个数是否为质数
//bool isPrime(long long b) {
// if (b <= 1) return false;
// if (b == 2) return true;
// if (b % 2 == 0) return false;
// for (long long i = 3; i * i <= b; i ++) {
// if (b % i == 0) {
// return false;
// }
// }
// return true;
//}
//
//int main() {
// int64_t L, R;
// cin >> L >> R;
// long long product = 1;
// bool found = false;
//
// long long start = ceil(sqrt(L));
// long long end = floor(sqrt(R));
//
// for (long long i = start; i <= end; i++) {
// long long square = i * i;
// if (square >= L && square <= R && isPrime(digitSum(square))) {
// product = (product * square) % MOD;
//
// found = true;
// }
// }
//
// if (found) {
// cout << product << endl;
// }
// else {
// cout << 0 << endl;
// }
//
// return 0;
//}