Run Code
|
API
|
Code Wall
|
Misc
|
Feedback
|
Login
|
Theme
|
Privacy
|
Patreon
always_late
#include <bits/stdc++.h> using namespace std; int main() { ios_base::sync_with_stdio(false); cin.tie(NULL); long int p =pow(10,9)+7; long long int a[10000],sum; int t,n,q,x,y,z; scanf("%d",&t); while(t--) { scanf("%d%d",&n,&q); for(int i=0;i<n;i++) scanf("%lld",&a[i]); for(int i=1;i<=q;i++) { scanf("%d",&x); if(x==1) { scanf("%d",&y); sum = 0 ; for(int i=y;i<=n;i+=y) sum = (sum + a[i-1]*a[i-1]); if(sum>p) printf("%lld\n",(sum%p)); else printf("%lld\n",sum); } if(x==2) { scanf("%d%d",&y,&z); a[y-1]=z; } } } }
run
|
edit
|
history
|
help
0
Handling new types without using RTTI
zeroout
static_cast makes a copy
area of a circle using pointer
finding counting multiple no that became a no
/
Facebook - Split into monotonic sequences
5
My Tuple class
2015(M2)Simulare