10925 - Krakovia

package uvaTry;

import java.math.BigInteger;
import java.util.Scanner;

public class Main10925 {

public static void main(String[] args) {
// TODO Auto-generated method stub
Scanner sc=new Scanner(System.in);
BigInteger value;
BigInteger total;
BigInteger div;
BigInteger com=new BigInteger("0");
int n,i,count=1;
BigInteger cost = null;
while(true)
{

total=new BigInteger("0");
n=sc.nextInt();
value=sc.nextBigInteger();
if(n==0&&value.compareTo(com)==0)
break;
for(i=0;i<n;i++)
{
cost=sc.nextBigInteger();
total=total.add(cost);


}
div=total.divide(value);
System.out.println("Bill #"+count+" costs "+total+": each friend should pay "+div);
System.out.print("\n");
count++;
}



}

}

SHARE

Amit Ghosh

    Blogger Comment
    Facebook Comment

0 comments :

Post a Comment