T7

  1 #include<iostream>
  2 #include<cstring>
  3 #include<cstdio>
  4 #include<algorithm>
  5 using namespace std;
  6 int s,n;
  7 int op;
  8 const int maxn=2e6+10;
  9 int c[maxn];
 10 struct SS
 11 {
 12     int lowbit(int x)
 13     {
 14         return x&(-x);
 15     }
 16     void add(int x,int w)
 17     {
 18         for(;x<=n;x+=lowbit(x))
 19         {
 20             c[x]+=w;
 21         }
 22     }
 23     int sum(int x)
 24     {
 25         int res=0;
 26         for(;x;x-=lowbit(x))
 27         {
 28             res+=c[x];
 29         }
 30         return res;
 31     }
 32 }XX;
 33 int ans[maxn];
 34 
 35 struct node
 36 {
 37     int id;
 38     int op;
 39     int x1,x2,y1,y2;
 40     bool operator <(const node &x)const 
 41     {
 42         if(x1==x.x1)
 43         {
 44             return op<x.op;
 45         }
 46         return x1<x.x1;
 47     }
 48 }way[maxn],a[maxn];
 49 void cdq(int l,int r)
 50 {
 51     if(l==r)
 52     {
 53         return ;
 54     }
 55     int mid=(l+r)>>1;
 56     cdq(l,mid);
 57     cdq(mid+1,r);
 58     int cnt=0;
 59     for(int i=l;i<=mid;i++)
 60     {
 61         if(way[i].op==1)
 62         {
 63             a[cnt++]=way[i];
 64         }
 65     }
 66     for(int i=mid+1;i<=r;i++)
 67     {
 68         if(way[i].op==2)
 69         {
 70             a[cnt++]=way[i];
 71             a[cnt-1].op=0;
 72             a[cnt++]=way[i];
 73             a[cnt-1].op=2;
 74             a[cnt-1].x1=way[i].x2;
 75         }
 76     }
 77     sort(a,a+cnt);
 78     for(int i=0;i<cnt;i++)
 79     {
 80         if(a[i].op==0)
 81         {
 82             ans[a[i].id]-=(XX.sum(a[i].y2)-XX.sum(a[i].y1-1));
 83         }
 84         else
 85         if(a[i].op==1)
 86         {
 87             XX.add(a[i].y1,a[i].x2);
 88         }
 89         else
 90         {
 91             ans[a[i].id]+=(XX.sum(a[i].y2)-XX.sum(a[i].y1-1));
 92         }
 93     }
 94 }
 95 inline int read()
 96 {
 97     int x=0,f=1;
 98     char ch=getchar();
 99     while(isdigit(ch)==0 && ch!='-')ch=getchar();
100     if(ch=='-')f=-1,ch=getchar();
101     while(isdigit(ch))x=x*10+ch-'0',ch=getchar();
102     return x*f;
103 }
104 int main()
105 {
106     memset(c,0,sizeof(c));
107     memset(ans,0,sizeof(ans));
108     s=read();
109     n=read();
110     int cnt=0;
111     int tot=0;
112     while(scanf("%d",&op)&&op!=3)
113     {
114         if(op==1)
115         {
116             int x,y,z;
117             x=read();
118             y=read();
119             z=read();
120             way[++cnt].op=op;
121             way[cnt].id=-1;
122             way[cnt].x1=x;
123             way[cnt].y1=y;
124             way[cnt].x2=z;
125             way[cnt].y2=0;
126             
127         }
128         if(op==2)
129         {
130             int x1,x2,y1,y2;
131             x1=read();
132             y1=read();
133             x2=read();
134             y2=read();
135             way[++cnt].op=op;
136             way[cnt].id=++tot;
137             way[cnt].x1=x1;
138             way[cnt].x2=x2;
139             way[cnt].y1=y1;
140             way[cnt].y2=y2;
141         }
142     }
143     cdq(1,cnt);
144     for(int i=1;i<=tot;i++)
145     {
146         printf("%d\n",ans[i]);
147         //cout<<ans[i]<<endl;
148     }
149     return 0;
150 }

 

转载于:https://www.cnblogs.com/2529102757ab/p/10994530.html

分数阶傅里叶变换(Fractional Fourier Transform, FRFT)是对传统傅里叶变换的拓展,它通过非整数阶的变换方式,能够更有效地处理非线性信号以及涉及时频局部化的问题。在信号处理领域,FRFT尤其适用于分析非平稳信号,例如在雷达、声纳和通信系统中,对线性调频(Linear Frequency Modulation, LFM)信号的分析具有显著优势。LFM信号是一种频率随时间线性变化的信号,因其具有宽频带和良好的时频分辨率,被广泛应用于雷达和通信系统。FRFT能够更准地捕捉LFM信号的时间和频率信息,相比普通傅里叶变换,其性能更为出色。 MATLAB是一种强大的数值计算和科学计算工具,拥有丰富的函数库和用户友好的界面。在MATLAB中实现FRFT,通常需要编写自定义函数或利用信号处理工具箱中的相关函数。例如,一个名为“frft”的文件可能是用于执行分数阶傅里叶变换的MATLAB脚本或函数,并展示其在信号处理中的应用。FRFT的正确性验证通常通过对比变换前后信号的特性来完成,比如评估信号的重构质量、信噪比等。具体而言,可以通过计算原始信号与经过FRFT处理后的信号之间的相似度,或者对比LFM信号的关键参数(如初始频率、扫频率和持续时间)是否在变换后得到准确恢复。 在MATLAB代码实现中,通常包含以下步骤:首先,生成LFM信号模型,设定其初始频率、扫频率、持续时间和采样率等参数;其次,利用自定义的frft函数对LFM信号进行分数阶傅里叶变换;接着,使用MATLAB的可视化工具(如plot或imagesc)展示原始信号的时域和频域表示,以及FRFT后的结果,以便直观对比;最后,通过计算均方误差、峰值信噪比等指标来评估FRFT的性能。深入理解FRFT的数学原理并结合MATLAB编程技巧,可以实现对LFM信号的有效分析和处理。这个代码示例不仅展示了理论知识在
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值