Skip to content

hellozhuzi/exchange_gift

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

4 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

exchange_gift

本程序源于一个有趣的需求,圣诞节上大家交换礼物,需要随机配对。

思路:

数列a[N]

1、随机排序

从[0~N-i-1]中找个随机数j,a[j]与a[N-i-1]交换位置

2、配对

新的数列,两两输出即可

About

同学随机交换礼物的算法 OC 实现

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published