[백준] 14470번 : 전자레인지 - Java(자바)

강재원·2022년 9월 19일
0

[코딩테스트] Java

목록 보기
50/200



https://www.acmicpc.net/problem/14470

import java.util.*;
public class Main {
    public static void main(String args[]) {
        Scanner s=new Scanner(System.in);
        int a=s.nextInt(),b=s.nextInt(),c=s.nextInt(),d=s.nextInt(),e=s.nextInt();
        int time=0;
        if(a<0){
            time+=Math.abs(a)*c;
            a=0;
        } 
        if(a==0) time+=d;
        time+=(b-a)*e;
        System.out.print(time);
    }
}
profile
개념정리 & 문법 정리 & 알고리즘 공부

0개의 댓글