結果
| 問題 | No.3156 Count That Day's N | 
| コンテスト | |
| ユーザー |  Cafe1942 | 
| 提出日時 | 2025-05-23 19:17:48 | 
| 言語 | C++17 (gcc 13.3.0 + boost 1.87.0) | 
| 結果 | 
                                WA
                                 
                             | 
| 実行時間 | - | 
| コード長 | 1,523 bytes | 
| コンパイル時間 | 1,302 ms | 
| コンパイル使用メモリ | 115,184 KB | 
| 実行使用メモリ | 7,848 KB | 
| 最終ジャッジ日時 | 2025-05-23 19:17:56 | 
| 合計ジャッジ時間 | 3,319 ms | 
| ジャッジサーバーID (参考情報) | judge2 / judge5 | 
(要ログイン)
| ファイルパターン | 結果 | 
|---|---|
| sample | AC * 3 WA * 1 | 
| other | AC * 22 WA * 10 | 
ソースコード
#include <iostream>
#include <iomanip>//小数点出力用
//cout << fixed << setprecision(10) << ans;
#include <cmath>
#include <algorithm>
#include <vector>
#include <queue>
#include <stack>
#include <set>
#include <unordered_set>
#include <map>
using ll = long long;
using namespace std;
#define modP7 1'000'000'007
#define modP 998244353
bool chkrng0idx(int pos, int sup) { return (0 <= pos && pos < sup); }
int clk4(int num) { return (num - 2) * (num % 2); }
void yn(bool tf) { cout << (tf ? "Yes\n" : "No\n"); }
int squareRoot(long long x) {
    int left = 1;
    int right = (int)1e8;
    int mid;
    while (right - left > 1) {
        mid = (right + left) / 2;
        if ((long long)mid * (long long)mid <= x) {
            left = mid;
        }
        else {
            right = mid;
        }
    }
    return left;
}
int main() {
    ll K;
    cin >> K;
    ll N;
    cin >> N;
    ll X[317];
    ll Y[5624];
    for (ll x = 1;x <= 316;x++) {
        X[x] = x * x * x * x * x * x;
    }
    for (ll y = 1;y <= 5623;y++) {
        Y[y] = y * y * y * y;
    }
    unordered_set <ll>ans;
    for (int i = 1;i <= 316;i++) {
        if (N < X[i])break;
        for (int j = 1;j <= 5623;j++) {
            if (N < X[i] + Y[j])break;
            if ((X[i] + Y[j]) % K == 0) {
                if (squareRoot((X[i] + Y[j]) / K) * squareRoot((X[i] + Y[j]) / K) == (X[i] + Y[j]) / K) {
                    ans.insert(X[i] + Y[j]);
                }
            }
        }
    }
    cout << ans.size();
    return 0;
}
            
            
            
        