結果

問題 No.378 名声値を稼ごう
ユーザー byami
提出日時 2017-11-16 08:00:12
言語 C++14
(gcc 13.3.0 + boost 1.87.0)
結果
AC  
実行時間 2 ms / 2,000 ms
コード長 188 bytes
コンパイル時間 1,534 ms
コンパイル使用メモリ 166,364 KB
実行使用メモリ 5,376 KB
最終ジャッジ日時 2024-06-30 03:26:03
合計ジャッジ時間 1,989 ms
ジャッジサーバーID
(参考情報)
judge1 / judge3
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 1
other AC * 5
権限があれば一括ダウンロードができます
コンパイルメッセージ
main.cpp: In function 'int main()':
main.cpp:11:17: warning: 's' may be used uninitialized [-Wmaybe-uninitialized]
   11 |     cout << t - s << endl;
      |                 ^
main.cpp:5:18: note: 's' was declared here
    5 |     long long n, s, t; cin >> n;
      |                  ^

ソースコード

diff #

#include<bits/stdc++.h>
using namespace std;

int main() {
    long long n, s, t; cin >> n;
    t = n * 2;
    while(n){
        s += n;
        n /= 2;
    } 
    cout << t - s << endl;
}
0