首页 > 其他分享 >ccfcsp 2023-09-02

ccfcsp 2023-09-02

时间:2023-11-25 16:12:39浏览次数:32  
标签:ccfcsp 02 int 09 nx ny choose data 1000

问题:

a。 80分档

1. 对于下标:题目中要求了下表n是从1开始

2.cout时要cout<<fixed<<value  注意要fixed 才能够输出完整的,不然只会输出前六位加上,且用e 的形式表示

 

代码:

#include<iostream> #include<math.h> using namespace std; int main() {     //n caozuo m geshu     double nx[1000]={0},ny[1000]={0};     int m_ground[1000]={0},m_roof[1000]={0};     int M_choose[1000]={0};     double M_data[1000]={0};     int n,m;     cin>>n>>m;     for(int i=1;i<=n;i++){cin>>M_choose[i]>>M_data[i];}     for(int i=0;i<m;i++){cin>>m_ground[i]>>m_roof[i]>>nx[i]>>ny[i];}
    for(int i=0;i<m;i++)         for(int j=m_ground[i];j<=m_roof[i];j++)         {             if (M_choose[j]==1)             {nx[i]=M_data[j]*nx[i];             ny[i]=M_data[j]*ny[i];}             if(M_choose[j]==2)             {double temp=nx[i];                 nx[i]=nx[i]*cos(M_data[j])-ny[i]*sin(M_data[j]);             ny[i]=ny[i]*cos(M_data[j])+temp*sin(M_data[j]);             }         }     for(int i=0;i<m;i++)     {         cout<<fixed<<nx[i]<<" "<<ny[i]<<endl;     }     return 0; }

标签:ccfcsp,02,int,09,nx,ny,choose,data,1000
From: https://www.cnblogs.com/wzzz-blogs/p/17855613.html

相关文章