Notice
Recent Posts
Recent Comments
- Today
- Total
01-11 08:45
Tags
- ๋ฐ์ดํฐ๋ฒ ์ด์ค
- ์๋ฃ๊ตฌ์กฐ
- java
- pytorch
- ๊ตฌํ
- CS
- spring
- ์๋ฐ์์ ์
- Algorithm
- ์ธํด
- OOP
- ๋ฒจ๋งํฌ๋
- ๋ฐฑ์ค
- PS
- ๊ทธ๋ฆฌ๋
- ์๋ฐ
- database
- leetcode
- dp
- BFS
- ๋ค์ต์คํธ๋ผ
- array
- Graph
- tree
- ์กธ์ ์ํ
- ํ๋ก๊ทธ๋๋จธ์ค
- ๋ฐฑ์๋
- ๋ฌธ๋ฒ
- MST
- ์์์ ๋ ฌ
Link
Partially Committed
[์ํด๋ฆฌ ์ฑ๋ฆฐ์ง] ๋ถ์กฑํ ๊ธ์ก ๊ณ์ฐํ๊ธฐ ๋ณธ๋ฌธ
๐ฅ Algorithm || ๋ฌธ์ ํ์ด/PS
[์ํด๋ฆฌ ์ฑ๋ฆฐ์ง] ๋ถ์กฑํ ๊ธ์ก ๊ณ์ฐํ๊ธฐ
WonderJay 2022. 7. 5. 16:54728x90
๋ฐ์ํ
SMALL
https://school.programmers.co.kr/learn/courses/30/lessons/82612
๋ฌธ์ ๋ ๋งค์ฐ ๋จ์ํ๋, ์๋ฃํ์ ์ฃผ์ํด์ผํ๋ค.
signed int ์๋ฃํ์ ์ต๋๊ฐ์ 2,147,483,647 ์ธ๋ฐ, ํด๋น ๋ฌธ์ ์์ ๋์ฌ ์ ์๋ ๊ฐ์ฅ ํฐ ์๋ 7,815,625,000 ์ผ๋ก
integer ๋ฒ์๋ฅผ ๋ฐ์ด๋๋๋ค. ๊ทธ๋ฌ๋ฏ๋ก long long ์๋ฃํ์ ์ฌ์ฉํ์๋ค.
[C++]
#include <bits/stdc++.h>
#define fastio cin.tie(0)->sync_with_stdio(0)
#define ll long long
using namespace std;
long long solution(int price, int money, int count)
{
fastio;
ll answer = -1;
ll acc_price = 0;
for (int i = 1; i <= count; i++)
{
acc_price += (price * i);
}
return (acc_price - money) >= 0 ? acc_price - money : 0;
}
728x90
๋ฐ์ํ
LIST
'๐ฅ Algorithm || ๋ฌธ์ ํ์ด > PS' ์นดํ ๊ณ ๋ฆฌ์ ๋ค๋ฅธ ๊ธ
[ํ๋ก๊ทธ๋๋จธ์ค] ๊ฐ์ด๋ฐ ๊ธ์ ๊ฐ์ ธ์ค๊ธฐ (0) | 2022.07.05 |
---|---|
[2018 KAKAO BLIND RECRUITMENT] (1์ฐจ) ๋น๋ฐ์ง๋ (0) | 2022.07.05 |
[์๊ฐ ์ฝ๋ ์ฑ๋ฆฐ์ง ์์ฆ3] ๋๋จธ์ง๊ฐ 1์ด ๋๋ ์ ์ฐพ๊ธฐ (0) | 2022.07.05 |
[์ํด๋ฆฌ ์ฑ๋ฆฐ์ง] ์ต์์ง์ฌ๊ฐํ (0) | 2022.07.04 |
[ํ๋ก๊ทธ๋๋จธ์ค] 2016๋ (0) | 2022.07.04 |
Comments