3708: The Key Locker of Cell Phone
总提交: 517 测试通过:160
描述
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)puts("1"); else puts("0"); }//坑点,只有这么一种情况可以输出;