Created
July 17, 2016 13:50
-
-
Save Jack-Saleem/e627203a32d699696ed3eb4f551ca2f8 to your computer and use it in GitHub Desktop.
codeforces 6A Triangle program in java
This file contains hidden or 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
import java.util.Scanner; | |
public class Triangle | |
{ | |
public static void main(String[] args) | |
{ | |
Scanner ip = new Scanner(System.in); | |
int a = ip.nextInt(); | |
int b = ip.nextInt(); | |
int c = ip.nextInt(); | |
int d = ip.nextInt(); | |
if(((a+b)>c && (b+c)>a && (a+c)>b) || ((a+c)>d && (a+d)>c && (c+d)>a) || | |
((b+c)>d && (b+d)>c && (c+d)>b) || ((b+a)>d && (b+d)>a && (a+d)>b)) | |
System.out.println("TRIANGLE"); | |
else if(((a+b)>=c && (b+c)>=a && (a+c)>=b) || ((a+c)>=d && (a+d)>=c && (c+d)>=a) || | |
((b+c)>=d && (b+d)>=c && (c+d)>=b) || ((b+a)>=d && (b+d)>=a && (a+d)>=b)) | |
System.out.println("SEGMENT"); | |
else | |
System.out.println("IMPOSSIBLE"); | |
ip.close(); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment