fork download
  1. #include <stdio.h>
  2.  
  3. // Small C program to simulate how many helpful flags someone could have raised on both comments and posts
  4. // Assumptions:
  5. // - Flags would be immediately marked helpful or near immediately
  6. // - Every 10 flags, you get one extra flag per day, up to 100 total flags.
  7. // - No declined flags
  8. // @Author: Magisch - http://stackoverflow.com/users/5389107/magisch
  9. // @License: CC0
  10.  
  11. int main(void) {
  12.  
  13. int nDays = 0; // Days to simulate for
  14. int nFlags = 0;
  15. int dFlags = 10;
  16. int dCounter = 0;
  17.  
  18. printf("Enter the amount of days you want to simulate for:\n");
  19.  
  20. scanf("%d ", &nDays);
  21.  
  22. printf("Computing Maximum helpful comment flags and post flags for %d days.\n",nDays);
  23.  
  24. for (int i = 0; i < nDays; i++) {
  25.  
  26. nFlags += dFlags;
  27. dCounter += dFlags;
  28. while (dCounter >= 10 && dFlags < 100) {
  29. dFlags++;
  30. nFlags++;
  31. dCounter -= 10;
  32. }
  33. printf("Day %d simulated. helpful comment / post flags (each): %d. Daily available flags: %d \n", i+1, nFlags, dFlags);
  34. }
  35. printf("Simulation for %d Days finished. Total helpful flags: %d",nDays,2*nFlags);
  36. return 0;
  37. }
Success #stdin #stdout 0s 2172KB
stdin
52
stdout
Enter the amount of days you want to simulate for:
Computing Maximum helpful comment flags and post flags for 52 days.
Day 1 simulated. helpful comment / post flags (each): 11. Daily available flags: 11 
Day 2 simulated. helpful comment / post flags (each): 23. Daily available flags: 12 
Day 3 simulated. helpful comment / post flags (each): 36. Daily available flags: 13 
Day 4 simulated. helpful comment / post flags (each): 50. Daily available flags: 14 
Day 5 simulated. helpful comment / post flags (each): 66. Daily available flags: 16 
Day 6 simulated. helpful comment / post flags (each): 83. Daily available flags: 17 
Day 7 simulated. helpful comment / post flags (each): 102. Daily available flags: 19 
Day 8 simulated. helpful comment / post flags (each): 123. Daily available flags: 21 
Day 9 simulated. helpful comment / post flags (each): 146. Daily available flags: 23 
Day 10 simulated. helpful comment / post flags (each): 171. Daily available flags: 25 
Day 11 simulated. helpful comment / post flags (each): 199. Daily available flags: 28 
Day 12 simulated. helpful comment / post flags (each): 229. Daily available flags: 30 
Day 13 simulated. helpful comment / post flags (each): 262. Daily available flags: 33 
Day 14 simulated. helpful comment / post flags (each): 299. Daily available flags: 37 
Day 15 simulated. helpful comment / post flags (each): 339. Daily available flags: 40 
Day 16 simulated. helpful comment / post flags (each): 383. Daily available flags: 44 
Day 17 simulated. helpful comment / post flags (each): 432. Daily available flags: 49 
Day 18 simulated. helpful comment / post flags (each): 486. Daily available flags: 54 
Day 19 simulated. helpful comment / post flags (each): 545. Daily available flags: 59 
Day 20 simulated. helpful comment / post flags (each): 610. Daily available flags: 65 
Day 21 simulated. helpful comment / post flags (each): 682. Daily available flags: 72 
Day 22 simulated. helpful comment / post flags (each): 761. Daily available flags: 79 
Day 23 simulated. helpful comment / post flags (each): 848. Daily available flags: 87 
Day 24 simulated. helpful comment / post flags (each): 943. Daily available flags: 95 
Day 25 simulated. helpful comment / post flags (each): 1043. Daily available flags: 100 
Day 26 simulated. helpful comment / post flags (each): 1143. Daily available flags: 100 
Day 27 simulated. helpful comment / post flags (each): 1243. Daily available flags: 100 
Day 28 simulated. helpful comment / post flags (each): 1343. Daily available flags: 100 
Day 29 simulated. helpful comment / post flags (each): 1443. Daily available flags: 100 
Day 30 simulated. helpful comment / post flags (each): 1543. Daily available flags: 100 
Day 31 simulated. helpful comment / post flags (each): 1643. Daily available flags: 100 
Day 32 simulated. helpful comment / post flags (each): 1743. Daily available flags: 100 
Day 33 simulated. helpful comment / post flags (each): 1843. Daily available flags: 100 
Day 34 simulated. helpful comment / post flags (each): 1943. Daily available flags: 100 
Day 35 simulated. helpful comment / post flags (each): 2043. Daily available flags: 100 
Day 36 simulated. helpful comment / post flags (each): 2143. Daily available flags: 100 
Day 37 simulated. helpful comment / post flags (each): 2243. Daily available flags: 100 
Day 38 simulated. helpful comment / post flags (each): 2343. Daily available flags: 100 
Day 39 simulated. helpful comment / post flags (each): 2443. Daily available flags: 100 
Day 40 simulated. helpful comment / post flags (each): 2543. Daily available flags: 100 
Day 41 simulated. helpful comment / post flags (each): 2643. Daily available flags: 100 
Day 42 simulated. helpful comment / post flags (each): 2743. Daily available flags: 100 
Day 43 simulated. helpful comment / post flags (each): 2843. Daily available flags: 100 
Day 44 simulated. helpful comment / post flags (each): 2943. Daily available flags: 100 
Day 45 simulated. helpful comment / post flags (each): 3043. Daily available flags: 100 
Day 46 simulated. helpful comment / post flags (each): 3143. Daily available flags: 100 
Day 47 simulated. helpful comment / post flags (each): 3243. Daily available flags: 100 
Day 48 simulated. helpful comment / post flags (each): 3343. Daily available flags: 100 
Day 49 simulated. helpful comment / post flags (each): 3443. Daily available flags: 100 
Day 50 simulated. helpful comment / post flags (each): 3543. Daily available flags: 100 
Day 51 simulated. helpful comment / post flags (each): 3643. Daily available flags: 100 
Day 52 simulated. helpful comment / post flags (each): 3743. Daily available flags: 100 
Simulation for 52 Days finished. Total helpful flags: 7486