結果
問題 | No.3156 Count That Day's N |
ユーザー |
![]() |
提出日時 | 2025-05-23 21:01:10 |
言語 | PyPy3 (7.3.15) |
結果 |
AC
|
実行時間 | 84 ms / 3,000 ms |
コード長 | 764 bytes |
コンパイル時間 | 428 ms |
コンパイル使用メモリ | 82,652 KB |
実行使用メモリ | 65,312 KB |
最終ジャッジ日時 | 2025-05-23 21:01:14 |
合計ジャッジ時間 | 3,759 ms |
ジャッジサーバーID (参考情報) |
judge5 / judge1 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 4 |
other | AC * 32 |
ソースコード
#yukicoder 3155- KCPC新歓杯 ''' #3155 import random N = int(input()) birthday = [tuple(map(int, input().split())) for _ in range(N)] birthday.sort() print('Yes' if any(birthday[i] == birthday[i + 1] for i in range(N - 1)) else 'No') ''' #3156 K, N = map(int, input().split()) ans = [] for x in range(1, N + 1): if (x6 := x ** 6) > N: break for y in range(1, N + 1): if x6 + (y4 := y ** 4) > N: break if (n := x6 + y4) < K: continue z2 = n // K if K * z2 != n: continue z = max(0, int(z2 ** 0.5) - 2) while z ** 2 < z2: z += 1 if z ** 2 != z2: continue ans.append(n) ans.sort() cnt = 0 if len(ans) == 0 else 1 for i in range(1, len(ans)): if ans[i - 1] != ans[i]: cnt += 1 print(cnt)