Skip to content

Instantly share code, notes, and snippets.

@shen0512
Created July 29, 2016 03:24
[Uva11689] Soda Surpler
//Java
import java.util.Scanner;
class uva11689{
public static void main(String args[]){
Scanner sc=new Scanner(System.in);
int cases=sc.nextInt();
for(int i=0;i<cases;i++){
int e=sc.nextInt(),f=sc.nextInt(),c=sc.nextInt();
int total=e+f,count=0;
while((total/c)!=0){
count=count+total/c; //共喝多少罐汽水
total=total/c+total%c; //手上剩下的瓶子
}
//Output
System.out.println(count);
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment