結果

問題 No.3156 Count That Day's N
ユーザー t98slider
提出日時 2025-06-01 19:11:56
言語 C++17
(gcc 13.3.0 + boost 1.87.0)
結果
AC  
実行時間 37 ms / 3,000 ms
コード長 636 bytes
コンパイル時間 2,217 ms
コンパイル使用メモリ 201,528 KB
実行使用メモリ 7,848 KB
最終ジャッジ日時 2025-06-01 19:12:00
合計ジャッジ時間 4,058 ms
ジャッジサーバーID
(参考情報)
judge2 / judge3
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 4
other AC * 32
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>
using namespace std;
using ll = long long;

int main(){
    ios::sync_with_stdio(false);
    cin.tie(0);
    ll k, n;
    cin >> k >> n;
    vector<ll> tmp;
    for(ll vx = 1, x = 1; vx <= n; x++, vx = x * x * x * x * x * x){
        for(ll vy = 1, y = 1; vx + vy <= n; y++, vy = y * y * y * y){
            ll v = vx + vy;
            ll d = v / k;
            if(v != d * k) continue;
            ll sqd = sqrtl(d);
            if(sqd * sqd == d) tmp.emplace_back(v);
        }
    }
    sort(tmp.begin(), tmp.end());
    tmp.erase(unique(tmp.begin(), tmp.end()), tmp.end());
    cout << tmp.size() << '\n';
}
0