Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[13기 표은서] Unity 2차시 과제 제출 #150

Open
wants to merge 23 commits into
base: 13-pes
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
23 commits
Select commit Hold shift + click to select a range
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
# king-assignment/.gitignore
.DS_Store
36 changes: 36 additions & 0 deletions C#과제1
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
// 자연수 A를 B번 곱한 수를 알고 싶다.
// 단, 구하려는 수가 매우 커질 수 있으므로 이를 C로 나눈 나머지를 구하는 프로그램을 작성하시오.

static void Main(string[] args)
{
StreamWriter writer = new StreamWriter(Console.OpenStandardOutput());
StreamReader reader = new StreamReader(Console.OpenStandardInput());

long[] input = Array.ConvertAll(reader.ReadLine().Split(), long.Parse);
long a = input[0];
long b = input[1];
long c = input[2];

// 지수 법칙 : a^(n+m) = a^n * a^m
// 모듈러 성질 : (a * b) % c = (a % c * b % c) % c
writer.WriteLine(DaC(a, b));

reader.Close();
writer.Close();

// DivideAndConquer
long DaC(long a, long b)
{
if (b == 1)
return a % c;

// 재귀적 풀이법
long value = DaC(a, b / 2);

// 짝수
if (b % 2 == 0)
return value * value % c;
else // 홀수
return (value * value % c) * a % c;
}
}
47 changes: 47 additions & 0 deletions C#과제2
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
// 강아지 멍멍 모니터링 및 출력 코드

using System;

public class DogMonitor
{
// 짖음 이벤트에 대한 델리게이트 선언
public delegate void BarkHandler();

// 짖음 이벤트 선언
public event BarkHandler OnBark;

// 강아지가 짖는 메소드
public void Bark()
{
Console.WriteLine("멍멍!");
// 짖음 이벤트 발생
OnBark?.Invoke();
}
}

public class DogBarkNotifier
{
// 짖음 알림을 받는 메소드
public void Notify()
{
Console.WriteLine("강아지가 멍멍!");
}
}

class Program
{
static void Main(string[] args)
{
// 강아지 모니터 인스턴스
DogMonitor dogMonitor = new DogMonitor();

// 강아지 짖음 알림기 인스턴스
DogBarkNotifier notifier = new DogBarkNotifier();

// 강아지 짖음 이벤트에 강아지 짖음 알림기's Notify 메소드 구독
dogMonitor.OnBark += notifier.Notify;

// 강아지가 멍멍!
dogMonitor.Bark();
}
}
83 changes: 83 additions & 0 deletions CSharp/bj14888.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,83 @@
using System;
using System.Collections.Generic;

class Program
{
static int[] Calc(int op, int op1, int op2)
{
switch (op)
{
case 0: // 더하기
return new int[] { op1 + op2 };
case 1: // 빼기
return new int[] { op1 - op2 };
case 2: // 곱하기
return new int[] { op1 * op2 };
case 3: // 나누기
if (op2 != 0)
return new int[] { op1 / op2 };
break;
}
// 0으로 나누거나 잘못된 연산자인 경우 null 반환
return null;
}

// 백트래킹을 통해 가능한 모든 경우의 수를 탐색
static void BackTracking(int value, int index, int n, ref int vmax, ref int vmin, List<int> nums, List<int> op)
{
// 모든 피연산자를 사용한 경우
if (index == n)
{
vmax = Math.Max(vmax, value);
vmin = Math.Min(vmin, value);
return;
}

// 아직 사용하지 않은 피연산자가 있는 경우
for (int i = 0; i < 4; i++)
{
if (op[i] == 0)
continue;

op[i]--;
int[] result = Calc(i, value, nums[index]);
if (result != null)
{
int nextValue = result[0];
BackTracking(nextValue, index + 1, n, ref vmax, ref vmin, nums, op);
}
op[i]++;
}
}

static Tuple<int, int> Solution(int n, List<int> nums, List<int> op)
{
int vmax = int.MinValue, vmin = int.MaxValue;
BackTracking(nums[0], 1, n, ref vmax, ref vmin, nums, op);
return Tuple.Create(vmax, vmin);
}

static void Main(string[] args)
{
// 입력 받기
int n = int.Parse(Console.ReadLine());
List<int> nums = new List<int>();
List<int> op = new List<int>();

string[] numsStr = Console.ReadLine().Split(' ');
for (int i = 0; i < n; i++)
{
nums.Add(int.Parse(numsStr[i]));
}

string[] opStr = Console.ReadLine().Split(' ');
for (int i = 0; i < 4; i++)
{
op.Add(int.Parse(opStr[i]));
}
//문제 풀이 & 결과 출력
var result = Solution(n, nums, op);
Console.WriteLine(result.Item1);
Console.WriteLine(result.Item2);
}
}
12 changes: 10 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,17 @@
* `자신의 로컬 브랜치`(ex.12-ksy) 내 이번 과제에 해당하는 폴더(ex.git-github-1) 안에 과제물을 업로드한 뒤 `자신의 원격 브랜치`(ex.EwhaKing:12-ksy)로 PR을 날린다.
* PR의 제목은 `[기수 이름] 과제명 제출`(ex. [12기 강승연] git-github-1 과제 제출)로 한다.
* 필요할 시 label에 `help wanted`, `question` 을 붙인다.
* 빠른 확인이 필요할 경우 Reviewers 에 `KangSYeon`을 할당한다.
* 빠른 확인이 필요할 경우 Reviewers 에 `KangSYeon`을 할당 후 Request를 누른다.

**3. 참고**
**3. 과제 확인 프로세스**

1. 양식에 맞게 PR을 보낸다.
2. 과제가 정상제출 처리됐을 시 `checked` label이 붙고 merge된다.
3. 만약 과제에 개선이 필요할 시 `more enhancement` label이 붙는다.
4. comment를 보고 과제를 수정한 뒤 `enhancement` label이 붙는다.
5. 만약 과제에 더 개선이 필요할 시 `enhancement` label이 사라지고(`more enhancement` label은 유지) 수정 요청 comment가 달린다.

**4. 참고**

* Pull requests 에 들어가면 PR 예시가 존재한다.
* 만약 과제를 다시 제출해야 할 경우 PR의 제목 형식을 유지한 채 `enhancement` 태그를 단다.
Expand Down
111 changes: 111 additions & 0 deletions Unity/Unity_King_2024/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,111 @@
# Created by https://www.toptal.com/developers/gitignore/api/unity,macos
# Edit at https://www.toptal.com/developers/gitignore?templates=unity,macos

### macOS ###
# General
.DS_Store

.AppleDouble
.LSOverride

# Icon must end with two \r
Icon


# Thumbnails
._*

# Files that might appear in the root of a volume
.DocumentRevisions-V100
.fseventsd
.Spotlight-V100
.TemporaryItems
.Trashes
.VolumeIcon.icns
.com.apple.timemachine.donotpresent

# Directories potentially created on remote AFP share
.AppleDB
.AppleDesktop
Network Trash Folder
Temporary Items
.apdisk

### macOS Patch ###
# iCloud generated files
*.icloud

### Unity ###
# This .gitignore file should be placed at the root of your Unity project directory
#
# Get latest from https://github.com/github/gitignore/blob/main/Unity.gitignore
/[Ll]ibrary/
/[Tt]emp/
/[Oo]bj/
/[Bb]uild/
/[Bb]uilds/
/[Ll]ogs/
/[Uu]ser[Ss]ettings/

# MemoryCaptures can get excessive in size.
# They also could contain extremely sensitive data
/[Mm]emoryCaptures/

# Recordings can get excessive in size
/[Rr]ecordings/

# Uncomment this line if you wish to ignore the asset store tools plugin
# /[Aa]ssets/AssetStoreTools*

# Autogenerated Jetbrains Rider plugin
/[Aa]ssets/Plugins/Editor/JetBrains*

# Visual Studio cache directory
.vs/

# Gradle cache directory
.gradle/

# Autogenerated VS/MD/Consulo solution and project files
ExportedObj/
.consulo/
*.csproj
*.unityproj
*.sln
*.suo
*.tmp
*.user
*.userprefs
*.pidb
*.booproj
*.svd
*.pdb
*.mdb
*.opendb
*.VC.db

# Unity3D generated meta files
*.pidb.meta
*.pdb.meta
*.mdb.meta

# Unity3D generated file on crash reports
sysinfo.txt

# Builds
*.apk
*.aab
*.unitypackage
*.app

# Crashlytics generated file
crashlytics-build.properties

# Packed Addressables
/[Aa]ssets/[Aa]ddressable[Aa]ssets[Dd]ata/*/*.bin*

# Temporary auto-generated Android Assets
/[Aa]ssets/[Ss]treamingAssets/aa.meta
/[Aa]ssets/[Ss]treamingAssets/aa/*

# End of https://www.toptal.com/developers/gitignore/api/unity,macos
5 changes: 5 additions & 0 deletions Unity/Unity_King_2024/.vscode/extensions.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
{
"recommendations": [
"visualstudiotoolsforunity.vstuc"
]
}
10 changes: 10 additions & 0 deletions Unity/Unity_King_2024/.vscode/launch.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
{
"version": "0.2.0",
"configurations": [
{
"name": "Attach to Unity",
"type": "vstuc",
"request": "attach"
}
]
}
60 changes: 60 additions & 0 deletions Unity/Unity_King_2024/.vscode/settings.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,60 @@
{
"files.exclude": {
"**/.DS_Store": true,
"**/.git": true,
"**/.vs": true,
"**/.gitmodules": true,
"**/.vsconfig": true,
"**/*.booproj": true,
"**/*.pidb": true,
"**/*.suo": true,
"**/*.user": true,
"**/*.userprefs": true,
"**/*.unityproj": true,
"**/*.dll": true,
"**/*.exe": true,
"**/*.pdf": true,
"**/*.mid": true,
"**/*.midi": true,
"**/*.wav": true,
"**/*.gif": true,
"**/*.ico": true,
"**/*.jpg": true,
"**/*.jpeg": true,
"**/*.png": true,
"**/*.psd": true,
"**/*.tga": true,
"**/*.tif": true,
"**/*.tiff": true,
"**/*.3ds": true,
"**/*.3DS": true,
"**/*.fbx": true,
"**/*.FBX": true,
"**/*.lxo": true,
"**/*.LXO": true,
"**/*.ma": true,
"**/*.MA": true,
"**/*.obj": true,
"**/*.OBJ": true,
"**/*.asset": true,
"**/*.cubemap": true,
"**/*.flare": true,
"**/*.mat": true,
"**/*.meta": true,
"**/*.prefab": true,
"**/*.unity": true,
"build/": true,
"Build/": true,
"Library/": true,
"library/": true,
"obj/": true,
"Obj/": true,
"Logs/": true,
"logs/": true,
"ProjectSettings/": true,
"UserSettings/": true,
"temp/": true,
"Temp/": true
},
"dotnet.defaultSolution": "Unity_King_2024.sln"
}
8 changes: 8 additions & 0 deletions Unity/Unity_King_2024/Assets/Scenes.meta

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading