結果
問題 | No.2057 Ising Model |
ユーザー |
|
提出日時 | 2022-08-26 21:30:42 |
言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
結果 |
AC
|
実行時間 | 2 ms / 2,000 ms |
コード長 | 206 bytes |
コンパイル時間 | 580 ms |
コンパイル使用メモリ | 63,232 KB |
実行使用メモリ | 5,248 KB |
最終ジャッジ日時 | 2024-10-13 21:55:55 |
合計ジャッジ時間 | 1,748 ms |
ジャッジサーバーID (参考情報) |
judge3 / judge2 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 44 |
コンパイルメッセージ
main.cpp:4:1: warning: ISO C++ forbids declaration of 'main' with no type [-Wreturn-type] 4 | main() | ^~~~
ソースコード
#include<iostream> using namespace std; long N,A,B; main() { cin>>N>>A>>B; long lc=0,rc=(N-1)/2; long ans=A*(N-1)-B*N+(2*B-4*A<0?rc:lc)*(2*B-4*A); if(N%2==0)ans=min(ans,A*(-(N-1))); cout<<ans<<endl; }