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 ...
随机推荐
- rsyslog imfile 模块说明
stop() { echo -n $"Shutting down system logger: " killproc -p "${PIDFILE}" -d 30 ...
- BZOJ3396: [Usaco2009 Jan]Total flow 水流
3396: [Usaco2009 Jan]Total flow 水流 Time Limit: 1 Sec Memory Limit: 128 MBSubmit: 45 Solved: 27[Sub ...
- iOS 9之应用内搜索(CoreSpotlight)API
金田(github 示例源码) 前言 在iOS9之前我们只能使用Spotlight来搜索应用名称来打开指定App,而其他的内容都是提供给系统使用(信息,联系人,邮件等).在iOS9以后Apple允许开 ...
- [LeetCode] 237. Delete Node in a Linked List 解题思路
Write a function to delete a node (except the tail) in a singly linked list, given only access to th ...
- [置顶] 【Git入门之十】Rebase操作
原创作品,转载请标明:http://blog.csdn.net/jackystudio/article/details/12309627 Rebase,衍合?变基?唉,我也不知道要怎么翻译合适...变 ...
- build/core/base_rules.mk:195: already define
编译错误: build/core/base_rules.mk:195: *** packages/apps/ScanDemo: MODULE.TARGET.APPS.ScanDemo already ...
- Shell的输入输出
通过使用read命令,可以实现从终端中输入内容后输出或执行运算 #!/bin/bash #Author: blacksonny #Copyright (c) #Script follows here: ...
- (转)苹果iOS开发者账号过期临时解决方法
苹果iOS开发者账号过期临时解决办法 苹果iOS开发者账号一年的费用是99美金,作者最近由于各种原因,导致renew没能在账号过期之前支付好,所以在账号过期等待renew的期间,试了试一些非正常手段, ...
- Demon_Tank (坦克移动发射子弹)
using UnityEngine; using System.Collections; public class Tank : MonoBehaviour { //子弹预设体 public Game ...
- ios开发中各种版本、设备的区分
设备类型的区分-iphone ,ipad-itouch..... 可以从 UIDevice 的属性 model 得到在现在执行的环境.例子如下: [cpp] view plaincopyprint? ...