結果
| 問題 |
No.604 誕生日のお小遣い
|
| コンテスト | |
| ユーザー |
extelo
|
| 提出日時 | 2017-12-08 15:42:25 |
| 言語 | C++17(gcc12) (gcc 12.3.0 + boost 1.87.0) |
| 結果 |
MLE
|
| 実行時間 | - |
| コード長 | 1,127 bytes |
| コンパイル時間 | 1,827 ms |
| コンパイル使用メモリ | 85,260 KB |
| 最終ジャッジ日時 | 2025-01-05 04:59:49 |
|
ジャッジサーバーID (参考情報) |
judge1 / judge4 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | MLE * 3 |
| other | AC * 2 TLE * 15 MLE * 4 |
コンパイルメッセージ
main.cpp: In function 'int BinarySearch(Yuki, long long int, long long int, long long int)':
main.cpp:41:1: warning: control reaches end of non-void function [-Wreturn-type]
41 | }
| ^
ソースコード
#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;
}
extelo