結果
問題 |
No.2091 Shio Ramen (Easy)
|
ユーザー |
|
提出日時 | 2022-10-11 00:13:18 |
言語 | Go (1.23.4) |
結果 |
AC
|
実行時間 | 2 ms / 2,000 ms |
コード長 | 529 bytes |
コンパイル時間 | 13,030 ms |
コンパイル使用メモリ | 230,848 KB |
実行使用メモリ | 6,944 KB |
最終ジャッジ日時 | 2024-06-30 02:23:46 |
合計ジャッジ時間 | 13,604 ms |
ジャッジサーバーID (参考情報) |
judge5 / judge4 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 12 |
ソースコード
package main import ( "bufio" "fmt" "os" "strconv" "strings" ) func main() { sc := bufio.NewScanner(os.Stdin) sc.Scan() ss := strings.Fields(sc.Text()) N, _ := strconv.Atoi(ss[0]) S, _ := strconv.Atoi(ss[1]) K, _ := strconv.Atoi(ss[2]) min_r := -1 min_d := 99 for r := 1; r <= N; r++ { sc.Scan() a, _ := strconv.Atoi(sc.Text()) d := a - S if d < 0 { d = -d } if d <= K && d < min_d { min_r = r min_d = d } } if min_r >= 0 { fmt.Println(min_r) } else { fmt.Println("Unlucky!") } }