結果
問題 | No.725 木は明らかに森である |
ユーザー | Grenache |
提出日時 | 2018-09-16 17:04:21 |
言語 | Java21 (openjdk 21) |
結果 |
AC
|
実行時間 | 128 ms / 2,000 ms |
コード長 | 907 bytes |
コンパイル時間 | 3,595 ms |
コンパイル使用メモリ | 72,304 KB |
実行使用メモリ | 55,900 KB |
最終ジャッジ日時 | 2023-09-25 09:01:33 |
合計ジャッジ時間 | 5,519 ms |
ジャッジサーバーID (参考情報) |
judge11 / judge13 |
テストケース
テストケース表示入力 | 結果 | 実行時間 実行使用メモリ |
---|---|---|
testcase_00 | AC | 119 ms
55,612 KB |
testcase_01 | AC | 128 ms
55,900 KB |
testcase_02 | AC | 120 ms
55,668 KB |
testcase_03 | AC | 121 ms
55,680 KB |
testcase_04 | AC | 119 ms
55,672 KB |
testcase_05 | AC | 120 ms
55,456 KB |
testcase_06 | AC | 120 ms
53,604 KB |
testcase_07 | AC | 125 ms
55,604 KB |
testcase_08 | AC | 125 ms
55,660 KB |
ソースコード
import java.io.*; import java.util.*; public class Main_yukicoder725 { private static Scanner sc; private static Printer pr; private static void solve() { String s = sc.next(); int n = s.length(); int i = 0; int next; while ((next = s.indexOf("treeone", i)) >= 0) { for (int j = i; j < next; j++) { pr.print(s.charAt(j)); } pr.print("forest"); i = next + 7; } for (int j = i; j < n; j++) { pr.print(s.charAt(j)); } pr.println(); } // --------------------------------------------------- public static void main(String[] args) { sc = new Scanner(INPUT == null ? System.in : new ByteArrayInputStream(INPUT.getBytes())); pr = new Printer(System.out); solve(); // pr.close(); pr.flush(); // sc.close(); } static String INPUT = null; private static class Printer extends PrintWriter { Printer(OutputStream out) { super(out); } } }