//
// 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. mysql数据库基本知识,简单框架

    https://www.cnblogs.com/geaozhang/p/7347950.html

  2. 数字货币量化分析报告_20170905_P

    [分析时间]2017-09-05 16:36:46 [数据来源]中国比特币 https://www.chbtc.com/ef4101d7dd4f1faf4af825035564dd81聚币网 http ...

  3. Python 面向对象进阶(二)

    1. 垃圾回收 小整数对象池 Python对小整数的定义是 [-5, 257),这些整数对象是提前建立好的; 在一个Python程序中,所有位于这个范围内的整数,使用的都是同一个对象; 单个字符共用对 ...

  4. 剑指Offer——链表中环的入口结点

    题目描述: 一个链表中包含环,请找出该链表的环的入口结点. 分析: 设置两个指针p1,p2, 两个指针都从链表的头部开始走,不过p1每次走一步,p2每次走两步. 直到相遇的时候,p2走的长度是p1的两 ...

  5. Xception

    Xception(Deep Learning with Depth-wise Separable convolutions)——google Inception-V3 Xception 并不是真正意义 ...

  6. 最长回文---hdu3068 (回文串 manacher 算法模板)

    题目链接:http://acm.hdu.edu.cn/showproblem.php?pid=3068 题意很清楚:就是求一个串s的子串中最长回文串的长度:这类题用到了manacher算法 #incl ...

  7. MySQL - 查询今天的数据(以及昨天、本月、上个月、今年...) 查询Datetime 时间的数据

    1,查询当天(今天)的数据 1 SELECT * FROM `order` WHERE TO_DAYS(order_time) = TO_DAYS(NOW()) 2,查询昨天的数据 1 SELECT  ...

  8. python 将日期戳(五位数时间)转换为标准时间

    5位数日期戳 读取 .mat 文件处理里面数据时,发现里面的日期数据全部都是 “5位数” 数字,很不解: 后来查到可以在excel中通过设置单元格调回标准日期格式,如下: 选中日期戳,右键选择 “格式 ...

  9. (2.4)Mysql之SQL基础——下载与使用测试库

    (2.4)SQL基础——下载与使用测试库 1.查看与下载测试数据库 2.查看安装向导视图 3.安装 [1]安装:解压后用 mysql 命令安装(记得加上set autocommit=1) [2]核验: ...

  10. STL: fill,fill_n,generate,generate_n

    fill Assigns the same new value to every element in a specified range. template<class ForwardIter ...