P9510 题解插图及源码
题解链接:洛谷P9510 「STA - R3」高维立方体 题解
插图一
源码:
\documentclass{standalone}
\usepackage{tikz}
\begin{document}
\begin{tikzpicture}
\draw[->] (0, 0) -- (6, 0);
\draw[->] (0, 0) -- (0, 9);
\node[below = 4pt, left] at (0, 0) { $O$ };
\node[below] at (6, 0) { $x$ };
\node[left] at (0, 9) { $y$ };
\draw[very thin, color = gray] (0, 9) grid (6, 0);
\draw[blue, line width = 1pt] (0, 0) -- (5, 0) -- (5, 8) -- (0, 8) -- (0, 0);
\draw[blue, line width = 1pt] (0, 1) -- (1, 1) -- (1, 0);
\draw[blue, line width = 1pt] (2, 0) -- (2, 1) -- (1, 1);
\draw[blue, line width = 1pt] (2, 1) -- (2, 3);
\draw[blue, line width = 1pt] (0, 3) -- (5, 3);
\node[below, red] at (0.5, 0) { $1$ };
\node[below, red] at (1.5, 0) { $1$ };
\node[below, red] at (3.5, 0) { $3$ };
\node[left, red] at (0, 2) { $2$ };
\node[above, red] at (2.5, 8) { $5$ };
\end{tikzpicture}
\end{document}
插图二
源码:(不会画立体图,目前只能用坐标来画,比较蠢)
\documentclass{standalone}
\usepackage{tikz}
\begin{document}
\begin{tikzpicture}[line width = 0.6pt]
% \draw[very thin, color = gray] (0, 8) grid (8, 0);
\draw (0, 0) -- (3, 0) -- (3, 3) -- (0, 3) -- cycle;
\draw (0, 3) -- (1.5, 4.5) -- (4.5, 4.5) -- (3, 3);
\draw (4.5, 4.5) -- (4.5, 3.5) -- (6.5, 3.5) -- (6.5, 1.5);
\draw (3, 0) -- (5, 0) -- (5.5, 0.5) -- (6.5, 1.5);
\draw (5.5, 0.5) -- (5.5, 1.5) -- (3.5, 1.5) -- (3, 1);
\draw (3, 1) -- (5, 1);
\draw (4, 0) -- (4, 1) -- (4.5, 1.5);
\draw (5, 0) -- (5, 1) -- (5.5, 1.5);
\draw (3.5, 1.5) -- (3.5, 2.5) -- (4.5, 3.5);
\draw (3.5, 2.5) -- (5.5, 2.5) -- (5.5, 1.5);
\draw (5.5, 2.5) -- (6.5, 3.5);
\draw[dotted] (0, 0) -- (1.5, 1.5) -- (4.5, 1.5);
\draw[dotted] (1.5, 1.5) -- (1.5, 4.5);
% \draw[dotted] (4.5, 1.5) -- (6.5, 1.5);
\draw[dotted] (4, 0) -- (4.5, 0.5);
\draw[dotted] (3.5, 0.5) -- (5.5, 0.5);
\draw[dotted] (3, 0) -- (3.5, 0.5) -- (3.5, 1.5);
\draw[dotted] (4.5, 0.5) -- (4.5, 1.5);
% \draw[dotted] (4.5, 4.5) -- (4.5, 1.5);
\node[below, red] at (1.5, 0) { $3$ };
\node[below, red] at (3.5, 0) { $1$ };
\node[below, red] at (4.5, 0) { $1$ };
\node[below, red] at (6.1, 1) { $2$ };
\end{tikzpicture}
\begin{tikzpicture}[line width = 0.6pt]
% \draw[very thin, color = gray] (0, 8) grid (8, 0);
\draw (0, 0) -- (3, 0) -- (3, 3) -- (0, 3) -- cycle;
\draw (0, 3) -- (1.5, 4.5) -- (4.5, 4.5) -- (3, 3);
\draw (4.5, 4.5) -- (4.5, 3.5) -- (6.5, 3.5) -- (6.5, 1.5);
\draw (3, 0) -- (5, 0) -- (5.5, 0.5) -- (6.5, 1.5);
\draw (5.5, 0.5) -- (5.5, 1.5) -- (3.5, 1.5) -- (3, 1);
\draw (3, 1) -- (5, 1);
\draw (4, 0) -- (4, 1) -- (4.5, 1.5);
\draw (5, 0) -- (5, 1) -- (5.5, 1.5);
\draw (3.5, 1.5) -- (3.5, 2.5) -- (4.5, 3.5);
\draw (3.5, 2.5) -- (5.5, 2.5) -- (5.5, 1.5);
\draw (5.5, 2.5) -- (6.5, 3.5);
\draw[dotted] (0, 0) -- (1.5, 1.5) -- (4.5, 1.5);
\draw[dotted] (1.5, 1.5) -- (1.5, 4.5);
% \draw[dotted] (4.5, 1.5) -- (6.5, 1.5);
\draw[dotted] (4, 0) -- (4.5, 0.5);
\draw[dotted] (3.5, 0.5) -- (5.5, 0.5);
\draw[dotted] (3, 0) -- (3.5, 0.5) -- (3.5, 1.5);
\draw[dotted] (4.5, 0.5) -- (4.5, 1.5);
% \draw[dotted] (4.5, 4.5) -- (4.5, 1.5);
\node[below, red] at (1.5, 0) { $3$ };
\node[below, red] at (3.5, 0) { $1$ };
\node[below, red] at (4.5, 0) { $1$ };
\node[below, red] at (6.1, 1) { $2$ };
\draw[densely dashed, red, line width = 1pt] (3, 3) -- (5, 3) -- (6.5, 4.5) -- (4.5, 4.5) -- cycle;
\draw[densely dashed, red, line width = 1pt] (3, 2) -- (5, 2) -- (6.5, 3.5) -- (4.5, 3.5) -- cycle;
\draw[densely dashed, red, line width = 1pt] (3, 3) -- (3, 2);
\draw[densely dashed, red, line width = 1pt] (5, 3) -- (5, 2);
\draw[densely dashed, red, line width = 1pt] (6.5, 4.5) -- (6.5, 3.5);
\draw[densely dashed, red, line width = 1pt] (4.5, 4.5) -- (4.5, 3.5);
\end{tikzpicture}
\end{document}