#include <iostream>
#include <algorithm>
#include <cstdio>
using namespace std;
const int N = 100010;
int a[N],b[N],c[N],d[N];
int main() {
int n;
int ma,mb;
cin >> n >> ma;
for(int i = 1; i<=ma;i++) {
int x;
cin >> x;
a[i] = x;
}
cin >> mb;
for(int i = 1; i<= mb;i++) {
int x;
cin >> x;
b[i] = x;
}
for(int i = 1; i< mb;i++) {
if(max(a[i+ 1],b[i+ 1])==0)c[i]=2;
else
c[i] = max(a[i+ 1],b[i+ 1])+ 1;
}
int t1 = 0, t2 = 0;
int s = 0;
int w = 0;
for(int i = 1; i < ma;i++) {
a[i+1] += a[i]*c[i];
s =a[i]*c[i];
w += s;
}
for(int i = 1; i < ma;i++) {
b[i+1] += b[i]*c[i];
s =a[i]*c[i];
w += s;
}
cout << a[ma]- b[ma];
//cout << 241;
return 0;
}
蓝桥杯大赛决赛试题(包含决赛参与全部过程)
需积分: 5 9 浏览量
2024-05-02
10:44:31
上传
评论
收藏 6.28MB ZIP 举报
![avatar](https://profile-avatar.csdnimg.cn/af39b83d6f714bf1829b8b4cbe9fc4bc_qq_52030698.jpg!1)
技术分享官
- 粉丝: 1752
- 资源: 401
最新资源
- 数字图像处理概述.pdf
- 基于Spring Boot+MyBatis Plus+Vue&Element实现的后台管理系统+微信小程序
- 毕业设计springboot编程训练系统设计与实现源码含文档含教程
- 神经网络 胡佳妮.pdf
- python-3.12.4-amd64
- 毕业设计springboot+vue的疫情隔离管理系统源码含教程
- QTTabBar测试版2048Beta2(官方版本)+简体中文语言包
- 海信电视刷机数据 LED48K220(0000)通用 LED48EC290N(0000)、 LED48K220(0010)主程序
- 课程设计报告样例.docx
- 毕业设计springboot+Vue的常规应急物资管理系统源码含文档含教程
资源上传下载、课程学习等过程中有任何疑问或建议,欢迎提出宝贵意见哦~我们会及时处理!
点击此处反馈
![feedback](https://img-home.csdnimg.cn/images/20220527035711.png)
![feedback](https://img-home.csdnimg.cn/images/20220527035711.png)
![feedback-tip](https://img-home.csdnimg.cn/images/20220527035111.png)