Skip to content

Instantly share code, notes, and snippets.

@chancancode
Created September 19, 2009 23:17
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save chancancode/189627 to your computer and use it in GitHub Desktop.
Save chancancode/189627 to your computer and use it in GitHub Desktop.
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