梁乃元 • 2个月前
# include<bits/stdc++.h>
using namespace std ;
int a [10005] ;
int main ( )
{
int n , m ;
cin >> n >> m ;
for ( int i = 1 ; i <= n ; i ++ )
{
cin >> a [i] ;
}
while ( m -- )
{
int op , x , y ;
cin >> op ;
if ( ! ( op - 1 ) )
{
cin >> x >> y ;
for ( int i = 1 ; i * x <= n ; i ++ )
{
a [i * x] += y ;
}
}
else
{
cin >> x ;
cout << a [x] << endl ;
}
}
return 0 ;
}
评论: