Last active
March 17, 2020 01:47
-
-
Save oha-yashi/9186256a784c675c0c7416e841576bda to your computer and use it in GitHub Desktop.
mazaiスロット
This file contains 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
#include <stdio.h> | |
#include <stdlib.h> | |
#include <time.h> | |
#define pow2(x) ((x)*(x)) | |
#define pow3(x) ((x)*(x)*(x)) | |
#define TRY 10 | |
char mazai_susiki(int x){ | |
double a, b, c; | |
a = pow3(x)*13/6.0; | |
b = pow2(x)*17/2.0; | |
c = x*43/3.0; | |
return (char)(a-b+c+97); | |
} | |
int main(){ | |
srand((unsigned)time(NULL)); | |
int i, j; | |
for(i=0; i<TRY; i++){ | |
for(j=0; j<5; j++){ | |
putchar( mazai_susiki( rand()%4 ) ); | |
} | |
putchar('\n'); | |
} | |
return 0; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment