Created
October 29, 2013 05:10
-
-
Save nanase/7209424 to your computer and use it in GitHub Desktop.
モンテカルロ法
This file contains hidden or 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
| char mes0[] = { 0xe8, 0xa8, 0x88, 0xe7, 0xae, 0x97, 0 , 0 , 0, 0 , 0 , 0 ,0} | |
| , mes1 [ ] = { 0 , 0 , 0 , 0 , 0 , 0 , 0xe5 , 0x9b , 0x9e , 0xe6 , 0x95 , 0xb0 | |
| , 0xe3, 0x82, 0x92, 0xe5 , 0x85, 0xa5 , 0xe5 , 0x8a , 0x9b , 0x3a , 0x20 , 0 , 0 , 0 | |
| , 0 } , mes2 [ ] = { 0x25 , 0x6c , 0x6c , 0x64 , 0 } , mes3 [ ] = { 0 , 0 , 0 , 0 | |
| , 0 , 0 , 0xe4 , 0xb8 , 0xad , 0x2e , 0x2e , 0x2e , 0x28 , 0x25 , 0x36 , 0x2e , 0x32 | |
| , 0x66 , 0x25 , 0x25 , 0x29 , 0x20 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 } , mes4 [ ] = { 0x50 | |
| , 0x49 , 0x20 , 0x3d , 0x20 , 0x25 , 0x2e , 0x36 , 0x66 , 0xa , 0 , 0 } , mes5 [ ] = { 0xa | |
| , 0 , 0 , 0 , 0 , 0 ,0,0xe5, 0xae | |
| , 0x8c , 0xe4,0xba ,0x86 , 0xa , | |
| 0 } ; void copy ( char * base | |
| ,char * to) ;void rndInt ( void | |
| );int dummy = 1 + 2 + 3 + 4 + | |
| 5-2; double ge (double max ); | |
| # include <././stdlib.h> | |
| # include <.////stdio.h> | |
| int main (void){double | |
| x = 0.00 , y=0.;unsigned | |
| long long int i , c, r ; | |
| copy ( mes0 , mes1 ) ;copy | |
| (mes0,mes3 ) ; copy (mes0 | |
| , mes5 + 1+ 2 + 3 + 4 + 5+ | |
| 6 + 7 + 8 + 9 - 8 - 7 - 6- | |
| 5 - 4 - 3 - 2 - 1 ) ; do { | |
| printf ( mes1 ) ; scanf(mes2 | |
| , &i);} while ( i < 1 ) ; r= | |
| 0 ; for ( c = 0 ; c < i ;c++ | |
| ) { x = ge(1.0 ) ; y =ge(1.0) | |
| ; if ( x * x + y * y < 1.0 ){ | |
| r ++ ; } if ( c >= 10000000 && | |
| c % 10000000 == 0 ) { printf ( | |
| mes3 , ( double ) c *100.0/(double ) i); | |
| printf ( mes4 , ( double ) r *4.0 / ( | |
| double ) c ) ; } } printf ( mes5 ) ; 1 +1; | |
| printf (mes4,(double ) r * 4.0/(double )c+0. | |
| + 0 ) ; return ( 0 );} void rndInt ( void ) {int | |
| tmp ; srand ((unsigned int ) & tmp ) ; } double ge(double | |
| max ) { int dummy = 27 * 0 + 781 * 24 + 0xFF / 0xFC - 23+2; | |
| int pi2 = 1 + 4 + 9 +25 + 36 + 49 + 64 + 81 + 100 ; return | |
| ( ( rand ( ) /((double ) RAND_MAX + 1.0 ) ) * max ) ; } | |
| void copy( char* base , char * to ) { char * i = "t" | |
| , *hin = "k", *th = "e" , *pi = "i", *s = "s", | |
| *o = "cr", *a = "zy";while(* base != | |
| 0){ *to ++=*base++;}} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment