結果
問題 | No.2209 Flip and Reverse |
ユーザー |
|
提出日時 | 2023-02-10 23:03:17 |
言語 | Java (openjdk 23) |
結果 |
WA
|
実行時間 | - |
コード長 | 1,273 bytes |
コンパイル時間 | 4,350 ms |
コンパイル使用メモリ | 81,460 KB |
実行使用メモリ | 62,304 KB |
最終ジャッジ日時 | 2024-07-07 17:05:36 |
合計ジャッジ時間 | 14,419 ms |
ジャッジサーバーID (参考情報) |
judge1 / judge2 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 4 |
other | AC * 7 WA * 23 |
ソースコード
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(); int ans = 0; for(int i=0;i<n;i++) { if(s.charAt(i) != t.charAt(i)) { ans++; if(s.charAt(i) != t.charAt(n-i-1)) { ans++; } } } output.print(ans/2); } 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; } }