Écrivez le code le plus court mesuré par le nombre d'octets pour générer une grille ASCII composée de losanges, compte tenu des paramètres suivants:
- m - nombre de losanges complets dans une rangée
- n - nombre de lignes
- s - côté du plus petit losange
- r - niveau d'imbrication - combien y a-t-il de losanges à l'intérieur des "base" (qui sont fonud entre les intersections de la grille)
Exemples
1. Input: 5 3 1 0
Output:
/\/\/\/\/\
\/\/\/\/\/
/\/\/\/\/\
\/\/\/\/\/
/\/\/\/\/\
\/\/\/\/\/
A 5x3 grid of rhombi with side 1, no nesting
2. Input: 3 2 2 0
Output:
/\ /\ /\
/ \/ \/ \
\ /\ /\ /
\/ \/ \/
/\ /\ /\
/ \/ \/ \
\ /\ /\ /
\/ \/ \/
A 3x2 grid of rhombi with side 2, no nesting
3. Input: 5 2 1 2
Output:
///\\\///\\\///\\\///\\\///\\\
///\\\///\\\///\\\///\\\///\\\
///\\\///\\\///\\\///\\\///\\\
\\\///\\\///\\\///\\\///\\\///
\\\///\\\///\\\///\\\///\\\///
\\\///\\\///\\\///\\\///\\\///
///\\\///\\\///\\\///\\\///\\\
///\\\///\\\///\\\///\\\///\\\
///\\\///\\\///\\\///\\\///\\\
\\\///\\\///\\\///\\\///\\\///
\\\///\\\///\\\///\\\///\\\///
\\\///\\\///\\\///\\\///\\\///
A 5x2 grid of rhombi with side 1 (the smallest rhombus), level of nesting is 2
4. Input: 4 2 2 1
Output:
//\\ //\\ //\\ //\\
///\\\///\\\///\\\///\\\
// \\// \\// \\// \\
\\ //\\ //\\ //\\ //
\\\///\\\///\\\///\\\///
\\// \\// \\// \\//
//\\ //\\ //\\ //\\
///\\\///\\\///\\\///\\\
// \\// \\// \\// \\
\\ //\\ //\\ //\\ //
\\\///\\\///\\\///\\\///
\\// \\// \\// \\//
A 4x2 grid of rhombi with side 2 with level of nesting 1
5. Input: 4 2 3 3
Output:
////\\\\ ////\\\\ ////\\\\ ////\\\\
/////\\\\\ /////\\\\\ /////\\\\\ /////\\\\\
//////\\\\\\//////\\\\\\//////\\\\\\//////\\\\\\
//////\\\\\\//////\\\\\\//////\\\\\\//////\\\\\\
///// \\\\\///// \\\\\///// \\\\\///// \\\\\
//// \\\\//// \\\\//// \\\\//// \\\\
\\\\ ////\\\\ ////\\\\ ////\\\\ ////
\\\\\ /////\\\\\ /////\\\\\ /////\\\\\ /////
\\\\\\//////\\\\\\//////\\\\\\//////\\\\\\//////
\\\\\\//////\\\\\\//////\\\\\\//////\\\\\\//////
\\\\\///// \\\\\///// \\\\\///// \\\\\/////
\\\\//// \\\\//// \\\\//// \\\\////
////\\\\ ////\\\\ ////\\\\ ////\\\\
/////\\\\\ /////\\\\\ /////\\\\\ /////\\\\\
//////\\\\\\//////\\\\\\//////\\\\\\//////\\\\\\
//////\\\\\\//////\\\\\\//////\\\\\\//////\\\\\\
///// \\\\\///// \\\\\///// \\\\\///// \\\\\
//// \\\\//// \\\\//// \\\\//// \\\\
\\\\ ////\\\\ ////\\\\ ////\\\\ ////
\\\\\ /////\\\\\ /////\\\\\ /////\\\\\ /////
\\\\\\//////\\\\\\//////\\\\\\//////\\\\\\//////
\\\\\\//////\\\\\\//////\\\\\\//////\\\\\\//////
\\\\\///// \\\\\///// \\\\\///// \\\\\/////
\\\\//// \\\\//// \\\\//// \\\\////
A 4x2 grid of rhombi with side 3, level of nesting 3
Assurez-vous d'afficher les losanges partiellement visibles sur les bords et les coins si nécessaire.