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”三种中任意一种就输 ...
随机推荐
- 【转】Lucas定理 & 逆元学习小结
(From:离殇灬孤狼) 这个Lucas定理是解决组合数的时候用的,当然是比较大的组合数了.比如C(1000000,50000)% mod,这个mod肯定是要取的,要不算出来真的是天文数字了. 对于一 ...
- BZOJ5372: [Pkusc2018]神仙的游戏
BZOJ5372: [Pkusc2018]神仙的游戏 https://lydsy.com/JudgeOnline/problem.php?id=5372 分析: 如果\(len\)为\(border\ ...
- glusterfs安装配置简单使用
GlusterFS是一种分布式分布式文件系统,默认采用无中心完全对等架构,搭建维护使用十分简单,是很受欢迎的分布式文件系统. 官网https://www.gluster.org/,官网上表示Glust ...
- Guice 学习
Guice: 是一个轻量级的DI框架. 不需要繁琐的配置,只需要定义一个Module来表述接口和实现类,以及父类和子类之间的关联关系的绑定,如下是一个例子. http://blog.csdn.net/ ...
- inner join ,left join ,right join区别
inner join ,left join ,right join区别 left join(左联接) 返回包括左表中的所有记录和右表中联结字段相等的记录 right join(右联接) 返回包括右表中 ...
- C++知识点总结(二)
1.字符串的部分拷贝 ① 利用标准库函数strncpy(),可以将一字符串的一部分拷贝到另一个字符串中.strncpy()函数有3个参数:第一个参数是目录字符串:第二个参 数是源字符串:第三个参数是一 ...
- sharepoint Foundation 2013安装过程
安装完必备软件后,便可安装sharepoint Foundation 2013
- KickStart安装CentOS,同时安装和配置hadoop
声明:这篇文章是前面是拾人牙慧,我是结合 http://www.111cn.net/sys/linux/59969.htm 和 http://www.cnblogs.com/mchina/p/cent ...
- C++哪些函数不能是虚函数
1. inline是编译时展开,必须有实体:(不考虑不展开的假inline) 2. static属于class自己的,也必须有实体: 3. 构造函数.复制构造函数.virtual函数基于vta ...
- C# 字符串转JSON
一.简单小结 C# 中 String 转 JSON var items = JsonConvert.DeserializeObject<class>(stringJSON); 这里的 cl ...