zoukankan      html  css  js  c++  java
  • 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.

    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>
    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
    ");
            else if(e==0)
            {
              if(min==d)
                printf("1
    ");
              else
            printf("%d
    ",m+1);
            }
        }
    }
    

      

  • 相关阅读:
    (第二天)原型、继承
    (第一天)包装对象、作用域、创建对象
    你欺骗了我,可选参数必须位于所有参数最后
    反射之动态创建对象
    异步编程
    前端性能优化方法
    性能瓶颈分析方法
    性能测试应用领域
    <转>jmeter(十五)函数助手
    正则表达式基础知识
  • 原文地址:https://www.cnblogs.com/yinghualuowu/p/5720696.html
Copyright © 2011-2022 走看看