提出 #36814504


ソースコード 拡げる

package main

import (
	"bufio"
	"fmt"
	"os"
	"strconv"
	"strings"
)

const SPACE = " "

func dump(x ...interface{}) {
	fmt.Printf("%+v\n", x...)
}

func toInt64(s string) int64 {
	n, _ := strconv.ParseInt(s, 10, 64)
	return n
}

func newBuffer() *buffer {
	return &buffer{
		bufio.NewScanner(os.Stdin),
	}
}

type buffer struct {
	scanner *bufio.Scanner
}

func (b *buffer) readLine() string {
	b.scanner.Scan()
	return b.scanner.Text()
}

func (b *buffer) readInt64() int64 {
	return toInt64(b.readLine())
}

func (b *buffer) readStrings(sep string) []string {
	s := strings.Split(b.readLine(), " ")
	return s
}

func (b *buffer) readInt64s(sep string) []int64 {
	ss := b.readStrings(sep)
	res := make([]int64, len(ss))
	for i, s := range ss {
		res[i] = toInt64(s)
	}
	return res
}

func main() {
	input := newBuffer()

	r := input.readLine()

	res := int64(0)
	for _, c := range []rune(r) {
		switch c {
		case 'v':
			res++
		case 'w':
			res += 2
		}
	}

	fmt.Printf("%d\n", res)
}

提出情報

提出日時
問題 A - wwwvvvvvv
ユーザ sters
言語 Go (1.14.1)
得点 100
コード長 1059 Byte
結果 AC
実行時間 7 ms
メモリ 1772 KiB

ジャッジ結果

セット名 Sample All
得点 / 配点 0 / 0 100 / 100
結果
AC × 3
AC × 10
セット名 テストケース
Sample 00_sample_00.txt, 00_sample_01.txt, 00_sample_02.txt
All 00_sample_00.txt, 00_sample_01.txt, 00_sample_02.txt, 01_random_00.txt, 01_random_01.txt, 01_random_02.txt, 01_random_03.txt, 02_max_00.txt, 02_max_01.txt, 02_max_02.txt
ケース名 結果 実行時間 メモリ
00_sample_00.txt AC 7 ms 1772 KiB
00_sample_01.txt AC 1 ms 1756 KiB
00_sample_02.txt AC 2 ms 1772 KiB
01_random_00.txt AC 1 ms 1756 KiB
01_random_01.txt AC 1 ms 1772 KiB
01_random_02.txt AC 1 ms 1772 KiB
01_random_03.txt AC 1 ms 1752 KiB
02_max_00.txt AC 1 ms 1760 KiB
02_max_01.txt AC 2 ms 1764 KiB
02_max_02.txt AC 2 ms 1756 KiB