結果
問題 |
No.135 とりあえず1次元の問題
|
ユーザー |
|
提出日時 | 2017-03-01 16:24:10 |
言語 | C90 (gcc 12.3.0) |
結果 |
TLE
|
実行時間 | - |
コード長 | 458 bytes |
コンパイル時間 | 336 ms |
コンパイル使用メモリ | 21,120 KB |
実行使用メモリ | 15,904 KB |
最終ジャッジ日時 | 2024-06-12 20:50:33 |
合計ジャッジ時間 | 12,879 ms |
ジャッジサーバーID (参考情報) |
judge3 / judge5 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | -- * 2 |
other | TLE * 1 -- * 21 |
コンパイルメッセージ
main.c: In function ‘main’: main.c:13:1: warning: ignoring return value of ‘scanf’ declared with attribute ‘warn_unused_result’ [-Wunused-result] 13 | scanf("%ld",&N); | ^~~~~~~~~~~~~~~ main.c:18:9: warning: ignoring return value of ‘scanf’ declared with attribute ‘warn_unused_result’ [-Wunused-result] 18 | scanf("%ld",&X[i]); | ^~~~~~~~~~~~~~~~~~
ソースコード
#include<stdio.h> int main(void) { long int N; /*X[1000000]={},i,j,temp,R;*/ long int X[1000000]={0}; long int i; long int j; long int temp=0; long int result=0; scanf("%ld",&N); for(i=0;i<N;i++){ scanf("%ld",&X[i]); } for(i=0;i<N;i++){ for(j=i+1;j<N;j++){ if(X[i]>X[j]){ temp= X[i]; X[i]=X[j]; X[j]=temp; } } } for(i=1;i<(N-1);i++){ if(X[0]<X[i]) result = X[i]-X[0]; break; } printf("%ld\n",result); return 0; }