結果
| 問題 | No.3156 Count That Day's N |
| コンテスト | |
| ユーザー |
tnakao0123
|
| 提出日時 | 2025-05-24 16:19:33 |
| 言語 | C++17 (gcc 15.2.0 + boost 1.90.0) |
| 結果 |
AC
|
| 実行時間 | 7 ms / 3,000 ms |
| + 773µs | |
| コード長 | 746 bytes |
| 記録 | |
| コンパイル時間 | 347 ms |
| コンパイル使用メモリ | 88,396 KB |
| 実行使用メモリ | 5,888 KB |
| 最終ジャッジ日時 | 2026-07-11 01:46:35 |
| 合計ジャッジ時間 | 2,150 ms |
|
ジャッジサーバーID (参考情報) |
judge1_0 / judge3_0 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 4 |
| other | AC * 32 |
ソースコード
/* -*- coding: utf-8 -*-
*
* 3156.cc: No.3156 Count That Day's N - yukicoder
*/
#include<cstdio>
#include<cmath>
#include<set>
#include<algorithm>
using namespace std;
/* constant */
/* typedef */
using ll = long long;
using sl = set<ll>;
/* global variables */
/* subroutines */
inline ll pow4(ll x) { return x * x * x * x; }
inline ll pow6(ll x) { return pow4(x) * x * x; }
/* main */
int main() {
ll k, n;
scanf("%lld%lld", &k, &n);
//printf("k=%lld, n=%lld\n", k, n);
sl as;
for (ll x = 1, x6; (x6 = pow6(x)) <= n; x++)
for (ll y = 1, a; (a = x6 + pow4(y)) <= n; y++) {
ll z = sqrt(0.5 + a / k);
if (z > 0 && a == z * z * k) as.insert(a);
}
printf("%d\n", (int)as.size());
return 0;
}
tnakao0123