SWEA/[D1]

[D1] SWEA2068 최대수 구하기

ruming 2020. 9. 29. 18:31
#include <stdio.h>
int main(void){
	int tc, T;
	int a[10], max, i;
	scanf("%d", &T);
	for(tc=1; tc<=T; tc++){
        for(i=0; i<10; i++)	a[i] = 0;
		for(i=0; i<10; i++)	scanf("%d", &a[i]);
		max = a[0];
		for(i=1; i<10; i++)	max = max > a[i] ? max : a[i];
		printf("#%d %d\n", tc, max);
	}
	return 0;
}

max랑 비교해야 되는데 a[i]랑 a[i+1]랑 비교해서 틀릴뻔


swexpertacademy.com/main/code/problem/problemDetail.do?contestProbId=AV5QQhbqA4QDFAUq&categoryId=AV5QQhbqA4QDFAUq&categoryType=CODE

 

SW Expert Academy

SW 프로그래밍 역량 강화에 도움이 되는 다양한 학습 컨텐츠를 확인하세요!

swexpertacademy.com

 

'SWEA > [D1]' 카테고리의 다른 글

[D1] SWEA2058 - 자릿수 더하기  (0) 2021.04.07
[D1] SWEA2043 서랍의 비밀번호  (0) 2021.04.07
[D1] SWEA2070 큰 놈, 작은 놈, 같은 놈  (0) 2020.08.31
[D1] SWEA2025 N줄 덧셈  (0) 2020.08.29
[D1] SWEA2027 대각선 출력하기  (0) 2020.08.29