64 lines
1.5 KiB
C++
64 lines
1.5 KiB
C++
|
//#include <iostream>
|
|||
|
//#include <cmath>
|
|||
|
//#include <vector>
|
|||
|
//using namespace std;
|
|||
|
//
|
|||
|
//const long long MOD = 998244353;
|
|||
|
//const int MAX_DIGIT_SUM = 162; // <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>λ<EFBFBD><CEBB><EFBFBD>ͣ<EFBFBD>999999999999 <20><>λ<EFBFBD><CEBB><EFBFBD><EFBFBD>Ϊ 162<36><32>
|
|||
|
//
|
|||
|
//// <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;
|
|||
|
//}
|
|||
|
//
|
|||
|
//// ʹ<>ð<EFBFBD><C3B0><EFBFBD><EFBFBD><EFBFBD>ɫ<EFBFBD><C9AB>ɸ<EFBFBD><C9B8>Ԥ<EFBFBD><D4A4><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|||
|
//vector<bool> sieve(int n) {
|
|||
|
// vector<bool> isPrime(n + 1, true);
|
|||
|
// isPrime[0] = isPrime[1] = false;
|
|||
|
// for (int i = 2; i * i <= n; ++i) {
|
|||
|
// if (isPrime[i]) {
|
|||
|
// for (int j = i * i; j <= n; j += i) {
|
|||
|
// isPrime[j] = false;
|
|||
|
// }
|
|||
|
// }
|
|||
|
// }
|
|||
|
// return isPrime;
|
|||
|
//}
|
|||
|
//
|
|||
|
//int main() {
|
|||
|
// long long L, R;
|
|||
|
// cin >> L >> R;
|
|||
|
//
|
|||
|
// // Ԥ<><D4A4><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>λ<EFBFBD><CEBB><EFBFBD><EFBFBD> [0, MAX_DIGIT_SUM] <20><>Χ<EFBFBD>ڵ<EFBFBD><DAB5><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|||
|
// vector<bool> primeTable = sieve(MAX_DIGIT_SUM);
|
|||
|
//
|
|||
|
// long long product = 1;
|
|||
|
// bool found = false;
|
|||
|
//
|
|||
|
// // <20><>ʽ<EFBFBD><CABD><EFBFBD><EFBFBD>ת<EFBFBD><D7AA>
|
|||
|
// long long start = static_cast<long long>(ceil(sqrt(L)));
|
|||
|
// long long end = static_cast<long long>(floor(sqrt(R)));
|
|||
|
//
|
|||
|
// for (long long i = start; i <= end; i++) {
|
|||
|
// long long square = i * i;
|
|||
|
// if (square >= L && square <= R && primeTable[digitSum(square)]) {
|
|||
|
// product = (product * square) % MOD;
|
|||
|
// found = true;
|
|||
|
// }
|
|||
|
// }
|
|||
|
//
|
|||
|
// if (found) {
|
|||
|
// cout << product << endl;
|
|||
|
// }
|
|||
|
// else {
|
|||
|
// cout << 0 << endl;
|
|||
|
// }
|
|||
|
//
|
|||
|
// return 0;
|
|||
|
//}
|