結果
問題 | No.2209 Flip and Reverse |
ユーザー | Asahi |
提出日時 | 2023-02-10 22:49:10 |
言語 | Java21 (openjdk 21) |
結果 |
WA
|
実行時間 | - |
コード長 | 1,383 bytes |
コンパイル時間 | 3,940 ms |
コンパイル使用メモリ | 78,076 KB |
実行使用メモリ | 64,072 KB |
最終ジャッジ日時 | 2023-09-21 23:58:29 |
合計ジャッジ時間 | 16,646 ms |
ジャッジサーバーID (参考情報) |
judge11 / judge14 |
(要ログイン)
テストケース
テストケース表示入力 | 結果 | 実行時間 実行使用メモリ |
---|---|---|
testcase_00 | AC | 130 ms
55,852 KB |
testcase_01 | AC | 133 ms
55,736 KB |
testcase_02 | AC | 129 ms
55,632 KB |
testcase_03 | AC | 132 ms
55,780 KB |
testcase_04 | AC | 133 ms
55,736 KB |
testcase_05 | AC | 132 ms
55,988 KB |
testcase_06 | AC | 132 ms
55,816 KB |
testcase_07 | AC | 128 ms
55,844 KB |
testcase_08 | WA | - |
testcase_09 | AC | 143 ms
55,856 KB |
testcase_10 | AC | 135 ms
55,996 KB |
testcase_11 | AC | 139 ms
57,800 KB |
testcase_12 | AC | 137 ms
55,744 KB |
testcase_13 | WA | - |
testcase_14 | AC | 433 ms
63,568 KB |
testcase_15 | WA | - |
testcase_16 | WA | - |
testcase_17 | WA | - |
testcase_18 | AC | 420 ms
63,620 KB |
testcase_19 | AC | 416 ms
63,736 KB |
testcase_20 | WA | - |
testcase_21 | WA | - |
testcase_22 | WA | - |
testcase_23 | AC | 408 ms
63,532 KB |
testcase_24 | AC | 419 ms
63,760 KB |
testcase_25 | WA | - |
testcase_26 | WA | - |
testcase_27 | WA | - |
testcase_28 | AC | 443 ms
63,356 KB |
testcase_29 | AC | 417 ms
63,900 KB |
testcase_30 | AC | 423 ms
63,776 KB |
testcase_31 | WA | - |
testcase_32 | AC | 417 ms
63,664 KB |
testcase_33 | WA | - |
ソースコード
import java.util.*; import java.io.*; import java.math.*; import java.util.stream.Stream; public class Main{ static PrintWriter output; static Scanner sc; static void solve(){ int n = ni(); String s = ns(); String t = ns(); StringBuilder sb = new StringBuilder(); sb.append(s); String r = sb.reverse().toString(); int ans = 0; for(int i=0;i<n;i++) { if(s.charAt(i) != t.charAt(n-i-1)) ans++; } int c = 0; for(int i=0;i<n;i++) { if(r.charAt(i) != t.charAt(n-i-1)) c++; } output.print(Math.min(ans,c)); } public static void main(String[] args) throws IOException{ output = new PrintWriter(System.out); sc = new Scanner(System.in); solve(); output.flush(); } static int ni(){ return sc.nextInt();} static long nl(){ return sc.nextLong();} static String ns(){return sc.next();} static BigInteger bi(){return sc.nextBigInteger();} static BigDecimal bd(){return sc.nextBigDecimal();} static Map<Long,Integer> counter(long [] A) { HashMap<Long,Integer> count = new HashMap<>(); for(int i=0;i<A.length;i++) { if(!count.containsKey(A[i])) count.put(A[i],1); else count.put(A[i],count.get(A[i])+1); } return count; } }