Riremito

6号機純増とコイン持ちの最大獲得枚数

Dec 3rd, 2021
731
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. #include<stdio.h>
  2. #include<Windows.h>
  3.  
  4. // 有利区間
  5. #define MAX_GAME_COUNT 3000
  6. // 最大放出枚数
  7. #define MAX_MEDAL_OUT 2400
  8.  
  9. int yurikukan(double medal_out_per_game, double game_count_per_1000) {
  10.     double medal_in_per_game = (double)(50.0 / game_count_per_1000);
  11.     double max_medal_out = MAX_MEDAL_OUT;
  12.  
  13.     // 1ゲームずつ消化したと想定
  14.     for (int game = 1; game <= MAX_GAME_COUNT; game++) {
  15.         // 最大放出枚数に吸い込み枚数を加算
  16.         max_medal_out += medal_in_per_game;
  17.  
  18.         int max_at_game_count = MAX_GAME_COUNT - game;
  19.         int medal_in = (int)medal_in_per_game * game;
  20.  
  21.         // 残り有利区間で最大放出枚数を獲得できなくなった場合に終了
  22.         if ((max_at_game_count * medal_out_per_game) < max_medal_out) {
  23.             printf("[純増 %.1f枚, コイン持ち 1k%.1fg]\n", medal_out_per_game, game_count_per_1000);
  24.             printf("通常ゲーム数 =  %d\n", game);
  25.             printf("ATゲーム数   = %d\n", max_at_game_count);
  26.             printf("最大獲得枚数 = %d\n", (int)max_medal_out);
  27.             return 1;
  28.         }
  29.     }
  30.  
  31.     return 0;
  32. }
  33.  
  34. int main(int argc, char **argv) {
  35.     // 純増
  36.     double medal_out_per_game = 1.0;
  37.     double game_count_per_1000 = 50.0;
  38.     int ret = 0;
  39.  
  40.     if (argc <= 2) {
  41.         medal_out_per_game = 3.0;
  42.         game_count_per_1000 = 50.0;
  43.         yurikukan(medal_out_per_game, game_count_per_1000);
  44.     }
  45.     else {
  46.         // yurikukan.exe [純増枚数] [コイン持ち]
  47.         medal_out_per_game = atof(argv[1]);
  48.         game_count_per_1000 = atof(argv[2]);
  49.         yurikukan(medal_out_per_game, game_count_per_1000);
  50.     }
  51.  
  52.     return 0;
  53. }
RAW Paste Data