結果
| 問題 | No.3156 Count That Day's N | 
| コンテスト | |
| ユーザー |  北杜 | 
| 提出日時 | 2025-05-23 19:25:30 | 
| 言語 | C++23 (gcc 13.3.0 + boost 1.87.0) | 
| 結果 | 
                                AC
                                 
                             | 
| 実行時間 | 34 ms / 3,000 ms | 
| コード長 | 994 bytes | 
| コンパイル時間 | 2,902 ms | 
| コンパイル使用メモリ | 280,944 KB | 
| 実行使用メモリ | 7,844 KB | 
| 最終ジャッジ日時 | 2025-05-23 19:25:51 | 
| 合計ジャッジ時間 | 4,918 ms | 
| ジャッジサーバーID (参考情報) | judge4 / judge1 | 
(要ログイン)
| ファイルパターン | 結果 | 
|---|---|
| sample | AC * 4 | 
| other | AC * 32 | 
ソースコード
//#define _GLIBCXX_DEBUG
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (ll i = 0; i < (ll)(n); i++)
#define all(a) (a).begin(), (a).end()
using ll = long long;
const ll INF32 = 2e9;
const ll INF64 = 4e18;
void printYN(bool ok){
    if(ok)cout << "Yes" << endl;
    else cout << "No" << endl;
    return;
}
int main() {
    ll K, N;
    cin >> K >> N;
    set<ll> use;
    ll cnt = 0;
    for(ll i = 1; i < 1000; i++){
        for(ll j = 1; j < 10000; j++){
            if(i*i*i*i*i*i + j*j*j*j > N)continue;
            ll cand = i*i*i*i*i*i + j*j*j*j;
            if(cand%K!=0)continue;
            cand /= K;
            if(floor(sqrt((long double)cand))*floor(sqrt((long double)cand)) == cand || (floor(sqrt((long double)cand))+1)*(floor(sqrt((long double)cand))+1) == cand){
                if(!use.count(cand)){
                    use.insert(cand);
                    cnt++;
                }
            }
        }
    }
    cout << cnt << endl;
    return 0;
}
            
            
            
        