File tree Expand file tree Collapse file tree
프로그래머스/1/12912. 두 정수 사이의 합 Expand file tree Collapse file tree Original file line number Diff line number Diff line change 11# [ level 1] 두 정수 사이의 합 - 12912
22
3- [ 문제 링크] ( https://school.programmers.co.kr/learn/courses/30/lessons/12912?language=java )
3+ [ 문제 링크] ( https://school.programmers.co.kr/learn/courses/30/lessons/12912 )
44
55### 성능 요약
66
7- 메모리: 74.3 MB, 시간: 8.58 ms
7+ 메모리: 80.4 MB, 시간: 8.58 ms
88
99### 구분
1010
1616
1717### 제출 일자
1818
19- 2026년 06월 18일 16:55:17
19+ 2026년 06월 21일 13:39:18
2020
2121### 문제 설명
2222
Original file line number Diff line number Diff line change 1- import java .math .*;
2-
31class Solution {
42 public long solution (int a , int b ) {
5- long answer = 0 ;
6- int c = Math . min ( a , b );
7- int d = Math . max ( a , b );
8- for ( int i = c ; i <= d ; i ++){
9- answer += i ;
3+ long res = 0L ;
4+ if ( a > b ){
5+ for ( int i = b ; b <= a ; b ++) {
6+ res += b ;
7+ }
108 }
11- return answer ;
9+ else {
10+ for (int i = a ; a <= b ; a ++) {
11+ res += a ;
12+ }
13+ }
14+ return res ;
1215 }
1316}
You can’t perform that action at this time.
0 commit comments