結果
| 問題 |
No.378 名声値を稼ごう
|
| コンテスト | |
| ユーザー |
srup٩(๑`н´๑)۶
|
| 提出日時 | 2016-07-15 17:41:19 |
| 言語 | C++11(廃止可能性あり) (gcc 13.3.0) |
| 結果 |
AC
|
| 実行時間 | 2 ms / 2,000 ms |
| コード長 | 352 bytes |
| コンパイル時間 | 396 ms |
| コンパイル使用メモリ | 55,804 KB |
| 実行使用メモリ | 6,944 KB |
| 最終ジャッジ日時 | 2024-06-29 14:07:15 |
| 合計ジャッジ時間 | 711 ms |
|
ジャッジサーバーID (参考情報) |
judge4 / judge5 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 1 |
| other | AC * 5 |
コンパイルメッセージ
main.cpp: In function ‘int main()’:
main.cpp:16:37: warning: format ‘%d’ expects argument of type ‘int’, but argument 2 has type ‘ll’ {aka ‘long long int’} [-Wformat=]
16 | if(an2 - an1 >= 0) printf("%d\n", an2 - an1);
| ~^ ~~~~~~~~~
| | |
| int ll {aka long long int}
| %lld
main.cpp:17:23: warning: format ‘%d’ expects argument of type ‘int’, but argument 2 has type ‘ll’ {aka ‘long long int’} [-Wformat=]
17 | else printf("%d\n", an1 - an2);
| ~^ ~~~~~~~~~
| | |
| int ll {aka long long int}
| %lld
ソースコード
#include <iostream>
#include <cstdio>
#include <algorithm>
using namespace std;
typedef long long ll;
#define rep(i,n) for(int i=0;i<(n);i++)
int main(void){
ll n; cin >> n;
ll tmp = n;
ll an1 = 0, an2 = 2 * n;
while(tmp > 0){
an1 += tmp; tmp /= 2;
}
if(an2 - an1 >= 0) printf("%d\n", an2 - an1);
else printf("%d\n", an1 - an2);
return 0;
}
srup٩(๑`н´๑)۶