結果
| 問題 |
No.634 硬貨の枚数1
|
| コンテスト | |
| ユーザー |
wajima_wataru
|
| 提出日時 | 2018-03-03 12:02:05 |
| 言語 | Python3 (3.13.1 + numpy 2.2.1 + scipy 1.14.1) |
| 結果 |
RE
|
| 実行時間 | - |
| コード長 | 556 bytes |
| コンパイル時間 | 185 ms |
| コンパイル使用メモリ | 12,928 KB |
| 実行使用メモリ | 11,008 KB |
| 最終ジャッジ日時 | 2024-06-23 21:10:06 |
| 合計ジャッジ時間 | 4,961 ms |
|
ジャッジサーバーID (参考情報) |
judge2 / judge4 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 |
| other | AC * 73 RE * 2 |
ソースコード
T = [i * (i + 1) // 2 for i in range(4472)]
def find(i, x):
low = 0
high = len(x)
t = (low + high) // 2
while (low <= high):
if (i == x[t]):
break
elif (i > x[t]):
low = t + 1
elif (i < x[t]):
high = t - 1
t = (low + high) // 2
return t if x[t] == i else -1
N = int(input())
if find(N, T) >= 0:
print('1')
exit()
else:
i = 0
while N - T[i] > 0:
if find(N - T[i], T) >= 0:
print('2')
exit()
i += 1
print('3')
wajima_wataru