Apparent Magnitude
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 magnitude | Brightness 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 Input | Sample Output |
---|---|
| |
完全是水题,遇到这种水题, 看题时要去掉多余的描述,取其精髓,这样可以加快读题速度。
比如这题题目描述的下方有个大致的表,之阅读表的周围就能知道题的要求了。
这样的题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;
}