結果
| 問題 | No.944 煎っぞ! |
| コンテスト | |
| ユーザー |
keymoon
|
| 提出日時 | 2021-02-02 03:12:06 |
| 言語 | C#(csc) (csc 3.9.0) |
| 結果 |
AC
|
| 実行時間 | 40 ms / 3,000 ms |
| コード長 | 1,044 bytes |
| 記録 | |
| コンパイル時間 | 529 ms |
| コンパイル使用メモリ | 107,776 KB |
| 実行使用メモリ | 26,060 KB |
| 最終ジャッジ日時 | 2026-03-19 15:04:56 |
| 合計ジャッジ時間 | 3,118 ms |
|
ジャッジサーバーID (参考情報) |
judge2_0 / judge3_0 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| 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