結果

問題 No.1903 Day1
ユーザー 👑 hitonanodehitonanode
提出日時 2022-02-02 00:58:01
言語 C++23
(gcc 12.3.0 + boost 1.83.0)
結果
WA  
実行時間 -
コード長 523 bytes
コンパイル時間 671 ms
コンパイル使用メモリ 83,128 KB
実行使用メモリ 4,384 KB
最終ジャッジ日時 2023-09-02 06:31:31
合計ジャッジ時間 1,343 ms
ジャッジサーバーID
(参考情報)
judge15 / judge16
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2 ms
4,376 KB
testcase_01 AC 1 ms
4,380 KB
testcase_02 AC 1 ms
4,376 KB
testcase_03 AC 1 ms
4,380 KB
testcase_04 AC 1 ms
4,380 KB
testcase_05 AC 1 ms
4,380 KB
testcase_06 AC 1 ms
4,380 KB
testcase_07 WA -
testcase_08 WA -
testcase_09 WA -
testcase_10 AC 2 ms
4,384 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

// 嘘二分探索
#include <iostream>
#include <vector>
using namespace std;

int solve(int N) {
    for (int day = 1;; ++day) {
        if (day % 7 == 0) N += 6;
        --N;
        if (N <= 0) return day;
    }
}

int uso_binary_search(int N) {
    int ng = 0, ok = 13964;
    while (ok > ng + 1) {
        int c = (ok + ng) / 2;
        int num_problem = N + c / 7 * 6;
        (num_problem <= c ? ok : ng) = c;
    }
    return ok;
}

int main() {
    int N;
    cin >> N;
    cout << uso_binary_search(N) << '\n';
}
0