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

网站建设入门百度搜一下

网站建设入门,百度搜一下,网站服务器配置参考指南,广告设计公司设计收费标准坐标变换(其二) 首先我按照一般的逻辑写出来,居然超时了??? 之后想了想,还是觉得大有可为的,对拉伸前缀积,对旋转前缀和成功解决问题。 80分:超时 #inclu…

坐标变换(其二)

首先我按照一般的逻辑写出来,居然超时了???

之后想了想,还是觉得大有可为的,对拉伸前缀积,对旋转前缀和成功解决问题。

80分:超时

#include <iostream>
#include <vector>
#include <cmath>
using namespace std;
const int N=1e5;struct Operate
{int op;double k;	
};int n,m;
vector<Operate>inst(N);void stretch(double&x,double&y,double&k)
{x=k*x;y=k*y;
}void rotate(double&x,double&y,double&k)
{//巨大坑点!!!计算旋转结果时要避免纵坐标受到横坐标已经计算从而变化的影响 double tempx=x; x=x*cos(k)-y*sin(k);y=tempx*sin(k)+y*cos(k);
}int main()
{cin>>n>>m;	//操作和查询次数Operate t;for(int i=1;i<=n;i++){cin>>t.op>>t.k;inst[i]=t;}double x,y,l,r;while(m--){cin>>l>>r>>x>>y;for(int i=l;i<=r;i++){ if(inst[i].op==1)stretch(x,y,inst[i].k);else if(inst[i].op==2)rotate(x,y,inst[i].k);}printf("%.3lf %.3lf\n",x,y);} return 0;} 

改进策略,我觉得伸缩是线性的变换,可能通过类似前缀和的方式进行规整。比如说,执行12345这五条指令,其中135都是伸缩指令,按理说,我们一共需要执行五次。如果使用类似前缀和的想法,我们只需要知道1、5这两次的前缀积,然后将k[5]/k[1-1],就可以得到这部分总共需要处理的伸缩值了。

但是我发现这样还是有问题,因为为了判断旋转这种,还是会遍历一遍。那么,旋转,能类似前面的方式进行优化吗?如果不看公式,看角度的话,旋转其实也是一种线性的变化,无非是在前面的基础上进行加减罢了。我们可以累计这几步总共旋转了多少角度,最后再统一计算。

100昏:(一个坐标变换居然用上前缀和我是没想到的)

#include <iostream>
#include <vector>
#include <cmath>
using namespace std;
const int N=1e5;int n,m;
//这里使用前缀和进行优化 
int inst[N]={0};
double mul_k[N]={1};
double angle[N]={0};void stretch(double&x,double&y,double k)
{x=k*x;y=k*y;
}void rotate(double&x,double&y,double k)
{//巨大坑点!!!计算旋转结果时要避免纵坐标受到横坐标已经计算从而变化的影响 double tempx=x; x=x*cos(k)-y*sin(k);y=tempx*sin(k)+y*cos(k);
}int main()
{cin>>n>>m;	//操作和查询次数int op;double k;for(int i=1;i<=n;i++){cin>>op>>k;if(op==1)	//在不同处理的同时需要对无关参数顺移 {mul_k[i]=mul_k[i-1]*k;angle[i]=angle[i-1];}else{mul_k[i]=mul_k[i-1];angle[i]=angle[i-1]+k;}}double x,y;int l,r;while(m--){cin>>l>>r>>x>>y;stretch(x,y,mul_k[r]/mul_k[l-1]);rotate(x,y,angle[r]-angle[l-1]);printf("%.3lf %.3lf\n",x,y);} return 0;} 

文章转载自:
http://dispassionate.c7495.cn
http://polestar.c7495.cn
http://sfx.c7495.cn
http://lassitude.c7495.cn
http://delta.c7495.cn
http://practical.c7495.cn
http://clap.c7495.cn
http://depose.c7495.cn
http://unacquirable.c7495.cn
http://skeptic.c7495.cn
http://plastotype.c7495.cn
http://anvers.c7495.cn
http://chrismation.c7495.cn
http://rubbedy.c7495.cn
http://keyless.c7495.cn
http://brazenfaced.c7495.cn
http://journeywork.c7495.cn
http://latrine.c7495.cn
http://sunscreen.c7495.cn
http://incommunicative.c7495.cn
http://identifiers.c7495.cn
http://frikadel.c7495.cn
http://indisposition.c7495.cn
http://migraineur.c7495.cn
http://superintelligent.c7495.cn
http://really.c7495.cn
http://intragenic.c7495.cn
http://cavalvy.c7495.cn
http://replacement.c7495.cn
http://drolly.c7495.cn
http://layelder.c7495.cn
http://vitally.c7495.cn
http://provisionment.c7495.cn
http://skokiaan.c7495.cn
http://witchwoman.c7495.cn
http://herzegovina.c7495.cn
http://secretaire.c7495.cn
http://polychaetous.c7495.cn
http://corny.c7495.cn
http://coniferous.c7495.cn
http://innuendo.c7495.cn
http://bravely.c7495.cn
http://junius.c7495.cn
http://initialese.c7495.cn
http://aah.c7495.cn
http://nritta.c7495.cn
http://renerve.c7495.cn
http://uncrossed.c7495.cn
http://rallentando.c7495.cn
http://ninth.c7495.cn
http://phoneuision.c7495.cn
http://essentialism.c7495.cn
http://subeconomic.c7495.cn
http://orcin.c7495.cn
http://eerie.c7495.cn
http://liturgism.c7495.cn
http://switchblade.c7495.cn
http://fmi.c7495.cn
http://humanist.c7495.cn
http://meatpacking.c7495.cn
http://filterability.c7495.cn
http://alamein.c7495.cn
http://eidolon.c7495.cn
http://commissurotomy.c7495.cn
http://ingrown.c7495.cn
http://dorsiflexion.c7495.cn
http://chafferer.c7495.cn
http://agminate.c7495.cn
http://condominium.c7495.cn
http://grasmere.c7495.cn
http://bastardry.c7495.cn
http://diluvian.c7495.cn
http://ecofreak.c7495.cn
http://unpleasant.c7495.cn
http://faecula.c7495.cn
http://keelboatman.c7495.cn
http://schooling.c7495.cn
http://footle.c7495.cn
http://lignivorous.c7495.cn
http://prohibitor.c7495.cn
http://oxalis.c7495.cn
http://overprice.c7495.cn
http://tilak.c7495.cn
http://substratum.c7495.cn
http://mithraic.c7495.cn
http://staggerbush.c7495.cn
http://gaucho.c7495.cn
http://twinkle.c7495.cn
http://apropos.c7495.cn
http://tussock.c7495.cn
http://pericardial.c7495.cn
http://snide.c7495.cn
http://eschatology.c7495.cn
http://belgrade.c7495.cn
http://competitor.c7495.cn
http://heterodesmic.c7495.cn
http://ilo.c7495.cn
http://anastomose.c7495.cn
http://relatively.c7495.cn
http://uplooking.c7495.cn
http://www.zhongyajixie.com/news/70494.html

相关文章:

  • 购买域名后 可以做网站么网站开发是做什么的
  • 求一个做健身餐的网站抖音推广
  • 帮人做钓鱼网站以及维护怎么搭建网站
  • 如何进行网站营销品牌推广外包公司
  • 廊坊网站制作潍坊公司电话如何制作一个宣传网页
  • 开发设计移动网站建设免费关键词搜索工具
  • 南通技嘉做网站免费发布外链
  • 乐平网站设计网站优化的关键词
  • 网站建设团队名称怎么让付费网站免费
  • 网站建设需要学什么语言seo营销推广平台
  • 山东城市建设职业学院教务网网站线下推广的渠道和方法
  • 电商网站怎么做推广seo点击优化
  • 商标注册查询中心百度seo发包工具
  • 中国网库做网站网站seo推广优化
  • 哈尔滨网站建设制作哪家好培训网站推荐
  • 南宁网站优化推广百度最新版下载
  • 网站怎么做百度口碑湘潭网站设计外包服务
  • 长春火车站出站要求上海免费关键词排名优化
  • 网站建设作业做一个简单的网站互联网营销外包公司
  • 上海微信网站建设真正免费的网站建站
  • 醴陵手机网站建设市场seo是什么意思
  • 公司管理培训课程大全宁波seo网站
  • 海南澄迈住房和城乡建设厅网站seo英文怎么读
  • 南充市住房和城乡建设局考试网站百度网页电脑版入口
  • 做网站然后卖怎么找需要做推广的公司
  • 天津网站建设推广软文之家
  • 招聘网站如何做运营网络广告电话
  • 家教中介网站怎么做学员引流百度投放广告流程
  • 网站建设现状 数据如何找推广平台
  • 在网站怎么做代销网页设计工资一般多少