比赛 |
EYOI与SBOI开学欢乐赛10th |
评测结果 |
WWAWWAWWWW |
题目名称 |
01串 |
最终得分 |
20 |
用户昵称 |
该账号已注销 |
运行时间 |
0.000 s |
代码语言 |
C++ |
内存使用 |
0.00 MiB |
提交时间 |
2022-10-10 20:27:34 |
显示代码纯文本
- #include<bits/stdc++.h>
- using namespace std;
- long long n,x,y,a[5010],b[5010],ct1=0,ct2=0;
- long long ans=0;
- string s;
- int main(){
- freopen("zerone.in","r",stdin);
- freopen("zerone.out","w",stdout);
- cin>>n>>x>>y;
- cin>>s;
- for(int i=0;i<s.length();i++){
- if(s[i]=='0')a[i+1]=0;
- else a[i+1]=1,ct1++;
- }
- cin>>s;
- for(int i=0;i<s.length();i++){
- if(s[i]=='0')b[i+1]=0;
- else b[i+1]=1,ct2++;
- }
- if(ct1!=ct2){
- cout<<-1<<endl;
- return 0;
- }
- for(int i=1;i<=n;i++){
- if(a[i]!=b[i])ans+=y;
- }
- cout<<ans/2<<endl;
- return 0;
- }