結果
| 問題 |
No.3156 Count That Day's N
|
| コンテスト | |
| ユーザー |
ha_chan
|
| 提出日時 | 2025-05-23 19:14:49 |
| 言語 | C++17 (gcc 13.3.0 + boost 1.87.0) |
| 結果 |
AC
|
| 実行時間 | 110 ms / 3,000 ms |
| コード長 | 1,061 bytes |
| コンパイル時間 | 2,078 ms |
| コンパイル使用メモリ | 197,688 KB |
| 実行使用メモリ | 7,844 KB |
| 最終ジャッジ日時 | 2025-05-23 19:14:57 |
| 合計ジャッジ時間 | 6,473 ms |
|
ジャッジサーバーID (参考情報) |
judge2 / judge4 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 4 |
| other | AC * 32 |
ソースコード
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
typedef vector<int> VI;
typedef vector<VI> VVI;
typedef vector<long long> VL;
typedef vector<VL> VVL;
typedef long long LL;
#define all(a) (a).begin(), (a).end()
#define Yes(n) cout << ((n) ? "Yes" : "No" ) << endl
#define YES(n) cout << ((n) ? "YES" : "NO" ) << endl
#define ALL(a) (a).begin(),(a).end()
#define pb push_back
LL aaa;
bool han(LL n){
LL m=sqrt(n*1.0)-10;
m=max(m,LL(0));
rep(i,12){
if(m*m==n){
//cout<<m<<endl;
aaa=m;return 1;}
m++;
}
return 0;
}
int main() {
int ans=0;
LL k,n;cin>>k>>n;
//cout<<n<<endl;
set<LL> D;
for(LL x=1;x<=1000;x++)for(LL y=1;y<=10000;y++){
LL p=x*x*x,q=y*y;
p=p*p;q=q*q;
LL nn=p+q;
//if(x==3&&y==6){cout<<nn<<endl;}
if(nn%k==0&&nn<=n){
LL m=nn/k;
//cout<<m<<endl;
//if(x==3&&y==6){cout<<m<<endl;}
if(han(m)){
//cout<<x<<' '<<y<<' '<<aaa<<endl;
D.insert(nn);
}
}
}
//han(16);
cout<<D.size()<<endl;
}
ha_chan