結果

問題 No.604 誕生日のお小遣い
コンテスト
ユーザー extelo
提出日時 2017-12-08 15:38:03
言語 C++17
(gcc 15.2.0 + boost 1.90.0)
コンパイル:
g++-15 -O2 -lm -std=c++17 -Wuninitialized -DONLINE_JUDGE -o a.out _filename_
実行:
./a.out
結果
MLE  
実行時間 -
コード長 1,096 bytes
記録
記録タグの例:
初AC ショートコード 純ショートコード 純主流ショートコード 最速実行時間
コンパイル時間 380 ms
コンパイル使用メモリ 78,208 KB
実行使用メモリ 1,305,600 KB
最終ジャッジ日時 2026-06-06 19:45:24
合計ジャッジ時間 3,883 ms
ジャッジサーバーID
(参考情報)
judge2_0 / judge3_0
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample MLE * 1 -- * 2
other MLE * 1 -- * 20
権限があれば一括ダウンロードができます
コンパイルメッセージ
main.cpp: In function 'int BinarySearch(Yuki, long long int, long long int, long long int)':
main.cpp:40:1: warning: control reaches end of non-void function [-Wreturn-type]
   40 | }
      | ^

ソースコード

diff #
raw source code

#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 {
    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