結果

問題 No.500 階乗電卓
ユーザー qazqaz
提出日時 2017-05-21 21:42:05
言語 C#(csc)
(csc 3.9.0)
結果
RE  
実行時間 -
コード長 1,822 bytes
コンパイル時間 961 ms
コンパイル使用メモリ 111,868 KB
実行使用メモリ 28,180 KB
最終ジャッジ日時 2023-10-19 12:06:57
合計ジャッジ時間 5,544 ms
ジャッジサーバーID
(参考情報)
judge12 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 RE -
testcase_01 RE -
testcase_02 RE -
testcase_03 RE -
testcase_04 AC 26 ms
24,352 KB
testcase_05 AC 27 ms
24,352 KB
testcase_06 AC 26 ms
24,352 KB
testcase_07 AC 27 ms
24,352 KB
testcase_08 AC 27 ms
24,352 KB
testcase_09 AC 27 ms
24,352 KB
testcase_10 AC 27 ms
24,352 KB
testcase_11 AC 27 ms
24,352 KB
testcase_12 AC 27 ms
24,352 KB
testcase_13 WA -
testcase_14 WA -
testcase_15 AC 28 ms
24,352 KB
testcase_16 WA -
testcase_17 WA -
testcase_18 TLE -
testcase_19 -- -
testcase_20 -- -
testcase_21 -- -
testcase_22 -- -
権限があれば一括ダウンロードができます
コンパイルメッセージ
Microsoft (R) Visual C# Compiler version 3.9.0-6.21124.20 (db94f4cc)
Copyright (C) Microsoft Corporation. All rights reserved.

ソースコード

diff #

using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;

public class Program
{
    public static void Main() {
        var so = new Solver();
        //var so = new Solver("input.txt", "output.txt");
        so.Solve();
    }
}

public class Solver
{
    private readonly Reader reader;
    private readonly TextWriter writer;

    public Solver() {
        reader = new Reader(Console.In);
        writer = Console.Out;
    }

    public Solver(string input, string output) {
        reader = new Reader(new StreamReader(input));
        writer = new StreamWriter(output);
    }

    public void Solve() {
        decimal N = reader.RInt();

        decimal s = 1;
        for (decimal i = 1; i <= N; i++) {
            s = s * i % (999999999999 + 1);
        }

        writer.WriteLine(s);
        writer.Flush();
    }
}

public class Reader
{
    private readonly TextReader reader;
    private readonly char separator = ' ';
    private string[] A = new string[0];
    private int i;

    public Reader(TextReader r) {
        reader = r;
    }

    public string String() { return Set(); }
    public int Int() { return int.Parse(Set()); }
    public long Long() { return long.Parse(Set()); }
    public decimal Decimal() { return decimal.Parse(Set()); }

    public string RString() { return RSet(); }
    public int RInt() { return int.Parse(RSet()); }
    public long RLong() { return long.Parse(RSet()); }
    public decimal RDecimal() { return decimal.Parse(RSet()); }

    public int[] RIntArray() { Read(); return A.Select(x => int.Parse(x)).ToArray(); }

    private void Read() {
        string line = reader.ReadLine();

        A = line.Split(separator);
        i = 0;
    }

    private string Set() { return A[i++]; }
    private string RSet() { Read(); return A[i++]; }
}
0