提交时间:2022-07-20 12:06:52
运行 ID: 52882
#include <bits/stdc++.h> using namespace std; const int MXN = 25; int n, a, b; int k[MXN]; inline bool check(int k[]) { for(int i(1); i <= n; i++) if(k[i] != i) return false; return true; } inline int cul(int k[]) { int ans; for(int i(1); i <= n; i++) if(k[i] != i) ans++; return ans; } int main() { ios::sync_with_stdio(false); cin >> n >> a >> b; for(int i(1); i <= n; i++) cin >> k[i]; if(check(k)) cout << 0 << endl; else { cout << (cul(k) / 2) * a << endl; } return 0; }