Skip to content

Commit

Permalink
[14기 손서희]C# 기초 세션 1차시 과제 제출
Browse files Browse the repository at this point in the history
[14기 손서희]C# 기초 세션 1차시 과제 제출
  • Loading branch information
ruruisryu authored Jul 15, 2024
2 parents 3500eaa + 41eb175 commit 69f031a
Show file tree
Hide file tree
Showing 5 changed files with 66 additions and 0 deletions.
Binary file added .vs/Project2/v16/.suo
Binary file not shown.
47 changes: 47 additions & 0 deletions king_assignment_cs1.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace Project2
{
class king_assignment_cs1
{
static int n, k;
static int[] num = new int[1000001];

static int GetMax(List<int> arr, int l, int r)
{
int cnt = 0;
while (r < n)
{
if (num[arr[r]] != k)
{
num[arr[r]]++;
r++;
}
else
{
num[arr[l]]--;
l++;
}
cnt = Math.Max(cnt, r - l);
}
return cnt;
}

static void Main()
{
var input = Console.ReadLine().Split(' ');
n = int.Parse(input[0]);
k = int.Parse(input[1]);

List<int> arr = Console.ReadLine().Split(' ').Select(int.Parse).ToList();

int maxCnt = GetMax(arr, 0, 0);

Console.WriteLine(maxCnt);
}
}
}
19 changes: 19 additions & 0 deletions 지난 과제/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
## 👑 과제 제출 방법

**1. 초기 세팅**

* 해당 레포지토리를 fork한다.
* fork 한 레포지토리를 clone 해 원격에서 작업한다.

**2. 과제 제출 방법**

* `자신의 로컬 브랜치`(ex.12-ksy) 내 이번 과제에 해당하는 폴더(ex.git-github-1) 안에 과제물을 업로드한 뒤 `자신의 원격 브랜치`(ex.EwhaKing:12-ksy)로 PR을 날린다.
* PR의 제목은 `[기수 이름] 과제명 제출`(ex. [12기 강승연] git-github-1 과제 제출)로 한다.
* 필요할 시 label에 `help wanted`, `question` 을 붙인다.
* 빠른 확인이 필요할 경우 Reviewers 에 `KangSYeon`을 할당한다.

**3. 참고**

* Pull requests 에 들어가면 PR 예시가 존재한다.
* 만약 과제를 다시 제출해야 할 경우 PR의 제목 형식을 유지한 채 `enhancement` 태그를 단다.
* 브랜치에 추가해야 할 커밋이 있을 경우 다시 PR을 날릴 필요 없이 동일 브랜치에 커밋 후 푸시하면 자동으로 PR에 추가된다.
Binary file added 지난 과제/assignment1.PNG
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added 지난 과제/캡처.PNG
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.

0 comments on commit 69f031a

Please sign in to comment.