CDOJ 481 Apparent Magnitude 水题

Apparent Magnitude

Time Limit: 20 Sec

Memory Limit: 256 MB

题目连接

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 eye into six magnitudes. The brightest stars were said to be of first magnitude (), while the faintest were of sixth magnitude (), 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 is times as bright as a typical sixth magnitude star; thus, a first magnitude star is 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 are listed below (the accurate ratio is , 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

Input

The first line of the input is (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 that 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

 

题意

给你一些数字的范围,让你输出是什么类型

题解:

直接输出就好了,判断范围就好了

代码

 

#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>
typedef long long ll;
using namespace std;
//freopen("D.in","r",stdin);
//freopen("D.out","w",stdout);
#define sspeed ios_base::sync_with_stdio(0);cin.tie(0)
#define test freopen("test.txt","r",stdin)
const int maxn=202501;
#define mod 1000000007
#define eps 1e-9
const int inf=0x3f3f3f3f;
const ll infll = 0x3f3f3f3f3f3f3f3fLL;
inline ll read()
{
    ll x=0,f=1;char ch=getchar();
    while(ch<'0'||ch>'9'){if(ch=='-')f=-1;ch=getchar();}
    while(ch>='0'&&ch<='9'){x=x*10+ch-'0';ch=getchar();}
    return x*f;
}
//*************************************************************************************

int main()
{
    //この戦い终わった、故郷に帰って结婚するだん!!! ??\
    cout<<"please hack me"<<endl;
    int t=read();
    for(int cas=1;cas<=t;cas++)
    {

        double a;
        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;
        else
            cout<<"Too Bright"<<endl;

    }
}

 

 

 

你可能感兴趣的:(APP)