Web Colors UVALive
来源:互联网 发布:mac无法导入手机照片 编辑:程序博客网 时间:2024/06/03 15:31
#include <iostream>#include <cstdio>#include <cstdlib>#include <cstring>#include <string>#include <cmath>#include <set>#include <map>#include <stack>#include <queue>#include <ctype.h>#include <vector>#include <algorithm>#include <sstream>#define PI acos(-1.0)// cout << " === " << endl;using namespace std;typedef long long ll;const int maxn = 50000 + 7, INF = 0x3f3f3f3f, mod = 1e9+7;double r, g, b;struct node { string name; double r, g, b;}a[maxn];void init() { a[0].name = "White"; a[0].r = 255, a[0].g = 255, a[0].b = 255; a[1].name = "Silver"; a[1].r = 192, a[1].g = 192, a[1].b = 192; a[2].name = "Gray"; a[2].r = 128, a[2].g = 128, a[2].b = 128; a[3].name = "Black"; a[3].r = 0, a[3].g = 0, a[3].b = 0; a[4].name = "Red"; a[4].r = 255, a[4].g = 0, a[4].b = 0; a[5].name = "Maroon"; a[5].r = 128, a[5].g = 0, a[5].b = 0; a[6].name = "Yellow"; a[6].r = 255, a[6].g = 255, a[6].b = 0; a[7].name = "Olive"; a[7].r = 128, a[7].g = 128, a[7].b = 0; a[8].name = "Lime"; a[8].r = 0, a[8].g = 255, a[8].b = 0; a[9].name = "Green"; a[9].r = 0, a[9].g = 128, a[9].b = 0; a[10].name = "Aqua"; a[10].r = 0, a[10].g = 255, a[10].b = 255; a[11].name = "Teal"; a[11].r = 0, a[11].g = 128, a[11].b = 128; a[12].name = "Blue"; a[12].r = 0, a[12].g = 0, a[12].b = 255; a[13].name = "Navy"; a[13].r = 0, a[13].g = 0, a[13].b = 128; a[14].name = "Fuchsia"; a[14].r = 255, a[14].g = 0, a[14].b = 255; a[15].name = "Purple"; a[15].r = 128, a[15].g = 0, a[15].b = 128;}void solve() { int id = 0; double d = (double)INF; for(int i = 0; i < 16; ++i) { double t = (a[i].r - r)*(a[i].r - r) + (a[i].g - g)*(a[i].g - g) + (a[i].b - b)*(a[i].b - b); if(t < d) { d = t; id = i; } } cout << a[id].name << endl;}int main () { init(); while(scanf("%lf %lf %lf", &r, &g, &b) != EOF) { if(r == -1 && g == -1 && b == -1) break; solve(); } return 0;}
阅读全文
1 0
- Web Colors UVALive
- Web Colors UVALive
- colors
- colors
- colors
- Colors
- UVALive
- UVALive
- UVALive
- UVALive
- UVALive
- UVALive
- UVALive
- UVALive
- UVALive
- UVALive
- UVALive
- UVALive
- Codeforces 714D [树上启发式合并][Hash]
- Kings of Persia UVALive
- 统计序列中当前元素之前比它大的元素个数(两种解法:归并排序应用,线段树)
- Hibernate中用注解配置一对多双向关联和多对一单向关联
- opencv 提取视频信息(提取每帧 VS 按照时间提取)
- Web Colors UVALive
- 帧中继笔记整理1
- 解决表单提交后跳转到空白页的问题
- 关于学习NDK基础知识这些就够了(七)
- HTTP请求错误类型
- 数通平台软件:编译体系实现
- 日记:一个大坑,关于python的sort和sorted
- 数据库学习纪要(七):SQL语法-2
- hdu 6039 线段树+dfs序