标签:class int ios 冲突 names register def define namespace
题面
https://www.luogu.org/problem/P3396
题解
#include<cstdio> #include<iostream> #define ri register int using namespace std; int n,m; int a[150050]; int ans[450][450]; char ch; int main(){ scanf("%d %d",&n,&m); for (ri i=1;i<=n;i++) { scanf("%d",&a[i]); for (ri j=1;j<=400;j++) ans[j][i%j]+=a[i]; } int x,y; for (ri i=1;i<=m;i++) { ch=getchar(); while (ch!=‘A‘ && ch!=‘C‘) ch=getchar(); scanf("%d %d",&x,&y); if (ch==‘A‘) { if (x>400) { int sum=0; y%=x; for (ri j=y;j<=n;j+=x) sum+=a[j]; printf("%d\n",sum); } else { printf("%d\n",ans[x][y]); } } else { for (ri j=1;j<=400;j++) ans[j][x%j]-=a[x]; a[x]=y; for (ri j=1;j<=400;j++) ans[j][x%j]+=a[x]; } } }
标签:class int ios 冲突 names register def define namespace
原文地址:https://www.cnblogs.com/shxnb666/p/11427204.html