[JAVA]SWEA 6730-障害競走難易度
import java.util.*;
class Solution
{
public static void main(String args[]) throws Exception
{
Scanner sc = new Scanner(System.in);
StringBuffer sb = new StringBuffer();
int T = sc.nextInt();
for(int tc=1; tc<=T; tc++){
sb.append("#").append(tc).append(" ");
ArrayList<Integer> block = new ArrayList<>();
int N = sc.nextInt();
for(int i=0; i<N; i++){
block.add(sc.nextInt());
}
int upLevel = 0, downLevel = 0;
for(int i=1; i<N; i++){
int cur = block.get(i-1);
int nxt = block.get(i);
if(nxt > cur){
//올라가기
upLevel = Math.max(upLevel, nxt - cur);
}else{
//내려가기
downLevel = Math.max(downLevel, cur - nxt);
}
}
sb.append(upLevel).append(" ").append(downLevel).append("\n");
}
System.out.println(sb);
}
}
Reference
この問題について([JAVA]SWEA 6730-障害競走難易度), 我々は、より多くの情報をここで見つけました https://velog.io/@gkdud583/JAVA-SWEA-6730-장애물-경주-난이도テキストは自由に共有またはコピーできます。ただし、このドキュメントのURLは参考URLとして残しておいてください。
Collection and Share based on the CC Protocol