結果
| 問題 | No.944 煎っぞ! |
| コンテスト | |
| ユーザー |
kokatsu
|
| 提出日時 | 2022-11-07 20:50:55 |
| 言語 | D (dmd 2.112.0) |
| 結果 |
AC
|
| 実行時間 | 12 ms / 3,000 ms |
| コード長 | 746 bytes |
| 記録 | |
| コンパイル時間 | 1,507 ms |
| コンパイル使用メモリ | 192,160 KB |
| 実行使用メモリ | 9,552 KB |
| 最終ジャッジ日時 | 2026-03-06 22:12:38 |
| 合計ジャッジ時間 | 2,904 ms |
|
ジャッジサーバーID (参考情報) |
judge2 / judge1 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| other | AC * 35 |
コンパイルメッセージ
/home/linuxbrew/.linuxbrew/opt/dmd/include/dlang/dmd/core/checkedint.d(814): Warning: cannot inline function `core.checkedint.mulu!().mulu`
ulong mulu()(ulong x, uint y, ref bool overflow)
^
ソースコード
import std;
void main() {
long N;
readf("%d\n", N);
auto a = readln.chomp.split.to!(long[]);
long[] divisors;
long S = a.sum, d = 1;
while (d * d <= S) {
if (S % d == 0) {
divisors ~= d;
if (d * d != S) divisors ~= S / d;
}
++d;
}
long res;
foreach (divisor; divisors) {
bool isOK = true;
long cnt, num;
foreach (x; a) {
num += x;
if (num == divisor) {
++cnt, num = 0;
}
else if (num > divisor) {
isOK = false;
break;
}
}
isOK &= (num == 0);
if (isOK) res = max(res, cnt);
}
res.writeln;
}
kokatsu