teacher_code_c/优秀正整数.cpp

58 lines
1.2 KiB
C++
Raw Permalink Normal View History

//#include <iostream>
//#include <cmath>
//#include <vector>
//using namespace std;
//
//const long long MOD = 998244353;
//
//// <20><><EFBFBD><EFBFBD>һ<EFBFBD><D2BB><EFBFBD><EFBFBD><EFBFBD><EFBFBD>λ<EFBFBD><CEBB><EFBFBD><EFBFBD>֮<EFBFBD><D6AE>
//long long digitSum(long long a) {
// long long sum = 0;
// while (a != 0) {
// sum += a % 10;
// a /= 10;
// }
// return sum;
//}
//
//// <20>ж<EFBFBD>һ<EFBFBD><D2BB><EFBFBD><EFBFBD><EFBFBD>Ƿ<EFBFBD>Ϊ<EFBFBD><CEAA><EFBFBD><EFBFBD>
//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;
//}