Solution for CCC '11 S2 - Multiple Choice in Java 8


Nov. 6, 2019 1.859196 seconds Java 8
import java.io.*;
import java.util.*;

public class Main {
    public static void main(String[] args) {
        
           Scanner in = new Scanner(System.in);
        int num = in.nextInt();
        String qa = "";
        int score = 0;
        for(int i = 0; i < (num * 2) + 1; i++){
            qa += in.nextLine();
        }
        
        
        String q = "";
        String a = "";
        
        for(int i = 0; i < num; i++){
            q += Character.toString(qa.charAt(i));
            a += Character.toString(qa.charAt(i + num));
        }
        
            for(int i = 0; i < num; i++){
                if(q.charAt(i) == a.charAt(i)){
                    score++;
                }
            }
        
            System.out.println(score);
             
 
    }
  
    
}

Editorial


No editorial for this problem. :(

Original Problem


You can view the original page for this problem on the DMOJ.