zoukankan      html  css  js  c++  java
  • Good Bye 2016

    题目链接:http://codeforces.com/contest/750/problem/A

    题意:有n场比赛要打,第i场比赛需要花i*5分钟来完成,比赛从20:00开始。然后新年派对24:00开始,需要花k分钟才能到达派对现场。问现在最多可以参加多少场比赛。

    思路:从20点到24点有240分钟。 240-k为可以参加比赛的时间。然后暴力算就好了。

    #define _CRT_SECURE_NO_DEPRECATE
    #include<iostream>
    #include<cstring>
    #include<string>
    #include<algorithm>
    #include<stdio.h>
    #include<queue>
    #include<vector>
    #include<stack>
    #include<map>
    #include<set>
    #include<time.h>
    #include<cmath>
    using namespace std;
    typedef long long int LL;
    const int MAXN = 200000 + 10;
    int main(){
    //#ifdef kirito
    //    freopen("in.txt", "r", stdin);
    //    freopen("out.txt", "w", stdout);
    //#endif
    //    int start = clock();
        int n,k;
        while (scanf("%d%d", &n,&k) != EOF){
            int tme = 240 - k;
            if (tme <= 0){
                printf("0
    ");
            }
            else{
                int i=0,sum=0;
                while (true){
                    sum += i * 5;
                    if (sum > tme){
                        break;
                    }
                    i++;
                }
                printf("%d
    ", min(i-1,n));
            }
        }
    //#ifdef LOCAL_TIME
    //    cout << "[Finished in " << clock() - start << " ms]" << endl;
    //#endif
        return 0;
    }
  • 相关阅读:
    sobel
    构造函数
    #pragma once & ifnde
    #pragma comment
    SET容器
    重载[] int& operator[ ]( )
    仿函数 operator()()
    remove_if erase
    vector
    map
  • 原文地址:https://www.cnblogs.com/kirito520/p/6238943.html
Copyright © 2011-2022 走看看