desislava_topuzakova

09. Spice Must Flow

Sep 24th, 2021
512
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.85 KB | None | 0 0
  1. import java.util.Scanner;
  2.  
  3. public class elevator {
  4. public static void main(String[] args) {
  5. Scanner scanner = new Scanner(System.in);
  6. int yield = Integer.parseInt(scanner.nextLine());
  7. //всеки ден -> добив - 26
  8. int days = 0; //общо работени дни
  9. int totalAmount = 0; //общ брой подправки
  10. //stop: yield < 100
  11. while(yield >= 100) {
  12. int workedSpices = yield - 26;
  13. totalAmount += workedSpices;
  14. yield -= 10;
  15. days++;
  16. }
  17.  
  18. System.out.println(days);
  19. //ako има подправки взимат 26
  20. //ако няма не взимат нищо
  21. if(totalAmount >= 26) {
  22. totalAmount -= 26;
  23. }
  24. System.out.println(totalAmount);
  25.  
  26.  
  27.  
  28.  
  29. }
  30. }
Advertisement
Add Comment
Please, Sign In to add comment