관리 메뉴

NineTwo meet you

[CodeUp/자바] 1091 : [기초-종합] 수 나열하기3 본문

카테고리 없음

[CodeUp/자바] 1091 : [기초-종합] 수 나열하기3

NineTwo 2020. 12. 21. 18:50
반응형

출처


코드

import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
public class CodeUp1091 {
public static void main(String[] args) throws IOException {
BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
String str[] = br.readLine().split(" ");
int a = Integer.parseInt(str[0]);
int m = Integer.parseInt(str[1]);
int d = Integer.parseInt(str[2]);
int n = Integer.parseInt(str[3]);
long result = a;
for(int i = 1; i < n; i++) {
result = result*m + d;
}
System.out.print(result);
}
}
view raw CodeUp1091.java hosted with ❤ by GitHub
반응형
Comments