結果
| 問題 | No.3156 Count That Day's N |
| コンテスト | |
| ユーザー |
tnakao0123
|
| 提出日時 | 2025-05-24 16:19:33 |
| 言語 | C++17 (gcc 13.3.0 + boost 1.89.0) |
| 結果 |
AC
|
| 実行時間 | 28 ms / 3,000 ms |
| コード長 | 746 bytes |
| 記録 | |
| コンパイル時間 | 940 ms |
| コンパイル使用メモリ | 71,672 KB |
| 実行使用メモリ | 7,848 KB |
| 最終ジャッジ日時 | 2025-05-24 16:19:36 |
| 合計ジャッジ時間 | 2,902 ms |
|
ジャッジサーバーID (参考情報) |
judge2 / judge3 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 4 |
| other | AC * 32 |
コンパイルメッセージ
main.cpp: In function ‘int main()’:
main.cpp:31:8: warning: ignoring return value of ‘int scanf(const char*, ...)’ declared with attribute ‘warn_unused_result’ [-Wunused-result]
31 | scanf("%lld%lld", &k, &n);
| ~~~~~^~~~~~~~~~~~~~~~~~~~
ソースコード
/* -*- 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