結果

問題 No.36 素数が嫌い!
ユーザー AreTrash
提出日時 2016-04-13 10:03:49
言語 C#(csc)
(csc 3.9.0)
結果
AC  
実行時間 74 ms / 5,000 ms
コード長 968 bytes
コンパイル時間 881 ms
コンパイル使用メモリ 110,236 KB
実行使用メモリ 25,808 KB
最終ジャッジ日時 2024-06-27 00:44:20
合計ジャッジ時間 2,830 ms
ジャッジサーバーID
(参考情報)
judge1 / 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;

            while(tmp % 2 == 0){
                tmp /= 2;
                cnt++;
                if(cnt >= 2){
                    if(input != 4){
                        Console.WriteLine("YES");
                        return;
                    }
                }
            }

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

            Console.WriteLine("NO");
        }
    }
}
0