diff --git a/JHLEE325/202507/.gitkeep b/JHLEE325/202507/.gitkeep new file mode 100644 index 00000000..8b137891 --- /dev/null +++ b/JHLEE325/202507/.gitkeep @@ -0,0 +1 @@ + diff --git "a/JHLEE325/202507/10 BOJ G4 \352\263\240\354\270\265 \352\261\264\353\254\274" "b/JHLEE325/202507/10 BOJ G4 \352\263\240\354\270\265 \352\261\264\353\254\274" new file mode 100644 index 00000000..cb22ab85 --- /dev/null +++ "b/JHLEE325/202507/10 BOJ G4 \352\263\240\354\270\265 \352\261\264\353\254\274" @@ -0,0 +1,49 @@ +'''java +import java.io.BufferedReader; +import java.io.InputStreamReader; +import java.util.StringTokenizer; + +public class Main { + public static void main(String[] args) throws Exception { + BufferedReader br = new BufferedReader(new InputStreamReader(System.in)); + StringTokenizer st = new StringTokenizer(br.readLine()); + int n = Integer.parseInt(st.nextToken()); + + st = new StringTokenizer(br.readLine()); + + int[] buildings = new int[n]; + + for (int i = 0; i < n; i++) { + buildings[i] = Integer.parseInt(st.nextToken()); + } + + int max = 0; + for (int i = 0; i < n; i++) { + double temp = 1000000001; + int count = 0; + for (int j = i - 1; j >= 0; j--) { + double degree = (double) (buildings[i] - buildings[j]) / (i - j); + if (temp > degree) { + count++; + temp = degree; + } else { + continue; + } + } + temp = -1000000001; + for (int j = i + 1; j < n; j++) { + double degree = (double) (buildings[j] - buildings[i]) / (j - i); + if (temp < degree) { + count++; + temp = degree; + } else { + continue; + } + } + max = Math.max(max, count); + } + + System.out.println(max); + } +} +'''