結果
| 問題 |
No.2057 Ising Model
|
| コンテスト | |
| ユーザー |
maitakeshimeji6
|
| 提出日時 | 2022-08-27 00:26:16 |
| 言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
| 結果 |
WA
|
| 実行時間 | - |
| コード長 | 640 bytes |
| コンパイル時間 | 962 ms |
| コンパイル使用メモリ | 92,032 KB |
| 実行使用メモリ | 6,824 KB |
| 最終ジャッジ日時 | 2024-10-14 01:08:31 |
| 合計ジャッジ時間 | 2,282 ms |
|
ジャッジサーバーID (参考情報) |
judge2 / judge5 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 2 WA * 1 |
| other | AC * 36 WA * 8 |
ソースコード
#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;
long long ans3 = INF;
if (n % 2 == 0) {
ans1 = a * (-(n - 1));
ans3 = a *(-(n - 2)) - 2 * b;
}
else {
ans1 = a * (-(n - 1)) - b;
}
ans2 = a * (n - 1) - b * n;
cout << min(ans1,min( ans2, ans3)) << endl;
}
maitakeshimeji6