Created
September 19, 2009 23:17
-
-
Save chancancode/189627 to your computer and use it in GitHub Desktop.
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; | |
import java.util.Arrays; | |
public class A { | |
/** | |
* @param args | |
*/ | |
public static void main(String[] args) { | |
// TODO Auto-generated method stub | |
Scanner in = new Scanner(System.in); | |
while(in.hasNextLine()){ | |
int loads = in.nextInt(); | |
if(loads == 0) { break; } | |
in.nextLine(); | |
String line = in.nextLine(); | |
Scanner tmp = new Scanner(line); | |
int time = 0; | |
int[] dryTime = new int[loads]; | |
for(int i=0;i<loads;i++){ | |
dryTime[i] = tmp.nextInt(); | |
} | |
Arrays.sort(dryTime); | |
for(int i=1;i<loads;i++){ | |
time += dryTime[i]; | |
} | |
if(time < (loads-1) * 30) | |
time = (loads-1) *30; | |
time += 30; | |
time += dryTime[0]; | |
System.out.printf("%d:%02d\n", time / 60, time % 60); | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment