結果
| 問題 |
No.365 ジェンガソート
|
| コンテスト | |
| ユーザー |
jokin_tokei
|
| 提出日時 | 2017-09-07 03:59:18 |
| 言語 | C (gcc 13.3.0) |
| 結果 |
AC
|
| 実行時間 | 12 ms / 2,000 ms |
| コード長 | 543 bytes |
| コンパイル時間 | 1,008 ms |
| コンパイル使用メモリ | 29,056 KB |
| 実行使用メモリ | 5,248 KB |
| 最終ジャッジ日時 | 2024-11-07 10:51:24 |
| 合計ジャッジ時間 | 1,604 ms |
|
ジャッジサーバーID (参考情報) |
judge5 / judge1 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| other | AC * 41 |
ソースコード
#include <stdio.h>
#include <stdlib.h>
#define ARRAY_NUM 100000
int main(void) {
int i, n, max,max1, max_num, count;
int list[ARRAY_NUM] = { };
max = max_num = count = 0;
scanf("%d", &n);
for (i = 0; i < n; i++) {
scanf("%d", &list[i]);
}
for (i = 0; i < n; i++) {
if (max < list[i]) {
max1 = max = list[i];
max_num = i;
}
}
max--;
while (max_num-- > 0) {
if (max == list[max_num]) {
count++;
max--;
}
}
count++; // include maxself
// printf("%d", count);
printf("%d", max1 - count);
return 0;
}
jokin_tokei