結果

問題 No.1250 汝は倍数なりや?
ユーザー azukunazukun
提出日時 2020-10-09 22:20:25
言語 C#(csc)
(csc 3.9.0)
結果
AC  
実行時間 139 ms / 1,000 ms
コード長 3,942 bytes
コンパイル時間 882 ms
コンパイル使用メモリ 66,708 KB
実行使用メモリ 42,496 KB
最終ジャッジ日時 2023-09-27 17:57:56
合計ジャッジ時間 6,960 ms
ジャッジサーバーID
(参考情報)
judge11 / judge12
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 59 ms
23,668 KB
testcase_01 AC 57 ms
21,832 KB
testcase_02 AC 58 ms
23,760 KB
testcase_03 AC 58 ms
21,632 KB
testcase_04 AC 58 ms
21,720 KB
testcase_05 AC 57 ms
21,772 KB
testcase_06 AC 57 ms
21,780 KB
testcase_07 AC 57 ms
21,712 KB
testcase_08 AC 57 ms
19,712 KB
testcase_09 AC 59 ms
23,820 KB
testcase_10 AC 60 ms
21,716 KB
testcase_11 AC 62 ms
23,804 KB
testcase_12 AC 60 ms
23,672 KB
testcase_13 AC 57 ms
21,764 KB
testcase_14 AC 58 ms
23,752 KB
testcase_15 AC 60 ms
23,752 KB
testcase_16 AC 59 ms
21,700 KB
testcase_17 AC 57 ms
23,820 KB
testcase_18 AC 57 ms
19,852 KB
testcase_19 AC 56 ms
21,692 KB
testcase_20 AC 57 ms
19,688 KB
testcase_21 AC 56 ms
21,880 KB
testcase_22 AC 58 ms
21,828 KB
testcase_23 AC 62 ms
21,940 KB
testcase_24 AC 65 ms
23,936 KB
testcase_25 AC 66 ms
21,804 KB
testcase_26 AC 65 ms
21,940 KB
testcase_27 AC 66 ms
21,808 KB
testcase_28 AC 65 ms
21,928 KB
testcase_29 AC 64 ms
21,888 KB
testcase_30 AC 64 ms
21,912 KB
testcase_31 AC 65 ms
21,840 KB
testcase_32 AC 64 ms
21,832 KB
testcase_33 AC 139 ms
41,440 KB
testcase_34 AC 97 ms
31,404 KB
testcase_35 AC 130 ms
41,952 KB
testcase_36 AC 137 ms
42,416 KB
testcase_37 AC 111 ms
40,032 KB
testcase_38 AC 110 ms
34,548 KB
testcase_39 AC 100 ms
29,468 KB
testcase_40 AC 108 ms
35,756 KB
testcase_41 AC 118 ms
37,280 KB
testcase_42 AC 94 ms
30,084 KB
testcase_43 AC 134 ms
42,272 KB
testcase_44 AC 90 ms
28,136 KB
testcase_45 AC 135 ms
42,496 KB
testcase_46 AC 82 ms
28,544 KB
testcase_47 AC 109 ms
38,360 KB
testcase_48 AC 57 ms
21,644 KB
testcase_49 AC 56 ms
21,616 KB
testcase_50 AC 58 ms
21,712 KB
testcase_51 AC 56 ms
21,704 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

using System;
using System.Collections.Generic;
using System.Globalization;
using System.IO;
using System.Linq;
using System.Text;
using System.Threading;

// (づ°ω°)づミe★゜・。。・゜゜・。。・゜☆゜・。。・゜゜・。。・゜
public class Solver
{
    public void Solve()
    {
        int n = ReadInt();
        int m = ReadInt();
        var a = ReadIntArray();

        long x = 1;
        foreach (int aa in a)
            x = x * Math.Abs(aa) % m;

        Write(x > 0 ? "NO" : "YES");
    }

    #region Main

    protected static TextReader reader;
    protected static TextWriter writer;
    static void Main()
    {
#if DEBUG
        reader = new StreamReader("..\\..\\input.txt");
        //reader = new StreamReader(Console.OpenStandardInput());
        writer = Console.Out;
        //writer = new StreamWriter("..\\..\\output.txt");
#else
        reader = new StreamReader(Console.OpenStandardInput());
        writer = new StreamWriter(Console.OpenStandardOutput());
        //reader = new StreamReader("input.txt");
        //writer = new StreamWriter("output.txt");
#endif
        try
        {
            new Solver().Solve();
            //var thread = new Thread(new Solver().Solve, 1024 * 1024 * 128);
            //thread.Start();
            //thread.Join();
        }
        catch (Exception ex)
        {
#if DEBUG
            Console.WriteLine(ex);
#else
            throw;
#endif
        }
        reader.Close();
        writer.Close();
    }

    #endregion

    #region Read / Write
    private static Queue<string> currentLineTokens = new Queue<string>();
    private static string[] ReadAndSplitLine() { return reader.ReadLine().Split(new[] { ' ', '\t', }, StringSplitOptions.RemoveEmptyEntries); }
    public static string ReadToken() { while (currentLineTokens.Count == 0) currentLineTokens = new Queue<string>(ReadAndSplitLine()); return currentLineTokens.Dequeue(); }
    public static int ReadInt() { return int.Parse(ReadToken()); }
    public static long ReadLong() { return long.Parse(ReadToken()); }
    public static double ReadDouble() { return double.Parse(ReadToken(), CultureInfo.InvariantCulture); }
    public static int[] ReadIntArray() { return ReadAndSplitLine().Select(int.Parse).ToArray(); }
    public static long[] ReadLongArray() { return ReadAndSplitLine().Select(long.Parse).ToArray(); }
    public static double[] ReadDoubleArray() { return ReadAndSplitLine().Select(s => double.Parse(s, CultureInfo.InvariantCulture)).ToArray(); }
    public static int[][] ReadIntMatrix(int numberOfRows) { int[][] matrix = new int[numberOfRows][]; for (int i = 0; i < numberOfRows; i++) matrix[i] = ReadIntArray(); return matrix; }
    public static int[][] ReadAndTransposeIntMatrix(int numberOfRows)
    {
        int[][] matrix = ReadIntMatrix(numberOfRows); int[][] ret = new int[matrix[0].Length][];
        for (int i = 0; i < ret.Length; i++) { ret[i] = new int[numberOfRows]; for (int j = 0; j < numberOfRows; j++) ret[i][j] = matrix[j][i]; }
        return ret;
    }
    public static string[] ReadLines(int quantity) { string[] lines = new string[quantity]; for (int i = 0; i < quantity; i++) lines[i] = reader.ReadLine().Trim(); return lines; }
    public static void WriteArray<T>(IEnumerable<T> array) { writer.WriteLine(string.Join(" ", array)); }
    public static void Write(params object[] array) { WriteArray(array); }
    public static void WriteLines<T>(IEnumerable<T> array) { foreach (var a in array) writer.WriteLine(a); }
    private class SDictionary<TKey, TValue> : Dictionary<TKey, TValue>
    {
        public new TValue this[TKey key]
        {
            get { return ContainsKey(key) ? base[key] : default(TValue); }
            set { base[key] = value; }
        }
    }
    private static T[] Init<T>(int size) where T : new() { var ret = new T[size]; for (int i = 0; i < size; i++) ret[i] = new T(); return ret; }
    #endregion
}
0