p8318,求助
  • 板块灌水区
  • 楼主TFBOYSIE
  • 当前回复0
  • 已保存回复0
  • 发布时间2023/3/12 14:43
  • 上次更新2023/10/23 21:46:23
查看原帖
p8318,求助
904158
TFBOYSIE楼主2023/3/12 14:43
#include<bits/stdc++.h>
using namespace std;
struct node{
int op,x,y;
}b[201];
int main()
{
 long long int a[1001],n,m;
 cin>>n>>m;
 for(int i=1;i<=n;i++)cin>>a[i]; 
 for(int i=1;i<=m;i++)
    cin>>b[i].op>>b[i].x>>b[i].y;
  for(int i=m;i>=1;i--)
  {
    int op,x,y;
    op=b[i].op; x=b[i].x; y=b[i].y;
    if(op==1){
        if(x=y)a[x]/2;
        else a[x]-=a[y];
    } else{
    if(x==y)a[x]=sqrt(a[x]+0.5);
    else a[x]/=a[y];
    }
  }
  for(int i=1;i<=n;i++)cout<<a[i]<<" ";
  return 0;
}
2023/3/12 14:43
加载中...