Night_Lord's blog

By Night_Lord, history, 4 weeks ago, In English

Hello, I got stuck here in this problem from cses Subarray Divisibility.I know that showing solutions is prohibited from cses but still I need some help here.My solution is here.Plz don't down vote me.If u can't help me just ignore this topic.

 
 
 
 
  • Vote: I like it
  • 0
  • Vote: I do not like it

»
4 weeks ago, # |
  Vote: I like it 0 Vote: I do not like it

My approach to this problem would be to calculate a prefix sum mod N. This gives N possible values for each prefix sum. Count the number of occurrences of each prefix sum and then do the sum of those numbers choose 2. This problem is very similar to http://usaco.org/index.php?page=viewproblem2&cpid=595

»
4 weeks ago, # |
  Vote: I like it +1 Vote: I do not like it

straight forward answer has geeks for geeks for this. Here is the link for this