結果
問題 |
No.716 距離
|
ユーザー |
![]() |
提出日時 | 2018-09-21 17:32:20 |
言語 | C (gcc 13.3.0) |
結果 |
AC
|
実行時間 | 1 ms / 2,000 ms |
コード長 | 495 bytes |
コンパイル時間 | 131 ms |
コンパイル使用メモリ | 29,440 KB |
実行使用メモリ | 6,944 KB |
最終ジャッジ日時 | 2024-07-18 08:44:24 |
合計ジャッジ時間 | 1,105 ms |
ジャッジサーバーID (参考情報) |
judge2 / judge1 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
other | AC * 40 |
ソースコード
#include <stdio.h> int main() { int n,i,max,min,j,k,mincand; int posi[1000]; int tempdis[999]; scanf("%d",&n); for(i=0;i<n;i++){ scanf("%d",&posi[i]); } max=posi[n-1]-posi[0]; for(j=0;j<n-1;j++){ tempdis[j]=posi[j+1]-posi[j]; } mincand=tempdis[0]; for(k=0;k<n-1;k++){ if(mincand>tempdis[k]){ mincand=tempdis[k]; } } min=mincand; printf("%d\n",min); printf("%d\n",max); return 0; }