結果
| 問題 |
No.381 名声値を稼ごう Extra
|
| コンテスト | |
| ユーザー |
もる
|
| 提出日時 | 2016-07-07 20:10:35 |
| 言語 | C++11(廃止可能性あり) (gcc 13.3.0) |
| 結果 |
WA
|
| 実行時間 | - |
| コード長 | 366 bytes |
| コンパイル時間 | 298 ms |
| コンパイル使用メモリ | 30,848 KB |
| 実行使用メモリ | 6,272 KB |
| 最終ジャッジ日時 | 2024-10-12 23:18:20 |
| 合計ジャッジ時間 | 559 ms |
|
ジャッジサーバーID (参考情報) |
judge2 / judge5 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| other | WA * 2 |
コンパイルメッセージ
main.cpp: In function ‘int main()’:
main.cpp:8:14: warning: ignoring return value of ‘int scanf(const char*, ...)’ declared with attribute ‘warn_unused_result’ [-Wunused-result]
8 | scanf("%d",&N);
| ~~~~~^~~~~~~~~
main.cpp:19:13: warning: ‘S’ may be used uninitialized [-Wmaybe-uninitialized]
19 | max = S[0];
| ~~~~^~~~~~
main.cpp:11:13: note: ‘S’ declared here
11 | int S[1000000];
| ^
ソースコード
#include <stdio.h>
#include <math.h>
int main(void)
{
int N;
scanf("%d",&N);
int T=N;
int K=0;
int S[1000000];
while(T!=0)
{ T=floor(T/2);
S[K]=N+2*T;
K++;
N=N+T;
}
int max;
max = S[0];
for (int i = 1; i < K; i++)
{
if (max < S[i])
{
max = S[i];
}
}
int answer=max-N;
printf("%d\n",answer);
}
もる