-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMain.java
More file actions
31 lines (27 loc) · 751 Bytes
/
Main.java
File metadata and controls
31 lines (27 loc) · 751 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
package com.company;
public class Main {
public static int feladat01(String [] szinek){
if(szinek.length == 0 || szinek.length == 1){
return 0;
}
int szam = 0;
int kezdo = 1;
int szamlalo = kezdo;
for(int i = 0; i < szinek.length; i++){
while(szamlalo < szinek.length){
szam++;
szamlalo++;
}
szamlalo = kezdo+1;
kezdo++;
}
if(szinek.length > 2){
szam++;
}
return szam;
}
public static void main(String[] args) {
String[] szinek = {"prios", "kék","zöld"};
System.out.println(feladat01(szinek));
}
}