結果

問題 No.135 とりあえず1次元の問題
ユーザー 👑 testestest
提出日時 2015-08-06 02:39:43
言語 C++11(廃止可能性あり)
(gcc 13.3.0)
結果
AC  
実行時間 27 ms / 5,000 ms
コード長 272 bytes
コンパイル時間 463 ms
コンパイル使用メモリ 29,440 KB
実行使用メモリ 6,824 KB
最終ジャッジ日時 2025-01-03 06:14:23
合計ジャッジ時間 1,408 ms
ジャッジサーバーID
(参考情報)
judge1 / judge2
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 2
other AC * 22
権限があれば一括ダウンロードができます
コンパイルメッセージ
main.cpp: In function ‘int main()’:
main.cpp:6:6: warning: ignoring return value of ‘int scanf(const char*, ...)’ declared with attribute ‘warn_unused_result’ [-Wunused-result]
    6 | scanf("%d",&m);s=m;
      | ~~~~~^~~~~~~~~
main.cpp:7:14: warning: ignoring return value of ‘int scanf(const char*, ...)’ declared with attribute ‘warn_unused_result’ [-Wunused-result]
    7 | while(s)scanf("%d",a+m-s--);
      |         ~~~~~^~~~~~~~~~~~~~

ソースコード

diff #

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