-
Notifications
You must be signed in to change notification settings - Fork 31
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[14기 손서희]C# 기초 세션 1차시 과제 제출
- Loading branch information
Showing
5 changed files
with
66 additions
and
0 deletions.
There are no files selected for viewing
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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); | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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에 추가된다. |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.