//
// 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. python常见模块之random模块

    import random print(random.random()) #随机产生一个0-1之间的小数 print(random.randint(1,3)) #随机产生一个1-3之间的整数,包括1和 ...

  2. Shiro Annotation保护实例

    之前介绍了Shiro的Web訪问控制和缓存配置,事实上Shiro和Spring一样能够使用Annotation来配置方法级别的安全.省去自己每次获取Subject去做权限验证,比方在改动用户passw ...

  3. javaScript 调用构造函数 Array() 时没有使用参数, length总是0

    如果调用构造函数 Array() 时没有使用参数,那么返回的数组为空,length 字段为 0. 当调用构造函数时只传递给它一个数字参数,该构造函数将返回具有指定个数.元素为 undefined 的数 ...

  4. Shiro出现的问题

    报错java.lang.IllegalArgumentException: Line argument must contain a key and a value.  Only one string ...

  5. (0.2.1)mysql数据库环境-操作系统配置

    目录 1.基于Linux平台的Mysql项目场景介绍 2.mysql数据库运行环境准备-最优配置 2.1.如何查看官方文档了解环境要求 2.2.安装虚拟机环境与操作系统 2.3.操作系统最优配置9大步 ...

  6. 001-mac使用桌面、Dock、键盘、程序安装

    一.桌面 Finder:dock第一个正方形蓝白笑脸,类似于Windows的资源管理器,是图形化界面基础,默认启动 菜单:最上侧一行左侧,当前程序的菜单 dock:应用程序快捷图标,启动的程序下面有个 ...

  7. java 多线程 day13 condition 线程通信

    /** * Created by chengtao on 17/12/5. * Condition 类似 wait和notify,解决线程间的同步问题 */ import java.util.conc ...

  8. SDUT2857:艺术联合会(简单dp)

    链接: http://acm.sdut.edu.cn/sdutoj/problem.php?action=showproblem&problemid=2857 题目解析: 这是去年校赛的题目, ...

  9. 创建Java不可变类

    不可变(immutable)类的意思是创建该类的实例后,该实例的Field是不可改变的,Java提供的8个包装类和java.lang.String类都是不可变类. 如果需要创建自定义的不可变类,可遵守 ...

  10. c++中字符串反转的3种方法

    第一种:使用algorithm中的reverse函数 #include <iostream> #include <string> #include <algorithm& ...