結果

問題 No.637 X: Yet Another FizzBuzz Problem
ユーザー moti
提出日時 2018-05-14 23:05:03
言語 Go
(1.23.4)
結果
AC  
実行時間 1 ms / 1,000 ms
コード長 453 bytes
コンパイル時間 11,876 ms
コンパイル使用メモリ 223,844 KB
実行使用メモリ 5,376 KB
最終ジャッジ日時 2024-06-28 19:05:12
合計ジャッジ時間 12,747 ms
ジャッジサーバーID
(参考情報)
judge4 / judge3
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 2
other AC * 30
権限があれば一括ダウンロードができます

ソースコード

diff #

package main

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

var sc = bufio.NewScanner(os.Stdin)

func nextInt() int {
	sc.Scan()
	i, err := strconv.Atoi(sc.Text())
	if err != nil {
		panic(err)
	}
	return i
}

func main() {
	sc.Split(bufio.ScanWords)
	ans := 0
	for i := 0; i < 5; i++ {
		a := nextInt()
		if a%3 == 0 {
			ans += 4
		}
		if a%5 == 0 {
			ans += 4
		}
		if a%3 != 0 && a%5 != 0 {
			ans += len(strconv.Itoa(a))
		}
	}
	fmt.Println(ans)
}
0