結果
問題 |
No.3156 Count That Day's N
|
ユーザー |
![]() |
提出日時 | 2025-05-30 21:22:52 |
言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
結果 |
AC
|
実行時間 | 19 ms / 3,000 ms |
コード長 | 539 bytes |
コンパイル時間 | 1,705 ms |
コンパイル使用メモリ | 166,712 KB |
実行使用メモリ | 7,848 KB |
最終ジャッジ日時 | 2025-05-30 21:22:56 |
合計ジャッジ時間 | 3,598 ms |
ジャッジサーバーID (参考情報) |
judge2 / judge3 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 4 |
other | AC * 32 |
ソースコード
#include <bits/stdc++.h> using namespace std; using ll = long long; #define rep(i, n) for(int i = 0; i < n; i++) int main() { ll K, N; cin >> K >> N; int ans = 0; set<ll> st; for(ll x = 1; x * x * x * x * x * x < N; x++) { for(ll y = 1; y * y * y * y + x * x * x * x * x * x <= N; y++) { ll n = y * y * y * y + x * x * x * x * x * x; if(n % K) continue; ll d = n / K; double sq = sqrt(d); ll z = sq; if(z * z != d) continue; if(st.count(n)) continue; st.insert(n); ans++; } } cout << ans << endl; }