Skip to content

Instantly share code, notes, and snippets.

@oha-yashi
Last active March 17, 2020 01:47
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save oha-yashi/9186256a784c675c0c7416e841576bda to your computer and use it in GitHub Desktop.
Save oha-yashi/9186256a784c675c0c7416e841576bda to your computer and use it in GitHub Desktop.
mazaiスロット
#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