結果
問題 |
No.1084 積の積
|
ユーザー |
![]() |
提出日時 | 2020-06-22 22:11:05 |
言語 | C#(csc) (csc 3.9.0) |
結果 |
TLE
|
実行時間 | - |
コード長 | 1,324 bytes |
コンパイル時間 | 826 ms |
コンパイル使用メモリ | 112,456 KB |
実行使用メモリ | 36,792 KB |
最終ジャッジ日時 | 2024-07-03 18:54:57 |
合計ジャッジ時間 | 4,580 ms |
ジャッジサーバーID (参考情報) |
judge2 / judge5 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 4 -- * 1 |
other | TLE * 1 -- * 26 |
コンパイルメッセージ
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 Problem1084 { class Program { static void Main(string[] args) { const long mod = 7 + (long)1e9; long N = GetLong(); var A = GetLongArray(); long ans = 1; for(int i = 0; i < N; i++) { long temp = 1; for(int j = i; j < N; j++) { temp *= A[j]; if(temp >= 1e9) { break; } else { ans *= temp; ans %= mod; } } } Console.WriteLine(ans); } public static int GetInt() => int.Parse(Console.ReadLine()); public static int[] GetIntArray() => Console.ReadLine().Split().Select(int.Parse).ToArray(); public static double GetDouble() => double.Parse(Console.ReadLine()); public static double[] GetDoubleArray() => Console.ReadLine().Split().Select(double.Parse).ToArray(); public static long GetLong() => long.Parse(Console.ReadLine()); public static long[] GetLongArray() => Console.ReadLine().Split().Select(long.Parse).ToArray(); } }