YTU 2629: E1 一种颜色,三个分量
2629: E1 一种颜色,三个分量
时间限制: 1 Sec 内存限制: 128 MB
提交: 300 解决: 226
题目描述
输入
输出
样例输入
84
128 58
32 225 48
样例输出
5505024
8403456
2097152
迷失在幽谷中的鸟儿,独自飞翔在这偌大的天地间,却不知自己该飞往何方……
#include <iostream>
using namespace std;
class Color
{
public:
Color(int r=0,int g=0,int b=0); //构造函数
int getValue( ); //求得颜色值
unsigned char red; //用无符号char,表示数的范围是0-255,三基色占用3字节
unsigned char green;
unsigned char blue;
};
Color::Color(int r,int g,int b): red(r),green(g),blue(b) { } //(1)
int Color::getValue( )
{
return(red*0x10000+green*0x100+blue);
}
int main( )
{
int r, g, b;
cin>>r;
Color c1(r);
cout<<c1.getValue()<<endl;
cin>>r>>g;
Color c2(r,g);
cout<<c2.getValue()<<endl;
cin>>r>>g>>b;
Color c3(r);
cout<<c3.getValue()<<endl;
return 0;
}
#include <iostream>
using namespace std;
class Color
{
public:
Color(int r=0,int g=0,int b=0); //构造函数
int getValue( ); //求得颜色值
unsigned char red; //用无符号char,表示数的范围是0-255,三基色占用3字节
unsigned char green;
unsigned char blue;
};
Color::Color(int r,int g,int b): red(r),green(g),blue(b) { } //(1)
int Color::getValue( )
{
return(red*0x10000+green*0x100+blue);
}
int main( )
{
int r, g, b;
cin>>r;
Color c1(r);
cout<<c1.getValue()<<endl;
cin>>r>>g;
Color c2(r,g);
cout<<c2.getValue()<<endl;
cin>>r>>g>>b;
Color c3(r);
cout<<c3.getValue()<<endl;
return 0;
}
YTU 2629: E1 一种颜色,三个分量的更多相关文章
- opencv —— 同时识别三种颜色
要点: 1.识别一种颜色 minH = ; //色相 maxH = ; minS = ; //饱和度 maxS = ; minV = ; // inRange(原图像, 最小值的范围, 最大值的范围, ...
- 一个label两种颜色,一个label两种字体
-(void)addLabel{ UILabel *label = [[UILabel alloc]init]; label.backgroundColor = [UIColor grayColor] ...
- Android代码中设置字体大小,字体颜色,显示两种颜色.倒计时效果
Android代码中设置字体大小,字体颜色,显示两种颜色 在xml文件中字体大小用的像素 <TextView android:id="@+id/uppaid_time" an ...
- APP界面常用的五种颜色搭配
众所周知,每一种颜色带给用户的视觉感受也是不同的.现在人们对手机的依赖程度,就能看到手机中APP的发展前景,那今天就跟大家聊聊如何通过颜色搭配的不同来进行移动端APP界面的布局和排版设计.移动端UI界 ...
- 几种颜色模型(颜色空间):HSV CMYK RGB
RGB和CMY颜色模型都是面向硬件的,而HSV(Hue Saturation Value)颜色模型是面向用户的. HSV(Hue, Saturation, Value)是根据颜色的直观特性由A. R. ...
- 【编程题目】一串首尾相连的珠子(m 个),有 N 种颜色(N<=10),取出其中一段,要求包含所有 N 中颜色,并使长度最短。
40.百度研发笔试题 2)一串首尾相连的珠子(m 个),有 N 种颜色(N<=10),设计一个算法,取出其中一段,要求包含所有 N 中颜色,并使长度最短.并分析时间复杂度与空间复杂度. 思路: ...
- Android TextView里显示两种颜色
今天介绍一个小技巧,在Android的TextView里设置两种颜色,直接上代码: TextView TV = (TextView)findViewById(R.id.mytextview01); S ...
- Html+Css+Js_之table每隔3行显示不同的两种颜色
<html> <head> <script type="text/javascript"> /** 最近因项目的需求,有这样的一个问题: 一个t ...
- 魅蓝Note有几种颜色 魅蓝Note哪个颜色好看
http://www.pc841.com/shoujizhishi/39882.html http://news.mydrivers.com/1/359/359443.htm 魅族发布首款千元高性价比 ...
随机推荐
- 合并多个MP4文件
把多个MP4文件连接起来的方法与音频文件不太一样,比较有效的方法是: $ cat mylist.txt file '/path/to/file1' file '/path/to/file2' file ...
- 定义一个复数类Complex
#include<iostream> #include<math.h> using namespace std; class Complex{ public: Complex( ...
- 【Codeforces 444A】DZY Loves Physics
[链接] 我是链接,点我呀:) [题意] 题意 [题解] 两个点的子图他们的"密度"是比所有联通生成子图都要大的 "只要胆子大,遇到什么问题都不怕!" [代码] ...
- 1 problem was encountered while building the effective model [FATAL] Non-parseable POM F:\MavenRepository\org\apache\maven\plugins\maven-resources-plugin\2.6\maven-resources-plugin-2.6.pom: start tag
Multiple annotations found at this line: - No plugin found for prefix 'war' in the current project a ...
- Linux下汇编语言学习笔记7 ---
这是17年暑假学习Linux汇编语言的笔记记录,参考书目为清华大学出版社 Jeff Duntemann著 梁晓辉译<汇编语言基于Linux环境>的书,喜欢看原版书的同学可以看<Ass ...
- POJ——T 2976 Dropping tests
http://poj.org/problem?id=2976 Time Limit: 1000MS Memory Limit: 65536K Total Submissions: 13861 ...
- codevs——1275 有鱼的声音
1275 有鱼的声音 2012年CCC加拿大高中生信息学奥赛 时间限制: 1 s 空间限制: 128000 KB 题目等级 : 青铜 Bronze 题解 查看运行结果 题目描述 Des ...
- Redis官方文档资源
官方文档: 如果要深入研究时,官方提供的文档是最权威的. 英文: https://redis.io/documentation 中文: http://www.redis.cn/documentatio ...
- 断路器监控(Hystrix Dashboard)
继上一篇http://www.cnblogs.com/EasonJim/p/7613595.html介绍了断路器之后,其实它还提供了一个管理页面来监控这些应用的调用数据. 首先,我是基于上一个例子Zo ...
- Android GIS开发系列-- 入门季(8) Json与Geometry的相互转换
在Android中json数据十分普遍,也很实用,在Arcgis中也同样支持Json数据,Json与Geometry可以相互转换,达到我们想要的数据. 一.Geometry转换成Json数据 这个实现 ...