U E D R , A S I H C RSS

떡장수할머니/강소현

Source

import java.util.Scanner;
public class granma {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int d = sc.nextInt();
		int [] num = new int[d+1];
		num[0]=1;num[1]=1;
		for(int i=2; i<num.length; i++){
			num[i] = num[i-1]+num[i-2];
		}
		int k = sc.nextInt();
		find(num[d-3],num[d-2],k);
		
	}
	private static void find(int x, int y, int k) {
		int i=1;
		while(true){
			if((k-x*i)%y==0){
				System.out.println(i+"\n"+(k-x*i)/y);
				System.exit(0);
			}
			i++;
		}		
	}
}

  • 여담이지만 선릉역 주변에 찹살떡 파시는 아주머니 목소리 완전크심.. - 서지혜

Valid XHTML 1.0! Valid CSS! powered by MoniWiki
last modified 2021-02-07 05:29:21
Processing time 0.0102 sec