/* vim: set sw=4 sts=4 et foldmethod=syntax : */ import java.util.*; import java.io.*; public class JobSizes { public static void main(String[] args) throws IOException { if (1 != args.length) { System.out.println("Usage: java JobSizes problemDirectory"); System.exit(1); } File dir = new File(new File(args[0]), "results"); Map sizes = new TreeMap(); for (String f : dir.list()) { if (! f.contains(".job.")) continue; Scanner sc = new Scanner(new File(dir, f)); long size = sc.nextLong(); long nodes = sc.nextLong(); long time = sc.nextLong(); int nodesApprox = (int) Math.floor(Math.log10(nodes + 0.0)); if (null == sizes.get(nodesApprox)) sizes.put(nodesApprox, 0); sizes.put(nodesApprox, sizes.get(nodesApprox) + 1); sc.close(); } for (int s : sizes.keySet()) { System.out.printf("%d %d\n", (long) Math.pow(10, s), sizes.get(s)); } } }