結果

問題 No.2063 ±2^k operations (easy)
ユーザー bluemeganebluemegane
提出日時 2022-09-24 07:10:39
言語 C#(csc)
(csc 3.9.0)
結果
AC  
実行時間 52 ms / 2,000 ms
コード長 632 bytes
コンパイル時間 2,280 ms
コンパイル使用メモリ 67,200 KB
実行使用メモリ 15,288 KB
最終ジャッジ日時 2023-08-23 21:19:41
合計ジャッジ時間 4,260 ms
ジャッジサーバーID
(参考情報)
judge15 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 49 ms
15,224 KB
testcase_01 AC 48 ms
15,116 KB
testcase_02 AC 51 ms
15,024 KB
testcase_03 AC 52 ms
15,044 KB
testcase_04 AC 48 ms
15,112 KB
testcase_05 AC 49 ms
14,952 KB
testcase_06 AC 49 ms
15,248 KB
testcase_07 AC 49 ms
15,124 KB
testcase_08 AC 49 ms
15,044 KB
testcase_09 AC 48 ms
15,124 KB
testcase_10 AC 49 ms
15,084 KB
testcase_11 AC 49 ms
15,080 KB
testcase_12 AC 49 ms
15,088 KB
testcase_13 AC 48 ms
15,080 KB
testcase_14 AC 49 ms
15,124 KB
testcase_15 AC 49 ms
15,088 KB
testcase_16 AC 48 ms
15,056 KB
testcase_17 AC 51 ms
15,144 KB
testcase_18 AC 51 ms
15,288 KB
testcase_19 AC 51 ms
15,200 KB
testcase_20 AC 51 ms
15,184 KB
testcase_21 AC 52 ms
15,168 KB
testcase_22 AC 52 ms
15,212 KB
testcase_23 AC 52 ms
15,096 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

using static System.Math;
using System.Collections.Generic;
using System.Linq;
using System;

public class Hello
{
    static void Main()
    {
        var s = Console.ReadLine().Trim();
        getAns(s);
    }
    static void getAns(string s)
    {
        var c = s.Count(x => x == '1');
        if (c == 2) { Console.WriteLine("Yes"); return; }
        if (c == 1) { Console.WriteLine("No"); return; }
        var n = s.Length;
        var z = 0;
        for (int i = n - 1; i >= 0; i--)
        {
            if (s[i] == '0') z++;
            else break;
        }
        Console.WriteLine(z + c == n ? "Yes" : "No");
    }
}
0