Codeforces Round #129 (Div. 2) A
Description
The Little Elephant loves Ukraine very much. Most of all he loves town Rozdol (ukr. "Rozdil").
However, Rozdil is dangerous to settle, so the Little Elephant wants to go to some other town. The Little Elephant doesn't like to spend much time on travelling, so for his journey he will choose a town that needs minimum time to travel to. If there are multiple such cities, then the Little Elephant won't go anywhere.
For each town except for Rozdil you know the time needed to travel to this town. Find the town the Little Elephant will go to or print "Still Rozdil", if he stays in Rozdil.
The first line contains a single integer n (1 ≤ n ≤ 105) — the number of cities. The next line contains n integers, separated by single spaces: the i-th integer represents the time needed to go from town Rozdil to the i-th town. The time values are positive integers, not exceeding 109.
You can consider the cities numbered from 1 to n, inclusive. Rozdil is not among the numbered cities.
Print the answer on a single line — the number of the town the Little Elephant will go to. If there are multiple cities with minimum travel time, print "Still Rozdil" (without the quotes).
2
7 4
2
7
7 4 47 100 4 9 12
Still Rozdil
In the first sample there are only two cities where the Little Elephant can go. The travel time for the first town equals 7, to the second one —4. The town which is closest to Rodzil (the only one) is the second one, so the answer is 2.
In the second sample the closest cities are cities two and five, the travelling time to both of them equals 4, so the answer is "Still Rozdil".
题意:告诉你一些时间,让你去寻找最小时间序号,如果存在多个结果,则输出:still Rozdil
解法:模拟,题意告诉你了
#include<stdio.h>
int main()
{
int n;
int a[100010];
long long min;
int i,d;
int m,q,e;
while(~scanf("%d",&n))
{
e=0;
scanf("%d",&d);
min=d;
for(i=1;i<n;i++)
{
scanf("%d",&a[i]);
if(a[i]<min)
{
min=a[i];
m=i;
e=0;
}
else if(a[i]==min)
{
e=1;
}
}
if(e)
printf("Still Rozdil\n");
else if(e==0)
{
if(min==d)
printf("1\n");
else
printf("%d\n",m+1);
}
}
}
Codeforces Round #129 (Div. 2) A的更多相关文章
- Codeforces Round #129 (Div. 2)
A. Little Elephant and Rozdil 求\(n\)个数中最小值的个数及下标. B. Little Elephant and Sorting \[\sum_{i=1}^{n-1}{ ...
- 字符串(后缀自动机):Codeforces Round #129 (Div. 1) E.Little Elephant and Strings
E. Little Elephant and Strings time limit per test 3 seconds memory limit per test 256 megabytes inp ...
- Codeforces Round #129 (Div. 1)E. Little Elephant and Strings
题意:有n个串,询问每个串有多少子串在n个串中出现了至少k次. 题解:sam,每个节点开一个set维护该节点的字符串有哪几个串,启发式合并set,然后在sam上走一遍该串,对于每个可行的串,所有的fa ...
- Codeforces Round #129 (Div. 2) C
Description The Little Elephant very much loves sums on intervals. This time he has a pair of intege ...
- Codeforces Round #129 (Div. 2) B
Description The Little Elephant loves sortings. He has an array a consisting of n integers. Let's nu ...
- Educational Codeforces Round 129 (Rated for Div. 2) A-D
Educational Codeforces Round 129 (Rated for Div. 2) A-D A 题目 https://codeforces.com/contest/1681/pro ...
- Codeforces Round #366 (Div. 2) ABC
Codeforces Round #366 (Div. 2) A I hate that I love that I hate it水题 #I hate that I love that I hate ...
- Codeforces Round #354 (Div. 2) ABCD
Codeforces Round #354 (Div. 2) Problems # Name A Nicholas and Permutation standard input/out ...
- Codeforces Round #368 (Div. 2)
直达–>Codeforces Round #368 (Div. 2) A Brain’s Photos 给你一个NxM的矩阵,一个字母代表一种颜色,如果有”C”,”M”,”Y”三种中任意一种就输 ...
随机推荐
- 【算法总结】Manacher's Algorithm
Manacher's Algorithm针对的是最长回文子串问题.对于此问题,最直接的方法是遍历每一个元素,遍历过程中以每一个字符为中心向两边扩展以寻找此字符为中心的最长回文子串.复杂度O(n2).M ...
- windows拾遗
Files has invalid value "<<<<<<< .mine". Illegal characters in path.在 ...
- logback个人使用配置
提供一个目前个人供词使用的,无需日志汇总的日志配置文件: <?xml version="1.0" encoding="UTF-8"?> <co ...
- poj 1519 Digital Roots (计算根数字)
一.Description The digital root of a positive integer is found by summing the digits of the integer. ...
- Python:easygui的安装、导入、使用、设置
转于:https://blog.csdn.net/sinat_37390744/article/details/55211652 博主:钏的博客 一.下载安装 1)下载0.96的easygui.htt ...
- 全面解析JS字符串和正则表达式中的match、replace、exec等函数
转自:https://www.jb51.net/article/87730.htm 正则表达式(regular expression)描述了一种字符串匹配的模式,可以用来检查一个串是否含有某种子串.将 ...
- CSS是什么?W3C是什么?W3C盒子与IE盒子的区别?
(1)层叠样式(Cascading Style Sheets, CSS)是用来表现HTML或XML文本样式的语言. (2)W3C推荐规范(World Wide Web Consortium,W3C ...
- Sequence Models 笔记(一)
1 Recurrent Neural Networks(循环神经网络) 1.1 序列数据 输入或输出其中一个或两个是序列构成.例如语音识别,自然语言处理,音乐生成,感觉分类,dna序列,机器翻译,视频 ...
- centos7安装与配置ansible
此次测试总共有三台机,分别如下: ansible服务器:10.0.0.20 client01:10.0.0.21 client02:10.0.0.22 一.安装ansible 1. python版本需 ...
- 06_android虚拟机介绍 05_sdkManager介绍
如果你不对SDK Manager进行设置,它默认会去谷歌官网下载最新的内容.由于官网被墙了,要么你FQ要么去设置代理.通过代理去下载相关的内容. 每一个android版本都对应着一个API的版本号.如 ...