結果
問題 |
No.489 株に挑戦
|
ユーザー |
![]() |
提出日時 | 2017-03-12 13:37:46 |
言語 | Java (openjdk 23) |
結果 |
TLE
|
実行時間 | - |
コード長 | 920 bytes |
コンパイル時間 | 3,166 ms |
コンパイル使用メモリ | 79,536 KB |
実行使用メモリ | 58,832 KB |
最終ジャッジ日時 | 2024-06-30 00:24:01 |
合計ジャッジ時間 | 7,399 ms |
ジャッジサーバーID (参考情報) |
judge5 / judge2 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | -- * 3 |
other | AC * 1 TLE * 1 -- * 33 |
ソースコード
import java.util.*; public class A { public static void main(String[] args){ int N, D, K, x[]; long Max; Scanner scan = new Scanner(System.in); N = scan.nextInt(); D = scan.nextInt(); K = scan.nextInt(); x = new int[N]; for(int i = 0; i < N; i++){ x[i] = scan.nextInt(); } Max = (long)x[D] - x[0]; int j = 0, k = D; for(int h = D; h > 0; h--){ for(int i = 0; i < N - h; i++){ if(Max <= (x[N - i - 1] - x[N - i - h - 1])){ Max = x[N - i - 1] - x[N - i - h - 1]; j = N - i - h - 1; k = N - i - 1; } } } if(Max > 0){ System.out.println(Max * K); System.out.println(j + " " + k); } else{ System.out.println(0); } } }