結果
| 問題 |
No.16 累乗の加算
|
| コンテスト | |
| ユーザー |
しらゆき
|
| 提出日時 | 2016-01-10 14:18:48 |
| 言語 | C#(csc) (csc 3.9.0) |
| 結果 |
TLE
|
| 実行時間 | - |
| コード長 | 2,158 bytes |
| コンパイル時間 | 921 ms |
| コンパイル使用メモリ | 107,264 KB |
| 実行使用メモリ | 24,864 KB |
| 最終ジャッジ日時 | 2024-09-19 15:54:55 |
| 合計ジャッジ時間 | 7,498 ms |
|
ジャッジサーバーID (参考情報) |
judge1 / judge2 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| other | AC * 2 TLE * 1 -- * 11 |
コンパイルメッセージ
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;
using System.Collections.Generic;
class Program
{
static long m = 1000003;
static void Main()
{
long x, n;
mul(out x, out n);
var a = rla();
long ans = 0;
for(int i=0;i< n; i++)
{
ans = (ans + pow(x, a[i])) % m;
}
Console.WriteLine(ans);
}
static long pow(long a, long b)
{
if (b == 0) return 1;
if (b % 2 == 0) return pow(a, b / 2) * pow(a, b / 2) % m;
else return pow(a, b / 2) * pow(a, b / 2) * a % m;
}
#region Scan
static int ri() { return int.Parse(Console.ReadLine()); }
static long rl() { return long.Parse(Console.ReadLine()); }
static double rd() { return double.Parse(Console.ReadLine()); }
static string rs() { return Console.ReadLine(); }
static int[] ria() { return Console.ReadLine().Trim().Split().Select(int.Parse).ToArray(); }
static long[] rla() { return Console.ReadLine().Trim().Split().Select(long.Parse).ToArray(); }
static double[] rda() { return Console.ReadLine().Trim().Split().Select(double.Parse).ToArray(); }
static string[] rsa() { return Console.ReadLine().Trim().Split(); }
static void mul(out int a, out int b) { var arr = ria(); a = arr[0]; b = arr[1]; }
static void mul(out int a, out int b, out int c) { var arr = ria(); a = arr[0]; b = arr[1]; c = arr[2]; }
static void mul(out int a, out int b, out int c, out int d) { var arr = ria(); a = arr[0]; b = arr[1]; c = arr[2]; d = arr[3]; }
static void mul(out long a, out long b) { var arr = rla(); a = arr[0]; b = arr[1]; }
static void mul(out long a, out long b, out long c) { var arr = rla(); a = arr[0]; b = arr[1]; c = arr[2]; }
static void mul(out long a, out long b, out long c, out long d) { var arr = rla(); a = arr[0]; b = arr[1]; c = arr[2]; d = arr[3]; }
#endregion
#region Math
const int mod = 1000000007;
static bool isprime(long n)
{
if (n < 2) return false;
for (long i = 2; i * i <= n; i++)
if (n % i == 0)
return false;
return true;
}
#endregion
}
しらゆき