結果

問題 No.2063 ±2^k operations (easy)
ユーザー scrappyscrappy
提出日時 2022-09-23 20:36:42
言語 Go
(1.22.1)
結果
WA  
実行時間 -
コード長 666 bytes
コンパイル時間 12,722 ms
コンパイル使用メモリ 211,984 KB
実行使用メモリ 4,384 KB
最終ジャッジ日時 2023-08-23 21:06:30
合計ジャッジ時間 13,737 ms
ジャッジサーバーID
(参考情報)
judge14 / judge15
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2 ms
4,352 KB
testcase_01 AC 2 ms
4,352 KB
testcase_02 AC 1 ms
4,352 KB
testcase_03 AC 2 ms
4,356 KB
testcase_04 AC 1 ms
4,356 KB
testcase_05 AC 1 ms
4,360 KB
testcase_06 AC 1 ms
4,356 KB
testcase_07 AC 2 ms
4,352 KB
testcase_08 AC 1 ms
4,356 KB
testcase_09 AC 1 ms
4,352 KB
testcase_10 AC 1 ms
4,352 KB
testcase_11 AC 1 ms
4,356 KB
testcase_12 AC 1 ms
4,352 KB
testcase_13 AC 2 ms
4,356 KB
testcase_14 AC 2 ms
4,356 KB
testcase_15 AC 2 ms
4,352 KB
testcase_16 AC 1 ms
4,356 KB
testcase_17 AC 2 ms
4,356 KB
testcase_18 WA -
testcase_19 WA -
testcase_20 WA -
testcase_21 WA -
testcase_22 AC 1 ms
4,352 KB
testcase_23 AC 1 ms
4,356 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

// No.2063 ±2^k operations (easy)
package main

import (
	"bufio"
	"fmt"
	"os"
	"strings"
)

func main() {
	sc := bufio.NewScanner(os.Stdin)
	sc.Scan()
	X := sc.Text()

	pos1 := strings.Index(X, "1")
	if pos1 < 0 {
		fmt.Println("No") // "0", n -> 0
	} else {
		count1 := strings.Count(X[pos1:], "1")
		if count1 < 2 {
			fmt.Println("No") // "10*", n -> 1 (-)
		} else if count1 == 2 {
			fmt.Println("Yes") // "10*10*", n -> 1 (-)(-)
		} else {
			pos0 := strings.Index(X[pos1:], "0")
			if pos0 < 0 {
				pos0 = len(X)
			}
			if pos0-pos1 == count1 {
				fmt.Println("Yes") // "11+0*", n -> 2 (+)(-)
			} else {
				fmt.Println("No") // "1+0+1.*"
			}
		}
	}
}
0