結果
問題 |
No.1992 Tendon Walk
|
ユーザー |
![]() |
提出日時 | 2025-03-31 17:31:40 |
言語 | PyPy3 (7.3.15) |
結果 |
AC
|
実行時間 | 37 ms / 2,000 ms |
コード長 | 1,176 bytes |
コンパイル時間 | 260 ms |
コンパイル使用メモリ | 82,168 KB |
実行使用メモリ | 54,036 KB |
最終ジャッジ日時 | 2025-03-31 17:32:45 |
合計ジャッジ時間 | 1,258 ms |
ジャッジサーバーID (参考情報) |
judge2 / judge5 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 6 |
ソースコード
X = int(input()) # Each entry corresponds to j=0 to 6 (moves 1 to 7), storing the cumulative distance up to that move in a set add_distance = [2, 4, 5, 6, 8, 9, 10] candidates = [] for j in range(7): valid = False possible_k = 0 if j in [0, 3, 6]: # Equation: X = 2k → k = X/2 if X % 2 == 0: possible_k = X // 2 valid = 1 <= possible_k <= 100 elif j in [1, 4]: # Equation: X = 2k + 2 → k = (X-2)/2 if (X - 2) >= 0 and (X - 2) % 2 == 0: possible_k = (X - 2) // 2 valid = 1 <= possible_k <= 100 elif j in [2, 5]: # Equation: X = 2k + 1 → k = (X-1)/2 if X % 2 == 1: possible_k = (X - 1) // 2 valid = 1 <= possible_k <= 100 if valid: candidates.append((possible_k, j)) # Find the candidate with the smallest k, and then smallest j if candidates: # Sort by k then j candidates.sort() best_k, best_j = candidates[0] total_distance = 10 * (best_k - 1) + add_distance[best_j] print(total_distance) else: # According to the problem constraints, this path should never be taken print(0)