联赛
来源:互联网 发布:大唐网络 国企 编辑:程序博客网 时间:2024/04/27 20:14
Problem A
Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 32768/32768 K (Java/Others)
Total Submission(s): 485 Accepted Submission(s): 74
Total Submission(s): 485 Accepted Submission(s): 74
Problem Description
Li Lei has many pearls of N different color. The number of each color is limited. Han Mei is Li Lei’s girl friend.
Since Han Mei’s birthday is coming, Li Lei wants to give Han Mei his present for her birthday. Finally, Li Lei decides to make a chain for his lovely girl friend with his beautiful pearls. He wants to make the chain more beautiful, so the number of the continuous pearls with same color is limited.
Now, Li Lei wants to know how long his chain will be. He will always make the chain as long as possible. Pay attention that the shape of a chain is a line but not a circle here.
Since Han Mei’s birthday is coming, Li Lei wants to give Han Mei his present for her birthday. Finally, Li Lei decides to make a chain for his lovely girl friend with his beautiful pearls. He wants to make the chain more beautiful, so the number of the continuous pearls with same color is limited.
Now, Li Lei wants to know how long his chain will be. He will always make the chain as long as possible. Pay attention that the shape of a chain is a line but not a circle here.
Input
The first line is an integer N. It means that Li Lei has many pearls of N different color.
The next line contains N integers A(0),A(1)……A(N-1). It means that Li Lei has A(i) pearls of the i-th color.
The third line contains N integers B(0),B(1)……B(N-1). It means that in the chain, there will be no more than B(i) continuous pearls of the i-th color.
You can assume that A(i) is not smaller than B(i).
All integers in the input is positive and no larger than 100000.
The next line contains N integers A(0),A(1)……A(N-1). It means that Li Lei has A(i) pearls of the i-th color.
The third line contains N integers B(0),B(1)……B(N-1). It means that in the chain, there will be no more than B(i) continuous pearls of the i-th color.
You can assume that A(i) is not smaller than B(i).
All integers in the input is positive and no larger than 100000.
Output
There is one integer in a line for each test case, representing the length of the chain.
SampleInput
31 1 1001 1 131 1 1001 1 2
SampleOutput
58
//一道简单的题目:题意:给你n个不同种类的珠子并且给你相对应应珠子最多可以有几个连在一起,让你求最多可以放多少珠子;思路:最多的珠子,有可能有剩余或则没有,但是,其它种类的珠子肯定已经最先放完了。这是解题的重点。#include<stdio.h>#include<algorithm>#include<string.h>#include<iostream>using namespace std;struct Node{ __int64 a; __int64 b;}node[100000];__int64 cmp(Node aa,Node bb){ return aa.a<bb.a;}int main(){ int len; __int64 ans; int i; while(scanf("%d",&len)!=EOF) { memset(node,0,sizeof(node)); ans=0; for(i=0;i<len;i++) scanf("%I64d",&node[i].a); for(i=0;i<len;i++) scanf("%I64d",&node[i].b); sort(node,node+len,cmp); for(i=0;i<len-1;i++) { ans+=node[i].a; } if((ans+1)*node[i].b>=node[i].a) { ans+=node[i].a; } else ans+=(ans+1)*node[i].b; printf("%I64d\n",ans); } return 0;}
- 联赛
- 联赛
- 联赛决赛
- 联赛题目
- 联赛题目
- 联赛题目
- 联赛总结
- 联赛第2轮
- 联赛第3轮
- 联赛第4轮
- 参加新景联赛
- 杭电多校联赛<9>
- 分区联赛初赛复习
- 分区联赛初赛复习
- 2014年多校联赛总结
- 多校联赛总结
- [COGS329] K- 联赛
- 德鲁联赛
- javascript location对象
- 我的家人
- Java多线程(十)之ReentrantReadWriteLock深入分析
- 少编码多思考:代码越多 问题越多
- 转发乱序与TCP
- 联赛
- Windows Phone 8开发之Hyper-V支持的另一种环境
- 高效敏捷的十大经验法则
- 联赛
- 学习apache-common-lang类库
- MSSQL 四舍五入 切舍 切上
- linux内核配置和驱动文件
- javascript中有用的方法(3)
- C# 文件操作--追加、拷贝、删除、移动文件、创建目录、递归、删除文件夹及文件....