Skip to content

Instantly share code, notes, and snippets.

@binjoo
Created October 21, 2012 17:27
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save binjoo/3927688 to your computer and use it in GitHub Desktop.
Save binjoo/3927688 to your computer and use it in GitHub Desktop.
JAVA:吉普赛人神奇的读心术
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