結果

問題 No.537 ユーザーID
ユーザー tsuchinaga
提出日時 2019-02-27 10:44:33
言語 Go
(1.23.4)
結果
AC  
実行時間 112 ms / 2,000 ms
コード長 556 bytes
コンパイル時間 10,694 ms
コンパイル使用メモリ 220,076 KB
実行使用メモリ 6,944 KB
最終ジャッジ日時 2024-06-23 05:02:53
合計ジャッジ時間 11,316 ms
ジャッジサーバーID
(参考情報)
judge5 / judge4
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 32
権限があれば一括ダウンロードができます

ソースコード

diff #

package main

import (
	"fmt"
	"math"
	"strconv"
)

func main() {
	var n int
	_, _ = fmt.Scan(&n)

	list := make([]string, 0)
	for i := 1; i <= int(math.Sqrt(float64(n))); i++ {
		if n%i == 0 {
			a := strconv.Itoa(i) + strconv.Itoa(n/i)
			if !Contain(list, a) {
				list = append(list, a)
			}

			a = strconv.Itoa(n/i) + strconv.Itoa(i)
			if !Contain(list, a) {
				list = append(list, a)
			}
		}
	}

	fmt.Println(len(list))
}

func Contain(list []string, a string) bool {
	for _, b := range list {
		if a == b {
			return true
		}
	}
	return false
}
0