結果

問題 No.795 Restrictions!!!!!!!!!!!!!!
ユーザー fmhrfmhr
提出日時 2019-03-15 21:48:42
言語 Go
(1.22.1)
結果
AC  
実行時間 15 ms / 2,000 ms
コード長 3,018 bytes
コンパイル時間 15,369 ms
コンパイル使用メモリ 208,784 KB
実行使用メモリ 8,396 KB
最終ジャッジ日時 2023-09-14 13:24:47
合計ジャッジ時間 16,733 ms
ジャッジサーバーID
(参考情報)
judge11 / judge15
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 14 ms
8,388 KB
testcase_01 AC 14 ms
8,384 KB
testcase_02 AC 14 ms
8,388 KB
testcase_03 AC 15 ms
8,388 KB
testcase_04 AC 14 ms
8,396 KB
testcase_05 AC 14 ms
8,388 KB
testcase_06 AC 13 ms
8,384 KB
testcase_07 AC 13 ms
8,388 KB
testcase_08 AC 14 ms
8,392 KB
testcase_09 AC 14 ms
8,392 KB
testcase_10 AC 14 ms
8,388 KB
testcase_11 AC 14 ms
8,388 KB
testcase_12 AC 14 ms
8,388 KB
testcase_13 AC 14 ms
8,392 KB
testcase_14 AC 13 ms
8,388 KB
testcase_15 AC 13 ms
8,388 KB
testcase_16 AC 14 ms
8,388 KB
testcase_17 AC 14 ms
8,388 KB
testcase_18 AC 13 ms
8,388 KB
testcase_19 AC 13 ms
8,388 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

package main

import (
	"bufio"
	"fmt"
	"log"
	"math"
	"math/big"
	"os"
	"strconv"
)

func setBit(d, n int) int {
	t := 1 << uint(n)
	return d | t
}
func bitExist(n, i int) bool {
	return ((n >> uint(i)) & 1) == 1
}
func bitCount(n uint) int {
	x := uint64(n)
	const m = 1<<64 - 1
	const m0 = 0x5555555555555555
	const m1 = 0x3333333333333333
	const m2 = 0x0f0f0f0f0f0f0f0f
	x = x>>1&(m0&m) + x&(m0&m)
	x = x>>2&(m1&m) + x&(m1&m)
	x = (x>>4 + x) & (m2 & m)
	x += x >> 8
	x += x >> 16
	x += x >> 32
	return int(x) & (1<<7 - 1)
}

func main() {
	N := nextString()
	M := nextString()
	n := new(big.Int)
	m := new(big.Int)
	n, ok := n.SetString(N, 10)
	if !ok {
		log.Println("error")
	}
	m, _ = m.SetString(M, 10)
	z := new(big.Int)
	two := new(big.Int)
	two.SetString("2", 10)
	one := new(big.Int)
	one.SetString("1", 10)
	zero := new(big.Int)
	zero.SetString("0", 10)
	ten := new(big.Int)
	ten.SetInt64(10)
	// fmt.Println(z.Cmp(zero))
	if z.Mod(m, two).Cmp(zero) != 0 || (z.Mod(n, two).Cmp(zero) != 0 && m.Cmp(ten) < 0) {
		fmt.Println("No")
	} else {
		fmt.Println("Yes")
	}
}

var dy = []int{1, 0, -1, 0, 0}
var dx = []int{0, 1, 0, -1, 0}
var inf = int(1e9)

func fill(a *[]int, n int) {
	for i := 0; i < len(*a); i++ {
		(*a)[i] = n
	}
}

func makeDoubleSlice(n int, m int) [][]int {
	s := make([][]int, n)
	for i := 0; i < n; i++ {
		s[i] = make([]int, m)
	}
	return s
}

func pow(a, b int) int {
	return int(math.Pow(float64(a), float64(b)))
}

func lcm(a, b int) int {
	return a * b / gcd(a, b)
}
func gcd(a, b int) int {
	if a < b {
		a, b = b, a
	}
	for b != 0 {
		a, b = b, a%b
	}
	return a
}
func max(a ...int) int {
	r := a[0]
	for i := 0; i < len(a); i++ {
		if r < a[i] {
			r = a[i]
		}
	}
	return r
}
func min(a ...int) int {
	r := a[0]
	for i := 0; i < len(a); i++ {
		if r > a[i] {
			r = a[i]
		}
	}
	return r
}
func sum(a []int) (r int) {
	for i := range a {
		r += a[i]
	}
	return r
}
func abs(a int) int {
	if a < 0 {
		return -a
	}
	return a
}

type pair struct {
	a, b int
}

type pairs []pair

func (p pairs) Len() int {
	return len(p)
}
func (p pairs) Swap(i, j int) {
	p[i], p[j] = p[j], p[i]
}

func (p pairs) Less(i, j int) bool {
	if p[i].a == p[j].a {
		return p[i].b < p[j].b
	}
	return p[i].a < p[j].a
}

var nextReader func() []byte

func init() {
	nextReader = newScanner()
	log.SetFlags(log.Lshortfile)
}

func newScanner() func() []byte {
	r := bufio.NewScanner(os.Stdin)
	r.Buffer(make([]byte, 1024), int(1e+11))
	r.Split(bufio.ScanWords)
	return func() []byte {
		r.Scan()
		return r.Bytes()
	}
}
func nextBytes() []byte {
	return nextReader()
}

func nextString() string {
	return string(nextReader())
}
func nextInt64() int64 {
	v, _ := strconv.ParseInt(string(nextReader()), 10, 64)
	return v
}
func nextInt() int {
	v, _ := strconv.Atoi(string(nextReader()))
	return v
}
func nextInts(n int) []int {
	r := make([]int, n)
	for i := 0; i < n; i++ {
		r[i] = nextInt()
	}
	return r
}
func nextFloat64() float64 {
	f, _ := strconv.ParseFloat(string(nextReader()), 64)
	return f
}
0