Skip to content

Instantly share code, notes, and snippets.

@gecko655
Last active August 29, 2015 14:18
Show Gist options
  • Save gecko655/615a09e9e5cc6d4ef3d9 to your computer and use it in GitHub Desktop.
Save gecko655/615a09e9e5cc6d4ef3d9 to your computer and use it in GitHub Desktop.
入力:0〜9までの1桁の数字
出力:入力に対応する7セグメントの数字表現
Example Input:
2
Example Output:
□■■■□
□□□□■
□□□□■
□■■■□
■□□□□
■□□□□
□■■■□
ideone: http://ideone.com/lDfomm
class Main{public static void main(String[]x)throws Throwable{for(int N=System.in.read()-48,i=-1,j;++i<7;System.out.println())for(j=0;j<5;)System.out.print(((1<<j++)&">AA0AA>0@@0@@0>@@>11>>@@>@@>0AA>@@0>11>@@>>11>AA>>@@0@@0>AA>AA>>AA>@@>".charAt(N*7+i)-48)>0?'■':'□');}}
class Main{public static void main(String[]x)throws Throwable{for(int N=System.in.read()-48,i=-1,j,k;++i<5;)for(k=i%2;k-->=0;System.out.println())for(j=0;j<5;)System.out.print(((1<<j++)&">A0A>0@0@0>@>1>>@>@>0A>@0>1>@>>1>A>>@0@0>A>A>>A>@>".charAt(N*5+i)-48)>0?'■':'□');}}
class Main{public static void main(String[]x)throws Throwable{for(int N=System.in.read()-48,i=-1,j;++i<7;System.out.println())for(j=0;j<5;)System.out.print(((1<<j++)&">A0A>0@0@0>@>1>>@>@>0A>@0>1>@>>1>A>>@0@0>A>A>>A>@>".charAt(N*5+(i>4?i-2:i>1?i-1:i))-48)>0?'■':'□');}}
class Golf{public static void main(String[]x)throws Throwable{for(int N=System.in.read()-48,i=-1,j,k;++i<7;System.out.println())for(j=0,k=N*5+(i>4?i-2:i>1?i-1:i);j++<5;)System.out.print(((j>4?4:j>1?2:1)&("%'uss5eUSS'5WVSe%Uss%%URS".charAt(k/2)>>k%2*4))>0?'□':'■');}}
class Golf{public static void main(String[]x)throws Throwable{for(int N=System.in.read()-48,i=0,j,k;++i<8;System.out.println())for(j=1,k=N*5+i*3/5;j++<6;)System.out.print((1<<j/3&"%'uss5eUSS'5WVSe%Uss%%URS".charAt(k/2)>>k%2*4)>0?'□':'■');}}
class Golf{public static void main(String[]x)throws Throwable{for(int N=System.in.read()-48,i=0,j,k;++i<8;System.out.println())for(j=1,k=N*5+i*3/5;j++<6;)System.out.print((1<<j/3&"✥獵㕳啥卓㔧噗敓唥獳┥剕S".charAt(k/4)>>k%4*4)>0?'□':'■');}}
class Golf{public static void main(String[]x)throws Throwable{for(int N=System.in.read()-48,i=0,j,k;++i<8;System.out.println())for(j=1,k=N*5+i*3/5;j++<6;)System.out.print((1<<j/3&"嗕矟嵝坝睗坵啵矝啕坕".charAt(k/5)>>k%5*3)>0?'□':'■');}}
class Golf{public static void main(String[]x)throws Throwable{for(int n="嗕矟嵝坝睗坵啵矝啕坕".charAt(System.in.read()-48),i=0,j;++i<8;System.out.println())for(j=1;j++<6;)System.out.print((1<<j/3&n>>i*3/5*3)>0?'□':'■');}}
class Golf{public static void main(String[]x)throws Throwable{for(int n="嗕矟嵝坝睗坵啵矝啕坕".charAt(System.in.read()-48),i=0,j;++i<8;)for(j=1;j++<7;)System.out.print(j>6?'\n':(1<<j/3&n>>i*3/5*3)>0?'□':'■');}}
class Golf{public static void main(String[]x)throws Throwable{for(int n="嗕矟嵝坝睗坵啵矝啕坕".charAt(System.in.read()-48),i=5;++i<48;System.out.print(i%6>4?10:(1<<(i%6+2)/3&n>>i/6*3/5*3)>0?'□':'■'));}}class Golf{public static void main(String[]x)throws Throwable{for(int n="嗕矟嵝坝睗坵啵矝啕坕".charAt(System.in.read()-48),i=0,j;++i<8;)for(j=1;j++<7;)System.out.print(j>6?10:(1<<j/3&n>>i*3/5*3)>0?'□':'■');}}
class Golf{public static void main(String[]x)throws Throwable{for(int n="嗕矟嵝坝睗坵啵矝啕坕".charAt(System.in.read()-48),i=5;++i<48;System.out.print(i%6>4?10:(1<<(i%6+2)/3&n>>i/6*3/5*3)>0?'□':'■'));}}
@gecko655
Copy link
Author

gecko655 commented Apr 1, 2015

1,2 270 characters
3 268 characters

@gecko655
Copy link
Author

gecko655 commented Apr 2, 2015

4 266 characters

@gecko655
Copy link
Author

gecko655 commented Apr 2, 2015

5 240 characters

キモい(恍惚

@gecko655
Copy link
Author

gecko655 commented Apr 2, 2015

6 228 characters
なおbyte数は増えた模様

@gecko655
Copy link
Author

gecko655 commented Apr 2, 2015

7 225 characters 249bytes

@gecko655
Copy link
Author

gecko655 commented Apr 2, 2015

8 211 characters 235 bytes

@gecko655
Copy link
Author

gecko655 commented Apr 2, 2015

9 200 characters 224 bytes

@gecko655
Copy link
Author

gecko655 commented Apr 2, 2015

10 198 characters 222 bytes

@gecko655
Copy link
Author

gecko655 commented Apr 2, 2015

11 192 characters 216 bytes

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment