Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- # Auto-generated code below aims at helping you parse
- # the standard input according to the problem statement.
- last="";
- read N
- for (( i=0; i<N; i++ )); do
- read Pi
- echo $Pi
- done | sort -n | while read current;
- do
- if [[ -z $last ]]
- then
- last=$current;
- continue;
- fi
- currentDiff=$((last - current));
- if [[ $currentDiff -lt 0 ]]
- then
- currentDiff=$((current - last))
- fi
- echo $currentDiff;
- last=$current;
- done | sort -n | head -n 1
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement