Time Limit:20 Sec
Memory limit:256 MB
Topic Connection
http://acm.uestc.edu.cn/#/problem/show/481
Description
*the scale now used to indicate magnitude originates in the Hellenistic practice of dividing stars visible to the naked ey E into six magnitudes. The brightest stars were said to being of first magnitude (), while the faintest were of sixth magnitude (), the limit of hum An visual perception (without the aid of a telescope). Each grade of magnitude is considered twice the brightness of the following grade (a logarithmic scale). This somewhat crude method of indicating the brightness of stars were popularized by Ptolemy in he Almagest, and is genera Lly believed to originate with Hipparchus. This original system does 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's times as Bright as a typical sixth magnitude star; Thus, a first magnitude star is the about times as bright as a second magnitude star. The fifth root of is known as Pogson ' s Ratio. *
-From Wikipedia
The apparent visual magnitude and its corresponding relative brightness be listed below (the accurate ratio is, and we u Se 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
Input
The first line of the input was (no more than), which stands for the number of test cases you need to solve.
Every case contains one line with a single real number standing for the star's brightness relative to Vega.
Output
For every test case, you should output case #k: First, where indicates the case number and counts from, then output the Grade of apparent magnitude. If the star is equally bright or brighter than Vega you should output Too bright. If the star is less bright than a sixth magnitude star you should output Invisible. (The test data is specially designed so, you can simply ignore the precision problem of the float number)
Sample Input
5
1.0001
0.8
0.17
0.015
0.001
Sample Output
Case #1: Too Bright
Case #2:1
Case #3:2
Case #4:5
Case #5: Invisible
HINT
Test instructions
Give you some number of ranges that let you output what type
Exercises
The direct output is good, the scope of judgment is good.
Code
#include <cstdio>#include<cmath>#include<cstring>#include<ctime>#include<iostream>#include<algorithm>#include<Set>#include<vector>#include<sstream>#include<queue>#include<typeinfo>#include<fstream>#include<map>#include<stack>typedefLong Longll;using namespacestd;//freopen ("d.in", "R", stdin);//freopen ("D.out", "w", stdout);#defineSspeed ios_base::sync_with_stdio (0); Cin.tie (0)#defineTest Freopen ("Test.txt", "R", stdin)Const intmaxn=202501;#defineMoD 1000000007#defineEPS 1e-9Const intinf=0x3f3f3f3f;Constll infll =0x3f3f3f3f3f3f3f3fll;inline ll Read () {ll x=0, f=1;CharCh=GetChar (); while(ch<'0'|| Ch>'9'){if(ch=='-') f=-1; ch=GetChar ();} while(ch>='0'&&ch<='9') {x=x*Ten+ch-'0'; ch=GetChar ();} returnx*F;}//*************************************************************************************intMain () {//この Stardust Kei end わった, so Heung occupies Kaesa にっては married するだん!!!?? \cout<<"Please hack me"<<Endl; intt=read (); for(intcas=1; cas<=t;cas++) { DoubleA; CIN>>A; printf ("Case #%d:", CAs); if(a<0.004) cout<<"Invisible"<<Endl; Else if(a<0.01) cout<<"6"<<Endl; Else if(a<0.025) cout<<"5"<<Endl; Else if(a<0.063) cout<<"4"<<Endl; Else if(a<0.16) cout<<"3"<<Endl; Else if(a<0.4) cout<<"2"<<Endl; Else if(a<1) cout<<"1"<<Endl; Elsecout<<"Too Bright"<<Endl; }}
Cdoj 481 apparent Magnitude water problem