编程介的小学生 2019-04-08 13:19 采纳率: 20.5%
浏览 793

三种颜色的混合的比例问题,RGB混合算法,采用C程序设计的语言的做法

Problem Description
Chae Yeon is a popular pop female singer who rose to fame with her amazing sexy dance style and the sounds of nature voice she has. She proved to be a great dancer, and she showed off her vocals in her live performances. If you had ever seen her dance, I bet you’d love it.
I felt stage lighting interesting when I was enjoying Chae Yeon’s performance. We all know that stage lighting instruments are used for the concerts and other performances taking place in live performance venues. They are also used to light the stages. Actually this is a color mixing process. There are two types of color mixing: Additive and Subtractive. Most stages use the former and in this case there are three primary colors: red, green, and blue. In the absence of color, or when no colors are showing, the stage is black. If all three primary colors are showing, the result is white. When red and green combine together, the result is yellow. When red and blue combine together, the result is magenta. When blue and green combine together, the result is cyan. When two same color combine together, the result is still that color.

We have got the coordinate and the primary color of the figure that each Stage Lighting Instrument sent out. For simplicity’s sake, we can just treat the figure as a circle. Of course we’ll know the radius of each colored circle. Some color may be changed based on the Color Mixed Theory we mentioned above. Can you find the area of each color?

Input
The first line consists of an integer T, indicating the number of test cases.
The first line of each case consists of three integers R, G, B, indicating the number of red circles, green circles and blue circles. The next R + G + B lines, each line consists of three integer x, y, r, indicating the coordinate and the radius. The first R lines descript the red circles, the second G lines descript the green circles and the last B lines descript the blue circles.

Output
Output seven floating numbers, they are the area of red, green, blue, white, yellow, magenta and cyan. Please take each number with two factional digits.
Constraints
0 < T <= 20
0 <= R, G, B <= 100
-100 <= x, y <= 100; 0 <= r <= 100

Sample Input
1
1 1 1
0 2 3
2 0 3
-2 0 3

Sample Output
9.28 15.04 15.04 4.92 7.04 7.04 1.28

  • 写回答

1条回答 默认 最新

  • qwrthggh 2019-04-08 17:24
    关注

    #define RGB565(R, G, B) \
    (((TUINT16) ((R) >> 3)) << 11) + (((TUINT16) ((G) >> 2)) << 5) + ((TUINT16) ((B) >> 3))

    #define RGB555_TO_RGB565(X) \
    ((((X)&0x7FE0) << 1)|((X)&0x003F))

    #define COLOR_BLACK RGB565(0, 0, 0)

    #define COLOR_DRED RGB565(64, 0, 0)
    #define COLOR_DGREEN RGB565(0, 64, 0)
    #define COLOR_DBLUE RGB565(0, 0, 64)

    #define COLOR_DYELLOW RGB565(64, 64, 0)
    #define COLOR_DPURPLE RGB565(64, 0, 64)
    #define COLOR_DDIAN RGB565(0, 64, 64)

    #define COLOR_GRAY RGB565(64, 64, 64)

    #define COLOR_RED RGB565(255, 0, 0)
    #define COLOR_GREEN RGB565(0, 255, 0)
    #define COLOR_BLUE RGB565(0, 0, 255)

    #define COLOR_YELLOW RGB565(255, 255, 0)
    #define COLOR_PURPLE RGB565(255, 0, 255)
    #define COLOR_DIAN RGB565(0, 255, 255)

    #define COLOR_WHITE RGB5

    评论

报告相同问题?

悬赏问题

  • ¥15 请教:如何用postman调用本地虚拟机区块链接上的合约?
  • ¥15 为什么使用javacv转封装rtsp为rtmp时出现如下问题:[h264 @ 000000004faf7500]no frame?
  • ¥15 乘性高斯噪声在深度学习网络中的应用
  • ¥15 运筹学排序问题中的在线排序
  • ¥15 关于docker部署flink集成hadoop的yarn,请教个问题 flink启动yarn-session.sh连不上hadoop,这个整了好几天一直不行,求帮忙看一下怎么解决
  • ¥15 深度学习根据CNN网络模型,搭建BP模型并训练MNIST数据集
  • ¥15 C++ 头文件/宏冲突问题解决
  • ¥15 用comsol模拟大气湍流通过底部加热(温度不同)的腔体
  • ¥50 安卓adb backup备份子用户应用数据失败
  • ¥20 有人能用聚类分析帮我分析一下文本内容嘛