結果

問題 No.397 NO MORE KADOMATSU
ユーザー kotatsugamekotatsugame
提出日時 2017-08-11 21:42:34
言語 C
(gcc 12.3.0)
結果
AC  
実行時間 45 ms / 2,000 ms
コード長 257 bytes
コンパイル時間 244 ms
コンパイル使用メモリ 29,568 KB
実行使用メモリ 25,220 KB
平均クエリ数 936.56
最終ジャッジ日時 2024-07-17 01:23:12
合計ジャッジ時間 2,307 ms
ジャッジサーバーID
(参考情報)
judge2 / judge1
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 33 ms
25,220 KB
testcase_01 AC 31 ms
24,836 KB
testcase_02 AC 28 ms
24,836 KB
testcase_03 AC 30 ms
25,220 KB
testcase_04 AC 31 ms
25,220 KB
testcase_05 AC 31 ms
25,220 KB
testcase_06 AC 31 ms
24,836 KB
testcase_07 AC 32 ms
25,220 KB
testcase_08 AC 29 ms
25,220 KB
testcase_09 AC 30 ms
24,580 KB
testcase_10 AC 45 ms
25,220 KB
testcase_11 AC 28 ms
25,220 KB
testcase_12 AC 35 ms
24,836 KB
testcase_13 AC 37 ms
24,580 KB
testcase_14 AC 39 ms
24,580 KB
testcase_15 AC 41 ms
25,220 KB
testcase_16 AC 30 ms
24,824 KB
testcase_17 AC 26 ms
25,208 KB
権限があれば一括ダウンロードができます
コンパイルメッセージ
main.c:1:1: warning: data definition has no type or storage class
    1 | s[101];i,j;a['~~'][2];c;
      | ^
main.c:1:1: warning: type defaults to 'int' in declaration of 's' [-Wimplicit-int]
main.c:1:8: warning: data definition has no type or storage class
    1 | s[101];i,j;a['~~'][2];c;
      |        ^
main.c:1:8: warning: type defaults to 'int' in declaration of 'i' [-Wimplicit-int]
main.c:1:10: warning: type defaults to 'int' in declaration of 'j' [-Wimplicit-int]
    1 | s[101];i,j;a['~~'][2];c;
      |          ^
main.c:1:14: warning: multi-character character constant [-Wmultichar]
    1 | s[101];i,j;a['~~'][2];c;
      |              ^~~~
main.c:1:12: warning: data definition has no type or storage class
    1 | s[101];i,j;a['~~'][2];c;
      |            ^
main.c:1:12: warning: type defaults to 'int' in declaration of 'a' [-Wimplicit-int]
main.c:1:23: warning: data definition has no type or storage class
    1 | s[101];i,j;a['~~'][2];c;
      |                       ^
main.c:1:23: warning: type defaults to 'int' in declaration of 'c' [-Wimplicit-int]
main.c:2:1: warning: return type defaults to 'int' [-Wimplicit-int]
    2 | main(n){
      | ^~~~
main.c: In function 'main':
main.c:2:1: warning: type of 'n' defaults to 'int' [-Wimplicit-int]
main.c:3:13: warning: implicit declaration of function 'scanf' [-Wimplicit-function-declaration]
    3 |         for(scanf("%d",&n);j<n;)scanf("%d",s+j++);
      |             ^~~~~
main.c:1:1: note: include '<stdio.h>' or provide a declaration of 'scanf'
  +++ |+#include <stdio.h>
    1 | s[101];i,j;a['~~'][2];c;
main.c:3:13: warning: incompatible implicit declaration of built-in function 'scanf' [-Wbuiltin-declaration-mismatch]
    3 |         for(scanf("%d",&n);j<n;)scanf("%d",s+j++);
      |             ^~~~~
main.c:3:13: note: include '<stdio.h>' or provide a declaration of 'scanf'
main.c:5:13: warning: implicit declaration of function 'printf' [-Wimplicit-function-declaration]
    5 |         for(printf("%d\n",c)

ソースコード

diff #

s[101];i,j;a['~~'][2];c;
main(n){
	for(scanf("%d",&n);j<n;)scanf("%d",s+j++);
	for(;i<n;i++)for(j=i;j--;)s[j]>s[j+1]&&(*a[c]=j,a[c++][1]=j+1,s[j+1]^=s[j]^=s[j+1]^=s[j]);
	for(printf("%d\n",c),i=0;i<c;i++)printf("%d %d\n",*a[i],a[i][1]);
	fflush(!gets(s));
}
0