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

运行 ID: 52759

#include <bits/stdc++.h> using namespace std; int n,a,b; int num[25],aim[21]= {0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20}; double ans; int main() { scanf("%d%d%d",&n,&a,&b); for(int i=1; i<=n; i++) scanf("%d",num+i); if(b>n*a) { for(int i=1; i<=n; i++) { if(num[i]!=aim[i]) { int pos=0; for(int j=i+1; j<=n; j++) if(aim[i]==num[j]) { pos=j; break; } swap(num[i],num[pos]); ans+=a; } } printf("%.10lf\n",ans); return 0; } cout<<"0.0000000000\n"; return 0; }