結果
問題 |
No.3156 Count That Day's N
|
ユーザー |
![]() |
提出日時 | 2025-05-23 20:27:21 |
言語 | C++23 (gcc 13.3.0 + boost 1.87.0) |
結果 |
TLE
|
実行時間 | - |
コード長 | 1,253 bytes |
コンパイル時間 | 3,129 ms |
コンパイル使用メモリ | 278,860 KB |
実行使用メモリ | 7,844 KB |
最終ジャッジ日時 | 2025-05-23 20:27:30 |
合計ジャッジ時間 | 8,046 ms |
ジャッジサーバーID (参考情報) |
judge5 / judge3 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 2 TLE * 1 -- * 1 |
other | -- * 32 |
ソースコード
#ifndef ONLINE_JUDGE #define _GLIBCXX_DEBUG #endif #include<bits/stdc++.h> using namespace std; using ll = long long; //https://boostjp.github.io/tips/multiprec-int.html #define YES cout<<"Yes"<<endl #define NO cout<<"No"<<endl #define YN {cout<<"Yes"<<endl;}else{cout<<"No"<<endl;}// if(a==b)YN; #define NO2 cout<<-1<<endl #define rep(i, n) for (int i = 0; i < (int)(n); ++i) #define rrep(i, n) for (int i=int(n)-1; i>=0; --i) #define all(a) a.begin(),a.end() #define rall(a) a.rbegin(),a.rend() int main() { ll K, N; cin >> K >> N; vector<ll> X, Y; ll n = 1; ll x = 1; while (x <= N) { X.emplace_back(x); n++; x = n*n*n*n*n*n; } n = 1; ll y = 1; while (y <= N) { Y.emplace_back(y); n++; y = n*n*n*n; } ll num = K; ll d = 1; ll ans = 0; while (num <= N) { //cerr << d << endl; int pos = lower_bound(all(X), num) - X.begin(); rep(i, pos) { ll res = num - X[i]; if (binary_search(all(Y), res)) { ans++; //cerr << d << ' ' << X[i] << ' ' << endl; break; } } d++; num = K*d*d; } cout << ans << endl; }