Viết mã ngắn nhất được đo bằng số byte để tạo lưới ASCII gồm rhombi, với các tham số sau:
- m - số lượng hình thoi hoàn chỉnh trong một hàng
- n - số lượng hàng
- s - bên của hình thoi nhỏ nhất
- r - mức độ lồng nhau - có bao nhiêu hình thoi bên trong "những cái cơ sở" (đó là sự kết hợp giữa các giao điểm của lưới)
Ví dụ
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
Hãy chắc chắn để hiển thị hình thoi có thể nhìn thấy một phần ở các cạnh và góc khi cần thiết.