結果

問題 No.36 素数が嫌い!
ユーザー fmhr
提出日時 2015-05-31 09:13:04
言語 Go
(1.23.4)
結果
AC  
実行時間 111 ms / 5,000 ms
コード長 403 bytes
コンパイル時間 13,662 ms
コンパイル使用メモリ 241,548 KB
実行使用メモリ 6,944 KB
最終ジャッジ日時 2024-06-27 00:19:44
合計ジャッジ時間 15,024 ms
ジャッジサーバーID
(参考情報)
judge2 / judge1
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 4
other AC * 26
権限があれば一括ダウンロードができます

ソースコード

diff #

package main

import (
	"fmt"
)

func primeFactor(n int) []int {
	res := make([]int, 0)
	for i := 2; i*i < n; i++ {
		for true {
			if n%i != 0 {
				break
			}
			res = append(res, i)
			n /= i
		}
	}
	//if n != 1 {
	//	res[n] = 1
	//}
	return res
}

func main() {
	var N int
	fmt.Scan(&N)
	x := primeFactor(N)
	//fmt.Println(x)
	if len(x) > 1 {
		fmt.Println("YES")
	} else {
		fmt.Println("NO")
	}
}
0