結果

問題 No.397 NO MORE KADOMATSU
コンテスト
ユーザー butsurizuki
提出日時 2016-11-02 14:55:01
言語 C90
(gcc 12.4.0)
コンパイル:
gcc-12 -O2 -std=c90 -DONLINE_JUDGE -o a.out _filename_ -lm
実行:
./a.out
結果
AC  
実行時間 57 ms / 2,000 ms
コード長 522 bytes
記録
記録タグの例:
初AC ショートコード 純ショートコード 純主流ショートコード 最速実行時間
コンパイル時間 1,164 ms
コンパイル使用メモリ 29,764 KB
最終ジャッジ日時 2026-02-23 22:47:10
ジャッジサーバー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 #
raw source code

#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