백준 8393 합

Solution 1

import java.util.Scanner;

public class Main {

    public static void main(String[] args) {

        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();

        int sum = 0;

        for (int i = 1; i <= n; i++) {
            sum += i;
        }

        System.out.println(sum);
    }
}
  • 시간 복잡도 : 212

  • 공간 복잡도 : 17568

  • 풀이 과정 :

Solution 2

  • 시간 복잡도 :

  • 공간 복잡도 :

  • 풀이 과정 :

Last updated