結果
| 問題 | No.365 ジェンガソート |
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2016-06-03 14:47:25 |
| 言語 | C90 (gcc 12.4.0) |
| 結果 |
AC
|
| 実行時間 | 27 ms / 2,000 ms |
| コード長 | 291 bytes |
| 記録 | |
| コンパイル時間 | 175 ms |
| コンパイル使用メモリ | 30,148 KB |
| 最終ジャッジ日時 | 2026-02-23 21:27:07 |
|
ジャッジサーバーID (参考情報) |
judge2 / judge2 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| other | AC * 41 |
コンパイルメッセージ
main.c: In function ‘main’:
main.c:6:3: warning: ignoring return value of ‘scanf’ declared with attribute ‘warn_unused_result’ [-Wunused-result]
6 | scanf("%d",&N);
| ^~~~~~~~~~~~~~
main.c:9:5: warning: ignoring return value of ‘scanf’ declared with attribute ‘warn_unused_result’ [-Wunused-result]
9 | scanf("%d",&a[i]);
| ^~~~~~~~~~~~~~~~~
ソースコード
#include <stdio.h>
#include <stdlib.h>
int main(){
int N,*a;
int i,result;
scanf("%d",&N);
a = (int*)malloc(sizeof(int)*N);
for(i=0;i<N;i++){
scanf("%d",&a[i]);
}
result = N;
for(i=N-1;i>=0;i--){
if(a[i]==result) result--;
}
printf("%d\n",result);
return 0;
}