Skip to content

Instantly share code, notes, and snippets.

@sasamijp
Created May 29, 2013 13:56
Show Gist options
  • Save sasamijp/5670431 to your computer and use it in GitHub Desktop.
Save sasamijp/5670431 to your computer and use it in GitHub Desktop.
素数分け鳥
import java.io.*;
public class Sosuhantei {
public static void main(String[] args) {
BufferedReader reader = new BufferedReader(new InputStreamReader(System.in));
try {
System.out.println("数字を入力");
String line = reader.readLine();
int n = Integer.parseInt(line);
boolean sosu=true;
for(int i=2;i<n;i++){
if(n%i==0) {
sosu=false;
break;
}
}
String crlf = System.getProperty("line.separator");
if(sosu){
System.out.println(crlf+"               ,, -―-、"+crlf+"             /     ヽ "+crlf+"       / ̄ ̄/  /i⌒ヽ、|    "+n+"は素数ーー!!!! "+crlf+"      /  (゜)/   / /"+crlf+"     /     ト、.,../ ,ー-、 "+crlf+"    =彳      \\‘゚。、` ヽ。、o "+crlf+"    /          \\゚。、。、o"+crlf+"   /         /⌒ ヽ ヽU  o"+crlf+"   /         │   `ヽU ∴l "+crlf+"  │         │     U :l "+crlf+"                    |:! ");
}else{
System.out.println(
"       ⌒  ヾ              、ミ川川川彡"+crlf+
"     r/ ̄ ̄ ̄ ̄ヽ、 ヽ             ミ       彡"+crlf+
"     /. ノ(  (゚ッ)/  ̄ ̄~ヽ ヾ      三  こ  駄 三"+crlf+
"    /  ⌒     ト、.,..    \丶。       三  ら  目 三"+crlf+
"   彳、_      |  ∴\    ヽ          三   え  だ  三"+crlf+
"    | ) r‐      /  ノ( \\  |∴     三  る     三"+crlf+
"     |           ⌒|⌒ ヽ ヽ  | 。o    三  ん  素  三"+crlf+
"   ノ(           /    | |  /        三  だ  数 三"+crlf+
"       ⌒      /    ヽ|/゙U         三     吐 三"+crlf+
"           /     u                 三      く  三"+crlf+
"                                   三      な 三"+crlf+
"                               彡      ミ"+crlf+
"                                彡川川川ミ"+crlf
);
;
}
} catch (IOException e){
System.out.println(e);
} catch (NumberFormatException e) {
System.out.println("数字の形式が正しくありません");
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment