結果

問題 No.1330 Multiply or Divide
ユーザー さかぽんさかぽん
提出日時 2021-01-08 21:35:40
言語 C#(csc)
(csc 3.9.0)
結果
WA  
実行時間 -
コード長 768 bytes
コンパイル時間 1,671 ms
コンパイル使用メモリ 107,520 KB
実行使用メモリ 45,788 KB
最終ジャッジ日時 2024-04-28 02:18:08
合計ジャッジ時間 7,309 ms
ジャッジサーバーID
(参考情報)
judge1 / judge2
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 WA -
testcase_01 AC 170 ms
43,520 KB
testcase_02 WA -
testcase_03 AC 30 ms
18,816 KB
testcase_04 AC 28 ms
18,688 KB
testcase_05 AC 28 ms
18,944 KB
testcase_06 AC 89 ms
33,152 KB
testcase_07 WA -
testcase_08 AC 144 ms
43,776 KB
testcase_09 AC 139 ms
43,904 KB
testcase_10 AC 143 ms
43,776 KB
testcase_11 AC 144 ms
43,776 KB
testcase_12 AC 141 ms
43,904 KB
testcase_13 AC 29 ms
18,816 KB
testcase_14 WA -
testcase_15 WA -
testcase_16 AC 29 ms
18,688 KB
testcase_17 WA -
testcase_18 AC 197 ms
43,904 KB
testcase_19 AC 199 ms
43,904 KB
testcase_20 AC 195 ms
43,776 KB
testcase_21 AC 196 ms
43,776 KB
testcase_22 AC 197 ms
43,776 KB
testcase_23 AC 163 ms
45,788 KB
testcase_24 AC 29 ms
18,816 KB
testcase_25 AC 29 ms
19,072 KB
testcase_26 AC 29 ms
18,944 KB
testcase_27 AC 30 ms
19,200 KB
testcase_28 AC 29 ms
18,944 KB
testcase_29 AC 29 ms
18,816 KB
testcase_30 AC 29 ms
18,944 KB
testcase_31 AC 31 ms
19,072 KB
testcase_32 AC 30 ms
18,944 KB
testcase_33 AC 31 ms
19,200 KB
testcase_34 AC 154 ms
38,912 KB
testcase_35 AC 68 ms
24,120 KB
testcase_36 AC 148 ms
37,632 KB
testcase_37 AC 137 ms
36,608 KB
testcase_38 AC 92 ms
27,904 KB
testcase_39 AC 75 ms
24,704 KB
testcase_40 AC 81 ms
25,984 KB
testcase_41 AC 59 ms
22,272 KB
testcase_42 AC 125 ms
35,968 KB
testcase_43 AC 136 ms
37,120 KB
testcase_44 WA -
testcase_45 WA -
権限があれば一括ダウンロードができます
コンパイルメッセージ
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.Linq;

class B
{
	static int[] Read() => Array.ConvertAll(Console.ReadLine().Split(), int.Parse);
	static (int, int) Read2() { var a = Read(); return (a[0], a[1]); }
	static (int, int, int) Read3() { var a = Read(); return (a[0], a[1], a[2]); }
	static long[] ReadL() => Array.ConvertAll(Console.ReadLine().Split(), long.Parse);
	static void Main()
	{
		var (n, m, p) = Read3();
		var a = ReadL();

		a = a.Where(x => Gcd(x, p) == 1).ToArray();
		if (!a.Any()) { Console.WriteLine(-1); return; }
		var amax = a.Max();

		long x = 1;
		for (int i = 1; ; i++)
		{
			x *= amax;
			if (x > m)
			{
				Console.WriteLine(i);
				return;
			}
		}
	}

	static long Gcd(long a, long b) { for (long r; (r = a % b) > 0; a = b, b = r) ; return b; }
}
0