結果
| 問題 |
No.3156 Count That Day's N
|
| コンテスト | |
| ユーザー |
ゼリトキ
|
| 提出日時 | 2025-05-23 19:20:43 |
| 言語 | C++23 (gcc 13.3.0 + boost 1.87.0) |
| 結果 |
AC
|
| 実行時間 | 98 ms / 3,000 ms |
| コード長 | 826 bytes |
| コンパイル時間 | 2,983 ms |
| コンパイル使用メモリ | 278,424 KB |
| 実行使用メモリ | 7,844 KB |
| 最終ジャッジ日時 | 2025-05-23 19:20:49 |
| 合計ジャッジ時間 | 5,260 ms |
|
ジャッジサーバーID (参考情報) |
judge3 / judge1 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 4 |
| other | AC * 32 |
ソースコード
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (ll i = 0; i < (ll)(n); i++)
#define ll long long
const long long mod=998244353;
const long long hmod=46216567629137;
ll SQRT(ll a){
ll l=0,r=2e9;
while(l!=r){
ll m=(l+r)/2;
if(m*m<a) l=m+1;
else r=m;
}
return l;
}
int main(){
cin.tie(0)->sync_with_stdio(0);
cout.tie(0);
ll K,N;
cin>>K>>N;
set<ll>ans;
for(ll x=1;x<=1000;x++){
for(ll y=1;y<=10000;y++){
ll cnt=x*x*x*x*x*x+y*y*y*y;
if(cnt<=N){
if(cnt%K==0){
cnt/=K;
ll b=SQRT(cnt);
if(cnt==b*b){
ans.insert(cnt);
}
}
}
}
}
cout<<ans.size()<<"\n";
}
ゼリトキ