結果

問題 No.2063 ±2^k operations (easy)
ユーザー Hima
提出日時 2022-10-09 17:17:08
言語 Go
(1.23.4)
結果
WA  
実行時間 -
コード長 628 bytes
コンパイル時間 12,504 ms
コンパイル使用メモリ 225,236 KB
実行使用メモリ 6,944 KB
最終ジャッジ日時 2024-06-23 16:22:21
合計ジャッジ時間 13,255 ms
ジャッジサーバーID
(参考情報)
judge5 / judge3
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 2 WA * 1
other AC * 19 WA * 2
権限があれば一括ダウンロードができます

ソースコード

diff #

package main

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

var sc = bufio.NewScanner(os.Stdin)
var out = bufio.NewWriter(os.Stdout)

func main() {
	buf := make([]byte, 1024*1024)
	sc.Buffer(buf, bufio.MaxScanTokenSize)
	sc.Split(bufio.ScanWords)

	n := nextString()
	ans := solve(n)
	PrintString(ans)
}

func solve(n string) string {
	//ビットが立っている数
	var cnt int
	for _, v := range n {
		if v == '1' {
			cnt++
		}
	}
	if cnt == 0 || cnt == 2 {
		return "Yes"
	} else {
		return "No"
	}
}

func nextString() string {
	sc.Scan()
	return sc.Text()
}

func PrintString(x string) {
	defer out.Flush()
	fmt.Fprintln(out, x)
}
0