結果

問題 No.36 素数が嫌い!
ユーザー AreTrash
提出日時 2016-04-13 09:36:22
言語 C#(csc)
(csc 3.9.0)
結果
AC  
実行時間 120 ms / 5,000 ms
コード長 680 bytes
コンパイル時間 2,277 ms
コンパイル使用メモリ 103,680 KB
実行使用メモリ 17,792 KB
最終ジャッジ日時 2024-06-27 00:44:17
合計ジャッジ時間 4,566 ms
ジャッジサーバーID
(参考情報)
judge3 / judge4
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
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.

ソースコード

diff #

using System;

namespace No36_1{
    public class Program{
        public static void Main(string[] args){
            var input = long.Parse(Console.ReadLine());
            var tmp = input;
            var cnt = 0;

            for(long i = 2; i * i <= input; i++){
                while(tmp % i == 0){
                    tmp /= i;
                    cnt++;
                    if(cnt >= 2) {
                        if(!(i * i == input && cnt == 2)){
                            Console.WriteLine("YES");
                            return;
                        }
                    }
                }
            }
            Console.WriteLine("NO");
        }
    }
}
0