提交时间:2022-07-20 11:59:02

运行 ID: 52802

#include <bits/stdc++.h> using namespace std; int n,a,b,SC[25],AW; inline int Read() { int x=0; char c=getchar(); for(; c<'0' || c>'9'; c=getchar()); for(; c<='9' && c>='0'; c=getchar()) x=(x<<3)+(x<<1)+c-'0'; return x; } int main() { n=Read(),a=Read(),b=Read(); for(int i=1; i<=n; i++) { SC[i]=Read(); } for(int i=1; i<=n; i++) { if(i!=SC[i]) { swap(SC[SC[i]],SC[i]); AW+=a; } } cout<<AW<<".00000000000000000000"; return 0; }