题目传送门

 /*
水题:开个结构体,rk记录排名,相同的值有相同的排名
*/
#include <cstdio>
#include <cstring>
#include <algorithm>
#include <cmath>
#include <string>
#include <iostream>
#include <queue>
#include <map>
#include <vector>
using namespace std; const int MAXN = 2e3 + ;
const int INF = 0x3f3f3f3f;
struct A
{
int v, id, rk;
}a[MAXN]; bool cmp_v(A x, A y) {return x.v > y.v;} bool cmp_id(A x, A y) {return x.id < y.id;} int main(void) //Codeforces Round #307 (Div. 2) A. GukiZ and Contest
{
// freopen ("A.in", "r", stdin); int n;
while (scanf ("%d", &n) == )
{
for (int i=; i<=n; ++i)
{
scanf ("%d", &a[i].v); a[i].id = i;
}
sort (a+, a++n, cmp_v); int cnt = ; a[].v = a[].v; a[].rk = ;
for (int i=; i<=n; ++i)
{
if (a[i].v < a[i-].v)
{
a[i].rk = cnt++;
}
else
{
a[i].rk = a[i-].rk; cnt++;
}
}
sort (a+, a++n, cmp_id);
for (int i=; i<=n; ++i)
{
printf ("%d%c", a[i].rk, (i==n) ? '\n' : ' ');
}
} return ;
}

水题 Codeforces Round #307 (Div. 2) A. GukiZ and Contest的更多相关文章

  1. Codeforces Round #307 (Div. 2) A. GukiZ and Contest 水题

    A. GukiZ and Contest Time Limit: 20 Sec Memory Limit: 256 MB 题目连接 http://codeforces.com/contest/551/ ...

  2. 水题 Codeforces Round #302 (Div. 2) A Set of Strings

    题目传送门 /* 题意:一个字符串分割成k段,每段开头字母不相同 水题:记录每个字母出现的次数,每一次分割把首字母的次数降为0,最后一段直接全部输出 */ #include <cstdio> ...

  3. 水题 Codeforces Round #299 (Div. 2) A. Tavas and Nafas

    题目传送门 /* 很简单的水题,晚上累了,刷刷水题开心一下:) */ #include <bits/stdc++.h> using namespace std; ][] = {" ...

  4. 水题 Codeforces Round #304 (Div. 2) A. Soldier and Bananas

    题目传送门 /* 水题:ans = (1+2+3+...+n) * k - n,开long long */ #include <cstdio> #include <algorithm ...

  5. 水题 Codeforces Round #303 (Div. 2) A. Toy Cars

    题目传送门 /* 题意:5种情况对应对应第i或j辆车翻了没 水题:其实就看对角线的上半边就可以了,vis判断,可惜WA了一次 3: if both cars turned over during th ...

  6. 水题 Codeforces Round #286 (Div. 2) A Mr. Kitayuta's Gift

    题目传送门 /* 水题:vector容器实现插入操作,暴力进行判断是否为回文串 */ #include <cstdio> #include <iostream> #includ ...

  7. 构造水题 Codeforces Round #206 (Div. 2) A. Vasya and Digital Root

    题目传送门 /* 构造水题:对于0的多个位数的NO,对于位数太大的在后面补0,在9×k的范围内的平均的原则 */ #include <cstdio> #include <algori ...

  8. 水题 Codeforces Round #306 (Div. 2) A. Two Substrings

    题目传送门 /* 水题:遍历一边先找AB,再BA,再遍历一边先找BA,再AB,两种情况满足一种就YES */ #include <cstdio> #include <iostream ...

  9. 水题 Codeforces Round #308 (Div. 2) A. Vanya and Table

    题目传送门 /* 水题:读懂题目就能做 */ #include <cstdio> #include <iostream> #include <algorithm> ...

随机推荐

  1. curl的使用(from 阮一峰)

    1.   http://www.ruanyifeng.com/blog/2011/09/curl.html 2.   https://curl.haxx.se/docs/httpscripting.h ...

  2. 跟着9张思维导图学JavaScript

    思维导图小tips 思维导图又叫心智图,是表达发射性思维的有效的图形思维工具 ,它简单却又极其有效,是一种革命性的思维工具.思维导图运用图文并重的技巧,把各级主题的关系用相互隶属与相关的层级图表现出来 ...

  3. CentOS系统中常用查看系统信息和日志命令小结

    转载:http://www.3lian.com/edu/2015/04-09/204628.html 进程 # ps -ef # 查看所有进程 # top # 实时显示进程状态(另一篇文章里面有详细的 ...

  4. Deepin-添加path

    以管理员权限添加path(Debian系列) sudo gedit /etc/profile 添加path路径格式是: export PATH=”$PATH:your path1:your path2 ...

  5. HDU3459:Rubik 2&#215;2&#215;2(IDA)

    Problem Description Sonny is probably the only computer science Ph.D. student who cannot solve a Rub ...

  6. python爬虫(二)--了解deque

    队列-deque 有了上面一节的基础.当然你须要全然掌握上一节的全部方法,由于上一节的方法.在以下的教程中 会重复的用到. 假设你没有记住,请你返回上一节. http://blog.csdn.net/ ...

  7. 【转】TestNG执行顺序控制

    1.class执行顺序控制---testng.xml之preserve-order preserve-order:用来控制<test>里面所有<classes>的执行顺序.&l ...

  8. 一个很小的C++写的MVC的例子

    #include<iostream> #include<vector> //get namespace related stuff using std::cin; using ...

  9. [读书笔记]《没人会告诉你的PPT真相》

    这本书分了三部分.第一部分偏重于基础技能,其中分为三部分,打印.放映.保存.第二部分是进阶,分为模板下载.模板修改.增加自定义页面等.第三部分是打造商业范的PPT,分为商业范的特征,具体技能体现(重复 ...

  10. [IT练习册]Python练习项目 思路

    1.爬虫:爬取如下网站一年的内容. http://www.calvarymoravian.org/dailytext 2.蛇形棋: 开发一个类似蛇形棋的游戏.最好基于Web. 3.爬虫+通讯录: 从公 ...