結果

問題 No.378 名声値を稼ごう
ユーザー SSRS
提出日時 2021-03-17 00:44:01
言語 C++17
(gcc 13.3.0 + boost 1.87.0)
結果
AC  
実行時間 2 ms / 2,000 ms
コード長 403 bytes
コンパイル時間 1,850 ms
コンパイル使用メモリ 195,240 KB
最終ジャッジ日時 2025-01-19 17:44:16
ジャッジサーバーID
(参考情報)
judge3 / judge4
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 1
other AC * 5
権限があれば一括ダウンロードができます

ソースコード

diff #

//https://yukicoder.me/submissions/630747
#include <bits/stdc++.h>
class Problem {
public:

  void solve() {
    long long N; std::cin >> N;
    std::vector<long long> Score;
    while (N != 0) {
      Score.emplace_back(N);
      N /= 2;
    }

    std::cout << Score[0] * 2 - std::accumulate(Score.begin(), Score.end(), 0ll) << std::endl;
  }
};

int main(void) {
  Problem solver;
  solver.solve();
}
0