結果
問題 | No.1992 Tendon Walk |
ユーザー |
|
提出日時 | 2022-10-27 10:55:41 |
言語 | Python3 (3.13.1 + numpy 2.2.1 + scipy 1.14.1) |
結果 |
AC
|
実行時間 | 31 ms / 2,000 ms |
コード長 | 1,214 bytes |
コンパイル時間 | 84 ms |
コンパイル使用メモリ | 12,544 KB |
実行使用メモリ | 10,752 KB |
最終ジャッジ日時 | 2024-07-04 21:08:59 |
合計ジャッジ時間 | 871 ms |
ジャッジサーバーID (参考情報) |
judge1 / judge3 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 6 |
ソースコード
class TendonWalk:def __init__(self, destination: int):self.destination = destinationself._init()def _init(self):self.point = 0self.distance = 0def move_a(self):self.point += 2self.distance += 2def move_b(self):self.point -= 1self.distance += 1def check_dest(self) -> bool:return self.point == self.destinationdef move(self) -> int:for _ in range(100):self.move_a()if self.check_dest():returnself.move_a()if self.check_dest():returnself.move_b()if self.check_dest():returnself.move_b()if self.check_dest():returnself.move_a()if self.check_dest():returnself.move_b()if self.check_dest():returnself.move_b()if self.check_dest():returndef main():X = int(input())simulator = TendonWalk(X)simulator.move()print(simulator.distance)if __name__ == "__main__":main()