Open Source Your Knowledge, Become a Contributor
Technology knowledge has to be shared and made accessible for free. Join the movement.
Les 64 fenêtres
Exercice 1
Ecrire un programme permettant d'afficher l'état des 64 fenêtres sous la forme d'un tableau de String.
Exercice 1
1
2
3
4
5
6
7
8
class swift_template_fenetre{
static func solve(fenetres:[String])-> [String]{
return ["F", "F", "F", "G", "F", "F", "F", "F", "F", "F", "F", "F", "F", "F", "F", "F", "F", "F", "F", "F", "F", "F", "F", "F", "F", "F", "F", "F", "F", "F", "F", "F", "F", "F", "F", "F", "F", "F", "F", "F", "F", "F", "F", "F", "F", "F", "F", "F", "G", "F", "F", "F", "F", "F", "F", "F", "F", "F", "F", "F", "F", "F", "F", "F"]
}
}
Enter to Rename, Shift+Enter to Preview
Exercice 2
Modifiez le programme de façon à renvoyer les numéros des visiteurs qui ont gagné à ce jeu. Le résultat est un tableau de Int.
Exercice 2
1
2
3
4
5
6
7
8
9
class swift_template_fenetre2{
static func getWinner(fenetres:[String])-> [Int]{
return [0]
}
}
Enter to Rename, Shift+Enter to Preview
Exercice 3
Modifiez le code précédent de façon à faire gagner avec une nouvelle règle:
On déclare gagant tous les visiteurs dont le numéros de brassard est égal aux numéros de fenêtres ouvertes (position 0).
Exercice 3
1
2
3
4
5
6
7
8
9
class swift_template_fenetre3{
static func getWinnerVersion2(fenetres:[String])-> [Int]{
return [0]
}
}
Enter to Rename, Shift+Enter to Preview
Référence
Open Source Your Knowledge: become a Contributor and help others learn. Create New Content