結果
| 問題 |
No.135 とりあえず1次元の問題
|
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2017-03-03 09:41:27 |
| 言語 | C90 (gcc 12.3.0) |
| 結果 |
TLE
|
| 実行時間 | - |
| コード長 | 423 bytes |
| コンパイル時間 | 191 ms |
| コンパイル使用メモリ | 21,248 KB |
| 実行使用メモリ | 8,484 KB |
| 最終ジャッジ日時 | 2024-06-22 04:41:20 |
| 合計ジャッジ時間 | 12,551 ms |
|
ジャッジサーバーID (参考情報) |
judge4 / judge3 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | -- * 2 |
| other | TLE * 1 -- * 21 |
コンパイルメッセージ
main.c: In function ‘main’:
main.c:8:1: warning: ignoring return value of ‘scanf’ declared with attribute ‘warn_unused_result’ [-Wunused-result]
8 | scanf("%d",&n);
| ^~~~~~~~~~~~~~
main.c:11:9: warning: ignoring return value of ‘scanf’ declared with attribute ‘warn_unused_result’ [-Wunused-result]
11 | scanf("%d",&x[i]);
| ^~~~~~~~~~~~~~~~~
ソースコード
#include<stdio.h>
int main(void)
{
int n,x[100000],i,c=1000001;
scanf("%d",&n);
for(i=0;i<n;i++){
scanf("%d",&x[i]);
}
int j,temp=0;
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;
}
}
}
if(n==1 || n==0){
c=0;
}
for(i=0;i<n-1;i++){
if( x[i] != x[i+1] && x[i+1]-x[i]<c){
c=x[i+1]-x[i];
}
}
if(c==1000001){
c=0;
}
printf("%d\n",c);
return 0;
}