zoukankan      html  css  js  c++  java
  • hdu 4218 ( IMBA? )

    原文地址:http://blog.himdd.com/?p=2286

    题意: if the square root of the difference between the square of its distance to the center and the square of the radius is less than
    1.73205080756887729352744634150587236694280525381038062805580697945193301690

    88000370811461867572485756756261414154067030299699450949989524788116555

    12094373648528093231902305582067974820101084674923265015312343266903322

    88665067225466892183797122704713166036786158801904998653737985938946765

    0347506576051, draw a star (‘*’), otherwise draw a blank.
    这一大串数字就是sqrt(3);其他的你靠你自己了。

     

    //Problem : 4218 ( IMBA? )     Judge Status : Accepted
    //RunId : 5779856    Language : C++    Author : himdd
    //Code Render Status : Rendered By HDOJ C++ Code Render Version 0.01 Beta
    #include <iostream>
    #include <cstdio>
    #include <cmath>
    #include <cstring>
    using namespace std;
    int main()
    {
        //freopen("1.txt","r",stdin);
        int n,r;
        scanf("%d",&n);
        for(int i=1; i<=n; i++)
        {
            scanf("%d",&r);
            printf("Case %d:\n",i);
            for(int j=0; j <2 * r+1; j++)
            {
                for(int k=0; k<2 * r + 1; k++)
                {
                    if( abs((j-r)*(j-r)+(k-r)*(k-r)-r*r+0.0)<=3 )
                        putchar('*');
                    else
                        putchar(' ');
                }
                puts("");
            }
        }
        return 0;
    }
  • 相关阅读:
    自定义一个运行时异常
    对象的知识点正确解释
    decimal模块
    B+树
    Web框架系列之Tornado
    初识git
    Mysql表的操作
    MySQl创建用户和授权
    MySql安装和基本管理
    为什么用Mysql?
  • 原文地址:https://www.cnblogs.com/AkQuan/p/2456903.html
Copyright © 2011-2022 走看看