結果
| 問題 |
No.2063 ±2^k operations (easy)
|
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2022-09-23 20:36:42 |
| 言語 | Go (1.23.4) |
| 結果 |
WA
|
| 実行時間 | - |
| コード長 | 666 bytes |
| コンパイル時間 | 14,918 ms |
| コンパイル使用メモリ | 223,932 KB |
| 実行使用メモリ | 5,248 KB |
| 最終ジャッジ日時 | 2024-12-22 05:38:24 |
| 合計ジャッジ時間 | 14,501 ms |
|
ジャッジサーバーID (参考情報) |
judge2 / judge5 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 |
| other | AC * 17 WA * 4 |
ソースコード
// 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.*"
}
}
}
}