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
MY NEW
Test 1(2018)
Proyecto1
stl_sizeof.cc
CodeChef P1 MATMIN1
C++ object lifecycle example
TraiectorieIdeala
runtime template mode processor
stl_sizeof
‘int R::print() const’ cannot be overloaded