結果
| 問題 | No.3156 Count That Day's N | 
| コンテスト | |
| ユーザー |  a01sa01to | 
| 提出日時 | 2025-05-25 00:49:17 | 
| 言語 | C++23 (gcc 13.3.0 + boost 1.87.0) | 
| 結果 | 
                                AC
                                 
                             | 
| 実行時間 | 913 ms / 3,000 ms | 
| コード長 | 800 bytes | 
| コンパイル時間 | 2,996 ms | 
| コンパイル使用メモリ | 281,092 KB | 
| 実行使用メモリ | 82,560 KB | 
| 最終ジャッジ日時 | 2025-05-25 00:49:44 | 
| 合計ジャッジ時間 | 23,846 ms | 
| ジャッジサーバーID (参考情報) | judge5 / judge1 | 
(要ログイン)
| ファイルパターン | 結果 | 
|---|---|
| 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;
      cand.insert(a);
    }
  }
  int ans = 0;
  for (ll x : cand)
    if (x % k == 0 && is_sqr(x / k)) ++ans;
  cout << ans << '\n';
  return 0;
}
            
            
            
        