結果
| 問題 | No.3156 Count That Day's N | 
| コンテスト | |
| ユーザー |  umezo | 
| 提出日時 | 2025-05-24 05:46:50 | 
| 言語 | C++23 (gcc 13.3.0 + boost 1.87.0) | 
| 結果 | 
                                AC
                                 
                             | 
| 実行時間 | 2,175 ms / 3,000 ms | 
| コード長 | 735 bytes | 
| コンパイル時間 | 4,164 ms | 
| コンパイル使用メモリ | 279,936 KB | 
| 実行使用メモリ | 86,912 KB | 
| 最終ジャッジ日時 | 2025-08-06 13:26:41 | 
| 合計ジャッジ時間 | 75,480 ms | 
| ジャッジサーバーID (参考情報) | judge2 / judge1 | 
(要ログイン)
| ファイルパターン | 結果 | 
|---|---|
| sample | AC * 4 | 
| other | AC * 32 | 
ソースコード
#include<bits/stdc++.h>
using namespace std;
#define rep(i,n) for(int i=0;i<(int)(n);i++)
#define ALL(v) v.begin(),v.end()
typedef long long ll;
template <class T> using V=vector<T>;
template <class T> using VV=V<V<T>>;
ll sqr(ll x){
  if(x<1) return 0;
  ll tmp=sqrt(x);
  if((tmp+1)<=x/(tmp+1)) return tmp+1;
  if(tmp<=x/tmp) return tmp;
  return tmp-1;
}
 
int main(){
  ios::sync_with_stdio(false);
  std::cin.tie(nullptr);
  
  set<ll> s;
  for(ll x=1;x<317;x++){
    for(ll y=1;y<5624;y++){
      s.insert(x*x*x*x*x*x+y*y*y*y);
    }
  }
  ll k,n;
  cin>>k>>n;
  int ans=0;
  for(auto x:s){
    if(x>n) break;
    if(x%k) continue;;
    ll t=x/k;
    ll a=sqr(t);
    if(a*a==t) ans++;
  }
  cout<<ans<<endl;
    
  return 0;
}
            
            
            
        