結果

問題 No.604 誕生日のお小遣い
ユーザー exteloextelo
提出日時 2017-12-08 15:42:25
言語 C++17
(gcc 12.3.0 + boost 1.83.0)
結果
MLE  
実行時間 -
コード長 1,127 bytes
コンパイル時間 575 ms
コンパイル使用メモリ 67,948 KB
実行使用メモリ 814,468 KB
最終ジャッジ日時 2023-08-19 22:30:50
合計ジャッジ時間 5,129 ms
ジャッジサーバーID
(参考情報)
judge13 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 MLE -
testcase_01 -- -
testcase_02 -- -
testcase_03 -- -
testcase_04 -- -
testcase_05 -- -
testcase_06 -- -
testcase_07 -- -
testcase_08 -- -
testcase_09 -- -
testcase_10 -- -
testcase_11 -- -
testcase_12 -- -
testcase_13 -- -
testcase_14 -- -
testcase_15 -- -
testcase_16 -- -
testcase_17 -- -
testcase_18 -- -
testcase_19 -- -
testcase_20 -- -
testcase_21 -- -
testcase_22 -- -
testcase_23 -- -
権限があれば一括ダウンロードができます
コンパイルメッセージ
main.cpp: 関数 ‘int BinarySearch(Yuki, long long int, long long int, long long int)’ 内:
main.cpp:41:1: 警告: 制御が非 void 関数の終りに到達しました [-Wreturn-type]
   41 | }
      | ^

ソースコード

diff #

#include <iostream>

class Yuki
{
public:
  long long int old;
  long long int sum;
  long long int old_start;

};

int BinarySearch(Yuki yuki, long long int a_num, long long int b_get, long long int c)
{
  long long int nget = yuki.old_start / a_num;
  yuki.sum = b_get * nget + (yuki.old_start - nget);
  
  long long int tmp_p;
  if((yuki.old_start+1)%a_num == 0){
    tmp_p = yuki.sum + b_get;
  } else {
    tmp_p = yuki.sum + 1;
  }

  if(yuki.sum < c){
    if(tmp_p >= c){
      yuki.old = yuki.old_start + 1;
      printf("%lld\n", yuki.old);
      return 0;
    }
    yuki.old_start = (c + yuki.old_start) / 2;
    BinarySearch(yuki, a_num, b_get, c);
  } else if(yuki.sum > c){
    yuki.old_start = yuki.old_start / 2;
    BinarySearch(yuki, a_num, b_get, c);
  } else {
    yuki.old = yuki.old_start;
    printf("%lld\n", yuki.old);
    return 0;
  }

}

int main(void)
{
  long long int a_num, b_get, c; 

  scanf("%lld %lld %lld", &a_num, &b_get, &c);

  
  Yuki yuki;
  yuki.sum=0;
 // yuki.old = 1;
  yuki.old_start = c / 2;

  BinarySearch(yuki, a_num, b_get, c);

  //printf("%lld\n", yuki.old);

  return 0;
}
0