zoukankan      html  css  js  c++  java
  • Codeforces Round #351 (VK Cup 2016 Round 3, Div. 2 Edition) A

    A. Bear and Game
    time limit per test
    2 seconds
    memory limit per test
    256 megabytes
    input
    standard input
    output
    standard output

    Bear Limak likes watching sports on TV. He is going to watch a game today. The game lasts 90 minutes and there are no breaks.

    Each minute can be either interesting or boring. If 15 consecutive minutes are boring then Limak immediately turns TV off.

    You know that there will be n interesting minutes t1, t2, ..., tn. Your task is to calculate for how many minutes Limak will watch the game.

    Input

    The first line of the input contains one integer n (1 ≤ n ≤ 90) — the number of interesting minutes.

    The second line contains n integers t1, t2, ..., tn (1 ≤ t1 < t2 < ... tn ≤ 90), given in the increasing order.

    Output

    Print the number of minutes Limak will watch the game.

    Examples
    input
    3
    7 20 88
    output
    35
    input
    9
    16 20 30 40 50 60 70 80 90
    output
    15
    input
    9
    15 20 30 40 50 60 70 80 90
    output
    90
    Note

    In the first sample, minutes 21, 22, ..., 35 are all boring and thus Limak will turn TV off immediately after the 35-th minute. So, he would watch the game for 35 minutes.

    In the second sample, the first 15 minutes are boring.

    In the third sample, there are no consecutive 15 boring minutes. So, Limak will watch the whole game.

    题意:n个有趣时间点 当持续15分钟没有遇到有趣时间点 则截至  输出持续的总时间

    题解:记录有趣时间点  for循环寻找 截至点并且输出   未找到则输出90

     1 #include<bits/stdc++.h>
     2 #include<iostream>
     3 #include<cstring>
     4 #include<cstdio>
     5 #include<queue>
     6 #include<stack>
     7 #include<map>
     8 #define ll __int64
     9 #define pi acos(-1.0)
    10 using namespace std;
    11 int n;
    12 map<int,int> mp;
    13 int exm;
    14 int ans;
    15 int main()
    16 {
    17     int n;
    18     scanf("%d",&n);
    19     mp.clear();
    20     for(int i=1;i<=n;i++)
    21     {
    22         scanf("%d",&exm);
    23         mp[exm]=1;
    24     }
    25     int gg=0;
    26     ans=0;
    27     for(int i=1;i<=90;i++)
    28     {
    29         if(mp[i])
    30         gg=i;
    31         if(i-gg>14)
    32         {
    33             ans=i;
    34             break;
    35         }
    36     }
    37     if(ans==0)
    38     cout<<"90"<<endl;
    39     else
    40     cout<<ans<<endl;
    41     return 0;
    42 }
  • 相关阅读:
    http4j
    EmbeddedBrowser
    curl v www.linode.com查看请求及响应信息
    JRUN
    PAC Manager: Ubuntu 上强大的 SSH 帐号管理工具,可取代 SecureCRT
    centos下载地址
    Web应用调试:现在是Weinre和JSConsole,最终会是WebKit的远程调试协议
    用ClusterSSH管理多台Linux服务器(2)
    Ubuntu + IntelliJ + Maven + Jetty + JRebel
    Java的连接池程序
  • 原文地址:https://www.cnblogs.com/hsd-/p/5469647.html
Copyright © 2011-2022 走看看