01204212/icecream
รุ่นแก้ไขเมื่อ 03:21, 3 พฤศจิกายน 2559 โดย Jittat (คุย | มีส่วนร่วม)
- This is part of 01204212
Tasks: icecream shop 3, icecream shop 4
Test data: icecream3, icecream4
เนื้อหา
Links
- Java priority queue class
- An example on how to add custom objects to the priority queue: stackoverflow
Codes
Customer class (for icecream3)
public class Customer implements Comparable<Customer> {
public int age;
public int id;
public Customer(int i, int a) {
id = i; age = a;
}
@Override
public int compareTo(Customer a) {
if(age < a.age) {
return -1;
} else if(age > a.age) {
return 1;
} else {
return 0;
}
}
}
Sample outputs
icecream3
Answer for n1000a.in (first 15 lines):
941855 652484 873447 822903 892748 432709 379980 679815 538760 374795 921908 174871 751693 371595 14346
Answer for n100000b.in (first 15 lines):
541932 125245 165780 827150 487479 824741 913162 493532 563729 714886 315377 445543 532953 22524 168978
icecream4
Answer for n100000a.in (first 15 lines):
157726 646406 135578 877759 646159 612081 488145 982535 955624 154100 762687 520843 743231 144842 378444
'Answer for n100000d.in (first 15 lines):
763548 739589 663667 64820 317254 375870 934699 743202 338115 31066 251780 274842 881545 76890 820892