hdu 4974 A simple water problem(14多校8)思维题
来源:互联网 发布:软件测试与分析 编辑:程序博客网 时间:2024/05/17 22:02
Dragon is watching competitions on TV. Every competition is held between two competitors, and surely Dragon's favorite. After each competition he will give a score of either 0 or 1 for each competitor and add it to the total score of that competitor. The total score begins with zero. Here's an example: four competitors with name James, Victoria, Penghu, and Digo. First goes a competition between Penghu and Digo, and Dragon enjoys the competition and draw both 1 score for them. Then there’s a competition between James and Victoria, but this time Dragon draw 1 for Victoria and 0 for James. Lastly a competition between James and Digo is held, but this time Dragon really dislike the competition and give zeroes for each of them. Finally we know the score for each one: James--0, Victoria--1, Penghu--1, Digo--1. All except James are the Winner!
However, Dragon's mom comes back home again and close the TV, driving Dragon to his homework, and find out the paper with scores of all competitors. Dragon's mom wants to know how many competition Dragon watched, but it's hard through the paper. Here comes the problem for you, given the scores of all competitors, at least how many competitions had Dragon watched?
However, Dragon's mom comes back home again and close the TV, driving Dragon to his homework, and find out the paper with scores of all competitors. Dragon's mom wants to know how many competition Dragon watched, but it's hard through the paper. Here comes the problem for you, given the scores of all competitors, at least how many competitions had Dragon watched?
For each test case, the first line contains only one integers N(<=100000), which means the number of competitors. Then a line contains N integers (a 1,a 2,a 3,...,a n).a i(<=1000000) means the score of i-th competitor.
132 3 4
Case #1: 5
int main(){ ios::sync_with_stdio(false); int T; cin>>T; int cas=1; while(T--) { int n; cin>>n; ll ans=0; ll a=0; for(int i=0;i<n;i++) { ll x; cin>>x; ans+=x; a=max(a,x); } ll t=max((ans+1)/2,a); cout<<"Case #"<<cas++<<": "<<t<<endl; } return 0;}
阅读全文
0 0
- hdu 4974 A simple water problem(14多校8)思维题
- HDU - 4974 A simple water problem
- HDU 4974 A simple water problem(贪心)
- hdu 4974 A simple water problem(水题)
- HDU - 4974 A simple water problem
- HDU 4974 A simple water problem
- hdu 4974 A simple water problem(数学题)
- hdu - 4974 - A simple water problem(贪心 + 反证)
- hdu - 4974 - A simple water problem(贪心 + 反证)
- HDU 4974 A simple water problem 模拟(水
- hdu 4974——A simple water problem
- HDU 4967 A simple water problem
- A simple water problem
- hdu 4974 A simple water problem(多校第十场 水题)
- HDU 4978 A simple probability problem.(思维+凸包)
- 【杂题】 HDOJ 4974 A simple water problem
- HDOJ 4974 A simple water problem
- HDU 4972 A simple dynamic programming problem(数学思维题)
- SSH与SSM学习之Spring04——Spring属性注入之set方法注入
- Andrew Ng公开课学习笔记——Coordinate ascent(坐标上升法)
- Linux打开虚拟机错误
- SSH与SSM学习之Spring05——Spring属性注入之构造函数注入
- 刻意学习:持续行动让你人生逆袭
- hdu 4974 A simple water problem(14多校8)思维题
- ubuntu16.04安装和配置上网
- SSH与SSM学习之Spring06——Spring属性注入之p名称空间注入
- 栈的应用--马踏棋盘-贪心加栈
- consul的安装和配置
- Java中IO流分类思维图
- SSH与SSM学习之Spring07——Spring属性注入之spel注入
- 京东与阿里要用区块链打击假货 造假将无可遁形
- 每日区块链:中国搜索引擎巨头百度加入超级账本区块链联盟;瑞士监管部门发行金融执照,首家比特币合规企业出炉