Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- package algorytmy;
- /**
- * kosmonauciZachlannie
- */
- public class kosmonauciZachlannie {
- /*
- a = k1 k4
- b = k2 k3 k4
- c = k3 k5
- d = k1 k2 k5
- */
- int[] listaKosmonautowDoWziecia = new int[5];
- static int a, b, c, d, numerKosmonauty = 0;
- public static void main(String[] args) {
- while ( a == 0 || b == 0 || c == 0 || d == 0 ) {
- switch ( numerKosmonauty ) {
- case 0:
- a++;
- d++;
- break;
- case 1:
- b++;
- d++;
- break;
- case 2:
- b++;
- c++;
- break;
- case 3:
- a++;
- b++;
- break;
- case 4:
- c++;
- d++;
- break;
- default:
- break;
- }
- System.out.println("Na pokład trafia kosmonauta " + numerKosmonauty);
- numerKosmonauty++;
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement