結果
問題 | No.604 誕生日のお小遣い |
ユーザー |
|
提出日時 | 2021-01-07 23:06:26 |
言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
結果 |
AC
|
実行時間 | 2 ms / 1,000 ms |
コード長 | 610 bytes |
コンパイル時間 | 1,506 ms |
コンパイル使用メモリ | 166,604 KB |
実行使用メモリ | 6,820 KB |
最終ジャッジ日時 | 2024-11-14 04:27:27 |
合計ジャッジ時間 | 2,367 ms |
ジャッジサーバーID (参考情報) |
judge4 / judge1 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 21 |
コンパイルメッセージ
main.cpp:8:45: warning: use of 'auto' in parameter declaration only available with '-std=c++20' or '-fconcepts' 8 | template<class T>T binarySearch(T ok, T ng, auto check){ | ^~~~
ソースコード
#include <bits/stdc++.h> using namespace std; #define int long long template<class T>bool chmax(T &a, const T &b) { if (a<b) { a=b; return 1; } return 0; } template<class T>bool chmin(T &a, const T &b) { if (b<a) { a=b; return 1; } return 0; } template<class T>T binarySearch(T ok, T ng, auto check){ while(ok-ng > 1){ T mid = (ok+ng)/2; if(check(mid)) ok = mid; else ng = mid; } return ok; } signed main(){ int aa, bb, cc; cin >> aa >> bb >> cc; __int128 a = aa, b = bb, c = cc; cout << (int)binarySearch(c, (__int128)0, [&](int mid){ return (mid+(b-1)*(mid/a) >= c); }) << endl; return 0; }