Automated Telephone Exchange

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 }
View Code

 

转载于:https://www.cnblogs.com/kongkaikai/p/3250356.html

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

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值