Toggle navigation
Home
Latest pastes
FAQ
Random
BitBin is shutting down!
Register
Login
UVA 102
SUBMITTED BY:
Guest
DATE:
Dec. 5, 2013, 3:19 p.m.
FORMAT:
Java
SIZE:
2.2 kB
Raw
Download
Tweet
HITS:
993
Go to comments
Report
import
java.util.*
;
public
class
Main
{
public
static
void
main
(
String
[]
args
)
{
// write your code here
Scanner
sc
=
new
Scanner
(
System
.
in
);
int
count
,
tmp
,
min
;
int
i
,
j
;
String
result
;
while
(
true
){
count
=
tmp
=
0
;
min
=
Integer
.
MAX_VALUE
;
result
=
""
;
if
(
!
sc
.
hasNext
())
{
break
;
}
int
[]
B
=
new
int
[
3
]
;
int
[]
G
=
new
int
[
3
]
;
int
[]
C
=
new
int
[
3
]
;
B
[
0
]
=
sc
.
nextInt
();
G
[
0
]
=
sc
.
nextInt
();
C
[
0
]
=
sc
.
nextInt
();
B
[
1
]
=
sc
.
nextInt
();
G
[
1
]
=
sc
.
nextInt
();
C
[
1
]
=
sc
.
nextInt
();
B
[
2
]
=
sc
.
nextInt
();
G
[
2
]
=
sc
.
nextInt
();
C
[
2
]
=
sc
.
nextInt
();
//BCG
tmp
=
G
[
0
]
+
C
[
0
]
+
B
[
1
]
+
B
[
2
]
+
G
[
1
]
+
C
[
2
]
;
if
(
tmp
<
min
){
min
=
tmp
;
result
=
"BCG"
;
}
//BGC
tmp
=
G
[
0
]
+
C
[
0
]
+
B
[
1
]
+
C
[
1
]
+
B
[
2
]
+
G
[
2
]
;
if
(
tmp
<
min
){
min
=
tmp
;
result
=
"BGC"
;
}
//CBG
tmp
=
B
[
0
]
+
G
[
0
]
+
G
[
1
]
+
C
[
1
]
+
B
[
2
]
+
C
[
2
]
;
if
(
tmp
<
min
){
min
=
tmp
;
result
=
"CBG"
;
}
//CGB
tmp
=
B
[
0
]
+
G
[
0
]
+
B
[
1
]
+
C
[
1
]
+
C
[
2
]
+
G
[
2
]
;
if
(
tmp
<
min
){
min
=
tmp
;
result
=
"CGB"
;
}
//GBC
tmp
=
B
[
0
]
+
C
[
0
]
+
C
[
1
]
+
G
[
1
]
+
B
[
2
]
+
G
[
2
]
;
if
(
tmp
<
min
){
min
=
tmp
;
result
=
"GBC"
;
}
//GCB
tmp
=
B
[
0
]
+
C
[
0
]
+
B
[
1
]
+
G
[
1
]
+
G
[
2
]
+
C
[
2
]
;
if
(
tmp
<
min
){
min
=
tmp
;
result
=
"GCB"
;
}
System
.
out
.
println
(
result
+
" "
+
min
);
}
}
}
Please enable JavaScript to view the
comments powered by Disqus.
comments powered by
Disqus