ENG  RUS Timus Online Judge
Online Judge
Problems
Authors
Online contests
Site news
Webboard
Problem set
Submit solution
Judge status
Guide
Register
Authors ranklist
Current contest
Scheduled contests
Past contests
Rules
back to board

## Discussion of Problem 1433. Diamonds

Anyone help me please! I have WA #12 :(
Posted by Enigma [UB of TUIT] 12 Nov 2010 14:49
Why WA#12??????
This my code:

import java.util.Scanner;
public class T_1433 {
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
String s_1 = sc.next();
String asos = s_1.substring(0,1);// tetraedr asosi
String left = s_1.substring(1,2);// tetraedr chap tamoni
String right = s_1.substring(2,3);// tetraedr o'ng tamoni
String back = s_1.substring(3,4);//  tetraedr orqa tamoni
String s_2 = sc.next(); // 2-tetraedr...
boolean equal = false;
//--------------------------
if(asos.equals(s_2.substring(0,1))){
if(left.equals(s_2.substring(1,2)) && right.equals(s_2.substring(2,3))&& back.equals(s_2.substring(3,4)))
equal = true;
if(left.equals(s_2.substring(2,3)) && right.equals(s_2.substring(3,4))&& back.equals(s_2.substring(1,2)))
equal = true;
if(left.equals(s_2.substring(3,4)) && right.equals(s_2.substring(1,2))&& back.equals(s_2.substring(2,3)))
equal = true;
}
//----------------------------
asos = s_1.substring(1,2);
left = s_1.substring(3,4);
right = s_1.substring(0,1);
back = s_1.substring(2,3);
if(asos.equals(s_2.substring(0, 1))){
if(left.equals(s_2.substring(1,2)) && right.equals(s_2.substring(2,3))&& back.equals(s_2.substring(3,4)))
equal = true;
if(left.equals(s_2.substring(2,3)) && right.equals(s_2.substring(3,4))&& back.equals(s_2.substring(1,2)))
equal = true;
if(left.equals(s_2.substring(3,4)) && right.equals(s_2.substring(1,2))&& back.equals(s_2.substring(2,3)))
equal = true;
}
//------------------------------
asos = s_1.substring(2,3);
left = s_1.substring(0,1);
right = s_1.substring(3,4);
back = s_1.substring(1,2);
if(asos.equals(s_2.substring(0, 1))){
if(left.equals(s_2.substring(1,2)) && right.equals(s_2.substring(2,3))&& back.equals(s_2.substring(3,4)))
equal = true;
if(left.equals(s_2.substring(2,3)) && right.equals(s_2.substring(3,4))&& back.equals(s_2.substring(1,2)))
equal = true;
if(left.equals(s_2.substring(3,4)) && right.equals(s_2.substring(1,2))&& back.equals(s_2.substring(2,3)))
equal = true;
}
//--------------------------------
asos = s_1.substring(3,4);
left = s_1.substring(2,3);
right = s_1.substring(1,2);
back = s_1.substring(0,1);
if(asos.equals(s_2.substring(0, 1))){
if(left.equals(s_2.substring(1,2)) && right.equals(s_2.substring(2,3))&& back.equals(s_2.substring(3,4)))
equal = true;
if(left.equals(s_2.substring(2,3)) && right.equals(s_2.substring(3,4))&& back.equals(s_2.substring(1,2)))
equal = true;
if(left.equals(s_2.substring(3,4)) && right.equals(s_2.substring(1,2))&& back.equals(s_2.substring(2,3)))
equal = true;
}
if(equal)System.out.println("equal");
else System.out.println("different");
}
}