結果

問題 No.311 z in FizzBuzzString
ユーザー yukirinyukirin
提出日時 2016-01-19 00:53:39
言語 Go
(1.22.1)
結果
TLE  
実行時間 -
コード長 962 bytes
コンパイル時間 15,760 ms
コンパイル使用メモリ 230,212 KB
実行使用メモリ 4,372 KB
最終ジャッジ日時 2023-10-25 02:40:37
合計ジャッジ時間 18,680 ms
ジャッジサーバーID
(参考情報)
judge14 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 1 ms
4,348 KB
testcase_01 AC 1 ms
4,372 KB
testcase_02 AC 1 ms
4,372 KB
testcase_03 AC 1 ms
4,372 KB
testcase_04 AC 1 ms
4,372 KB
testcase_05 AC 1 ms
4,372 KB
testcase_06 AC 1 ms
4,372 KB
testcase_07 TLE -
testcase_08 -- -
testcase_09 -- -
testcase_10 -- -
権限があれば一括ダウンロードができます

ソースコード

diff #

package main

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

var sc = bufio.NewScanner(os.Stdin)

// var rdr = bufio.NewReaderSize(os.Stdin, 1000000)

func nextLine() string {
	sc.Scan()
	return sc.Text()
}

func nextInt() int {
	i, _ := strconv.Atoi(nextLine())
	return i
}

func nextInt64() int64 {
	i, _ := strconv.ParseInt(nextLine(), 10, 64)
	return i
}

func nextUint64() uint64 {
	i, _ := strconv.ParseUint(nextLine(), 10, 64)
	return i
}

func nextFloat() float64 {
	f, _ := strconv.ParseFloat(nextLine(), 64)
	return f
}

// func readLine() string {
// buf := make([]byte, 0, 1000000)
// for {
// l, p, e := rdr.ReadLine()
// if e != nil {
// panic(e)
// }
// buf = append(buf, l...)
// if !p {
// break
// }
// }
// return string(buf)
// }

func main() {
	sc.Split(bufio.ScanWords)
	var z uint64
	n := nextUint64()
	for i := uint64(1); i <= n; i++ {
		switch {
		case i%15 == 0:
			z += 4
		case i%3 == 0 || i%5 == 0:
			z += 2
		}
	}
	fmt.Println(z)

}
0