TOJ 3708: The Key Locker of Cell Phone (大水题)

3708: The Key Locker of Cell Phone

描述

A cell phone with an unlocked keypad has a funny way of causing a lot of grief. First the phantom phone calls start. Then the random numbers and symbols are punched into your keypad from bumping objects in your purse. Or perhaps you suddenly realize you are accessing the Internet on your phone without knowing how. All of this can lead up to a cell phone bill full of charges you could have easily avoided if you just locked your cell phone keypad. There, now your cell phone keypad is locked. But wait--how do you unlock the keypad? The answer is easier than you think.

First, you press one button with the key to lock the keypad, the cell phone screen will display a quick indicator as follows:
(1) If you press the "OK" key, it will indicate that you should press asterisk sign (*) keys to unlock.
(2) Or else it will indicate that you should press the "OK" key first.
(3) If you press one key and does not press the other key after 5 seconds, you should start all over again.

Now given the two keys you pressed and the interval between two times of pressing, you should estimate whether your cell phone is unlocked or not.
You should assume that your cell phone is locked at the start.

输入

The input case contains two characters indicating the two press and one positive integer indicating the interval between two times of pressing, which separated with blank characters. the "OK" key is your enter key, which will be represented by '\n' in C/C++ Language and its ASCII value is 10.

输出

If the cell phone is unlocked, you should output 1 or else output 0.
 

样例输入

# * 5

样例输出

0

代码

#include<stdio.h>
int main()
{
int a;char b,c;
scanf("%c %c %d",&b,&c,&a);
if(b==10&&c=='*'&&a<=5)
printf("1");
else printf("0");
return 0;
}

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值