재원 넘버

han.user();·2023년 4월 9일
0

구름

목록 보기
6/20
post-thumbnail

import java.io.*;
class Main {
public static void main(String[] args) throws Exception {
        BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
        int answer = Integer.parseInt(br.readLine());
        long result = 0; 
        for(int i =1; i <= answer; i++) {
            result += Math.pow(3, i);
        }
        System.out.println(result);
    }
}
profile
I'm still hungry.

0개의 댓글