티스토리 뷰
import
java.util.Scanner;
class
YeungSik{
int
total;
void
sum(
int
[] newtime){
for
(
int
i=
0
;i<newtime.length;i++){
int
result=
0
;
while
(newtime[i]>=
0
)
{
result+=
10
;
newtime[i]-=
30
;
}
this
.total=
this
.total+result;
}
}
}
class
MinSik{
int
total;
void
sum(
int
[] newtime){
for
(
int
i=
0
;i<newtime.length;i++){
int
result=
0
;
while
(newtime[i]>=
0
)
{
result+=
15
;
newtime[i]-=
60
;
}
total=total+result;
}
}
}
class
Main{
public
static
void
main(String args[]){
Scanner scan =
new
Scanner(System.in);
int
N= scan.nextInt();
int
[] time=
new
int
[N];
int
[] time2=
new
int
[N];
for
(
int
i=
0
; i<N;i++){
time[i]=scan.nextInt();
time2[i]=time[i];
}
YeungSik ys=
new
YeungSik();
ys.sum(time);
MinSik ms=
new
MinSik();
ms.sum(time2);
if
(ms.total==ys.total)
System.out.println(
"Y M "
+ys.total);
else
if
(ms.total>ys.total)
System.out.println(
"Y "
+ys.total);
else
System.out.println(
"M "
+ms.total);
}
}
'BOJ' 카테고리의 다른 글
BOJ/백준온라인/2743번/단어 길이 재기 (0) | 2017.02.02 |
---|---|
BOJ/백준온라인/3943번/헤일스톤 수열 (0) | 2016.02.17 |
BOJ/백준온라인/2783번/삼각 김밥 (0) | 2016.02.17 |
BOJ/백준온라인/1373번/2진수 8진수 (0) | 2016.02.09 |
BOJ/백준온라인/1913번/달팽이 (0) | 2016.02.06 |
댓글