Pages

1/19/2014

UVA 10346 Solution

import java.util.Scanner;

class Main {

/**
* @param args
*/
public static void main(String[] args) {
// TODO Auto-generated method stub
Scanner sc = new Scanner(System.in);
while (sc.hasNext()) {
int x = sc.nextInt();
if (x==0) break;
int y = sc.nextInt();
System.out.println(x + ((x-1)/(y-1)));
}

}

}

No comments :

Post a Comment