Skip to content

Commit

Permalink
Merge pull request #1 from Dongun614/Dongun614-patch-1
Browse files Browse the repository at this point in the history
Create 2024-01-01-backjoon11382.md
  • Loading branch information
Dongun614 authored Jan 1, 2024
2 parents f7f65a9 + a7f7281 commit 3f1012b
Showing 1 changed file with 62 additions and 0 deletions.
62 changes: 62 additions & 0 deletions _posts/2024-01-01-backjoon11382
Original file line number Diff line number Diff line change
@@ -0,0 +1,62 @@
---
layout: single
title: ๐Ÿ’ปBaekjoon 11382๐Ÿ’ป
---

## ๐Ÿ“ขBriefing

์˜ค๋Š˜์€ ๋ฐฑ์ค€ ๋ฌธ์ œ 11382๋ฒˆ์„ ํ’€์–ด๋ณด๊ณ ์ž ํ•œ๋‹ค.

## ๋ฌธ์ œ

### "๋ฐฑ์ค€ 11382. Bronze 5"

๋ฌธ์ œ : ๊ผฌ๋งˆ ์ •๋ฏผ์ด๋Š” ์ด์ œ A + B ์ •๋„๋Š” ์‰ฝ๊ฒŒ ๊ณ„์‚ฐํ•  ์ˆ˜ ์žˆ๋‹ค. ์ด์ œ A + B + C๋ฅผ ๊ณ„์‚ฐํ•  ์ฐจ๋ก€์ด๋‹ค!

์ž…๋ ฅ : ์ฒซ ๋ฒˆ์งธ ์ค„์— A, B, C (1 โ‰ค A, B, C โ‰ค 1012)์ด ๊ณต๋ฐฑ์„ ์‚ฌ์ด์— ๋‘๊ณ  ์ฃผ์–ด์ง„๋‹ค.
์ถœ๋ ฅ : A+B+C์˜ ๊ฐ’์„ ์ถœ๋ ฅํ•œ๋‹ค.

์˜ˆ๋ฅผ ๋“ค์–ด 77, 77, 7777์ด ์ž…๋ ฅ๋˜๋ฉด
77 + 77 + 7777 = 7931๋ฅผ ๊ณ„์‚ฐํ•ด์„œ 7931์„ ์ถœ๋ ฅํ•˜๋Š” ํ”„๋กœ๊ทธ๋žจ์„ ๋งŒ๋“œ๋Š” ๊ฒƒ์ด๋‹ค.

์ƒ๊ฐ ํ›„ ์ฝ”๋”ฉ
```
1. ์‚ฌ์šฉ์ž์—๊ฒŒ A, B, C ๊ฐ’์„ ์ž…๋ ฅ๋ฐ›๋Š”๋‹ค.
2. ๋ฐ›์€ ๊ฐ’์„ ๋ชจ๋‘ ๋”ํ•œ๋‹ค โ†’ ๋ณ€์ˆ˜ ํ•„์š”
3. ๋”ํ•œ ๊ฐ’์„ ์ถœ๋ ฅํ•œ๋‹ค.
```

์œ„ ์ƒ๊ฐ์„ ๋ฐ”ํƒ•์œผ๋กœ ์ž‘์„ฑํ•œ ์ฝ”๋“œ๋Š” ์•„๋ž˜์™€ ๊ฐ™๋‹ค.

```
#include <iostream>
using namespace std;

int main(void){
long long num1, num2, num3;
long long sum;

cin>>num1>>num2>>num3;
sum = num1 + num2 + num3;
cout<<sum<<endl;

return 0;
}
```

์ฒ˜์Œ์—๋Š” long long ๋Œ€์‹  int๋ฅผ ์‚ฌ์šฉํ•ด์„œ ์˜ค๋‹ต์œผ๋กœ ์ฑ„์ ๋˜์—ˆ๋‹ค.

int์™€ long long์˜ ์ฐจ์ด๋Š” ํ• ๋‹น๋˜๋Š” ๋ฉ”๋ชจ๋ฆฌ์˜ ํฌ๊ธฐ์—์„œ ์ฐจ์ด๊ฐ€ ๋‚œ๋‹ค.

int์˜ ๊ฒฝ์šฐ์—๋Š” 4byte๊ฐ€ ํ• ๋‹น๋˜๊ณ  long long์—๋Š” 8byte๊ฐ€ ํ• ๋‹น๋œ๋‹ค.

์ด ์ฐจ์ด๊ฐ€ ๋ฌธ์ œ์˜ ์ •๋‹ต๊ณผ ์˜ค๋‹ต์„ ๊ฐ€๋ฅด๊ฒŒ ๋˜๋Š” ๋ถ€๋ถ„์ด์—ˆ๋‹ค.

๋ฐ˜๋ฉด int๊ณผ long์€ ๋˜‘๊ฐ™์ด 4byte๊ฐ€ ํ• ๋‹น๋˜๋Š”๋ฐ ๋ฌด์—‡์ด ๋‹ค๋ฅธ ๊ฒƒ์ผ๊นŒ?

์ด ๋ถ€๋ถ„์— ๋Œ€ํ•ด์„œ๋Š” ๋‹ค๋ฅธ ํฌ์ŠคํŒ…์—์„œ ์•Œ์•„๋ณด๋„๋ก ํ•˜์ž.

--

**๐Ÿ”์ฐธ๊ณ ํ•œ ์‚ฌ์ดํŠธ:** <br>
[Baekjoon](https://www.acmicpc.net/problem/11382)<br>

0 comments on commit 3f1012b

Please sign in to comment.