結果
問題 |
No.642 Two Operations No.1
|
ユーザー |
![]() |
提出日時 | 2018-02-22 16:30:44 |
言語 | C#(csc) (csc 3.9.0) |
結果 |
WA
|
実行時間 | - |
コード長 | 630 bytes |
コンパイル時間 | 1,341 ms |
コンパイル使用メモリ | 102,912 KB |
実行使用メモリ | 17,664 KB |
最終ジャッジ日時 | 2024-10-01 20:36:53 |
合計ジャッジ時間 | 2,186 ms |
ジャッジサーバーID (参考情報) |
judge1 / judge5 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
other | AC * 6 WA * 9 |
コンパイルメッセージ
Microsoft (R) Visual C# Compiler version 3.9.0-6.21124.20 (db94f4cc) Copyright (C) Microsoft Corporation. All rights reserved.
ソースコード
using System; namespace ConsoleApp1 { class Program { static void Main(string[] args) { int N = int.Parse(Console.ReadLine()); int X = 1; int time = 0; if (N == 0) { Console.WriteLine(1); return; } if (N == 1) { Console.WriteLine(0); return; } while(N > X) { X = X << 1; time++; } time += X - N; Console.WriteLine(time); } } }