比赛 2025.5.4 评测结果 TTTTTTTTTT
题目名称 数列操作η 最终得分 0
用户昵称 会挽弯弓满月 运行时间 19.992 s
代码语言 C++ 内存使用 4.89 MiB
提交时间 2025-05-04 11:56:32
显示代码纯文本
#include <bits/stdc++.h>
#define ll long long
using namespace std;
const int N=1e5+10;
ll n,q;
ll a[N],b[N];
string opt;
ll l,r;
int main(){
	freopen("eta.in","r",stdin);
	freopen("eta.out","w",stdout);
	scanf("%lld%lld",&n,&q);
	for(int i=1;i<=n;i++){
		scanf("%lld",&b[i]);
	}
	while(q--){
		cin>>opt;
		scanf("%lld%lld",&l,&r);
		if(opt=="add"){
			for(ll i=l;i<=r;i++){
				a[i]++;
			}
		}
		else{
			ll ans=0,t;
			for(ll i=l;i<=r;i++){
				t=a[i]/b[i];
				ans+=t;
			}
			printf("%lld\n",ans);
		}
	}
	return 0;
}