반응형
250x250
Notice
Recent Posts
Recent Comments
Link
일 | 월 | 화 | 수 | 목 | 금 | 토 |
---|---|---|---|---|---|---|
1 | 2 | |||||
3 | 4 | 5 | 6 | 7 | 8 | 9 |
10 | 11 | 12 | 13 | 14 | 15 | 16 |
17 | 18 | 19 | 20 | 21 | 22 | 23 |
24 | 25 | 26 | 27 | 28 | 29 | 30 |
31 |
Tags
- 서울맛집
- 대구카페
- programmers
- oracle
- 큐
- 프로그래머스
- 수성못삼겹살
- 대구데이트
- 압구정데이트
- 대구맛집
- 대명동맛집
- 별찍기
- 백준
- 조건문
- 대구삼겹살
- 오라클
- 브루트 포스
- 범어동맛집
- C#
- SQL
- BFS
- 수성못맛집
- 수성구맛집
- 수성구데이트
- 앞산카페
- 안지랑카페
- 들안길삼겹살
- 정렬
- 반복문
- 대구고깃집
Archives
- Today
- Total
모든 일상
C# 백준 2564번 색종이 문제 본문
728x90
반응형
100 X 100 이차원 배열을 생성하고 입력한 X, Y 값부터 + 10까지의 범위에 모두 "1"을 넣고
마지막에 1의 개수를 합이 곧 이 문제의 답이 된다.
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace ConsoleApplication2
{
public class Program
{
public static void Main(string[] args)
{
int num = int.Parse(Console.ReadLine());
string[,] arr = new string[100,100];
int cnt = 0;
while (num > 0)
{
string[] buff = Console.ReadLine().Split();
int x = int.Parse(buff[0]);
int y = int.Parse(buff[1]);
num--;
for (int i = 0; i < 10; i++)
{
for (int j = 0; j < 10; j++)
{
arr[x + i, y + j] = "1";
}
}
}
for(int i = 0; i<100; i++)
{
for(int j = 0; j<100; j++)
{
if (arr[i, j] == "1") cnt++;
}
}
Console.WriteLine(cnt);
}
}
}
728x90
반응형
'코딩 공부 > C#' 카테고리의 다른 글
[C# / 백준] 5086번 문제 배수와 약수 (0) | 2023.04.27 |
---|---|
[C# / 프로그래머스] Lv1. 나누어 떨어지는 숫자 배열 (0) | 2023.04.14 |
C# 백준 2231번 문제 분해합 (0) | 2023.01.12 |
C# 백준 2798번 문제 블랙잭 (0) | 2023.01.11 |
C# 백준 1427번 문제 소트인사이드 (0) | 2023.01.10 |