水题 Codeforces Round #307 (Div. 2) A. GukiZ and Contest
/*
水题:开个结构体,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的更多相关文章
- 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/ ...
- 水题 Codeforces Round #302 (Div. 2) A Set of Strings
题目传送门 /* 题意:一个字符串分割成k段,每段开头字母不相同 水题:记录每个字母出现的次数,每一次分割把首字母的次数降为0,最后一段直接全部输出 */ #include <cstdio> ...
- 水题 Codeforces Round #299 (Div. 2) A. Tavas and Nafas
题目传送门 /* 很简单的水题,晚上累了,刷刷水题开心一下:) */ #include <bits/stdc++.h> using namespace std; ][] = {" ...
- 水题 Codeforces Round #304 (Div. 2) A. Soldier and Bananas
题目传送门 /* 水题:ans = (1+2+3+...+n) * k - n,开long long */ #include <cstdio> #include <algorithm ...
- 水题 Codeforces Round #303 (Div. 2) A. Toy Cars
题目传送门 /* 题意:5种情况对应对应第i或j辆车翻了没 水题:其实就看对角线的上半边就可以了,vis判断,可惜WA了一次 3: if both cars turned over during th ...
- 水题 Codeforces Round #286 (Div. 2) A Mr. Kitayuta's Gift
题目传送门 /* 水题:vector容器实现插入操作,暴力进行判断是否为回文串 */ #include <cstdio> #include <iostream> #includ ...
- 构造水题 Codeforces Round #206 (Div. 2) A. Vasya and Digital Root
题目传送门 /* 构造水题:对于0的多个位数的NO,对于位数太大的在后面补0,在9×k的范围内的平均的原则 */ #include <cstdio> #include <algori ...
- 水题 Codeforces Round #306 (Div. 2) A. Two Substrings
题目传送门 /* 水题:遍历一边先找AB,再BA,再遍历一边先找BA,再AB,两种情况满足一种就YES */ #include <cstdio> #include <iostream ...
- 水题 Codeforces Round #308 (Div. 2) A. Vanya and Table
题目传送门 /* 水题:读懂题目就能做 */ #include <cstdio> #include <iostream> #include <algorithm> ...
随机推荐
- linux 中安装JDK
一般公司差点儿相同全部的server都是搭建在Linux上面的,所以这就免不了.(要是使用Java语言)要在Linux上面布一套JDK也就是Java虚拟机环境. 以下.我详细说一下安装过程,以及可能出 ...
- 容器使用笔记(List篇)
上一篇博客介绍了Dictionary,这篇博客介绍List的相关内容. C#中要存储一组数据.我们会想到数组Array,ArrayList,List这三个对象,当中,数组是最早出现的,我们就从数组開始 ...
- 使用 maskView 设计动画
1.maskView(maskLayer) 基本原理 :可类比于多张png图片叠加遮罩 2.maskView配合CAGradientLayer,alpha通道图片的使用.maskView是iOS8以上 ...
- 用SQL脚本 生成INSERT SQL语句
配置表B 中的数据,可以从A表中查询到,在实际配置时,通过sql脚本生成B表的insert脚本,最多用到的是sql中连接符[||],以及双引号[''''] 例1:电销系统中地区出单机构关系表配置数据生 ...
- 机器学习和深度学习笔记(Matlab语言实现)
不多说,直接上干货! 这里,对于想用matlab语言来做的朋友,强烈推荐 http://www.cnblogs.com/tornadomeet/
- MVC架构在游戏开发中的应用
一 定义 MVC即Model View Controller,是模型(model)-视图(view)-控制器(controller)的缩写. MVC是一种"前端"的设计模式. MV ...
- 2016/4/26 sublime text 2 版本 遇到的问题及解决方法
1.汉化:下载汉化包 .打开程序Preference下的浏览包文件夹.将解压的程序包粘贴进包文件夹2.破解:标题栏上面有带(unregistered)表示还没有注册: 打开HELP→Enter lic ...
- ABAP 读取服务器CSV文件到内表
DATA: BEGIN OF gs_data , cola TYPE string, colb TYPE string, ... END OF gs_data, gt_data LIKE TABLE ...
- 实践001:char 类型字段在表中的长度
Rainy on 20170215 1.同事在 写RFC的时候遇到报错:"YTST_001" 必须为扁平结构.不能将内部表.字符# 原因是自建结构中字段定义为了string 类型. ...
- 获取WiFi MAC地址总结【转】
本文转载自:http://blog.csdn.net/crazyman2010/article/details/50464256 今天对MAC地址的获取做了一些学习,目前网上获取MAC地址的方法主要如 ...