結果

問題 No.135 とりあえず1次元の問題
コンテスト
ユーザー testestest
提出日時 2015-08-06 03:01:59
言語 C90(gcc12)
(gcc 12.4.0)
コンパイル:
gcc-12 -O2 -std=c90 -DONLINE_JUDGE -o a.out _filename_ -lm
実行:
./a.out
結果
AC  
実行時間 26 ms / 5,000 ms
コード長 259 bytes
記録
記録タグの例:
初AC ショートコード 純ショートコード 純主流ショートコード 最速実行時間
コンパイル時間 208 ms
コンパイル使用メモリ 30,280 KB
最終ジャッジ日時 2026-02-23 18:58:28
ジャッジサーバーID
(参考情報)
judge4 / judge1
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 2
other AC * 22
権限があれば一括ダウンロードができます
コンパイルメッセージ
main.c: In function ‘main’:
main.c:5:24: warning: ignoring return value of ‘scanf’ declared with attribute ‘warn_unused_result’ [-Wunused-result]
    5 | int m,a[1<<17],s=0,n=0;scanf("%d",&m);
      |                        ^~~~~~~~~~~~~~
main.c:6:11: warning: ignoring return value of ‘scanf’ declared with attribute ‘warn_unused_result’ [-Wunused-result]
    6 | while(s<m)scanf("%d",a+s++);qsort(a,m,4,c);
      |           ^~~~~~~~~~~~~~~~~

ソースコード

diff #
raw source code

#include<stdio.h>
#include<stdlib.h>
int c(const void*a,const void*b){return*(int*)a-*(int*)b;}
int main(){
int m,a[1<<17],s=0,n=0;scanf("%d",&m);
while(s<m)scanf("%d",a+s++);qsort(a,m,4,c);
while(--m)if(s=a[m]-a[m-1])n=!n||s<n?s:n;printf("%d",n);
return 0;
}
0