Codeforces Round #318

居然可以看测试数据,哪里没过一目了然,哈哈哈

 #include<cstdio>
#include<iostream>
#include<algorithm>
#include<cstring>
#include<cmath>
#include<queue>
#include<map>
using namespace std;
#define MOD 1000000007
const int INF=0x3f3f3f3f;
const double eps=1e-;
typedef long long ll;
#define cl(a) memset(a,0,sizeof(a))
#define ts printf("*****\n");
const int MAXN=;
int n,m,tt;
struct Node
{
int id,x;
void in(int i)
{
scanf("%d",&x);
id=i;
}
friend bool operator<(Node a,Node b)
{
if(a.x==b.x) return a.id<b.id;
else return a.x<b.x;
}
}node[MAXN];
int main()
{
int i,j,k,ca=;
#ifndef ONLINE_JUDGE
freopen("1.in","r",stdin);
#endif
while(scanf("%d",&n)!=EOF)
{
priority_queue<Node> q;
for(i=;i<n;i++)
{
node[i].in(i);
q.push(node[i]);
}
int tot=;
while()
{
Node now=q.top();
q.pop();
if(node[].x+tot>now.x||now.id==)
{
break;
}
now.x-=;
tot++;
q.push(now);
}
printf("%d\n",tot);
}
}

codeforce好地方啊 Bear and Elections *的更多相关文章

  1. Codeforces Round #318 [RussianCodeCup Thanks-Round] (Div. 2) A. Bear and Elections 优先队列

                                                    A. Bear and Elections                               ...

  2. codeforces Codeforces Round #318 div2 A. Bear and Elections 【优先队列】

    A. Bear and Elections time limit per test 1 second memory limit per test 256 megabytes input standar ...

  3. Codeforces Round #318 (Div. 2) A Bear and Elections (优先队列模拟,水题)

    优先队列模拟一下就好. #include<bits/stdc++.h> using namespace std; priority_queue<int>q; int main( ...

  4. chd校内选拔赛题目+题解

    题目链接   A. Currency System in Geraldion 有1时,所有大于等于1的数都可由1组成.没有1时,最小不幸的数就是1. #include<iostream> ...

  5. Codeforces Round #318 [RussianCodeCup Thanks-Round] (Div. 2)

    以后每做完一场CF,解题报告都写在一起吧   暴力||二分 A - Bear and Elections 题意:有n个候选人,第一个候选人可以贿赂其他人拿到他们的票,问最少要贿赂多少张票第一个人才能赢 ...

  6. Codeforce 791A - Bear and Big Brother

    Bear Limak wants to become the largest of bears, or at least to become larger than his brother Bob. ...

  7. Codeforces Round #226 (Div. 2)B. Bear and Strings

    /* 题意就是要找到包含“bear”的子串,计算出个数,需要注意的地方就是不要计算重复. */ 1 #include <stdio.h> #include <string.h> ...

  8. Codeforces 385D - Bear and Floodlight

    385D - Bear and Floodlight 题目大意:有一个人从( l , 0 ) 想走到 ( r , 0 ),有 n 盏路灯,位置为( xi , yi ),每盏路灯都有一个照射的角度ai ...

  9. Codeforces Round #356 (Div. 1) D. Bear and Chase 暴力

    D. Bear and Chase 题目连接: http://codeforces.com/contest/679/problem/D Description Bearland has n citie ...

随机推荐

  1. SDL播放视频

    // PlayVideo.cpp : Defines the entry point for the console application. // extern "C" { #i ...

  2. SQL合并多行查询到一行

    示例表 tb 数据如下 id value—————1 aa1 bb2 aaa2 bbb2 ccc 第一种 SELECT id, [val]=( SELECT [value] +',' FROM tb ...

  3. meeting room I & II

    Given an array of meeting time intervals consisting of start and end times [[s1,e1],[s2,e2],...] (si ...

  4. Delphi XE5 常见问题解答

    Delphi XE5 常见问题解答 有关于新即时试用的问题吗?请看看 RAD Studio 即时试用常见问答. 常见问题 什么是 Delphi? Embarcadero? Delphi? XE5 是易 ...

  5. FFMpeg 滤镜中英文对照

    FFMpeg ver 20160213-git-588e2e3 滤镜中英文对照 2016.02.17 by 1CM T.. = Timeline support 支持时间轴 .S. = Slice t ...

  6. 网页中超链接的简化问题(如何避免超链接的get提交)

    废话不多,直接看例子吧: <a href="###?key=${*** }">跳转</a> 上面这个超链接被点击后,肯定会向某个控制器发送一个get请求,而 ...

  7. Can't bind to local 8700 for debugger报错和解决

    [2016-02-15 22:37:17 - ddms] Can't bind to local 8700 for debugger报错和解决 1.打开studio monitor是出错: Can't ...

  8. ORACLE、MYSQL的JDBC配置

    info.jdbc.driverClassName=oracle.jdbc.driver.OracleDriver info.jdbc.url=jdbc:oracle:thin:@192.168.18 ...

  9. 在HTML网页中设置弹出窗口的办法

    [1.最基本的弹出窗口代码] 其实代码非常简单: <SCRIPT LANGUAGE="javascript"> <!-- window.open ('page.h ...

  10. CSS居中布局总结

    居中布局 <div class="parent"> <div class="child">demo</div> </d ...