SWEA [D1] N줄덧셈 - 2025 JAVA

YB·2026년 5월 12일
post-thumbnail

링크텍스트

설명

풀이 흐름 설명

시간복잡도: O(1), 공간복잡도: O(1)

회독

  • [ x ] 1회
  • 2회
  • 3회

코드

import java.util.Scanner;
import java.io.FileInputStream;

class Solution
{
	public static void main(String args[]) throws Exception
	{
		Scanner sc = new Scanner(System.in);
		
        int N = sc.nextInt();
        
	     System.out.print((N*(N+1))/2);
	}
}

profile
안녕하세요

0개의 댓글