-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathCodare date.java
More file actions
40 lines (40 loc) · 1.14 KB
/
Codare date.java
File metadata and controls
40 lines (40 loc) · 1.14 KB
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
32
33
34
35
36
37
38
39
40
import java.util.*;
public class ECCPR{
public static void main(String []args){
int n,max=0,aux=0;
char x,y;
String nr;
char []arr=new char[13];
Scanner sc=new Scanner(System.in);
n=sc.nextInt();
for(int i=0;i<=n;i++){
nr=sc.nextLine();
arr=nr.toCharArray();
for(int j=0;j<nr.length()-1;){
x=nr.charAt(j);
y=nr.charAt(j+2);
arr[j]=y;
arr[j+2]=x;
j+=4;
}
String str = new String(arr);
//System.out.println(str);
for(int j=0;j<str.length();j++){
if(str.charAt(j)!=' '){
int number = Character.getNumericValue(str.charAt(j));
if(number%2==1&&j!=0){
aux++;
}
if(j==0){
aux+=number;
}
}
}
if(aux>max){
max=aux;
}
aux=0;
}
System.out.print(max);
}
}