0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 3 years have passed since last update.

Programming

問題

Programming:プログラミング

問題をみると、program.cppがある。
拡張子からc++で書かれたプログラムかなと思ったけど、見てみると全然違った。

program.cpp
# include   	 	<stdio.h>    
	
     	#include  	  <string.h>	
	
  int   	  	main		 
	()
   {   	const		char 	* 
s	=
 "     	    " 
"0123456789"	
"     "
	
"		   "
"			         							  				 			 "    	  
	 "ABCDEFGHIJ" 	;
	 printf	(
   	  "%c"	,		strlen 
(s)	
 );  int  i	  =	020000000	+	001000000	+
000600000	
  +000040000
+000007000
+000000500
+000000020
+000000002  	;
   	  	printf		(	
	"%s"
     	,&  	 i		
	)
;        	 	 
	long
    long 
			   							  				 		 	 					 l
	  =	 
 	
  2LL   		 
	    *
 	11LL
     	 		
	  	 *
 	229LL
     		 
	    *
 	614741LL
     		   
	    *
 	9576751LL
     		 	 
	  	 +
 	5LL
     	 	   
	    
 	;
     		  	
	  	 
 	printf
     	  	  (
	  "%s"  
 	
     	    ,	 
	  	 
 	
    & 	    
	    
 	
     		l	 
	    
 	
    ) 			 
	    
 	
     		 		;
	  	 
 	
    float 	 	
	    
 	
     	f		 =	
	    
 	
     1.0962664770776731080774868826855754386638240000e-38f	  
	  	 
 	
     ;	  
	    
 	
     printf(		"%s"	  
	  	 
 	
     	 ,		 
	    &f
 )	
    ; 	   	 
	double  	 
 	
d     		 			=
	6.7386412564254706622868098890859398199406890000e-308  	 
 ;	
  printf
("%s"
,&d);
}

includeとかint mainとか、printfとかc言語っぽのが書かれているけど、
もちろんそのままコンパイルして実行してみてもダメ。

これは**WhiteSpace**という言語で書かれたプログラムらしい。難解プログラミング言語の1つで、スペースとタブだけで構成されていてそれ以外の文字はコメント扱いになる。

ここで実行できる。「WhiteSpace online compile」とかで調べたら出てくる。

ソースコードをコピペして右のdebugの[Run]をするとスクリーンショット 2021-03-16 19.49.14.png
readiで処理が止まっていて、outputに書かれているPINの入力待ち状態になる。PINの値はわからない。右のdebugを見てみると、readiの2行下に「push 33355524」と書かれており、とりあえずこの値をPINとして入力してみる。PINを入力したら再び[Run]を押して実行するとFLAGが得られた。

まとめ

スペースとタブでのみで書かれた言語があることに驚いた。
難解プログラミング言語はなんのために作られたのだろうか。

0
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?