fork download
  1. import java.util.Scanner;
  2.  
  3. class Main {
  4. public static void main(String[] args) {
  5. Scanner scan = new Scanner(System.in);
  6. int max = scan.nextInt();
  7. int[] backpuck = new int[max];
  8. int suitcase = 0;
  9. int N = scan.nextInt();
  10. for (int i = 1; i < N; i++) {
  11. int cennost1 = scan.nextInt();
  12. if(cennost1 < max) {
  13. backpuck = cennost1;
  14. }else{
  15. suitcase = cennost1;
  16. }
  17. int cennost2 = scan.nextInt();
  18. if(cennost2 < max) {
  19. backpuck += cennost2;
  20. }else{
  21. suitcase = cennost2;
  22. }
  23. int cennost3 = scan.nextInt();
  24. if(cennost3 < max) {
  25. backpuck += cennost3;
  26. }else{
  27. suitcase = cennost3;
  28. }
  29. int cennost4 = scan.nextInt();
  30. if(cennost4 < max) {
  31. backpuck += cennost4;
  32. }else{
  33. suitcase = cennost4;
  34. int cennost5 = scan.nextInt();
  35. if(cennost5 < max) {
  36. backpuck += cennost5;
  37. }else{
  38. suitcase = cennost5;
  39. }
  40. }
  41. System.out.println(buckpuck);
  42. System.out.println(suitcase);
  43. }
  44. }
  45. }
Compilation error #stdin compilation error #stdout 0s 0KB
stdin
Standard input is empty
compilation info
Main.java:13: error: incompatible types: int cannot be converted to int[]
                backpuck = cennost1;
                           ^
Main.java:19: error: bad operand types for binary operator '+'
                backpuck += cennost2;
                         ^
  first type:  int[]
  second type: int
Main.java:25: error: bad operand types for binary operator '+'
                backpuck += cennost3;
                         ^
  first type:  int[]
  second type: int
Main.java:31: error: bad operand types for binary operator '+'
                backpuck += cennost4;
                         ^
  first type:  int[]
  second type: int
Main.java:36: error: bad operand types for binary operator '+'
                backpuck += cennost5;
                         ^
  first type:  int[]
  second type: int
Main.java:41: error: cannot find symbol
    System.out.println(buckpuck);
                       ^
  symbol:   variable buckpuck
  location: class Main
6 errors
stdout
Standard output is empty