2851번 - 슈퍼 마리오
#define _CRT_SECURE_NO_WARNINGS
#include <stdio.h>
int main(void)
{
int mushroom[11], score = 0;
for (int i = 1; i <= 10; i++)
scanf("%d", &mushroom[i]); // 입력
if (mushroom[1] == 100)
printf("%d", mushroom[1]);
else
score += mushroom[i];
if (score < 100)
if (score + mushroom[i + 1] >= 100)
int score1 = score + mushroom[i + 1];
int s1 = 100 - score;
int s2 = score1 - 100;
if (s1 > s2)
printf("%d", score1);
break;
}
else if (s1 == s2)
printf("%d", score);
continue;
return 0;
자꾸만 96%에서 틀리네요. 반례 부탁합니다!!
https://help.acmicpc.net/quest...
소스코드는 하단의 "소스 추가"란에 추가해주세요
댓글을 작성하려면 로그인해야 합니다.
jnaul990 2년 전
#define _CRT_SECURE_NO_WARNINGS
#include <stdio.h>
int main(void)
{
int mushroom[11], score = 0;
for (int i = 1; i <= 10; i++)
scanf("%d", &mushroom[i]); // 입력
if (mushroom[1] == 100)
printf("%d", mushroom[1]);
else
{
for (int i = 1; i <= 10; i++)
{
score += mushroom[i];
if (score < 100)
{
if (score + mushroom[i + 1] >= 100)
{
int score1 = score + mushroom[i + 1];
int s1 = 100 - score;
int s2 = score1 - 100;
if (s1 > s2)
{
printf("%d", score1);
break;
}
else if (s1 == s2)
{
printf("%d", score1);
break;
}
else
{
printf("%d", score);
break;
}
}
else
continue;
}
}
}
return 0;
}
자꾸만 96%에서 틀리네요. 반례 부탁합니다!!