c언어 1806번 부분합 (백준)
#include #include int main(void) { int n = 0; int s = 0; int i = 1; int ans = 100001; scanf("%d %d", &n, &s); //동적할당 (heap메모리) long long int *a = (long long int*) malloc(sizeof(long long int) * (n+3)); a[0] = 0; while(i = s) ans = 1; //하나만으로도 s이상이면 정답은 1 a[i] += a[i-1] + tmp; i++; } if(ans == 1) { //정답이 1이면 바로 종료 printf("%d", ans); return 0; } if(a[n] < s) { //모든걸 다합쳐도 s미만이면, 정답은 0 printf("0"); ..
c언어/BAEKJOON
2022. 10. 11. 22:24
최근에 올라온 글
최근에 달린 댓글
- Total
- Today
- Yesterday
링크
TAG
- BFS
- 플로이드
- 누적합
- 세그먼트 트리
- 트리
- 6198
- 백준
- 최대공약수
- 6198번
- union
- 그리디
- 정렬
- 덱
- 오프라인 쿼리
- 16120번
- C++
- Mo.s
- DFS
- 그래프
- 최소 스패닝 트리
- C언어
- Krustal
- find
- java
- 스택
- 1835번
- 카드
- 1835
- 누적 합
- DP
일 | 월 | 화 | 수 | 목 | 금 | 토 |
---|---|---|---|---|---|---|
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 |
글 보관함