Created
July 29, 2016 03:24
[Uva11689] Soda Surpler
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//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