41 lines
725 B
C
41 lines
725 B
C
#include <stdio.h>
|
|
#include <stdlib.h>
|
|
#include <time.h>
|
|
#include <fcntl.h>
|
|
#include <unistd.h>
|
|
|
|
#define FLAGSIZE 64
|
|
|
|
void win() {
|
|
char buf[FLAGSIZE];
|
|
int fd = open("flag", O_RDONLY);
|
|
read(fd, buf, sizeof(buf));
|
|
puts(buf);
|
|
close(fd);
|
|
}
|
|
|
|
void init() {
|
|
setvbuf(stdin, 0LL, 2, 0LL);
|
|
setvbuf(stdout, 0LL, 2, 0LL);
|
|
setvbuf(stderr, 0LL, 2, 0LL);
|
|
}
|
|
|
|
int main() {
|
|
init();
|
|
int number, guess, round;
|
|
round = rand() % 10;
|
|
number = 0;
|
|
for(int i = 0; i < round; ++i) {
|
|
number += rand() % 1000000;
|
|
}
|
|
// 2260578
|
|
// printf("%d\n", number);
|
|
puts("Input your guess number: ");
|
|
scanf("%d", &guess);
|
|
if (guess == number) {
|
|
win();
|
|
}
|
|
|
|
return 0;
|
|
}
|