結果
問題 |
No.378 名声値を稼ごう
|
ユーザー |
![]() |
提出日時 | 2018-09-07 00:52:42 |
言語 | C#(csc) (csc 3.9.0) |
結果 |
AC
|
実行時間 | 27 ms / 2,000 ms |
コード長 | 652 bytes |
コンパイル時間 | 814 ms |
コンパイル使用メモリ | 115,080 KB |
実行使用メモリ | 24,924 KB |
最終ジャッジ日時 | 2024-07-01 04:18:14 |
合計ジャッジ時間 | 1,467 ms |
ジャッジサーバーID (参考情報) |
judge3 / judge2 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 1 |
other | AC * 5 |
コンパイルメッセージ
Microsoft (R) Visual C# Compiler version 3.9.0-6.21124.20 (db94f4cc) Copyright (C) Microsoft Corporation. All rights reserved.
ソースコード
using System; using System.Linq; using System.Collections.Generic; class No378 { static void Main() { var num = long.Parse(Console.ReadLine()); var list = new List<long>(); list.Add(num); while (num > 0) { num /= 2; list.Add(num); } var sum = list.Sum(); long score = 0; var length = list.Count(); for (int i = 0; i < length; ++i) { score += list[i]; if (sum < score + list[i]) { Console.WriteLine((score + list[i]) - sum); return; } } } }