Gift for GS5
//
// 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的更多相关文章
- USACO . Greedy Gift Givers
Greedy Gift Givers A group of NP (2 ≤ NP ≤ 10) uniquely named friends has decided to exchange gifts ...
- 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 ...
- 快来玩“Gift大转盘”百分百赚好礼
现在开始到今年的最后一天,你天天都可以来转100%中奖的“ Gift大转盘 ”.代金券.产品折扣.精美纪念礼,没有多余规则.全部网友都可参加,转到就是你赚到,赶快转起来吧! >>活动主页& ...
- Gift Hunting(分组背包)
Gift Hunting Time Limit: 6000/3000 MS (Java/Others) Memory Limit: 32768/32768 K (Java/Others) Total ...
- 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 ...
- 1002 GTY's birthday gift
GTY's birthday gift Time Limit ...
- [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 ...
- 119 - Greedy Gift Givers
Greedy Gift Givers The Problem This problem involves determining, for a group of gift-giving frien ...
- HDU 5171 GTY's birthday gift 矩阵快速幂
GTY's birthday gift Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 65536/65536 K (Java/Othe ...
随机推荐
- C++之贪吃蛇
#include<iostream> #include<cstdio> #include<cstdlib> #include<ctime> #inclu ...
- java基础03变量和基本数据类型
package cn.bdqn.test; /** * * @author 小豆腐 * * 变量:会变化的量?? * 一个数据在内存中存储空间的表示!在运行期间可以动态改变! * * 关键字:在jav ...
- react es6语法 之 “ ... ” (扩展运算符)
扩展运算符(…)用于取出参数对象中的所有可遍历属性,拷贝到当前对象之中 let bar = { a: 1, b: 2 }; let baz = { ...bar }; // { a: 1, b: 2 ...
- 【非root用户】安装【python,pip,package】
安装python: 下载源码 解压 进入 ./configure --prefix=/path/python3.6 注意一定要设置prefix,否则默认安装到/usr/local make make ...
- js小数四舍五入,保留两位小数
直接用用number.toFixed(2)即可 <template> <section class="p-10"> <h1> {{ number ...
- 出现 Request Entity Too Large问题的解决方法
根据经验判断应该是上传文件大小被限制了,检查了应用配置是10M,把它设置成100M,重启服务也不能解决问题. 原来我们的tomcat是通过nginx发现服务代理的,问题就出现nginx服务器上,原来n ...
- 001-window下运行linux
一.概述 前提:有条件的情况下,自行安装 在windows上模拟linux环境,主要有三种方法: 1.VMware等虚拟机,缺点:占用系统资源多,运行速度慢. 2.Cygwin等模拟环境,用windo ...
- spring 启动过程
首先,对于一个web应用,其部署在web容器中,web容器提供其一个全局的上下文环境,这个上下文就是ServletContext,其为后面的spring IoC容器提供宿主环境: 其次,在web.xm ...
- Intellij IDEA如何使用Maven Tomcat Plugin运行web项目
首先,Run ——> Edit Configurations,这时候如下图: 然后点击左上角的加号,可以添加一个新的配置,如下图: 选择Maven,如下图: 下面填上自己的配置信息,点击appl ...
- jmeter使用代理服务器录制脚本端口号被占用
初学jmeter工具,在设置端口号时,使用8080,IE设置的局域网端口也为8080,启动代理服务器时,提示:Could not create script recorder-port in use. ...