This file contains 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
【内容】 | |
最小値(min)〜最大値(max)までの整数を順番に出力します。 | |
3の倍数だとfizz、5の倍数だとbuzz、 3と5の最小公倍数15の倍数がとfizzbuzzを出力する。 | |
public class FizzBuzz { | |
public static void main(String[] args) { | |
int min = 1; | |
int max = 100; |
This file contains 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
【内容】 | |
整数が代入できるリストを作成して、リストに1~10の整数を挿入します。そのリストを昇順、降順に並び替えてみます。 | |
【SortListクラス】 | |
public class SortList { | |
public static void main(String[] args) { | |
//整数のリストを作成する | |
ArrayList<Integer> list = new ArrayList<Integer>(); | |
int max = 10; |
This file contains 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
【アルゴリズム】 | |
0. 読み込む。 | |
1. 1つの空マスに対して1~9の値候補を用意する。 | |
2. 横(行)を見て、並んでいる値をそのマスの候補から除く。 | |
3. 縦(列)を見て、並んでいる値をそのマスの候補から除く。 | |
4. ブロック(3×3)を見て、並んでいる値をそのマスの候補から除く。 | |
5. 残った候補をマスに入れる。 | |
6. 0.から5.を繰り返す。 |
This file contains 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
【問題】 | |
http://judge.u-aizu.ac.jp/onlinejudge/description.jsp?id=10010 | |
【Scannerクラス】 | |
http://docs.oracle.com/javase/jp/6/api/java/util/Scanner.html | |
package example.excercise; | |
import java.io.IOException; | |
import java.util.Scanner; |
This file contains 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
【引用先】 | |
http://judge.u-aizu.ac.jp/onlinejudge/description.jsp?id=10033 | |
import java.io.BufferedReader; | |
import java.io.IOException; | |
import java.io.InputStreamReader; | |
import java.util.ArrayList; | |
import java.util.List; |
This file contains 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.io.BufferedReader; | |
import java.io.IOException; | |
import java.io.InputStreamReader; | |
import java.util.Random; | |
public class CardGame { | |
/** |
This file contains 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
【Stacking Blocks I】 | |
http://judge.u-aizu.ac.jp/onlinejudge/description.jsp?id=10032 | |
import java.io.BufferedReader; | |
import java.io.IOException; | |
import java.io.InputStreamReader; | |
import java.util.Stack; | |