結果
| 問題 |
No.8023 素数判定するだけ
|
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2017-03-30 09:31:23 |
| 言語 | C#(csc) (csc 3.9.0) |
| 結果 |
TLE
|
| 実行時間 | - |
| コード長 | 953 bytes |
| コンパイル時間 | 731 ms |
| コンパイル使用メモリ | 112,256 KB |
| 実行使用メモリ | 38,288 KB |
| 最終ジャッジ日時 | 2024-07-06 21:44:30 |
| 合計ジャッジ時間 | 5,602 ms |
|
ジャッジサーバーID (参考情報) |
judge4 / judge5 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| other | TLE * 1 -- * 24 |
コンパイルメッセージ
Microsoft (R) Visual C# Compiler version 3.9.0-6.21124.20 (db94f4cc) Copyright (C) Microsoft Corporation. All rights reserved.
ソースコード
using System;
public class Program
{
const int one =('C'^'B');
const int zero =('A'^'A');
const int twelve=('M'^'A');
static int add(int a,int b){
int c;
while(zero<b){
c = a&b;
a = a^b;
b = c<<one;
}
return a;
}
static int negative(int a){
return add(~a,one);
}
static int mul(int a,int b){
int c=b;
int r=zero;
while(zero<c){
c=add(c,negative(one));
r=add(r,a);
}
return r;
}
static int mod(int a,int d){
int q=zero,r=zero,i;
for (i=twelve;zero<=i;i=add(i,negative(one))){
r <<= one;
r |= (a>>i)&one;
if (r >= d){
r = add(r,negative(d));
q|=one<<i;
}
}
return r;
}
static void Main()
{
string s = Console.ReadLine();
int x = int.Parse(s);
int i;
if (x==one){Console.WriteLine("NO");return ;}
for (i=add(one,one);i<x;i=add(i,one)){if (mod(x,i)==zero){Console.WriteLine("NO");return ;}}
Console.WriteLine("YES");return ;
}
}