1. ๋ฌธ์
10๊ฐ์ ์๋ฅผ ์
๋ ฅ ๋ฐ์, ๊ทธ ์ค์์ ๊ฐ์ฅ ํฐ ์๋ฅผ ์ถ๋ ฅํ๋ ํ๋ก๊ทธ๋จ์ ์์ฑํ๋ผ.
[์ ์ฝ ์ฌํญ]
๊ฐ ์๋ 0 ์ด์ 10000 ์ดํ์ ์ ์์ด๋ค.
[์
๋ ฅ]
๊ฐ์ฅ ์ฒซ ์ค์๋ ํ
์คํธ ์ผ์ด์ค์ ๊ฐ์ T๊ฐ ์ฃผ์ด์ง๊ณ , ๊ทธ ์๋๋ก ๊ฐ ํ
์คํธ ์ผ์ด์ค๊ฐ ์ฃผ์ด์ง๋ค.
๊ฐ ํ
์คํธ ์ผ์ด์ค์ ์ฒซ ๋ฒ์งธ ์ค์๋ 10๊ฐ์ ์๊ฐ ์ฃผ์ด์ง๋ค.
3
3 17 1 39 8 41 2 32 99 2
22 8 5 123 7 2 63 7 3 46
6 63 2 3 58 76 21 33 8 1
[์ถ๋ ฅ]
์ถ๋ ฅ์ ๊ฐ ์ค์ '#t'๋ก ์์ํ๊ณ , ๊ณต๋ฐฑ์ ํ ์นธ ๋ ๋ค์ ์ ๋ต์ ์ถ๋ ฅํ๋ค.
(t๋ ํ
์คํธ ์ผ์ด์ค์ ๋ฒํธ๋ฅผ ์๋ฏธํ๋ฉฐ 1๋ถํฐ ์์ํ๋ค.)
#1 99
#2 123
#3 76
2. ์์ค์ฝ๋
#include <stdio.h>
int main(void){
int a=0;//ํ
์คํธ์ ๊ฐฏ์
int b = 0;//test case
int max;
int i = 0;
int j =0;
scanf("%d" ,&a);
for(i=1; i<a+1; i++){
max = 0;
for(j=0; j<10; j++){
scanf("%d", &b);
if(max <= b){
max = b;
}
}
printf("#%d ",i);
printf("%d\n", max);
}
}
'Algorithm' ์นดํ ๊ณ ๋ฆฌ์ ๋ค๋ฅธ ๊ธ
[SW Expert Academy] #1945. ๊ฐ๋จํ ์์ธ์๋ถํด - Python (0) | 2019.11.06 |
---|---|
[SW Expert Academy] #1986. ์ง๊ทธ์ฌ๊ทธ ์ซ์ - Python (0) | 2019.11.06 |
[LeetCode] #198. House Robber - Python (0) | 2019.11.06 |
[LeetCode] #746. Min Cost Climbing Stairs - Python (0) | 2019.11.06 |
[LeetCode] #1025. Divisor Game - Python (0) | 2019.11.06 |