Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
J
java-e003-generala
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Pedro Rolon
java-e003-generala
Commits
23ba7ce5
Commit
23ba7ce5
authored
Oct 24, 2018
by
Pedro Rolon
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Se solucionó un bug en la comprobación de las escaleras
parent
9cdb9e95
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
43 additions
and
5 deletions
+43
-5
Generala.java
+43
-5
No files found.
Generala.java
View file @
23ba7ce5
...
...
@@ -22,11 +22,6 @@ public class Generala
return
"INVALIDO"
;
}
//Para comprobar los tres casos posibles de escalera
if
(
dados
.
equals
(
"12345"
)
||
dados
.
equals
(
"23456"
)
||
dados
.
equals
(
"34561"
)){
return
"ESCALERA"
;
}
//array para tener la cantidad de apariciones de un número
int
[]
cantidad
=
{
0
,
0
,
0
,
0
,
0
,
0
};
for
(
int
i
=
0
;
i
<
dados
.
length
();
i
++){
...
...
@@ -40,6 +35,48 @@ public class Generala
cantidad
[
index
-
1
]++;
}
boolean
bandera
=
true
;
System
.
out
.
print
(
cantidad
[
0
]+
"|"
+
cantidad
[
1
]+
"|"
+
cantidad
[
2
]+
"|"
+
cantidad
[
3
]+
"|"
+
cantidad
[
4
]+
"|"
+
cantidad
[
5
]);
System
.
out
.
println
();
//Comprueba la escalera 12345
for
(
int
i
=
0
;
i
<
5
;
i
++)
{
if
(
cantidad
[
i
]!=
1
){
bandera
=
false
;
break
;
}
}
if
(
bandera
){
return
"ESCALERA"
;
}
bandera
=
true
;
//Comprueba la escalera 23456
for
(
int
i
=
1
;
i
<
6
;
i
++)
{
if
(
cantidad
[
i
]!=
1
){
bandera
=
false
;
break
;
}
}
if
(
bandera
){
return
"ESCALERA"
;
}
bandera
=
true
;
//Comprueba la escalera 34561
for
(
int
i
=
2
;
i
<
6
;
i
++)
{
if
(
cantidad
[
i
]!=
1
){
bandera
=
false
;
break
;
}
}
if
(
cantidad
[
0
]!=
1
){
bandera
=
false
;
}
if
(
bandera
){
return
"ESCALERA"
;
}
//calcula el máximo del vector cantidad
int
max
=
maximo
(
cantidad
);
//System.out.println(max);
...
...
@@ -141,5 +178,6 @@ public class Generala
*/
}
}
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment