Created
March 25, 2020 12:01
-
-
Save gao-sun/0cf4c86df18e7b88a10410b3ce37a52d to your computer and use it in GitHub Desktop.
Lottery
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 <cstdio> | |
#include <cmath> | |
#include <cstdlib> | |
int hash[10000] = {0}; | |
int main () | |
{ | |
float index; | |
int count; | |
scanf("%f%d", &index, &count); | |
srand(floor(index * index)); | |
for (int i = 0; i < 50; ++ i) { | |
int next = 0; | |
while (!next) { | |
int tmp = rand() % count + 1; | |
if (!hash[tmp]) { | |
next = tmp; | |
hash[tmp] = 1; | |
} | |
} | |
printf("%d\n", next); | |
} | |
return 0; | |
} |
Author
gao-sun
commented
Mar 27, 2020
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment