Advertisement
Guest User

Untitled

a guest
Nov 9th, 2018
98
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Kotlin 0.40 KB | None | 0 0
  1.    @Test
  2.     fun nahojdenieCheacSumm(){
  3.         val mass = arrayOf(3, 1, 4, 1, 5, 9)
  4.         var result = 0
  5.         val seed = 113
  6.         val limit = 10000007
  7.         for (i in 0..mass.lastIndex){
  8.             result = (result + i) * seed
  9.             if (result > limit){
  10.                 result = (result + i) * seed
  11.                 result %= limit
  12.             }
  13.         }
  14.         print(result)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement