Little Elephant and Rozdil

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.

Input
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.

Output
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).

Examples
Input
2
7 4

Output
2

Input
7
7 4 47 100 4 9 12

Output
Still Rozdil

Note
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"
#include"iostream"
using namespace std;
int main()
{
    int n,a,min,ordinal,flag;
    while(cin>>n>>a)
    {
        min=a;
        ordinal=1;
        flag=true;
        for(int i=2;i<=n;i++)
        {
            cin>>a;
            if(a<min)
            {
                min=a;
                ordinal=i;
				flag=true;
            }
            else if(a==min) 
			{
			    flag=false;
			} 
        }
        if(flag) //if(flag==true)
		{
		    cout<<ordinal<<endl;//输出是第几条路
		}
        else //else if(flag==false)
		{
		    cout<<"Still Rozdil"<<endl;
		}
    }
    return 0;
}
  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值