結果
問題 |
No.3156 Count That Day's N
|
ユーザー |
![]() |
提出日時 | 2025-05-25 00:50:55 |
言語 | C++23 (gcc 13.3.0 + boost 1.87.0) |
結果 |
AC
|
実行時間 | 185 ms / 3,000 ms |
コード長 | 824 bytes |
コンパイル時間 | 3,135 ms |
コンパイル使用メモリ | 278,384 KB |
実行使用メモリ | 29,952 KB |
最終ジャッジ日時 | 2025-05-25 00:51:00 |
合計ジャッジ時間 | 4,710 ms |
ジャッジサーバーID (参考情報) |
judge1 / judge3 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 4 |
other | AC * 32 |
ソースコード
#include <bits/stdc++.h> using namespace std; #ifdef LOCAL #include "settings/debug.cpp" #else #define Debug(...) void(0) #endif #define rep(i, n) for (int i = 0; i < (n); ++i) using ll = long long; using ull = unsigned long long; inline bool is_sqr(ll x) { ll s = sqrt(x); for (ll i = s - 5; i <= s + 5; ++i) { if (i * i == x) return true; } return false; } int main() { cin.tie(nullptr)->sync_with_stdio(false); ll k, n; cin >> k >> n; set<ll> cand; for (ll x = 1; x * x * x * x * x * x <= n; ++x) { for (ll y = 1; y * y * y * y <= n; ++y) { ll a = x * x * x * x * x * x + y * y * y * y; if (a > n) break; if (a % k != 0) continue; cand.insert(a / k); } } int ans = 0; for (ll x : cand) { if (is_sqr(x)) ++ans; } cout << ans << '\n'; return 0; }