UESTC - 481(2011四川省省赛水题)

Apparent Magnitude

Edit

Time Limit: 3000/1000MS (Java/Others)     Memory Limit: 65535/65535KB (Java/Others)

The scale now used to indicate magnitude originates in the Hellenistic practice of dividing stars visible to the naked eye into six magnitudes. The brightest stars were said to be of first magnitude (m=1 m=1), while the faintest were of sixth magnitude (m=6 m=6), the limit of human visual perception (without the aid of a telescope). Each grade of magnitude was considered twice the brightness of the following grade (a logarithmic scale). This somewhat crude method of indicating the brightness of stars was popularized by Ptolemy in his Almagest, and is generally believed to originate with Hipparchus. This original system did not measure the magnitude of the Sun.

In 1856, Norman Robert Pogson formalized the system by defining a typical first magnitude star as a star that is100 100 times as bright as a typical sixth magnitude star; thus, a first magnitude star is about2.512 2.512 times as bright as a second magnitude star. The fifth root of 100 100 is known as Pogson's Ratio.

-- from Wikipedia

The apparent visual magnitude and its corresponding relative brightness are listed below (the accurate ratio is100 − − −  √ 5  1005 , and we use a rounded value here for simplicity ). Your task is to decide the apparent visual magnitude according to a given relative brightness.

Apperant magnitudeBrightness relative to Vega
1 1[0.400,1.000) [0.400,1.000)
2 2[0.160,0.400) [0.160,0.400)
3 3[0.063,0.160) [0.063,0.160)
4 4[0.025,0.063) [0.025,0.063)
5 5[0.010,0.025) [0.010,0.025)
6 6[0.004,0.010) [0.004,0.010)

Input

T

Output

k

Sample input and output

Sample InputSample Output
5
1.0001
0.8
0.17
0.015
0.001
Case #1: Too Bright
Case #2: 1
Case #3: 2
Case #4: 5
Case #5: Invisible

完全是水题,遇到这种水题, 看题时要去掉多余的描述,取其精髓,这样可以加快读题速度。

比如这题题目描述的下方有个大致的表,之阅读表的周围就能知道题的要求了。

这样的题0难度,但是要写出简便快速的代码。

 

少些几个判断条件也是一点简化

#include<bits/stdc++.h>
using namespace std;

#define EPS 1e-7
#define clr(x) memset(x, 0, sizeof(x))
#define LL unsigned long long
#define db  double
#define PI acos(-1.0)

const int INF = 0x3f3f3f3f;
const int MOD=1000000007;
const int MAXN = 10000000;
const int dx[] = {1, -1, 0, 0};
const int dy[] = {0, 0, 1, -1};

int main()
{
    int t;
    int cnt = 0;
    scanf("%d", &t);
    while(t--)
    {
        db tmp;
        scanf("%lf", &tmp);
        printf("Case #%d: ", ++cnt);
        if(tmp > 1.0)   puts("Too Bright");
        else if(tmp > 0.4)      puts("1");
        else if(tmp > 0.16)     puts("2");
        else if(tmp > 0.063)    puts("3");
        else if(tmp > 0.025)    puts("4");
        else if(tmp > 0.01)     puts("5");
        else if(tmp > 0.004)    puts("6");
        else                    puts("Invisible");
    }
    return 0;
}

 

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值