結果
問題 | No.36 素数が嫌い! |
ユーザー |
![]() |
提出日時 | 2015-12-30 19:59:44 |
言語 | C#(csc) (csc 3.9.0) |
結果 |
AC
|
実行時間 | 97 ms / 5,000 ms |
コード長 | 936 bytes |
コンパイル時間 | 2,117 ms |
コンパイル使用メモリ | 112,124 KB |
実行使用メモリ | 18,048 KB |
最終ジャッジ日時 | 2024-06-27 00:36:17 |
合計ジャッジ時間 | 2,699 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; namespace yukicoder { class _036 { static void Main() { long n = long.Parse(Console.ReadLine()); int d = 0; while(n >= 4 && n % 2 == 0) { d++; if (d == 2) { Console.WriteLine("YES"); return; } n /= 2; } int i = 3; while (Math.Pow(i, 3 - d) <= n) { if(n % i == 0) { d++; if (d == 2) { Console.WriteLine("YES"); return; } n /= i; } else { i += 2; } } Console.WriteLine("NO"); } } }