U E D R , A S I H C RSS

달리기/강소현 (rev. 1.2)

달리기/강소현

Source

import java.util.Scanner;
public class Running {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int M = sc.nextInt();
		int T = sc.nextInt();
		int U = sc.nextInt();
		int F = sc.nextInt();
		int D = sc.nextInt();
		
		int [] path = new int[T];
		
		for(int i=0; i<T; i++){
			if(sc.next().equals("f")){
				path[i] = F*2;
			}else{
				path[i] = U+D;
			}
		}
		int run = 0;
		for(int i=0; i<T; i++){
			run += path[i];
			if(run >= M){
				System.out.println(i);
				break;
			}
		}
	}
}
Valid XHTML 1.0! Valid CSS! powered by MoniWiki
last modified 2021-02-07 05:28:55
Processing time 0.0274 sec