fork download
  1. #include <stdio.h>
  2. #include <stdlib.h>
  3. #include <time.h>
  4. #include <limits.h>
  5.  
  6. int main() {
  7. unsigned int target_secret = 1930152082;
  8. unsigned int guessed_secret, secret,second_secret;
  9.  
  10.  
  11. // 現在時刻周辺の範囲で総当たり
  12. time_t current_time = time(NULL);
  13. time_t start_time = current_time - 120; // 現在時刻の60秒前から試す
  14. time_t end_time = current_time + 120; // 現在時刻の60秒後まで試す
  15.  
  16. for (time_t t = start_time; t <= end_time; ++t) {
  17. srand(t); // 現在の時刻 t で srand を初期化
  18.  
  19. // 元のプログラムの計算を再現
  20. guessed_secret = rand();
  21.  
  22. // 推測した secret がターゲットと一致するか確認
  23. if (guessed_secret == target_secret) {
  24. secret = guessed_secret;
  25. printf("First Secret: %u\n", secret);
  26. second_secret = rand();
  27. secret *= second_secret;
  28. printf("Second Value: %u\n", second_secret);
  29. printf("Second Secret: %u\n", secret);
  30.  
  31. secret *= 0x5EC12E7;
  32. printf("Final Secret: %u\n", secret);
  33.  
  34.  
  35. return 0; // 見つかったらプログラムを終了
  36. }
  37. }
  38.  
  39. printf("Seed not found within the specified range.\n");
  40. return 1; // 見つからなかった場合
  41. }
Success #stdin #stdout 0s 5268KB
stdin
775713629
stdout
First Secret: 1930152082
Second Value: 1458057391
Second Secret: 2868476878
Final Secret: 4189795042