【Henu ACM Round#16 A】 Bear and Game

【链接】 我是链接,点我呀:)
【题意】

在这里输入题意

【题解】

看看什么时候t[i]-t[i-1]>15。 输出t[i-1]+15就好。

不存在这样的i就输出min(t[n]+15,90)

【代码】

#include <bits/stdc++.h>
using namespace std;

int n;
int t[100];

int main()
{
    cin >> n;
    for (int i = 1;i <= n;i++)cin>>t[i];
    for (int i = 1;i <= n;i++){
        if (t[i]-t[i-1]>15){
            cout<<t[i-1]+15<<endl;
            return 0;
        }
    }
    cout<<min(90,t[n]+15)<<endl;
    return 0;
}

posted @ 2018-01-26 12:14  AWCXV  阅读(140)  评论(0编辑  收藏  举报