結果

問題 No.397 NO MORE KADOMATSU
ユーザー butsurizuki
提出日時 2016-11-02 14:55:01
言語 C90
(gcc 12.3.0)
結果
AC  
実行時間 36 ms / 2,000 ms
コード長 522 bytes
コンパイル時間 159 ms
コンパイル使用メモリ 21,504 KB
実行使用メモリ 25,220 KB
平均クエリ数 936.56
最終ジャッジ日時 2024-07-17 00:35:26
合計ジャッジ時間 1,651 ms
ジャッジサーバーID
(参考情報)
judge3 / judge1
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other AC * 18
権限があれば一括ダウンロードができます
コンパイルメッセージ
main.c: In function ‘main’:
main.c:26:9: warning: ignoring return value of ‘scanf’ declared with attribute ‘warn_unused_result’ [-Wunused-result]
   26 |         scanf("%d",&n);
      |         ^~~~~~~~~~~~~~
main.c:28:17: warning: ignoring return value of ‘scanf’ declared with attribute ‘warn_unused_result’ [-Wunused-result]
   28 |                 scanf("%d",&a[i]);
      |                 ^~~~~~~~~~~~~~~~~
main.c:36:9: warning: ignoring return value of ‘scanf’ declared with attribute ‘warn_unused_result’ [-Wunused-result]
   36 |         scanf("%d",&d);
      |         ^~~~~~~~~~~~~~

ソースコード

diff #

#include <stdio.h>

int t=0,c[65536] = {0};

#include <stdio.h>

int sort(int x[],int l){
	int i,j,k;
	for(i=1;i<=l;i++){
		for(j=l;j>=i+1;j--){
			if(x[j-1]>x[j]){
				c[2*t] = j-2;
				c[2*t+1] = j-1;
				t++;
				k=x[j];
				x[j]=x[j-1];
				x[j-1]=k;
			}
		}
	}
	return 0;
}

int main(void) {
	int n,a[128],d,i;
	scanf("%d",&n);
	for(i = 1;i <= n;i++){
		scanf("%d",&a[i]);
	}
	sort(a,n);
	printf("%d\n",t);
	for(i = 0;i < t;i++){
		printf("%d %d\n",c[2*i],c[2*i+1]);
	}
	fflush(stdout);
	scanf("%d",&d);
	return 0;
}
0