結果

問題 No.2209 Flip and Reverse
ユーザー AsahiAsahi
提出日時 2023-02-10 22:56:04
言語 Java21
(openjdk 21)
結果
WA  
実行時間 -
コード長 1,363 bytes
コンパイル時間 4,510 ms
コンパイル使用メモリ 87,588 KB
実行使用メモリ 65,720 KB
最終ジャッジ日時 2023-09-22 00:04:41
合計ジャッジ時間 15,495 ms
ジャッジサーバーID
(参考情報)
judge15 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 128 ms
55,680 KB
testcase_01 AC 130 ms
55,972 KB
testcase_02 AC 130 ms
55,808 KB
testcase_03 AC 132 ms
55,964 KB
testcase_04 AC 129 ms
55,780 KB
testcase_05 AC 128 ms
55,520 KB
testcase_06 AC 126 ms
55,760 KB
testcase_07 AC 127 ms
55,780 KB
testcase_08 WA -
testcase_09 AC 129 ms
55,768 KB
testcase_10 AC 126 ms
55,836 KB
testcase_11 WA -
testcase_12 AC 129 ms
55,704 KB
testcase_13 AC 129 ms
53,792 KB
testcase_14 AC 401 ms
64,008 KB
testcase_15 AC 390 ms
63,728 KB
testcase_16 AC 403 ms
63,828 KB
testcase_17 AC 400 ms
63,576 KB
testcase_18 WA -
testcase_19 WA -
testcase_20 AC 392 ms
63,360 KB
testcase_21 AC 395 ms
63,860 KB
testcase_22 AC 398 ms
63,364 KB
testcase_23 WA -
testcase_24 WA -
testcase_25 AC 399 ms
63,840 KB
testcase_26 WA -
testcase_27 WA -
testcase_28 AC 403 ms
63,824 KB
testcase_29 AC 405 ms
63,968 KB
testcase_30 WA -
testcase_31 AC 399 ms
63,588 KB
testcase_32 WA -
testcase_33 WA -
権限があれば一括ダウンロードができます

ソースコード

diff #

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;
        int same = 0;
        for(int i=0;i<n;i++) {
            if(s.charAt(i) != t.charAt(n-i-1)) ans++;
            if(r.charAt(i) == s.charAt(i)) same++;
        }
        output.print(same == n && !r.equals(t)? n : ans);
    }

    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;
    }
}
0