Created
July 17, 2011 05:44
-
-
Save 6LYTH3/1087240 to your computer and use it in GitHub Desktop.
Transformation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package main; | |
import java.util.Scanner; | |
import java.util.Vector; | |
public class M { | |
public static void pro() { | |
Scanner sc = new Scanner(System.in); | |
int c = 1; | |
while (sc.hasNext()) { | |
Vector<Integer> r = new Vector<Integer>(); | |
Vector<Integer> g = new Vector<Integer>(); | |
Vector<Integer> b = new Vector<Integer>(); | |
Vector<Integer> count = new Vector<Integer>(); | |
int row = sc.nextInt(); | |
int col = sc.nextInt(); | |
if (col == 0 && row == 0) | |
break; | |
for (int i = 0; i < (row * col); i++) { | |
r.add(sc.nextInt()); | |
} | |
for (int i = 0; i < (row * col); i++) { | |
g.add(sc.nextInt()); | |
} | |
for (int i = 0; i < (row * col); i++) { | |
b.add(sc.nextInt()); | |
} | |
for (int i = 0; i < (row * col); i++) { | |
count.add((r.get(i) + g.get(i) + b.get(i)) / 3); | |
} | |
System.out.println("\nCase " + c++ + ":"); | |
int k = 0; | |
for (int i = 0; i < (row * col); i++) { | |
if (k++ == col) | |
System.out.println(""); | |
System.out.print(count.get(i) + ","); | |
} | |
} | |
} | |
public static void main(String[] arge) { | |
pro(); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment