結果
| 問題 |
No.36 素数が嫌い!
|
| コンテスト | |
| ユーザー |
mban
|
| 提出日時 | 2016-12-22 14:42:42 |
| 言語 | C#(csc) (csc 3.9.0) |
| 結果 |
AC
|
| 実行時間 | 144 ms / 5,000 ms |
| コード長 | 973 bytes |
| コンパイル時間 | 943 ms |
| コンパイル使用メモリ | 108,672 KB |
| 実行使用メモリ | 17,792 KB |
| 最終ジャッジ日時 | 2024-06-27 00:52:43 |
| 合計ジャッジ時間 | 3,371 ms |
|
ジャッジサーバーID (参考情報) |
judge4 / judge3 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 4 |
| other | AC * 26 |
コンパイルメッセージ
Microsoft (R) Visual C# Compiler version 3.9.0-6.21124.20 (db94f4cc) Copyright (C) Microsoft Corporation. All rights reserved.
ソースコード
using System;
using System.Collections;
using System.Collections.Generic;
using System.Collections.Specialized;
using System.Text;
using System.Text.RegularExpressions;
using System.Linq;
class Magatro
{
static void Main()
{
long N = long.Parse(Console.ReadLine());
List<int> a = new List<int>();
if (N == 1)
{
Console.WriteLine("NO");
return;
}
for(int i = 2; i <= Math.Sqrt(N); i++)
{
if (N % i == 0)
{
a.Add(0);
while (N % i == 0)
{
a[a.Count - 1]++;
N /= i;
}
}
}
if (N != 1)
{
a.Add(1);
}
if ((a.Count == 1&&a[0]<=2)||(a.Count==2&&a[0]==1&&a[1]==1))
{
Console.WriteLine("NO");
}
else
{
Console.WriteLine("YES");
}
}
}
mban