当前位置: 首页 > news >正文

购物网站 购物车界面如何做全球搜钻是什么公司

购物网站 购物车界面如何做,全球搜钻是什么公司,全国做网站的,延庆区住房和城乡建设委员会网站资源限制 内存限制:256.0MB C/C时间限制:1.0s Java时间限制:3.0s Python时间限制:5.0s 问题描述 足球赛上,只见Q神如闪电般的速度带球时而左,时而右,时而前,时而后&#xff…

资源限制

内存限制:256.0MB   C/C++时间限制:1.0s   Java时间限制:3.0s   Python时间限制:5.0s

问题描述

  足球赛上,只见Q神如闪电般的速度带球时而左,时而右,时而前,时而后,时而上,时而下……等等,有什么奇怪的东西混进去了?假设Q神力量可以突破地心引力,他在一个三维空间里面可以沿着直角坐标系的坐标轴方向前进。告诉你他的每一次转的方向以及前进的距离,请你回答他最后在哪个位置,面朝那一个方向。假设他一开始在(0,0,0),面朝x轴的正方向。

输入格式

  多组输入数据。
  每组第一行是一个整数n。接下来n行每行一个字符表示方向,接着一个整数表示前进距离。其中,f(forward)表示继续前进,方向不变;b(back)表示向后转;l(left)表示向左转;r(right)表示像右转;u(up)表示向上;d(表示向下)。如图示。

输出格式

  对于每一组数据,输出Q神的坐标和他的朝向。其中:左手系的x正方向、y正方向、z正方向分别位0、1、2,对应的负方向分别为3、4、5.

样例输入

6
l 10
r 11
u 12
d 13
f 14
b 15

样例输出

23 -10 12 3

数据规模和约定

  数据组数不超过10组,n《=200 ,每次移动距离不超过100

#include<iostream>
using namespace std;
int next_face(int &face,int &foot,char orient){if(face==0){if(foot==5){if(orient=='f'){face=0;}else if(orient=='b'){face=3;}else if(orient=='l'){face=4;}else if(orient=='r'){face=1;}else if(orient=='u'){face=2;foot=0;}else if(orient=='d'){face=5;foot=3;}}if(foot==1){if(orient=='f'){face=0;}else if(orient=='b'){face=3;}else if(orient=='l'){face=5;}else if(orient=='r'){face=2;}else if(orient=='u'){face=4;foot=0;}else if(orient=='d'){face=1;foot=3;}}if(foot==2){if(orient=='f'){face=0;}else if(orient=='b'){face=3;}else if(orient=='l'){face=1;}else if(orient=='r'){face=4;}else if(orient=='u'){face=5;foot=0;}else if(orient=='d'){face=2;foot=3;}}if(foot==4){if(orient=='f'){face=0;}else if(orient=='b'){face=3;}else if(orient=='l'){face=2;}else if(orient=='r'){face=5;}else if(orient=='u'){face=1;foot=0;}else if(orient=='d'){face=4;foot=3;}}}else if(face==1){if(foot==5){if(orient=='f'){face=1;}else if(orient=='b'){face=4;}else if(orient=='l'){face=0;}else if(orient=='r'){face=3;}else if(orient=='u'){face=2;foot=1;}else if(orient=='d'){face=5;foot=4;}}if(foot==3){if(orient=='f'){face=1;}else if(orient=='b'){face=4;}else if(orient=='l'){face=5;}else if(orient=='r'){face=2;}else if(orient=='u'){face=0;foot=1;}else if(orient=='d'){face=3;foot=4;}}if(foot==2){if(orient=='f'){face=1;}else if(orient=='b'){face=4;}else if(orient=='l'){face=3;}else if(orient=='r'){face=0;}else if(orient=='u'){face=5;foot=1;}else if(orient=='d'){face=2;foot=4;}}if(foot==0){if(orient=='f'){face=1;}else if(orient=='b'){face=4;}else if(orient=='l'){face=2;}else if(orient=='r'){face=5;}else if(orient=='u'){face=3;foot=1;}else if(orient=='d'){face=0;foot=4;}}}else if(face==2){if(foot==4){if(orient=='f'){face=2;}else if(orient=='b'){face=5;}else if(orient=='l'){face=3;}else if(orient=='r'){face=0;}else if(orient=='u'){face=1;foot=2;}else if(orient=='d'){face=4;foot=5;}}if(foot==3){if(orient=='f'){face=2;}else if(orient=='b'){face=5;}else if(orient=='l'){face=1;}else if(orient=='r'){face=4;}else if(orient=='u'){face=0;foot=2;}else if(orient=='d'){face=3;foot=5;}}if(foot==1){if(orient=='f'){face=2;}else if(orient=='b'){face=5;}else if(orient=='l'){face=0;}else if(orient=='r'){face=3;}else if(orient=='u'){face=4;foot=2;}else if(orient=='d'){face=1;foot=5;}}if(foot==0){if(orient=='f'){face=2;}else if(orient=='b'){face=5;}else if(orient=='l'){face=4;}else if(orient=='r'){face=1;}else if(orient=='u'){face=3;foot=2;}else if(orient=='d'){face=0;foot=5;}}}else if(face==3){if(foot==5){if(orient=='f'){face=3;}else if(orient=='b'){face=0;}else if(orient=='l'){face=1;}else if(orient=='r'){face=4;}else if(orient=='u'){face=2;foot=3;}else if(orient=='d'){face=5;foot=0;}}if(foot==1){if(orient=='f'){face=3;}else if(orient=='b'){face=0;}else if(orient=='l'){face=2;}else if(orient=='r'){face=5;}else if(orient=='u'){face=4;foot=3;}else if(orient=='d'){face=1;foot=0;}}if(foot==2){if(orient=='f'){face=3;}else if(orient=='b'){face=0;}else if(orient=='l'){face=4;}else if(orient=='r'){face=1;}else if(orient=='u'){face=5;foot=3;}else if(orient=='d'){face=2;foot=0;}}if(foot==4){if(orient=='f'){face=3;}else if(orient=='b'){face=0;}else if(orient=='l'){face=5;}else if(orient=='r'){face=2;}else if(orient=='u'){face=1;foot=3;}else if(orient=='d'){face=4;foot=0;}}}else if(face==4){if(foot==5){if(orient=='f'){face=4;}else if(orient=='b'){face=1;}else if(orient=='l'){face=3;}else if(orient=='r'){face=0;}else if(orient=='u'){face=2;foot=4;}else if(orient=='d'){face=5;foot=1;}}if(foot==3){if(orient=='f'){face=4;}else if(orient=='b'){face=1;}else if(orient=='l'){face=2;}else if(orient=='r'){face=5;}else if(orient=='u'){face=0;foot=4;}else if(orient=='d'){face=3;foot=1;}}if(foot==2){if(orient=='f'){face=4;}else if(orient=='b'){face=1;}else if(orient=='l'){face=0;}else if(orient=='r'){face=3;}else if(orient=='u'){face=5;foot=4;}else if(orient=='d'){face=2;foot=1;}}if(foot==0){if(orient=='f'){face=4;}else if(orient=='b'){face=1;}else if(orient=='l'){face=5;}else if(orient=='r'){face=2;}else if(orient=='u'){face=3;foot=4;}else if(orient=='d'){face=0;foot=1;}}}else if(face==5){if(foot==1){if(orient=='f'){face=5;}else if(orient=='b'){face=2;}else if(orient=='l'){face=3;}else if(orient=='r'){face=0;}else if(orient=='u'){face=4;foot=5;}else if(orient=='d'){face=1;foot=2;}}if(foot==3){if(orient=='f'){face=5;}else if(orient=='b'){face=2;}else if(orient=='l'){face=4;}else if(orient=='r'){face=1;}else if(orient=='u'){face=0;foot=5;}else if(orient=='d'){face=3;foot=2;}}if(foot==4){if(orient=='f'){face=5;}else if(orient=='b'){face=2;}else if(orient=='l'){face=0;}else if(orient=='r'){face=3;}else if(orient=='u'){face=1;foot=5;}else if(orient=='d'){face=4;foot=2;}}if(foot==0){if(orient=='f'){face=5;}else if(orient=='b'){face=2;}else if(orient=='l'){face=1;}else if(orient=='r'){face=4;}else if(orient=='u'){face=3;foot=5;}else if(orient=='d'){face=0;foot=2;}}}
}
int main(){int n;while(cin>>n){int x=0,y=0,z=0;//最开始时的坐标int face=0;//脸的朝向 int foot=5;//脚的站位 for(int i=0;i<n;i++){char orient;int num;cin>>orient>>num;next_face(face,foot,orient);if(face==0){x+=num;}else if(face==1){y+=num;}else if(face==2){z+=num;}else if(face==3){x-=num;}else if(face==4){y-=num;}else if(face==5){z-=num;}} cout<<x<<" "<<y<<" "<<z<<" "<<face<<" "<<endl;}return 0;
} 

思路:需要知道Q神的脸的朝向、脚的站位(头指向脚的方向)才能确定Q神的位置。已知脸的朝向,可能有4个站位。

例如:初始位置:脸的朝向为0,脚的站位为5

http://www.khdw.cn/news/7616.html

相关文章:

  • 外贸卖货哪个平台好网站建设优化
  • wordpress 主题网络优化
  • 成都网站外包优化免费网站建设哪家好
  • 网站建设是设计师吗网页设计素材网站
  • 专业的网站制作专业公司长沙百度快照优化排名
  • 做网站头部为什么很多代码兰州网络推广
  • 邯郸做网站的公司关键词排名查询
  • 搭建网站用什么软件首页关键词排名代发
  • 建设大型网站建设关键词如何确定
  • 大型门户网站是这样炼成的源代码百度推广账户登录首页
  • 网站开发涉及技术理发培训专业学校
  • 企业网站制作正规公司百度seo培训
  • 做分析图超牛的地图网站爱站关键词挖掘工具
  • 做兼职那个网站比较靠谱如何进行网络营销推广
  • 免费自学平面设计的网站如何制作网页游戏
  • 湖州网站建设湖州网站建设seo培训价格
  • 西安本地十家做网站建设的公司郑州seo网络推广
  • 电商网站话费充值怎么做外贸电商平台哪个网站最好
  • 代做论文毕业设计网站靠谱不济南百度seo
  • 12306网站为什么做不好使seo有什么作用
  • vue 实现网站开发百度百科推广费用
  • 淘客网站怎么做淘口令培训加盟
  • wordpress做表格插件qq群排名优化软件
  • b2b产品有哪些石家庄网站seo
  • 手机游戏的官方网站开发是同步进行的么百度一下你就知道官网下载安装
  • 对于职业规划做的好的网站海口网站排名提升
  • 免费模板下载网站推荐app关键词排名优化
  • 35互联做网站怎么样怎么策划一个营销方案
  • 网站的打开速度广州网站排名优化公司
  • 马蹄室内设计网论坛seo网络优化专员