[表示 : 全て 最新50 1-99 101- 201- 301- 401- 501- 601- 701- 801- 901- 2chのread.cgiへ]
Update time : 05/09 23:01 / Filesize : 381 KB / Number-of Response : 977
[このスレッドの書き込みを削除する]
[+板 最近立ったスレ&熱いスレ一覧 : +板 最近立ったスレ/記者別一覧] [類似スレッド一覧]


↑キャッシュ検索、類似スレ動作を修正しました、ご迷惑をお掛けしました

★★ Java の宿題ここで答えます Part 65 ★★



207 名前:デフォルトの名無しさん mailto:sage [2008/06/18(水) 18:19:48 ]
>>201
public class GameResult {
public static void main(String[] args) {
// {{一位の勝ち数,負け数}, ... ,{六位の勝ち数,負け数}}
int[][] winlose = {{34, 17}, {28, 22}, {23, 25}, {25, 28}, {22, 28}, {15, 35}};
if (args.length == 2) {
try {
int teamA = Integer.parseInt(args[0]);
int teamB = Integer.parseInt(args[1]);
if (teamA < 1 || teamA > 6 || teamB < 1 || teamB > 6) throw new NumberFormatException();
if (teamA > teamB) { int tmp = teamA; teamA = teamB; teamB = tmp; }
System.out.println(teamA + "位と" + teamB + "位のゲーム差は" +
((winlose[teamA-1][0] - winlose[teamA-1][1]) - (winlose[teamB-1][0] - winlose[teamB-1][1])) / 2.);
} catch (NumberFormatException e) {
System.err.println("1から6までの整数を指定してください");
return;
}
} else {
System.err.println("usage: java GameResult 順位 順位");
}
}
}






[ 続きを読む ] / [ 携帯版 ]

全部読む 前100 次100 最新50 [ このスレをブックマーク! 携帯に送る ] 2chのread.cgiへ
[+板 最近立ったスレ&熱いスレ一覧 : +板 最近立ったスレ/記者別一覧](;´∀`)<381KB

read.cgi ver5.27 [feat.BBS2 +1.6] / e.0.2 (02/09/03) / eucaly.net products.
担当:undef