結果
問題 | No.2057 Ising Model |
ユーザー |
|
提出日時 | 2022-10-02 14:46:50 |
言語 | Go (1.23.4) |
結果 |
WA
|
実行時間 | - |
コード長 | 628 bytes |
コンパイル時間 | 17,561 ms |
コンパイル使用メモリ | 230,404 KB |
実行使用メモリ | 5,248 KB |
最終ジャッジ日時 | 2024-12-25 03:16:56 |
合計ジャッジ時間 | 16,676 ms |
ジャッジサーバーID (参考情報) |
judge1 / judge5 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 40 WA * 4 |
ソースコード
package mainimport ("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)n, a, b := nextInt(), nextInt(), nextInt()// 1, -1, 1, -1, ....a1 := -a*(n-1) - b*(n%2)// 1, 1, 1, 1, ....a2 := a*(n-1) - b*nans := Min(a1, a2)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 Min(x, y int) int {if x < y {return x}return y}