SGU 276 解题报告

http://acm.sgu.ru/problem.php?contest=0&problem=276

276. Andrew's Troubles

time limit per test: 1 sec.
memory limit per test: 65536 KB

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.

著名的 Berland ACM-ICPC 团队 Anisovka 包含三名成员:Andrew, Michael and Ilya.在团队刚建立的几个月里,Andrew 经常在比赛和训练中迟到.为了激励 Andrew 更加准时, Ilya 和 Andrew 决定在团队训练中引入一条新规则.如果有人迟到(即至少比约定的时间晚一秒) 则他欠团队其他成员一杯茶.如果他迟到5 分钟,他将欠 2 杯茶.如果他迟到 15 分钟,他将欠 3 杯茶.如果迟到 15 分钟惠更多,他将欠 4 杯茶.

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

训练开始的时间是 S (以秒作为计时单位) Andrew到达的时间是 P (同样以秒作为计时单位).

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

你的任务是计算出 Andrew 一共欠多少杯茶.

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

没什么好说的,就是做点翻译,题目模拟就可以解决了.

CODE

#include<stdio.h>
 
int main()
{
  int p,s,ans=0;
  scanf("%d%d",&s,&p);
  p-=s;
  if(p>=1800) ans=4;
  else if(p>=900) ans=3;
  else if(p>=300) ans=2;
  else if(p>0) ans=1;
  printf("%dn",ans);
  return 0;
}
» 本博客采用署名 2.5 中国大陆许可协议进行许可,本文版权归作者所有,欢迎转载,但必须在明显位置给出原文连接。
anyShare分享到:

Leave a Comment

NOTE - You can use these HTML tags and attributes:
<a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <s> <strike> <strong>