結果
問題 | No.16 累乗の加算 |
ユーザー |
![]() |
提出日時 | 2015-12-29 21:43:58 |
言語 | C#(csc) (csc 3.9.0) |
結果 |
WA
(最新)
AC
(最初)
|
実行時間 | - |
コード長 | 982 bytes |
コンパイル時間 | 1,014 ms |
コンパイル使用メモリ | 112,748 KB |
実行使用メモリ | 32,680 KB |
最終ジャッジ日時 | 2024-11-06 17:09:40 |
合計ジャッジ時間 | 2,276 ms |
ジャッジサーバーID (参考情報) |
judge5 / judge3 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
other | AC * 13 WA * 1 |
コンパイルメッセージ
Microsoft (R) Visual C# Compiler version 3.9.0-6.21124.20 (db94f4cc) Copyright (C) Microsoft Corporation. All rights reserved.
ソースコード
using System;using System.Linq;namespace yukicoder{class _016{static int[] p;static void Main(){int[] xn = Array.ConvertAll(Console.ReadLine().Split(' '), x => int.Parse(x));int[] an = Array.ConvertAll(Console.ReadLine().Split(' '), x => int.Parse(x));int m = an.Max();p = new int[m + 1];int l = c(xn[0], m);int ans = 0;foreach(int a in an){ans += p[l == 1 ? a : a % l];}Console.WriteLine(ans % 1000003);}static int c(int x, int m){int l = 1;p[0] = 1;for (int i = 1; i < m + 1; i++){p[i] = p[i -1] * x % 1000003;if (p[i] == 1){return i;}}return l;}}}