zoukankan      html  css  js  c++  java
  • 【ECJTU_ACM 11级队员2012年暑假训练赛(7) D Little Elephant and Rozdil】

    D - Little Elephant and Rozdil
    Time Limit:2000MS     Memory Limit:262144KB     64bit IO Format:%I64d & %I64u

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

    Sample Input

    Input
    2
    7 4
    Output
    2
    Input
    7
    7 4 47 100 4 9 12
    Output
    Still Rozdil

    Hint

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

     1 #include <iostream>
     2 using namespace std;
     3 
     4 typedef unsigned long long int longint;
     5 
     6 longint* iMap;
     7 
     8 int main()
     9 {
    10     int n;
    11     while (cin >> n)
    12     {
    13         iMap = new longint[n];
    14         for (int i = 0; i < n; i++)
    15         {
    16             cin >> iMap[i];
    17         }
    18 
    19         int flag = 0;
    20         for (int i = 0; i < n; i++)
    21         {
    22             if (iMap[i] < iMap[flag])
    23             {
    24                 flag = i;
    25             }
    26         }
    27 
    28         int count = 0;
    29         for (int i = 0; i < n; i++)
    30         {
    31             if (iMap[i] == iMap[flag])
    32             {
    33                 count++;
    34             }
    35         }
    36         if (count == 1)
    37         {
    38             cout << flag + 1 << endl;
    39         }
    40         else
    41         {
    42             cout << "Still Rozdil" << endl;
    43         }
    44 
    45         delete[] iMap;
    46     }
    47     return 0;
    48 }
    49 
    50 
    51 // end
    52 // ism
  • 相关阅读:
    cocos2d-x Mask的实现及优化
    cocos2d-x CCTableView
    cocos2d-x CCScrollView
    网络服务端开发
    跨平台web调试代理工具---whistle
    探索c#之一致性Hash详解
    Redis性能问题排查解决手册
    Redis的Aof被阻塞原因调查
    AOF 持久化策略
    如何招到一个靠谱的程序员
  • 原文地址:https://www.cnblogs.com/ismdeep/p/2624398.html
Copyright © 2011-2022 走看看