BOJ - [Basic Algebra - 5063 TGN] - BronzeIII๐ฅ
https://www.acmicpc.net/problem/5063 ๊ด๊ณ ๋ฅผ ํ์ง์์์๋ ์์ต๊ณผ ๊ด๊ณ ๋ฅผ ํ์๋ ์์ด์ต(๊ด๊ณ ๋ฅผ ํ์๋ ๋ฐ์ํ๋ ์ด์ต - ๊ด๊ณ ๋น์ฉ)์ ํฌ๊ธฐ๋ฅผ ๋น๊ตํด [advertise],[do not advertise],[does not matter]๋ก ํ๋จ ๊ฒฐ๊ณผ๋ฅผ ํ์...
1๋ถ ์ฝ๊ธฐ
๋ฌธ์
https://www.acmicpc.net/problem/5063
์ค๋ช
๊ด๊ณ ๋ฅผ ํ์ง์์์๋ ์์ต๊ณผ ๊ด๊ณ ๋ฅผ ํ์๋ ์์ด์ต(๊ด๊ณ ๋ฅผ ํ์๋ ๋ฐ์ํ๋ ์ด์ต - ๊ด๊ณ ๋น์ฉ)์ ํฌ๊ธฐ๋ฅผ ๋น๊ตํด [advertise],[do not advertise],[does not matter]๋ก ํ๋จ ๊ฒฐ๊ณผ๋ฅผ ํ์ํด๋ฌ๋ผ๋ ๊ฒ์ด ์กฐ๊ฑด์ธ ๋ฌธ์ ์๋ค. ๋ฐ๋ณต๋ฌธ์ผ๋ก ์ ๋ ฅ์๋ฐ๊ณ ํ๋จ์ํ๊ณ ๋ฐ๋ก ๊ฒฐ๊ณผ๋ฅผ ์ถ๋ ฅํ๋๊ฒ ์ธ์ ๋ณ ํน๋ณํ ๊ฒ์ด ์๋ค.
์ฝ๋
#include <stdio.h>
int main() {
int n;
scanf("%d",&n);
for(int i=0; i<n; i++)
{
int n_benefit, y_benefit, adv_cost;
scanf("%d %d %d",&n_benefit, &y_benefit, &adv_cost);
if(n_benefit<y_benefit-adv_cost)
printf("advertise");
else if (n_benefit == y_benefit-adv_cost)
printf("does not matter");
else if (n_benefit > y_benefit-adv_cost)
printf("do not advertise");
printf("\n");
}
return 0;
}