fork download
  1. import java.util.*;
  2. import java.lang.*;
  3. import java.io.*;
  4.  
  5.  
  6. public class Main
  7. {
  8.  
  9. private static PrintWriter out = new PrintWriter(new OutputStreamWriter(System.out));
  10.  
  11. public static int nextInt() throws IOException{
  12. in.nextToken();
  13. return (int)in.nval;
  14. }
  15.  
  16.  
  17. public static void read(int[][] a) throws IOException{
  18. int n = a.length;
  19. int m = a[0].length;
  20. for(int i = 0; i < n; i++){
  21. for(int j = 0; j < m; j++){
  22. a[i][j] = nextInt();
  23. }
  24. }
  25. }
  26.  
  27.  
  28. public static void print(int[] a){
  29. int m = a.length;
  30. for(int j = 0; j < m; j++){
  31. out.print(a[j]);
  32. }
  33. out.println();
  34. }
  35.  
  36.  
  37. public static void EQ(int[][] a, int[][] b, int[] c){
  38. for(int i = 0; i < a.length; i++){
  39.  
  40. int t=0, g=0;
  41.  
  42. for(int j=0; j < a.length; j++){
  43. if( a[i][j] < 0 ){
  44. t++;
  45. }
  46. }
  47.  
  48. for(int j=0; j < b.length; j++){
  49. if( b[i][j] < 0 ){
  50. g++;
  51. }
  52. }
  53.  
  54. c[i] = t == g? 1 : 0;
  55. }
  56. }
  57.  
  58.  
  59. public static void main (String[] args) throws java.lang.Exception
  60. {
  61. int [][] a = new int[6][6], b = new int[6][6];
  62. int [] c = new int [6];
  63. read(a);
  64. read(b);
  65. EQ(a,b,c);
  66. print(c);
  67. out.flush();
  68. }
  69. }
  70.  
Success #stdin #stdout 0.1s 320512KB
stdin
Standard input is empty
stdout
111111