結果
| 問題 |
No.944 煎っぞ!
|
| コンテスト | |
| ユーザー |
bal4u
|
| 提出日時 | 2019-12-07 08:40:00 |
| 言語 | C (gcc 13.3.0) |
| 結果 |
AC
|
| 実行時間 | 5 ms / 3,000 ms |
| コード長 | 666 bytes |
| コンパイル時間 | 178 ms |
| コンパイル使用メモリ | 31,360 KB |
| 実行使用メモリ | 6,784 KB |
| 最終ジャッジ日時 | 2024-12-24 14:08:12 |
| 合計ジャッジ時間 | 1,826 ms |
|
ジャッジサーバーID (参考情報) |
judge2 / judge4 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| other | AC * 35 |
ソースコード
// yuki 944 煎っぞ!
// 2019.12.7 bal4u
#include <stdio.h>
#include <math.h>
int getchar_unlocked(void);
#define gc() getchar_unlocked()
int in() { // 非負整数の入力
int n = 0, c = gc();
do n = 10 * n + (c & 0xf); while ((c = gc()) >= '0');
return n;
}
char f[10000005];
int ans = 1;
void check(int w, int n) {
int x = 0, m;
if (n <= ans) return;
m = n;
while (n--) {
x += w;
if (f[x] == 0) return;
}
ans = m;
}
int main()
{
int i, b, s, N;
N = in();
s = 0; while (N--) s += in(), f[s] = 1;
b = (int)sqrt((double)s);
for (i = 1; i <= b; ++i) if (s % i == 0) {
check(i, s/i), check(s/i, i);
}
printf("%d\n", ans);
return 0;
}
bal4u