結果
問題 | No.378 名声値を稼ごう |
ユーザー | pirorirori_n712 |
提出日時 | 2018-09-07 00:52:42 |
言語 | C#(csc) (csc 3.9.0) |
結果 |
AC
|
実行時間 | 57 ms / 2,000 ms |
コード長 | 652 bytes |
コンパイル時間 | 2,691 ms |
コンパイル使用メモリ | 105,208 KB |
実行使用メモリ | 23,688 KB |
最終ジャッジ日時 | 2023-09-13 19:44:47 |
合計ジャッジ時間 | 3,405 ms |
ジャッジサーバーID (参考情報) |
judge15 / judge13 |
テストケース
テストケース表示入力 | 結果 | 実行時間 実行使用メモリ |
---|---|---|
testcase_00 | AC | 57 ms
23,688 KB |
testcase_01 | AC | 55 ms
21,460 KB |
testcase_02 | AC | 57 ms
23,436 KB |
testcase_03 | AC | 56 ms
21,420 KB |
testcase_04 | AC | 56 ms
21,528 KB |
testcase_05 | AC | 57 ms
21,424 KB |
コンパイルメッセージ
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; } } } }