Test instructions: The number of M operations for N is counted as the number of lucky numbers in the Count interval. Add a value to each number in the interval
Daniel on the internet is a tree-like array of line-segment trees can also be solved just a little hanging just learning line tree to strengthen the knowledge of the reserve and Code capability line Tree Single point update thank you for your advice
#include<iostream>#include<cstdio>#include<cstdlib>#include<cstring>#include<algorithm>UsingNamespace Std;int nM;int ans;int a[1000000];int tree[1000000];int b[50]={0,4,7,44,47,74,77,444,64u,474,477,744,747,774,777,4444,4447,4474,4477,4744,4747,4774,4777,7444,7447,7474,7477,7744,7747,7774,7777,};int F[1000000];voidPushup(int ID){Tree[ID]=tree[ID*2]+tree[ID*2+1];}voidUpdate(int ID,int Le,int RI,int x,int k){If(Le==ri){Tree[ID]+=k;Return;}int mid= (Le+ri)/2;If(x<=mid)Update(ID*2, le, midXK);ElseUpdate(ID*2+1, mid+1, RIXK);Pushup(ID);}IntQuery(int ID,int Le,int RI,int LL,int RR){If(LL<=le&&ri<=rr)Return tree[ID];int mid= (Le+ri)/2K=0;If(LL<=mid) K+=Query(ID*2, le, mid, LLRr);If(RR>mid) K+=Query(ID*2+1, mid+1, RI, LLRr);Return K;}IntMain(){int INM;scanf