Author : Jisan
Programming language : Java
Difficulty : Easy
Status : Accepted
Problem number : UVA-10346
http://uva.onlinejudge.org/index.php?option=com_onlinejudge&Itemid=8&page=show_problem&problem=1287
Code:
import java.util.Scanner;
public class Uva_10346 {
public static void main(String[] args) {
Scanner in = new Scanner(System.in);
int n = 0, k = 0, ans, butt = 0;
while (in.hasNext()) {
n = ans = butt = in.nextInt();
k = in.nextInt();
while ((n =butt/k) > 0) {
ans+= n;
butt = butt%k + n;
}
System.out.println(ans);
}
}
}
Programming language : Java
Difficulty : Easy
Status : Accepted
Problem number : UVA-10346
http://uva.onlinejudge.org/index.php?option=com_onlinejudge&Itemid=8&page=show_problem&problem=1287
Code:
import java.util.Scanner;
public class Uva_10346 {
public static void main(String[] args) {
Scanner in = new Scanner(System.in);
int n = 0, k = 0, ans, butt = 0;
while (in.hasNext()) {
n = ans = butt = in.nextInt();
k = in.nextInt();
while ((n =butt/k) > 0) {
ans+= n;
butt = butt%k + n;
}
System.out.println(ans);
}
}
}
No comments:
Post a Comment