Created
October 21, 2012 17:27
-
-
Save binjoo/3927688 to your computer and use it in GitHub Desktop.
JAVA:吉普赛人神奇的读心术
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.util.Scanner; | |
public class ReadMinds { | |
public static void main(String[] args) { | |
String result = init(); // 初始化 | |
Scanner scan = new Scanner(System.in); | |
scan.nextLong(); | |
System.out.println(result); | |
} | |
/** | |
* 初始化读心图 | |
*/ | |
public static String init() { | |
String[] pic = { "∪", "∩", "∷", "√", "∑", "≠", "$", "⊙", "∵", "≈", "☆", "∞", "★", "〓", "○", "♂", "♀", "∝", "∮", "≌" }; | |
String result = pic[(int) (Math.random() * 20)]; | |
for (int i = 0; i <= 99; i++) { | |
if (i % 9 == 0) { | |
System.out.print(i + " " + result + "\t"); | |
} else { | |
System.out.print(i + " " + pic[(int) (Math.random() * 20)] + "\t"); | |
} | |
if ((i + 1) % 5 == 0) { | |
System.out.println(); | |
} | |
} | |
return result; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment