]>
Commit | Line | Data |
---|---|---|
5c5cd38a MG |
1 | #include<cstdio> |
2 | #include<cstdlib> | |
3 | #include<ctime> | |
4 | #include<unistd.h> | |
5 | ||
6 | int main(void){ | |
7 | srand(time(NULL)); | |
8 | for(int i=0;i<100;i++){ | |
9 | int nr = rand() % 100; | |
10 | printf("%d\n", nr); | |
11 | fflush(stdout); | |
12 | int ret; | |
13 | scanf("%d", &ret); | |
14 | if(ret != nr + 1){ | |
15 | fprintf(stderr, "bad ret: %d instead of %d", ret, nr + 1); | |
16 | return 1; | |
17 | } | |
18 | } | |
19 | ||
20 | if(write(4, "20", 2) == -1) | |
21 | perror("write"); | |
22 | return 0; | |
23 | } |