cf B. Vasya and Public Transport
http://codeforces.com/contest/355/problem/B
#include <cstdio>
#include <cstring>
#include <algorithm>
using namespace std;
int a[],b[];
int c1,c2,c3,c4;
int n,m;
int main()
{
while(scanf("%d%d%d%d",&c1,&c2,&c3,&c4)!=EOF)
{
scanf("%d%d",&n,&m);
for(int i=; i<=n; i++)
{
scanf("%d",&a[i]);
}
for(int i=; i<=m; i++)
{
scanf("%d",&b[i]);
}
int sum=;
for(int i=; i<=n; i++)
{
sum+=min(a[i]*c1,c2);
}
if(sum>c3)
{
sum=c3;
}
int sum1=;
for(int i=; i<=m; i++)
{
sum1+=min(b[i]*c1,c2);
}
if(sum1>c3)
{
sum1=c3;
}
int ans=sum1+sum;
if(sum1+sum>c4)
{
ans=c4;
}
printf("%d\n",ans);
}
return ;
}
cf B. Vasya and Public Transport的更多相关文章
- codeforces B. Vasya and Public Transport 解题报告
题目链接:http://codeforces.com/problemset/problem/355/B 题目意思:给出四种票种,c1: 某一部bus或者trolley的单程票(暗含只可以乘坐一次):c ...
- CF355B Vasya and Public Transport 题解
Content 小 \(A\) 要乘坐交通工具,其中公交车的辆数是 \(n\),第 \(i\) 辆公交车的编号为 \(i\),乘坐次数为 \(a_i\):手推车的辆数是 \(m\),每辆手推车的编号为 ...
- CF 1073C Vasya and Robot(二分答案)
C. Vasya and Robot time limit per test 1 second memory limit per test 256 megabytes input standard i ...
- CF 577C Vasya and Petya's Game
题意:一个游戏,A童鞋在1~n的范围里猜一个数,B童鞋询问一个集合,A童鞋要对集合里每个数做出回答,他猜的数能否给整除,B要通过这些答案得到A猜的数,最少需要猜哪些数? 解法:一个数可以由若干个质数的 ...
- cf C. Vasya and Robot
http://codeforces.com/contest/355/problem/C 枚举L和R相交的位置. #include <cstdio> #include <cstring ...
- CF E. Vasya and a Tree】 dfs+树状数组(给你一棵n个节点的树,每个点有一个权值,初始全为0,m次操作,每次三个数(v, d, x)表示只考虑以v为根的子树,将所有与v点距离小于等于d的点权值全部加上x,求所有操作完毕后,所有节点的值)
题意: 给你一棵n个节点的树,每个点有一个权值,初始全为0,m次操作,每次三个数(v, d, x)表示只考虑以v为根的子树,将所有与v点距离小于等于d的点权值全部加上x,求所有操作完毕后,所有节点的值 ...
- CF 1076E Vasya and a Tree(线段树+树剖)
传送门 解题思路 首先按照每个修改时\(x\)的深度\(+d\)从大到小排序,然后按照深度分层,一层一层的修改,修改的时候就直接暴力修改子树,然后每做完一层把答案都取下来,因为以后的所有修改的深度都小 ...
- Netty Tutorial Part 1.5: On Channel Handlers and Channel Options [z]
Intro: After some feedback on Part 1, and being prompted by some stackoverflow questions, I want to ...
- Netty Tutorial Part 1: Introduction to Netty [z]
Netty Tutorial, Part 1: Introduction to Netty Update: Part 1.5 Has Been Published: Netty Tutorial P ...
随机推荐
- Set的并集
public static void main(String[] args) { Set<Long> old = new HashSet<>(); for (int i = 0 ...
- bzoj4096 [Usaco2013 dec]Milk Scheduling
Description Farmer John has N cows that need to be milked (1 <= N <= 10,000), each of which ta ...
- iBatis查询结果部分为null的解决办法
今天第一天接触iBatis,没有系统学习过,遇到了一个简单却闹心的错误:用iBatis查询数据库中某个表的多列结果作为一个对象返回时,会出现对象的部分属性为null值得错误.例如,查询用户表中的用户I ...
- Java组合与继承生成的类中构造函数的执行顺序
[程序实例] import java.util.*; class Meal{ Meal() { System.out.println("Meal Constructor"); } ...
- CSS常用操作-图片
index.html <!DOCTYPE html> <html> <head> <meta charset="UTF-8"> &l ...
- [Qt] QString 和 char* 转换
(1) QString 转 char* char acResult[10240]; //QByteArray baResult = strResult.toLatin1(); QByteArray b ...
- 预处理、const与sizeof相关面试题
1.用预处理指令#define 声明一个常数,用以表明一年中有多少秒(忽略闰年问题) #define语法知识: (1) 不能以分号结束,括号的使用防止宏定义展开后的二义性. (2) 预处理器将为你计算 ...
- 流媒体开发之-腾讯体育NBA视频点播解析
在前面解析赛事和排名,在这里解析点播视频,选取的是腾讯体育链接里面的点播. 首先还是先封装一个保存点播视频的相关信息的类 package com.jwzhangjie.model; import ja ...
- MySQL获取系统性能和状态
#!/bin/ksh INTERVAL=5 PREFIX=$INTERVAL-sec-status touch /tmp/running RUNFILE=/tmp/running my -e 'sho ...
- 数据库VIEW(视图)
视图是基于 SQL 语句的结果集的可视化的表. 视图包括行和列,就像一个真实的表.视图中的字段就是来自一个或多个数据库中的真实的表中的字段. 我们能够向视图加入 SQL 函数.WHERE 以及 JOI ...