結果

問題 No.316 もっと刺激的なFizzBuzzをください
ユーザー mbanmban
提出日時 2016-12-25 15:17:49
言語 C#(csc)
(csc 3.9.0)
結果
AC  
実行時間 57 ms / 1,000 ms
コード長 1,059 bytes
コンパイル時間 1,995 ms
コンパイル使用メモリ 103,296 KB
実行使用メモリ 22,804 KB
最終ジャッジ日時 2023-08-21 08:59:44
合計ジャッジ時間 5,849 ms
ジャッジサーバーID
(参考情報)
judge12 / judge13
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 56 ms
20,596 KB
testcase_01 AC 57 ms
22,724 KB
testcase_02 AC 57 ms
20,620 KB
testcase_03 AC 57 ms
22,636 KB
testcase_04 AC 56 ms
20,580 KB
testcase_05 AC 56 ms
22,744 KB
testcase_06 AC 55 ms
20,684 KB
testcase_07 AC 57 ms
20,720 KB
testcase_08 AC 56 ms
18,740 KB
testcase_09 AC 55 ms
22,604 KB
testcase_10 AC 56 ms
20,648 KB
testcase_11 AC 56 ms
20,692 KB
testcase_12 AC 56 ms
22,720 KB
testcase_13 AC 56 ms
20,780 KB
testcase_14 AC 57 ms
20,876 KB
testcase_15 AC 56 ms
22,804 KB
testcase_16 AC 56 ms
22,636 KB
testcase_17 AC 56 ms
22,696 KB
testcase_18 AC 57 ms
22,700 KB
testcase_19 AC 57 ms
22,608 KB
testcase_20 AC 56 ms
20,688 KB
testcase_21 AC 57 ms
20,712 KB
testcase_22 AC 57 ms
20,688 KB
testcase_23 AC 57 ms
22,652 KB
testcase_24 AC 57 ms
22,688 KB
testcase_25 AC 57 ms
22,600 KB
testcase_26 AC 57 ms
22,680 KB
testcase_27 AC 56 ms
20,676 KB
testcase_28 AC 57 ms
20,744 KB
testcase_29 AC 57 ms
22,740 KB
testcase_30 AC 56 ms
20,692 KB
testcase_31 AC 57 ms
22,752 KB
testcase_32 AC 56 ms
20,668 KB
testcase_33 AC 56 ms
20,580 KB
testcase_34 AC 56 ms
20,752 KB
testcase_35 AC 56 ms
20,692 KB
testcase_36 AC 56 ms
22,780 KB
権限があれば一括ダウンロードができます
コンパイルメッセージ
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;
using System.Collections.Generic;
using System.Collections.Specialized;
using System.Text;
using System.Text.RegularExpressions;
using System.Linq;

class Magatro
{
    static long N;
    static long a, b, c;
    static void Main()
    {
        N = int.Parse(Console.ReadLine());
        string[] s = Console.ReadLine().Split(' ');
        a = int.Parse(s[0]);
        b = int.Parse(s[1]);
        c = int.Parse(s[2]);
        long cnt = N / a + N / b + N / c;
        cnt += N / LCM(a, b, c);
        cnt -= N / LCM(a, b) + N / LCM(a, c) + N / LCM(b, c);
        Console.WriteLine(cnt);
    }
    static long LCM(long a,long b)
    {
        long r;
        long x = a * b;
        if (a < b)
        {
            long t = a;
            a = b;
            b = t;
        }
        r = a % b;
        while (r > 0)
        {
            a = b;
            b = r;
            r = a % b;
        }
        return x / b;
    }
    static long LCM(long a,long b,long c)
    {
        return LCM(LCM(a, b), c);
    }
}


0