結果
| 問題 | No.365 ジェンガソート | 
| コンテスト | |
| ユーザー |  | 
| 提出日時 | 2016-06-03 14:47:25 | 
| 言語 | C90 (gcc 12.3.0) | 
| 結果 | 
                                AC
                                 
                             | 
| 実行時間 | 12 ms / 2,000 ms | 
| コード長 | 291 bytes | 
| コンパイル時間 | 253 ms | 
| コンパイル使用メモリ | 21,248 KB | 
| 実行使用メモリ | 6,820 KB | 
| 最終ジャッジ日時 | 2024-10-12 02:21:41 | 
| 合計ジャッジ時間 | 1,619 ms | 
| ジャッジサーバーID (参考情報) | judge1 / 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;
}
            
            
            
        