結果
| 問題 |
No.2063 ±2^k operations (easy)
|
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2022-09-23 20:51:45 |
| 言語 | Go (1.23.4) |
| 結果 |
AC
|
| 実行時間 | 2 ms / 2,000 ms |
| コード長 | 725 bytes |
| コンパイル時間 | 14,192 ms |
| コンパイル使用メモリ | 236,076 KB |
| 実行使用メモリ | 5,248 KB |
| 最終ジャッジ日時 | 2024-12-22 05:39:38 |
| 合計ジャッジ時間 | 14,014 ms |
|
ジャッジサーバーID (参考情報) |
judge4 / judge5 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 |
| other | AC * 21 |
ソースコード
// No.2063 ±2^k operations (easy)
package main
import (
"bufio"
"fmt"
"os"
"strings"
)
func main() {
sc := bufio.NewScanner(os.Stdin)
sc.Buffer(make([]byte, 0, 200000), 200000)
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.*", n -> 2 (+)(-)
}
}
}
}