結果

問題 No.2057 Ising Model
ユーザー maitakeshimeji6
提出日時 2022-08-26 22:16:42
言語 C++14
(gcc 13.3.0 + boost 1.87.0)
結果
WA  
実行時間 -
コード長 572 bytes
コンパイル時間 795 ms
コンパイル使用メモリ 91,412 KB
実行使用メモリ 5,248 KB
最終ジャッジ日時 2024-10-13 22:54:40
合計ジャッジ時間 2,064 ms
ジャッジサーバーID
(参考情報)
judge5 / judge2
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 40 WA * 4
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <iostream>
#include <string>
#include <algorithm>
#include <math.h>
#include <vector>
#include <map>
#include <set>
#include <deque>
#include <queue>
#include <cstdio>
#include <iomanip>
#include <list>

#define PI 3.14159265358979323846
#define mod 1000000007
#define pow9 1000000000
#define INF (1 << 30)

using namespace std;

int main() {
	long long n, a, b;
	cin >> n >> a >> b;
	long long ans1, ans2;
	if (n % 2 == 0) {
		ans1 = a * (-(n - 1));
	}
	else {
		ans1 = a * (-(n - 1)) - b;
	}

	ans2 = a * (n - 1) - b * n;

	cout << min(ans1, ans2) << endl;

}

0