前往小程序,Get更优阅读体验!
立即前往
首页
学习
活动
专区
工具
TVP
发布
社区首页 >专栏 >ACMSGURU 276 - Andrew's Troubles

ACMSGURU 276 - Andrew's Troubles

作者头像
Reck Zhang
发布2021-08-11 10:51:15
2390
发布2021-08-11 10:51:15
举报
文章被收录于专栏:Reck Zhang

Andrew’s Troubles

Problem Description

Famous Berland ACM-ICPC team Anisovka consists of three programmers: Andrew, Michael and Ilya. A long time ago, during the first few months the team was founded, Andrew was very often late to the trainings and contests. To stimulate Andrew to be more punctual, Ilya and Andrew decided to introduce a new rule for team participants. If somebody is late (i.e. comes at least one second after appointed time) he owes a cup of tea to other team members. If he is late for 5 minutes, he owes two cups of tea. If he is late for 15 minutes, he owes three cups of tea. And if he is late for 30 minutes or more, he owes 4 cups of tea. The training starts at the time S (counted in seconds, from some predefined moment of time) and Andrew comes at the time P (also in seconds, counted from the same moment of time).

Your task is to find how many cups of tea Andrew owes.

Input

The input file contains single line with integer numbers S and P (0 <= S,P <= 10^4).

Output

Write to the output file the number of cups Andrew owes.

Sample test(s)

Input

Test #1

10 10

Test #2

10 11

Test #3

0 300

Output

Test #1

0

Test #2

1

Test #3

2

Solution

代码语言:javascript
复制
#include <bits/stdc++.h>

int main() {
    std::ios::sync_with_stdio(false);

    int s, p;
    std::cin >> s >> p;
    p -= s;
    int res = 0;
    if(p > 0 && p < 5 * 60) {
        res = 1;
    } else if(p >= 5 * 60 && p < 15 * 60) {
        res = 2;
    } else if(p >= 15 * 60 && p < 30 * 60) {
        res = 3;
    } else if(p >= 30 * 60) {
        res = 4;
    }

    std::cout << res << std::endl;
    return 0;
}
本文参与 腾讯云自媒体同步曝光计划,分享自作者个人站点/博客。
原始发表:2019-12-17,如有侵权请联系 cloudcommunity@tencent.com 删除

本文分享自 作者个人站点/博客 前往查看

如有侵权,请联系 cloudcommunity@tencent.com 删除。

本文参与 腾讯云自媒体同步曝光计划  ,欢迎热爱写作的你一起参与!

评论
登录后参与评论
0 条评论
热度
最新
推荐阅读
目录
  • Andrew’s Troubles
    • Problem Description
      • Input
        • Output
          • Sample test(s)
            • Input
            • Output
          • Solution
          领券
          问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档