【第二周周练 E 】
来源:互联网 发布:代挂乐最新源码 编辑:程序博客网 时间:2024/05/06 18:48
One day Vasya was going home when he saw a box lying on the road. The box can be represented as a rectangular parallelepiped. Vasya needed no time to realize that the box is special, as all its edges are parallel to the coordinate axes, one of its vertices is at point (0, 0, 0), and the opposite one is at point (x1, y1, z1). The six faces of the box contain some numbers a1, a2, ..., a6, exactly one number right in the center of each face.
The numbers are located on the box like that:
- number a1 is written on the face that lies on the ZOX plane;
- a2 is written on the face, parallel to the plane from the previous point;
- a3 is written on the face that lies on the XOY plane;
- a4 is written on the face, parallel to the plane from the previous point;
- a5 is written on the face that lies on the YOZ plane;
- a6 is written on the face, parallel to the plane from the previous point.
At the moment Vasya is looking at the box from point (x, y, z). Find the sum of numbers that Vasya sees. Note that all faces of the box are not transparent and Vasya can't see the numbers through the box. The picture contains transparent faces just to make it easier to perceive. You can consider that if Vasya is looking from point, lying on the plane of some face, than he can not see the number that is written on this face. It is enough to see the center of a face to see the corresponding number for Vasya. Also note that Vasya always reads correctly the ainumbers that he sees, independently of their rotation, angle and other factors (that is, for example, if Vasya sees some ai = 6, then he can't mistake this number for 9and so on).
The fist input line contains three space-separated integers x, y and z (|x|, |y|, |z| ≤ 106) — the coordinates of Vasya's position in space. The second line contains three space-separated integers x1, y1, z1 (1 ≤ x1, y1, z1 ≤ 106) — the coordinates of the box's vertex that is opposite to the vertex at point (0, 0, 0). The third line contains six space-separated integers a1, a2, ..., a6 (1 ≤ ai ≤ 106) — the numbers that are written on the box faces.
It is guaranteed that point (x, y, z) is located strictly outside the box.
Print a single integer — the sum of all numbers on the box faces that Vasya sees.
2 2 21 1 11 2 3 4 5 6
12
0 0 103 2 31 2 3 4 5 6
4
The first sample corresponds to perspective, depicted on the picture. Vasya sees numbers a2 (on the top face that is the darkest), a6 (on the right face that is the lightest) and a4 (on the left visible face).
In the second sample Vasya can only see number a4.
题目很长,别被吓到就能做出来,,,,,
#include<cstdio>int a[7];int main(){int x,y,z,x1,y1,z1;while(~scanf("%d%d%d%d%d%d",&x,&y,&z,&x1,&y1,&z1)){for(int i=1;i<=6;i++) scanf("%d",a+i);int s=0;if(x<0) s+=a[5];if(x-x1>0) s+=a[6];if(y<0) s+=a[1];if(y-y1>0) s+=a[2];if(z<0) s+=a[3]; if(z-z1>0) s+=a[4];printf("%d\n",s);}return 0;}
- 【第二周周练 E 】
- 【第二周周练 H 】
- AYIT2017暑假集训第二周周三赛 E
- HPU第七周周练 I
- HPU第七周周练 A
- 第二周周报
- 第二周周作业
- 第二周周工作表
- 冬令营第二周周报
- 冬令营第二周周报
- 第二周周一
- 第二周周二
- 第二周周三
- 第二周周报
- 第二周周总结
- 第二周周四总结
- 第二周周中总结
- 第二周周末总结
- 【Linux命令】磁盘管理
- SSH整合开发的小Demo--网上银行系统之管理员模块开发
- Hbase启动后,在主节点只有Hmaster,而在slave节点上没有Hregionserver
- 快速排序优化-4个方面
- 研究生课程 算法分析笔记
- 【第二周周练 E 】
- 各种皮试液的配制方法
- 从零开始···mysql的安装配置
- RecyclerView简单点击
- html调用高德地图选址和查看地图详情
- Spring Aop express解析
- HTML CSS +js 实现tab选项卡,自动轮换
- 本次比赛总结(2017.10.6比赛)
- U3D Shader