結果
問題 |
No.1026 OGAWA's New Keyboard
|
ユーザー |
![]() |
提出日時 | 2020-04-30 10:07:15 |
言語 | Java (openjdk 23) |
結果 |
AC
|
実行時間 | 849 ms / 1,000 ms |
コード長 | 603 bytes |
コンパイル時間 | 2,102 ms |
コンパイル使用メモリ | 75,656 KB |
実行使用メモリ | 60,660 KB |
最終ジャッジ日時 | 2024-09-16 05:05:45 |
合計ジャッジ時間 | 9,192 ms |
ジャッジサーバーID (参考情報) |
judge1 / judge2 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 5 |
other | AC * 21 |
ソースコード
import java.util.*; public class Main { public static void main(String[] args) { Scanner sc = new Scanner(System.in); int n = sc.nextInt(); ArrayDeque<Character> deq = new ArrayDeque<>(); for (int i = 0; i < n; i++) { if (sc.nextInt() == 0) { deq.addLast(sc.next().charAt(0)); } else { deq.addFirst(sc.next().charAt(0)); } } StringBuilder sb = new StringBuilder(); while (deq.size() > 0) { sb.append(deq.poll()); } System.out.println(sb); } }