結果
| 問題 |
No.944 煎っぞ!
|
| コンテスト | |
| ユーザー |
keymoon
|
| 提出日時 | 2021-02-02 03:12:06 |
| 言語 | C#(csc) (csc 3.9.0) |
| 結果 |
AC
|
| 実行時間 | 59 ms / 3,000 ms |
| コード長 | 1,044 bytes |
| コンパイル時間 | 874 ms |
| コンパイル使用メモリ | 114,492 KB |
| 実行使用メモリ | 32,412 KB |
| 最終ジャッジ日時 | 2024-06-29 23:35:07 |
| 合計ジャッジ時間 | 3,605 ms |
|
ジャッジサーバーID (参考情報) |
judge4 / judge5 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| other | AC * 35 |
コンパイルメッセージ
Microsoft (R) Visual C# Compiler version 3.9.0-6.21124.20 (db94f4cc) Copyright (C) Microsoft Corporation. All rights reserved.
ソースコード
using System;
using System.Collections;
using System.Collections.Generic;
using System.Diagnostics;
using System.IO;
using System.Linq;
using System.Numerics;
using System.Text;
using System.Text.RegularExpressions;
using System.Threading.Tasks;
using static System.Math;
public static class P
{
public static void Main()
{
int n = int.Parse(Console.ReadLine());
var a = Console.ReadLine().Split().Select(int.Parse).ToArray();
var sum = a.Sum();
int res = 0;
bool Validate(int sum)
{
int cur = 0;
for (int i = 0; i < a.Length; i++)
{
cur += a[i];
if (sum < cur) return false;
if (sum == cur) cur = 0;
}
return cur == 0;
}
for (int i = 1; i * i <= sum; i++)
{
if (sum % i != 0) continue;
if (Validate(i)) res = Max(res, sum / i);
if (Validate(sum / i)) res = Max(res, i);
}
Console.WriteLine(res);
}
}
keymoon