일 | 월 | 화 | 수 | 목 | 금 | 토 |
---|---|---|---|---|---|---|
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
- JPA프록시
- 데이터베이트h2
- OSIV
- springbootH2
- MySqlType
- 에이치투데이터베이스
- JPA Hint & Lock
- springboot기본설정
- spring
- sql
- Git
- embededtype
- httppie
- gitinitial
- 임베디드타입
- JPA값타입
- 스프링부트
- 스프링부트기본설정
- 이해와 원리
- jpqlquery
- Open EntityManager
- javageneric
- JDBC connection pool
- jpa
- springbootproxy
- dockercmd
- 자바제너릭
- JPAmapping
- JPAproxy
- 제이피큐엘쿼리
Archives
- Today
- Total
빡코
[과제]프로그래머스_두 정수 사이의 합 본문
https://programmers.co.kr/learn/courses/30/lessons/12912
package programers;
import java.util.Arrays;
public class Solution1 {
public long solution(int a, int b) {
long answer = 0;
int[] num = {a,b};
Arrays.sort(num);
int a1 = num[0];
int b1= num[1];
if(a1!=b1) {
for(int i=a1;i<=b1;i++) {
answer+=i;
}
}else{
answer = a1;
}
return answer;
}
public static void main(String[] args) {
Solution1 sl = new Solution1();
System.out.println(sl.solution(5, 3));
}
}
'Algorithm' 카테고리의 다른 글
백준_1931번_회의실배정 (0) | 2020.01.16 |
---|---|
백준_11399번_ATM (0) | 2020.01.15 |
[과제] 설명 준비해오기1 (0) | 2020.01.02 |
[ 과제]백준_ 11047번_동전0 (0) | 2020.01.02 |
[과제]백준_ 10872번 _팩토리얼 (0) | 2020.01.02 |