백준 #1964번 오각형, 오각형, 오각형…

jhj·2025년 1월 18일

백준 JAVA

목록 보기
558/583
import java.util.Scanner;
public class Main {
	public static void main(String[] args) {
		
		Scanner sc = new Scanner(System.in);
		
		int n = sc.nextInt();
		long total = 0;
		total += n + 1;
		
		for(int i = 0; i < n; i++) {
			total += (i + 1) * 3;
		}
		System.out.println(total % 45678);
		sc.close();
	}
}
profile
개발자를 꿈꾸는

0개의 댓글