fork download
  1. #include <stddef.h>
  2. #include <stdio.h>
  3. #include <stdlib.h>
  4. #include <time.h>
  5.  
  6. int main(void) {
  7. int p1, px, p2, r;
  8.  
  9. srand((unsigned int) time(NULL));
  10. while (scanf("%d%d%d", &p1, &px, &p2) == 3) {
  11. r = rand() % (p1 + px + p2);
  12. if (r < p1) {
  13. puts("1");
  14. } else if (r < p1 + px) {
  15. puts("X");
  16. } else {
  17. puts("2");
  18. }
  19. }
  20. return 0;
  21. }
Success #stdin #stdout 0s 9424KB
stdin
Standard input is empty
stdout
Standard output is empty