kokusz19

2016nov818

Nov 2nd, 2017
234
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.90 KB | None | 0 0
  1. //https://progcont.hu/progcont/100171/?pid=200937
  2. import java.util.Scanner;
  3.  
  4. public class Test {
  5. //rovar - 6 láb, pók - 8 láb
  6.  
  7. public static void main(String[] args) {
  8. int fej, lab, rovar = 0, pok = 0, xd = 0;
  9. Scanner sc = new Scanner(System.in);
  10. while(sc.hasNext()){
  11. fej = Integer.parseInt(sc.next());
  12. lab = Integer.parseInt(sc.next());
  13. if(fej == 0 && lab == 0) break;
  14.  
  15. while((rovar * 6 + pok * 8) != lab){
  16. if(xd == 0){
  17. rovar = fej;
  18. xd++;
  19. }
  20. if(lab != rovar*6){
  21. rovar--;
  22. pok++;
  23. }
  24. }
  25. System.out.println(rovar + " " + pok);
  26.  
  27. xd = rovar = pok = 0;
  28. }
  29. }
  30. }
Advertisement
Add Comment
Please, Sign In to add comment