提出 #64548100


ソースコード 拡げる

package main

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

type pair struct {
	x, y int
}

type tuple struct {
	x, y, z int
}

type myType interface {
	int | int64 | float64 | string | rune | byte
}

type additionalTypes interface {
	bool | pair | tuple
}

func readArr[T myType](n int) []T {
	arr := make([]T, n)
	for i := 0; i < n; i++ {
		fmt.Fscan(in, &arr[i])
	}
	return arr
}

func createArr[T myType | additionalTypes](n int, val T) []T {
	arr := make([]T, n)
	for i := 0; i < n; i++ {
		arr[i] = val
	}
	return arr
}

func readMat[T myType](n, m int) [][]T {
	mat := make([][]T, n)
	for i := 0; i < n; i++ {
		row := make([]T, m)
		for j := 0; j < n; j++ {
			fmt.Fscan(in, &row[j])
		}
		mat[i] = row
	}
	return mat
}

func createMat[T myType | additionalTypes](n, m int, val T) [][]T {
	mat := make([][]T, n)
	for i := 0; i < n; i++ {
		row := make([]T, m)
		for j := 0; j < n; j++ {
			row[j] = val
		}
		mat[i] = row
	}
	return mat
}

func min[T myType](a, b T) T {
	if a < b {
		return a
	}
	return b
}

func max[T myType](a, b T) T {
	if a > b {
		return a
	}
	return b
}

var mod = int(1e9 + 7)

func invMod(a int) int {
	return pow(a, mod-2)
}

func pow(a, b int) int {
	res := 1
	for b > 0 {
		if b&1 == 1 {
			res = (res * a) % mod
		}
		a = (a * a) % mod
		b >>= 1
	}
	return res
}

var (
	in  = bufio.NewReader(os.Stdin)
	out = bufio.NewWriter(os.Stdout)
)

func main() {
	defer out.Flush()

	var n int64
	fmt.Fscan(in, &n)

	ans := int64(0)
	for i := int64(2); i <= n; i *= 2 {
		val := int64(math.Sqrt(float64(n / i)))
		ans += (val + 1) / 2
	}
	fmt.Fprintln(out, ans)
}

提出情報

提出日時
問題 C - 2^a b^2
ユーザ saiprasadDuduka
言語 Go (go 1.20.6)
得点 0
コード長 1705 Byte
結果 WA
実行時間 1 ms
メモリ 1724 KiB

ジャッジ結果

セット名 Sample All
得点 / 配点 0 / 0 0 / 350
結果
AC × 3
AC × 25
WA × 4
セット名 テストケース
Sample example_00.txt, example_01.txt, example_02.txt
All example_00.txt, example_01.txt, example_02.txt, hand_00.txt, hand_01.txt, hand_02.txt, hand_03.txt, hand_04.txt, hand_05.txt, hand_06.txt, hand_07.txt, hand_08.txt, hand_09.txt, hand_10.txt, random_00.txt, random_01.txt, random_02.txt, random_03.txt, random_04.txt, random_05.txt, random_06.txt, random_07.txt, random_08.txt, random_09.txt, random_10.txt, random_11.txt, random_12.txt, random_13.txt, random_14.txt
ケース名 結果 実行時間 メモリ
example_00.txt AC 1 ms 1712 KiB
example_01.txt AC 1 ms 1712 KiB
example_02.txt AC 1 ms 1716 KiB
hand_00.txt AC 1 ms 1712 KiB
hand_01.txt AC 1 ms 1712 KiB
hand_02.txt AC 0 ms 1712 KiB
hand_03.txt AC 1 ms 1720 KiB
hand_04.txt AC 0 ms 1720 KiB
hand_05.txt WA 1 ms 1720 KiB
hand_06.txt WA 0 ms 1716 KiB
hand_07.txt AC 1 ms 1720 KiB
hand_08.txt WA 0 ms 1716 KiB
hand_09.txt WA 1 ms 1716 KiB
hand_10.txt AC 0 ms 1716 KiB
random_00.txt AC 0 ms 1716 KiB
random_01.txt AC 0 ms 1712 KiB
random_02.txt AC 0 ms 1712 KiB
random_03.txt AC 1 ms 1716 KiB
random_04.txt AC 1 ms 1712 KiB
random_05.txt AC 1 ms 1716 KiB
random_06.txt AC 0 ms 1716 KiB
random_07.txt AC 1 ms 1724 KiB
random_08.txt AC 1 ms 1716 KiB
random_09.txt AC 1 ms 1720 KiB
random_10.txt AC 0 ms 1716 KiB
random_11.txt AC 0 ms 1716 KiB
random_12.txt AC 0 ms 1716 KiB
random_13.txt AC 0 ms 1716 KiB
random_14.txt AC 1 ms 1720 KiB