結果
| 問題 | 
                            No.365 ジェンガソート
                             | 
                    
| コンテスト | |
| ユーザー | 
                             feeling_burst
                         | 
                    
| 提出日時 | 2016-05-03 22:29:57 | 
| 言語 | C90  (gcc 12.3.0)  | 
                    
| 結果 | 
                             
                                WA
                                 
                             
                            
                         | 
                    
| 実行時間 | - | 
| コード長 | 377 bytes | 
| コンパイル時間 | 140 ms | 
| コンパイル使用メモリ | 22,400 KB | 
| 実行使用メモリ | 6,820 KB | 
| 最終ジャッジ日時 | 2024-10-05 06:02:16 | 
| 合計ジャッジ時間 | 1,799 ms | 
| 
                            ジャッジサーバーID (参考情報)  | 
                        judge5 / 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