結果
| 問題 |
No.104 国道
|
| コンテスト | |
| ユーザー |
nanophoto12
|
| 提出日時 | 2015-12-13 22:42:10 |
| 言語 | C#(csc) (csc 3.9.0) |
| 結果 |
AC
|
| 実行時間 | 24 ms / 5,000 ms |
| コード長 | 670 bytes |
| コンパイル時間 | 833 ms |
| コンパイル使用メモリ | 103,552 KB |
| 実行使用メモリ | 17,664 KB |
| 最終ジャッジ日時 | 2024-09-15 11:48:20 |
| 合計ジャッジ時間 | 2,115 ms |
|
ジャッジサーバーID (参考情報) |
judge1 / judge2 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 4 |
| other | AC * 16 |
コンパイルメッセージ
Microsoft (R) Visual C# Compiler version 3.9.0-6.21124.20 (db94f4cc) Copyright (C) Microsoft Corporation. All rights reserved.
ソースコード
using System;
using System.Collections.Generic;
using System.Linq;
namespace No104
{
class MainClass
{
private static long LeftPosition(int length)
{
long index = 1;
for (int i = 0; i < length; i++) {
index *= 2;
}
return index;
}
public static void Main (string[] args)
{
var s = Console.ReadLine ();
if (s.Length == 0) {
Console.WriteLine ("1");
return;
}
var leftPosition = LeftPosition (s.Length);
var length = leftPosition / 2L;
for (int i = 0; i < s.Length; i++) {
if (s [i] == 'R') {
leftPosition += length;
}
length /= 2L;
}
Console.WriteLine (leftPosition.ToString());
}
}
}
nanophoto12