Submission #60544653
Source Code Expand
Copy
#include <bits/stdc++.h>using namespace std;using ll = long long;using vi = vector<int>;using vl = vector<long long>;using vs = vector<string>;using vc = vector<char>;using vb = vector<bool>;using pii = pair<int, int>;using pll = pair<long long, long long>;using vpii = vector<pair<int, int>>;using vpll = vector<pair<long long, long long>>;using vvi = vector<vector<int>>;using vvl = vector<vector<long long>>;using vvc = vector<vector<char>>;using vvb = vector<vector<bool>>;using vvvi = vector<vector<vector<int>>>;#define rep(i, n) for (int i = 0; i < (int)(n); i++)#define all(x) (x).begin(), (x).end()
#include <bits/stdc++.h> using namespace std; using ll = long long; using vi = vector<int>; using vl = vector<long long>; using vs = vector<string>; using vc = vector<char>; using vb = vector<bool>; using pii = pair<int, int>; using pll = pair<long long, long long>; using vpii = vector<pair<int, int>>; using vpll = vector<pair<long long, long long>>; using vvi = vector<vector<int>>; using vvl = vector<vector<long long>>; using vvc = vector<vector<char>>; using vvb = vector<vector<bool>>; using vvvi = vector<vector<vector<int>>>; #define rep(i, n) for (int i = 0; i < (int)(n); i++) #define all(x) (x).begin(), (x).end() #define INFTY (1 << 30) #define EPS (1e-7) #define equal(a, b) (fabs((a) - (b)) < EPS) template <typename T> inline bool chmax(T &a, T b) { return ((a < b) ? (a = b, true) : (false)); } template <typename T> inline bool chmin(T &a, T b) { return ((a > b) ? (a = b, true) : (false)); } bool prime(int n) { // 0,1の場合は素数ではない if (n < 2) return false; // √n まででよいということは i*i<=n までチェックすることと同じ for (int i = 2; i * i <= n; i++) { if (n % i == 0) { return false; } } // 1と自分自身以外で割り切れる数が無かったので素数 return true; } int main() { ll n; cin >> n; // 候補となる素因数をリストアップ vl kouho; rep(i, int(std::sqrt(n)) / 2 + 2) { if (prime(i)) { kouho.push_back(i); } } ll ans = 0; rep(i, kouho.size()) { ll a1 = std::pow(kouho[i], 2); if (a1 < n) { rep(j, kouho.size() - i - 1) { ll a2 = std::pow(kouho[i + j + 1], 2); if (a2 > n) { break; } if (a1 * a2 <= n) { ans += 1; } else { break; } } } } cout << ans << endl; return 0; }
Submission Info
Submission Time | |
---|---|
Task | D - 9 Divisors |
User | pika2 |
Language | C++ 23 (gcc 12.2) |
Score | 0 |
Code Size | 2009 Byte |
Status | WA |
Exec Time | 124 ms |
Memory | 4312 KB |
Judge Result
Set Name | Sample | All | ||||||||
---|---|---|---|---|---|---|---|---|---|---|
Score / Max Score | 0 / 0 | 0 / 400 | ||||||||
Status |
|
|
Set Name | Test Cases |
---|---|
Sample | 00_sample_01.txt, 00_sample_02.txt |
All | 00_sample_01.txt, 00_sample_02.txt, 01_test_01.txt, 01_test_02.txt, 01_test_03.txt, 01_test_04.txt, 01_test_05.txt, 01_test_06.txt, 01_test_07.txt, 01_test_08.txt, 01_test_09.txt, 01_test_10.txt, 01_test_11.txt, 01_test_12.txt, 01_test_13.txt, 01_test_14.txt, 01_test_15.txt, 01_test_16.txt, 01_test_17.txt, 01_test_18.txt, 01_test_19.txt, 01_test_20.txt, 01_test_21.txt, 01_test_22.txt, 01_test_23.txt, 01_test_24.txt, 01_test_25.txt, 01_test_26.txt, 01_test_27.txt, 01_test_28.txt, 01_test_29.txt, 01_test_30.txt, 01_test_31.txt, 01_test_32.txt |
Case Name | Status | Exec Time | Memory |
---|---|---|---|
00_sample_01.txt | AC | 1 ms | 3432 KB |
00_sample_02.txt | WA | 123 ms | 4260 KB |
01_test_01.txt | AC | 1 ms | 3576 KB |
01_test_02.txt | AC | 1 ms | 3524 KB |
01_test_03.txt | AC | 1 ms | 3532 KB |
01_test_04.txt | AC | 1 ms | 3524 KB |
01_test_05.txt | AC | 1 ms | 3696 KB |
01_test_06.txt | WA | 57 ms | 3860 KB |
01_test_07.txt | WA | 20 ms | 3580 KB |
01_test_08.txt | WA | 104 ms | 4156 KB |
01_test_09.txt | WA | 114 ms | 4236 KB |
01_test_10.txt | WA | 46 ms | 3816 KB |
01_test_11.txt | WA | 123 ms | 4172 KB |
01_test_12.txt | WA | 50 ms | 3900 KB |
01_test_13.txt | WA | 49 ms | 3768 KB |
01_test_14.txt | WA | 62 ms | 3656 KB |
01_test_15.txt | WA | 118 ms | 4252 KB |
01_test_16.txt | WA | 82 ms | 3768 KB |
01_test_17.txt | WA | 52 ms | 3880 KB |
01_test_18.txt | WA | 43 ms | 3860 KB |
01_test_19.txt | WA | 106 ms | 4204 KB |
01_test_20.txt | WA | 15 ms | 3748 KB |
01_test_21.txt | AC | 1 ms | 3556 KB |
01_test_22.txt | AC | 1 ms | 3456 KB |
01_test_23.txt | AC | 1 ms | 3552 KB |
01_test_24.txt | WA | 124 ms | 4212 KB |
01_test_25.txt | WA | 124 ms | 4212 KB |
01_test_26.txt | WA | 124 ms | 4248 KB |
01_test_27.txt | WA | 124 ms | 4184 KB |
01_test_28.txt | WA | 123 ms | 4044 KB |
01_test_29.txt | WA | 124 ms | 4236 KB |
01_test_30.txt | WA | 113 ms | 4312 KB |
01_test_31.txt | WA | 113 ms | 4268 KB |
01_test_32.txt | WA | 113 ms | 4244 KB |