Competitive/Collaborative Programming Class

ICPC Computer Programming Contest Prep

Problem Solving in Computer Science

Fall 2011 -- CSC 2700 Section 02

[Isaac's Home Page ]  [Mailing List ]  [Class Page ]  [Normal ]  

4/m/OpticalReader.java

/*
Man Vo
Problem Number: 11839
Problem Name: Optical Reader
9-19-11
*/

import java.util.*;
public class OpticalReader {
    public static void main (String[] args){
        Scanner input1 = new Scanner(System.in);
        ArrayList<String> multipleChoice = new ArrayList<String>();
        multipleChoice.add("A");
        multipleChoice.add("B");
        multipleChoice.add("C");
        multipleChoice.add("D");
        multipleChoice.add("E");
        multipleChoice.add("*");
        ArrayList<String> output = new ArrayList<String>(); 
        int[] questions = new int[5];
        int l = 0;
        while(input1.hasNextInt()){
        int number = input1.nextInt();
        if(number>0){
            for(int i = 0; i<number; i++){
                int k =0;
                for(int j=0; j<5; j++){
                questions[j] = input1.nextInt();
                    if(questions[j]<=127){
                    k++;
                    l = j;
                    }
                    if(j==4){
                        if(k==1){
                            output.add(multipleChoice.get(l));
                        }else{
                            output.add(multipleChoice.get(5));
                        }
                    }
                }
            }
        }
        else {break;}
        }
        for(int i=0; i<output.size(); i++){
            System.out.println(output.get(i));
        }
    }    
} 

The statements and opinions included in these pages are those of only. Any statements and opinions included in these pages are not those of Louisiana State University or the LSU Board of Supervisors.
© 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011 Isaac Traxler