Advertisement
Flaron

Udemy_24. FlourPackProblem

Sep 14th, 2019
150
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.36 KB | None | 0 0
  1. package lista.Alapok;
  2.  
  3. public class Main {
  4.  
  5. public static boolean canPack(int bigCount, int smallCount, int goal) {
  6. if(bigCount<0 || smallCount<0 || goal<0) return false;
  7. return goal<=(bigCount*5+smallCount) && goal%5<=smallCount;
  8. }
  9.  
  10. public static void main(String[] args) {
  11. System.out.println(canPack(0,5,4));
  12. }
  13. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement