Time Limit: 3000MS Memory limit: 65536K
题目描述
In St Petersburg phone numbers are formatted as “XXX–XX–XX”, where the first three digits represent index of the Automated Telephone Exchange (ATE). Each ATE has exactly 10000 unique phone numbers.Peter has just bought a new flat and now he wants to install a telephone line. He thinks that a phone number is lucky if the arithmetic expression represented by that phone number is equal to zero. For
example, the phone number 102–40–62 is lucky (102-40-62 = 0), and the number 157–10–47 is not lucky (157-10-47 = 100 != 0).
Peter knows the index of the ATE that serves his house. To get an idea of his chances to get a lucky number he wants to know how many lucky numbers his ATE has.
输入
The input file contains a single integer number n — the index of Peter’s ATE (100 <= n <= 999).
输出
Output a single integer number — the number of lucky phone numbers Peter’s ATE has.
示例输入
196
239示例输出
3
0
题目意思:一个人有个喜好,对于XXX-XX-XX这种电话号码,他喜欢让他的的值为0,也就是 XXX-XX-XX=0;
给出XXX,求出有多少种情况满足他喜欢的号码
注意:xx可能是01。02这种啊
代码很简单,不解释
1 #include<stdio.h> 2 int main() 3 { 4 int a,b,n; 5 while(~scanf("%d",&n)) 6 { 7 if(n>198) 8 printf("0\n"); 9 else 10 { 11 b=(99-n/2)*2; 12 if(n%2==0) 13 b+=1; 14 printf("%d\n",b); 15 } 16 } 17 return 0; 18 }