第31次 CCF 第二题坐标变换(其二)
用前缀和,这样写,为什么是0分,有没有大佬指导一下
#include <bits/stdc++.h>
using namespace std;
const int N=1e5+10;
double a[N],b[N];//前缀和
int main()
{
ios::sync_with_stdio(false);cin.tie(nullptr);
int n,m;
cin>>n>>m;
a[0]=1;
for(int i=1;i<=n;++i)
{
int k;
double c;
scanf("%d %lf",&k,&c);
a[i]=a[i-1];
b[i]=b[i-1];
if(k==1) a[i]*=c;
else b[i]+=c;
}
while(m--)
{
int i,j;
double x,y;
cin>>i>>j>>x>>y;
double K=a[j]/a[i-1];
double C=b[j]-b[i-1];
x=x*K,y=y*K;
double dx=x*cos(C)-y*sin(C);
double dy=x*sin(C)+y*cos(C);
printf("%f %f\n",dx,dy);
}
return 0;
}
把
ios::sync_with_stdio(false);cin.tie(nullptr);
去掉或者把scanf
换成cin
就对了,关流之后cin
不能和scanf
同时使用原来官网的数据应该是有问题的,现在重新评测了,是对的
提交上去显示是答案错误,哪儿错了看不出来啊
帮看一下大佬们
为什么我就暴力做一下也是0分
是不是第二题答案数据就是有问题啊