//
// main.cpp
// 生日快乐
//
// Created by wasdns on 16/11/21.
// Copyright © 2016年 wasdns. All rights reserved.
// #include <stdio.h>
#include <math.h>
#include <iostream>
using namespace std; float f(float x, float y, float z) {
float a = x * x + 9.0f / 4.0f * y * y + z * z - 1;
return a * a * a - x * x * z * z * z - 9.0f / 80.0f * y * y * z * z * z;
} float h(float x, float z) {
for (float y = 1.0f; y >= 0.0f; y -= 0.001f)
if (f(x, y, z) <= 0.0f)
return y;
return 0.0f;
} int main() { for (float z = 1.5f; z > -1.5f; z -= 0.05f) {
for (float x = -1.5f; x < 1.5f; x += 0.025f) {
float v = f(x, 0.0f, z);
if (v <= 0.0f) {
float y0 = h(x, z);
float ny = 0.01f;
float nx = h(x + ny, z) - y0;
float nz = h(x, z + ny) - y0;
float nd = 1.0f / sqrtf(nx * nx + ny * ny + nz * nz);
float d = (nx + ny - nz) * nd * 0.5f + 0.5f;
putchar(".:-=+*#%@"[(int)(d * 5.0f)]);
}
else
putchar(' ');
}
putchar('\n');
}
}

2016/11/20 兄弟松松生日快乐~

注:源码来自网络。使用DevC++编译器进行编译,一般终端可能过小,无法完全显示。

Gift for GS5的更多相关文章

  1. USACO . Greedy Gift Givers

    Greedy Gift Givers A group of NP (2 ≤ NP ≤ 10) uniquely named friends has decided to exchange gifts ...

  2. CF# Educational Codeforces Round 3 B. The Best Gift

    B. The Best Gift time limit per test 2 seconds memory limit per test 256 megabytes input standard in ...

  3. 快来玩“Gift大转盘”百分百赚好礼

    现在开始到今年的最后一天,你天天都可以来转100%中奖的“ Gift大转盘 ”.代金券.产品折扣.精美纪念礼,没有多余规则.全部网友都可参加,转到就是你赚到,赶快转起来吧! >>活动主页& ...

  4. Gift Hunting(分组背包)

    Gift Hunting Time Limit: 6000/3000 MS (Java/Others) Memory Limit: 32768/32768 K (Java/Others) Total ...

  5. Codeforces Educational Codeforces Round 3 B. The Best Gift 水题

    B. The Best Gift 题目连接: http://www.codeforces.com/contest/609/problem/B Description Emily's birthday ...

  6. 1002 GTY's birthday gift

    GTY's birthday gift                                                                       Time Limit ...

  7. [light oj 1328] A Gift from the Setter

    1328 - A Gift from the Setter   Problem setting is somewhat of a cruel task of throwing something at ...

  8. 119 - Greedy Gift Givers

     Greedy Gift Givers  The Problem This problem involves determining, for a group of gift-giving frien ...

  9. HDU 5171 GTY's birthday gift 矩阵快速幂

    GTY's birthday gift Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 65536/65536 K (Java/Othe ...

随机推荐

  1. HTTP代理服务器基本知识

    http://www.cnblogs.com/TankXiao/archive/2012/12/12/2794160.html https://blog.csdn.net/xiaoxiaorenky/ ...

  2. arcgis server 无法手动删除切片

    背景 问题 场景如下: 切片放置在专门的文件服务器上,通过unc共享路径对外共享.文件服务器的OS为windows server2008R2 想手动更新切片服务的切片.发现同一切片服务,有的比例级别文 ...

  3. Java 代码实现Http 的GET和POST 请求

    先来个传统的,不过这个里面有些类已经标明 deprecated,所以之后还有更好的方法,起码没有被标明 deprecated的类和方法. 前两个方法是有deprecated的情况.后面用HttpURL ...

  4. C++的全部目标就是最优化资源的利用,以人付出更多为代价。Python刚好是另一个极端(Bjarne就说,一个人至少应该掌握两种计算机语言)

    说 C++ 反人类,是如果把 C++ 看作人(程序员)和资源(电子系统)的桥梁,他的全部目标就是最优化资源的利用,以人付出更多为代价.Python刚好是另一个极端.做好两个一起学.Bjarne就说,一 ...

  5. 基于Hadoop的数据仓库Hive

    Hive是基于Hadoop的数据仓库工具,可对存储在HDFS上的文件中的数据集进行数据整理.特殊查询和分析处理,提供了类似于SQL语言的查询语言–HiveQL,可通过HQL语句实现简单的MR统计,Hi ...

  6. 存储库之——MongoDB

    阅读目录 一 简介 二 MongoDB基础知识 三 安装 四 基本数据类型 五 CRUD操作 六 可视化工具 七 pymongo 一 简介 MongoDB是一款强大.灵活.且易于扩展的通用型数据库1. ...

  7. Zen-cart产品页面随机调用Wordpress文章

    <?php require('./wordpress所在目录/wp-blog-header.php'); ?><?php$rand_posts = get_posts('number ...

  8. rabbitmq报错type

    TypeError: exchange_declare() got an unexpected keyword argument 'type' 原因应该为pika版本不同导致的用法不同,解决方法为把t ...

  9. PKU 1094 Sorting It All Out(拓扑排序)

    题目大意:就是给定一组字母的大小关系判断他们是否能组成唯一的拓扑序列. 是典型的拓扑排序,但输出格式上确有三种形式: 1.该字母序列有序,并依次输出: 2.判断该序列是否唯一: 3.该序列字母次序之间 ...

  10. bin2lib shell脚本

    #!/bin/sh#输入文件名filename=$1#分割文件大小filesize=4096#输出库文件名libname="lib"$(echo $filename | tr . ...