結果

問題 No.736 約比
ユーザー claw88claw88
提出日時 2018-09-28 21:51:45
言語 C#(csc)
(csc 3.9.0)
結果
AC  
実行時間 69 ms / 2,000 ms
コード長 2,528 bytes
コンパイル時間 5,443 ms
コンパイル使用メモリ 110,620 KB
実行使用メモリ 23,952 KB
最終ジャッジ日時 2023-08-02 11:13:59
合計ジャッジ時間 9,311 ms
ジャッジサーバーID
(参考情報)
judge15 / judge14
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 66 ms
21,784 KB
testcase_01 AC 66 ms
21,776 KB
testcase_02 AC 65 ms
21,852 KB
testcase_03 AC 65 ms
21,776 KB
testcase_04 AC 65 ms
21,896 KB
testcase_05 AC 66 ms
21,904 KB
testcase_06 AC 65 ms
21,744 KB
testcase_07 AC 66 ms
21,840 KB
testcase_08 AC 65 ms
21,836 KB
testcase_09 AC 65 ms
23,688 KB
testcase_10 AC 64 ms
21,768 KB
testcase_11 AC 65 ms
21,808 KB
testcase_12 AC 65 ms
23,772 KB
testcase_13 AC 64 ms
21,704 KB
testcase_14 AC 63 ms
21,724 KB
testcase_15 AC 64 ms
21,824 KB
testcase_16 AC 65 ms
23,936 KB
testcase_17 AC 66 ms
21,736 KB
testcase_18 AC 68 ms
21,796 KB
testcase_19 AC 66 ms
21,776 KB
testcase_20 AC 65 ms
21,724 KB
testcase_21 AC 65 ms
21,780 KB
testcase_22 AC 65 ms
23,784 KB
testcase_23 AC 65 ms
21,704 KB
testcase_24 AC 65 ms
21,836 KB
testcase_25 AC 65 ms
21,784 KB
testcase_26 AC 65 ms
21,800 KB
testcase_27 AC 66 ms
23,704 KB
testcase_28 AC 65 ms
21,728 KB
testcase_29 AC 64 ms
23,848 KB
testcase_30 AC 66 ms
23,776 KB
testcase_31 AC 65 ms
21,712 KB
testcase_32 AC 64 ms
21,684 KB
testcase_33 AC 65 ms
21,780 KB
testcase_34 AC 65 ms
21,908 KB
testcase_35 AC 64 ms
19,792 KB
testcase_36 AC 64 ms
21,708 KB
testcase_37 AC 65 ms
21,640 KB
testcase_38 AC 65 ms
23,832 KB
testcase_39 AC 65 ms
21,800 KB
testcase_40 AC 65 ms
21,784 KB
testcase_41 AC 65 ms
21,684 KB
testcase_42 AC 65 ms
23,880 KB
testcase_43 AC 65 ms
23,952 KB
testcase_44 AC 65 ms
21,736 KB
testcase_45 AC 64 ms
21,788 KB
testcase_46 AC 65 ms
21,648 KB
testcase_47 AC 65 ms
23,700 KB
testcase_48 AC 65 ms
23,820 KB
testcase_49 AC 65 ms
21,660 KB
testcase_50 AC 65 ms
23,756 KB
testcase_51 AC 64 ms
21,732 KB
testcase_52 AC 64 ms
21,792 KB
testcase_53 AC 66 ms
23,896 KB
testcase_54 AC 65 ms
21,792 KB
testcase_55 AC 65 ms
21,700 KB
testcase_56 AC 65 ms
21,896 KB
testcase_57 AC 64 ms
23,752 KB
testcase_58 AC 64 ms
23,836 KB
testcase_59 AC 65 ms
23,764 KB
testcase_60 AC 65 ms
21,848 KB
testcase_61 AC 68 ms
19,660 KB
testcase_62 AC 69 ms
23,812 KB
testcase_63 AC 66 ms
23,760 KB
testcase_64 AC 64 ms
21,652 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.Generic;
using System.Linq;
using System.IO;
//using System.Text;
//using System.Text.RegularExpressions;
//using System.Globalization;
//using System.Diagnostics;
using static System.Console;
//using System.Numerics;
//using static System.Math;
//using pair = Pair<int, int>;

class Program
{
    static void Main()
    {
        //SetOut(new StreamWriter(OpenStandardOutput()) { AutoFlush = false });
        new Program().solve();
        Out.Flush();
    }
    Scanner cin = new Scanner();
    readonly int[] dd = { 0, 1, 0, -1, 0 }; //→↓←↑
    readonly int mod = 1000000007;
    void chmax<T>(ref T a, T b) where T : IComparable<T> { a = a.CompareTo(b) < 0 ? b : a; }
    void chmin<T>(ref T a, T b) where T : IComparable<T> { a = a.CompareTo(b) < 0 ? a : b; }

    void solve()
    {
        int N = cin.nextint;
        var A = cin.scanlong;
        long m = A[0];
        for (int i = 1; i < N; i++)
        {
            m = gcd(m, A[i]);
        }
        WriteLine(string.Join(":", A.Select(i => i / m).ToArray()));

    }

    long gcd(long a, long b)
    {
        return (b != 0) ? gcd(b, a % b) : a;
    }
    long lcm(long a, long b)
    {
        return a / gcd(a, b) * b;
    }
    //ax + by = gcd(a, b)となるx, yを求める
    long extgcd(long a, long b, out long x, out long y)
    {
        long g = a;
        if (b != 0)
        {
            g = extgcd(b, a % b, out y, out x);
            y -= (a / b) * x;
        }
        else
        {
            x = 1;
            y = 0;
        }
        return g;
    }
}

class Scanner
{
    string[] s; int i;
    char[] cs = new char[] { ' ' };
    public Scanner() { s = new string[0]; i = 0; }
    public string[] scan { get { return ReadLine().Split(); } }
    public int[] scanint { get { return Array.ConvertAll(scan, int.Parse); } }
    public long[] scanlong { get { return Array.ConvertAll(scan, long.Parse); } }
    public double[] scandouble { get { return Array.ConvertAll(scan, double.Parse); } }
    public string next
    {
        get
        {
            if (i < s.Length) return s[i++];
            string st = ReadLine();
            while (st == "") st = ReadLine();
            s = st.Split(cs, StringSplitOptions.RemoveEmptyEntries);
            i = 0;
            return next;
        }
    }
    public int nextint { get { return int.Parse(next); } }
    public long nextlong { get { return long.Parse(next); } }
    public double nextdouble { get { return double.Parse(next); } }
}
0