// Playground - noun: a place where people can play import UIKit //------------------------------------------------------------------------------ // 1. for // 传统的for循环方式在swift中同样支持 var num = 0 for(var i = 0; i < 10 ; i++) { num += i } num //---------…
这几天做了几道随机生成数组的题,且需要用nth-elemeng函数,并且都是北航出的多校题…… 首先我们先贴一下随机生成数组函数的代码: unsigned x = A, y = B, z = C; unsigned rng61() { unsigned t; x ^= x << ; x ^= x >> ; x ^= x << ; t = x; x = y; y = z; z = t ^ x ^ y; return z; } 这个函数的原理原谅我不太懂,就不多说了-_-|…
// Playground - noun: a place where people can play import UIKit //------------------------------------------------------------------------------ // 1. for // 传统的for循环方式在swift中相同支持 var num = 0 for(var i = 0; i < 10 ; i++) { num += i } num //---------…