This commit is contained in:
2025-07-17 11:31:11 +09:00
parent 1cc0c43954
commit e304f900ee
29 changed files with 281 additions and 107 deletions

View File

@@ -12,7 +12,7 @@ BIBFLAGS := --input-directory=$(OUTDIR) --output-directory=$(OUTDIR)/
PRINTFORMAT := "\033[1;92;49m%s\033[m\n"
USE_MARKDOWN := true
USE_MARKDOWN := false
MARKDOWNS := $(wildcard markdown/*.md)
MARKDOWN_OUTPUTS := $(patsubst markdown/%.md,md-out/%.tex,$(MARKDOWNS))

BIN
assets/p413.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 471 KiB

BIN
assets/p414.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 594 KiB

BIN
assets/p418.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 602 KiB

BIN
assets/p419.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 673 KiB

View File

@@ -1,28 +1,28 @@
doc_class: nitreport
title: Insert Title Here
title: 第14回課題
author:
name: 高専 太郎
student_id: 0000-01
seating_number: 1
name: 柴田 健琉
student_id: 2024D14
seating_number: 15
date:
year: 令和7年
month: aa
day: bb
month: 07
day: 15
turnin:
year: 令和7年
month: cc
day: dd
month: 07
day: 17
school_name: abc高専
department: 一般
subject: 〇〇概論
professor: □□教員
school_name: 岐阜工業高等専門学校
department: 電子制御工学
subject: 情報処理I
professor: 岡崎 憲一
paper_config:
include_cover_page: true
include_table_of_contents: true
use_bib: false
use_bib: true
use_additional_packages: false
show_compiled_time: true
@@ -31,6 +31,9 @@ paper_config:
# - { name: "pkg-wo-opt", options: "" }
sections:
- { path: 'section/introduction.tex', newpg: true }
- { path: 'md-out/test.tex', newpg: false }
- { path: 'section/introduction.tex', newpg: false }
- { path: 'section/syntax.tex', newpg: true }
- { path: 'section/p413.tex', newpg: false }
- { path: 'section/p414.tex', newpg: false }
- { path: 'section/p418.tex', newpg: false }
- { path: 'section/p419.tex', newpg: false }

39
main.tex Normal file
View File

@@ -0,0 +1,39 @@
\documentclass{class/nitreport}
\reporttitle{第14回課題}
\reportauthor{柴田 健琉}
\studentid{2024D14}
\seatingnum{15}
\reportdate{令和7年}{07月}{15日}
\turnindate{令和7年}{07月}{17日}
\schoolname{岐阜工業高等専門学校}
\department{電子制御工学科}
\subject{情報処理I}
\professor{岡崎 憲一}
\pagenumbering{roman}
\begin{document}
\coverpage
\tableofcontents
\newpage
\pagenumbering{arabic}
\input{section/introduction.tex}
\input{section/syntax.tex}
\newpage
\input{section/p413.tex}
\input{section/p414.tex}
\input{section/p418.tex}
\input{section/p419.tex}
\printbibliography[heading=bibintoc,title={参考文献}]
\compiledTime
\end{document}

View File

@@ -1,18 +0,0 @@
# Hi
| x | y |
| --- | --- |
| 0 | 0 |
| 1 | 1 |
| 2 | 2 |
| 3 | 3 |
| 4 | 4 |
* i1
* i2
* i3
1. n1
2. n2
3. n3

BIN
output/main-opt-final.pdf Normal file

Binary file not shown.

BIN
output/main.pdf Normal file

Binary file not shown.

10
programs/p413/info.json Normal file
View File

@@ -0,0 +1,10 @@
{
"language": "C",
"name": "演習 4-13",
"description": "1から$n$までの総和を求めるプログラム。",
"output": {
"type": "screenshot",
"content": "./assets/p413.png"
},
"note": ""
}

BIN
programs/p413/main Executable file

Binary file not shown.

23
programs/p413/main.c Normal file
View File

@@ -0,0 +1,23 @@
#include <stdio.h>
int main(void) {
int n;
int sum = 0;
numInput:
printf("Input integer: ");
scanf("%d", &n);
if (n < 1) {
puts("Error: Please type in non-zero positive integer.");
goto numInput;
}
for (int i = 1; i <= n; i++) {
sum += i;
}
printf("ANS: %d", sum);
return 0;
}

10
programs/p414/info.json Normal file
View File

@@ -0,0 +1,10 @@
{
"language": "C",
"name": "演習 4-14",
"description": "1,2,3...8,9,0を入力した整数値個表示するプログラム。",
"output": {
"type": "screenshot",
"content": "./assets/p414.png"
},
"note": ""
}

BIN
programs/p414/main Executable file

Binary file not shown.

22
programs/p414/main.c Normal file
View File

@@ -0,0 +1,22 @@
#include <stdio.h>
int main(void) {
int n;
numInput:
printf("Input positive integer: ");
scanf("%d", &n);
if (n < 0) {
puts("Please input positive integer.");
goto numInput;
}
for (int i = 1; i <= n; i++) {
printf("%d", i % 10);
}
putchar('\n');
return 0;
}

10
programs/p418/info.json Normal file
View File

@@ -0,0 +1,10 @@
{
"language": "C",
"name": "演習 4-18",
"description": "入力した整数値の個数分アスタリスクを各行に5個ずつ表示するプログラム。",
"output": {
"type": "screenshot",
"content": "./assets/p418.png"
},
"note": ""
}

BIN
programs/p418/main Executable file

Binary file not shown.

25
programs/p418/main.c Normal file
View File

@@ -0,0 +1,25 @@
#include <stdio.h>
#define CHARSPERLINE 5
int main(void) {
int n;
numInput:
printf("Input integer: ");
scanf("%d", &n);
if (n < 1) {
puts("Please input non-zero positive integer.");
goto numInput;
}
for (int i = 1; i <= n; i++) {
putchar('*');
if (i % CHARSPERLINE == 0) {
putchar('\n');
}
}
return 0;
}

10
programs/p419/info.json Normal file
View File

@@ -0,0 +1,10 @@
{
"language": "C",
"name": "演習 4-19",
"description": "入力した整数値の全約数とその個数を表示するプログラム。",
"output": {
"type": "screenshot",
"content": "./assets/p419.png"
},
"note": ""
}

BIN
programs/p419/main Executable file

Binary file not shown.

26
programs/p419/main.c Normal file
View File

@@ -0,0 +1,26 @@
#include <stdio.h>
int main(void) {
int n;
int factors = 0;
numInput:
printf("Input integer: ");
scanf("%d", &n);
if (n < 1) {
puts("Please input positive integer.");
goto numInput;
}
for (int i = 1; i <= n; i++) {
if (n % i == 0) {
printf("%d\n", i);
factors++;
}
}
printf("Number of factors: %d\n", factors);
return 0;
}

View File

@@ -1,9 +1,6 @@
@online{example,
title = {Example Entry},
author = {Inc., Example},
organization = {Example, Inc.},
url = {https://www.example.com},
year = {1970},
month = {01},
urldate = {1970-01-01}
@online{cppref,
title = {for loop},
author = {cppreference},
url = {https://en.cppreference.com/w/c/language/for.html},
urldate = {2025-07-17}
}

View File

@@ -1,70 +1,12 @@
\section{はじめに}
Start Writing!
\subsection{実行環境}
Use lualatex + biber to compile.
Test Bib\cite{example}
いろはにほへと ちりぬるを
{\gtfamily \sffamily \LaTeX で自由な組版を。}
{\gtfamily \sffamily Write freely with \LaTeX{}.}
{\ttfamily LaTeX shall be free forever!}
\noindent
この行のテキストは四十二字です。ああああああああああああああああああああああああああいいいい
\defaultlistingstyle
\begin{lstlisting}[language=C, caption=Basic Hello World]
#include <stdlib.h>
int square(int n) {
return n*n;
}
int main(int argc, char** argv) {
char* msg = "Hello World";
int x = 3;
int y = square(x);
printf("%s\n", msg);
printf("f(x) = x^2; x: %d, y: %d\n", x, y);
return 0;
}
\end{lstlisting}
\begin{displaymath}
\int_{a}^{b} f(x) \,dx = F(b)-F(a)
\end{displaymath}
この課題のプログラムは以下の環境で動作することが確認されている:
\begin{itemize}
\item C
\item Python
\item Javascript
\item Rust
\item Haskell
\item OS: Arch Linux
\item CPU アーキテクチャ: \texttt{x86\_64}
\item C コンパイラ: \texttt{gcc バージョン 14.2.1 20250322 (GCC)}
\item C コンパイラオプション: \texttt{-Wall}
\end{itemize}
\begin{enumerate}
\item lualatex <filename>.tex
\item biber <filename>
\item lualatex <filename>.tex
\item lualatex <filename>.tex
\end{enumerate}
\newpage
\section{Section}
section
\subsection{Sub Section}
sub section
\paragraph{Paragraph}
paragraph

13
section/p413.tex Normal file
View File

@@ -0,0 +1,13 @@
\section{演習 4-13}
1から$n$までの総和を求めるプログラム。
\subsection{コードリスティング}
\lstinputlisting[language=C,title={演習 4-13}]{../programs/p413/main.c}
\subsection{実行結果}
\begin{center}
\includegraphics[width=\textwidth]{./assets/p413.png}
\end{center}

13
section/p414.tex Normal file
View File

@@ -0,0 +1,13 @@
\section{演習 4-14}
1,2,3...8,9,0を入力した整数値個表示するプログラム。
\subsection{コードリスティング}
\lstinputlisting[language=C,title={演習 4-14}]{../programs/p414/main.c}
\subsection{実行結果}
\begin{center}
\includegraphics[width=\textwidth]{./assets/p414.png}
\end{center}

13
section/p418.tex Normal file
View File

@@ -0,0 +1,13 @@
\section{演習 4-18}
入力した整数値の個数分アスタリスクを各行に5個ずつ表示するプログラム。
\subsection{コードリスティング}
\lstinputlisting[language=C,title={演習 4-18}]{../programs/p418/main.c}
\subsection{実行結果}
\begin{center}
\includegraphics[width=\textwidth]{./assets/p418.png}
\end{center}

13
section/p419.tex Normal file
View File

@@ -0,0 +1,13 @@
\section{演習 4-19}
入力した整数値の全約数とその個数を表示するプログラム。
\subsection{コードリスティング}
\lstinputlisting[language=C,title={演習 4-19}]{../programs/p419/main.c}
\subsection{実行結果}
\begin{center}
\includegraphics[width=\textwidth]{./assets/p419.png}
\end{center}

23
section/syntax.tex Normal file
View File

@@ -0,0 +1,23 @@
\section{今回の構文}
\section{\texttt{for}}
\texttt{for}文は繰り返しを記述する方法の一つで、1つの文と2つ式で構成される。
それぞれの式・文はセミコロンで分けられている。
\cite{cppref}
\defaultlistingstyle
\begin{lstlisting}[language=C, title={\texttt{for}}]
for (<カウンターの初期化文> ; <条件式> ; <反復式>) {
<文>...;
}
\end{lstlisting}
初期化文、条件式、反復式を全て省略すると無限ループになる。
\begin{lstlisting}[language=C, title={\texttt{for}文による無限ループ}]
for (;;) {
<文>...;
}
\end{lstlisting}