2010-08-17から1日間の記事一覧

Codeforces #26 B "Regular Bracket Sequence"

問題:http://codeforces.com/contest/26/problem/B本番は問題を読み間違えてテストケース3で引っかかってた. スタックである必要ないけどなんとなく. import java.util.Stack; public class B { public static void main(String[] args) throws Exceptio…

Codeforces #26 A "Almost Prime"

問題:http://codeforces.com/contest/26/problem/Anまでの素因数的なものを計算してった. なんか冗長っぽい. import java.util.ArrayList; import java.util.HashSet; import java.util.List; import java.util.Scanner; import java.util.Set; public cl…

Topcoder SRM 479 "TheCoffeeTimeDivOne"

問題:http://www.topcoder.com/stat?c=problem_statement&pm=11028 (要ログイン)とりあえず貼っとく. 冗長なのは気にしない. DivTwoのテキトーなやつと比べると,最初の配列確保でメモリが確保できないので 配列を確保せずにやる方法をテキトーに実装.…

Topcoder SRM 479 "TheCoffeeTimeDivTwo"

問題:http://www.topcoder.com/stat?c=problem_statement&pm=11029 (要ログイン)とりあえず貼っとく. import java.util.Arrays; public class TheCoffeeTimeDivTwo { public int find(int n, int[] tea) { Arrays.sort(tea); int[] coffee = new int[n-t…

Topcoder SRM 479 "TheAirTripDivTwo"

問題:http://www.topcoder.com/stat?c=problem_statement&pm=11031 (要ログイン)とりあえず貼っとく. public class TheAirTripDivTwo { public int find(int[] flights, int fuel) { int i = 0; for(;i