結果
問題 | No.2138 Add Bacon |
ユーザー |
|
提出日時 | 2022-12-01 20:52:50 |
言語 | Go (1.23.4) |
結果 |
AC
|
実行時間 | 2 ms / 2,000 ms |
コード長 | 625 bytes |
コンパイル時間 | 13,875 ms |
コンパイル使用メモリ | 224,772 KB |
実行使用メモリ | 6,820 KB |
最終ジャッジ日時 | 2024-10-09 00:58:46 |
合計ジャッジ時間 | 15,083 ms |
ジャッジサーバーID (参考情報) |
judge3 / judge2 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 2 |
other | AC * 25 |
ソースコード
package main import ( "bufio" "fmt" "os" "strconv" ) var sc = bufio.NewScanner(os.Stdin) var out = bufio.NewWriter(os.Stdout) func main() { buf := make([]byte, 1024*1024) sc.Buffer(buf, bufio.MaxScanTokenSize) sc.Split(bufio.ScanWords) a, b, c, d, e := nextInt(), nextInt(), nextInt(), nextInt(), nextInt() ans := -int(1e6) for i := 0; i <= c; i++ { ans = Max(ans, a+i*d-(b+i*e)) } PrintInt(ans) } func nextInt() int { sc.Scan() i, _ := strconv.Atoi(sc.Text()) return i } func PrintInt(x int) { defer out.Flush() fmt.Fprintln(out, x) } func Max(x, y int) int { if x < y { return y } return x }