結果
| 問題 | No.365 ジェンガソート |
| コンテスト | |
| ユーザー |
feeling_burst
|
| 提出日時 | 2016-05-03 22:29:57 |
| 言語 | C90(gcc12) (gcc 12.4.0) |
| 結果 |
WA
|
| 実行時間 | - |
| コード長 | 377 bytes |
| 記録 | |
| コンパイル時間 | 246 ms |
| コンパイル使用メモリ | 32,320 KB |
| 最終ジャッジ日時 | 2026-02-23 21:14:16 |
|
ジャッジサーバーID (参考情報) |
judge2 / judge4 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| other | AC * 11 WA * 30 |
コンパイルメッセージ
main.c: In function ‘main’:
main.c:10:3: warning: ignoring return value of ‘scanf’ declared with attribute ‘warn_unused_result’ [-Wunused-result]
10 | scanf("%d", &N);
| ^~~~~~~~~~~~~~~
main.c:12:5: warning: ignoring return value of ‘scanf’ declared with attribute ‘warn_unused_result’ [-Wunused-result]
12 | scanf("%d", &a[i]);
| ^~~~~~~~~~~~~~~~~~
ソースコード
#include <stdio.h>
#include <string.h>
#include <math.h>
int main(void) {
int N;
int i;
int a[1000000];
int t;
int cnt = 0;
scanf("%d", &N);
for (i = 0; i < N; i++) {
scanf("%d", &a[i]);
}
for (i = N-1; i > 0; i--) {
if (a[i-1] > a[i]) {
t = a[i-1];
a[i-1] = a[i];
a[i] = t;
cnt++;
}
}
printf("%d",cnt);
return 0;
}
feeling_burst