結果
問題 |
No.889 素数!
|
ユーザー |
|
提出日時 | 2020-07-10 18:31:26 |
言語 | C#(csc) (csc 3.9.0) |
結果 |
AC
|
実行時間 | 32 ms / 2,000 ms |
コード長 | 1,108 bytes |
コンパイル時間 | 939 ms |
コンパイル使用メモリ | 113,592 KB |
実行使用メモリ | 26,908 KB |
最終ジャッジ日時 | 2024-10-11 02:57:44 |
合計ジャッジ時間 | 4,225 ms |
ジャッジサーバーID (参考情報) |
judge4 / judge3 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 61 |
コンパイルメッセージ
Microsoft (R) Visual C# Compiler version 3.9.0-6.21124.20 (db94f4cc) Copyright (C) Microsoft Corporation. All rights reserved.
ソースコード
using System; using System.Linq; namespace _0889 { class Program { static void Main(string[] args) { var n = int.Parse(Console.ReadLine()); var sosu = 0; for(var i = 2; i <= n; i++){ if(n % i == 0){ sosu++; } } if(sosu == 1){ Console.WriteLine("Sosu!"); return; } for(var i = 2; i <= n; i++){ var x = i * i; if(n == x){ Console.WriteLine("Heihosu!"); return; } x = x * i; if(n == x){ Console.WriteLine("Ripposu!"); return; } } if(n != 0){ var k = Enumerable.Range(1,n-1).Where(t => n % t == 0).Sum(); if(n == k){ Console.WriteLine("Kanzensu!"); return; } } Console.WriteLine(n); } } }