Created
July 17, 2016 13:51
-
-
Save Jack-Saleem/2d53b909bb21415ef2458fbb8794e43d to your computer and use it in GitHub Desktop.
codeforces 100935A Time 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 Time | |
{ | |
public static void main(String[] args) | |
{ | |
Scanner z=new Scanner(System.in); | |
int n=z.nextInt(); | |
int[] ar=new int[n*6]; | |
for(int i=0;i<ar.length;i++) | |
ar[i]=z.nextInt(); | |
String x=""; | |
for(int i=0,y=1;i<ar.length;i+=6) { | |
if(ar[i+2]==0 && ar[i+5]==0) { | |
if(ar[i]*60+ar[i+1]==ar[i+3]*60+ar[i+4]) | |
x+="Case "+y+++": Yes\n"; | |
else | |
x+="Case "+y+++": No\n"; | |
} | |
else if(ar[i+2]==0 && ar[i+5]==0 && ar[i+1]==0 && ar[i+4]==0) { | |
if(ar[i]==ar[i+3]) | |
x+="Case "+y+++": Yes\n"; | |
else | |
x+="Case "+y+++": No\n"; | |
} | |
else { | |
if((ar[i]*60+ar[i+1])*60+ar[i+2]==(ar[i+3]*60+ar[i+4])*60+ar[i+5]) | |
x+="Case "+y+++": Yes\n"; | |
else | |
x+="Case "+y+++": No\n"; | |
} | |
} | |
System.out.println(x); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment