結果
問題 |
No.729 文字swap
|
ユーザー |
![]() |
提出日時 | 2020-04-06 15:56:10 |
言語 | PyPy3 (7.3.15) |
結果 |
WA
|
実行時間 | - |
コード長 | 401 bytes |
コンパイル時間 | 194 ms |
コンパイル使用メモリ | 81,964 KB |
実行使用メモリ | 55,744 KB |
最終ジャッジ日時 | 2024-07-06 11:44:25 |
合計ジャッジ時間 | 1,579 ms |
ジャッジサーバーID (参考情報) |
judge2 / judge1 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | WA * 3 |
other | WA * 11 |
ソースコード
s = str(input()) s = list(s) from collections import deque s = deque(s) ans = [] if len(s)%2 == 1: for i in range(len(s)): if i%2 == 0: ans.append(s.popleft()) else: ans.append(s.pop()) else: for i in range(len(s)): if i%2 == 1: ans.append(s.popleft()) else: ans.append(s.pop()) ans.reverse() print(''.join(ans))