結果
| 問題 | No.604 誕生日のお小遣い |
| コンテスト | |
| ユーザー |
extelo
|
| 提出日時 | 2017-12-08 15:42:25 |
| 言語 | C++17(gcc12) (gcc 12.4.0 + boost 1.90.0) |
| 結果 |
MLE
|
| 実行時間 | - |
| コード長 | 1,127 bytes |
| 記録 | |
| コンパイル時間 | 1,234 ms |
| コンパイル使用メモリ | 68,224 KB |
| 実行使用メモリ | 1,307,136 KB |
| 最終ジャッジ日時 | 2026-06-06 19:45:52 |
| 合計ジャッジ時間 | 6,695 ms |
|
ジャッジサーバーID (参考情報) |
judge2_1 / judge1_1 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| 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:41:1: warning: control reaches end of non-void function [-Wreturn-type]
41 | }
| ^
main.cpp: In function ‘int main()’:
main.cpp:47:8: warning: ignoring return value of ‘int scanf(const char*, ...)’ declared with attribute ‘warn_unused_result’ [-Wunused-result]
47 | scanf("%lld %lld %lld", &a_num, &b_get, &c);
| ~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
ソースコード
#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