Skip to content

Instantly share code, notes, and snippets.

@oha-yashi
Last active Mar 17, 2020
Embed
What would you like to do?
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