250x250
반응형
Notice
Recent Posts
Recent Comments
Link
N
(SWEA c++)3975. 승률 비교하기 본문
728x90
반응형
SW Expert Academy
SW 프로그래밍 역량 강화에 도움이 되는 다양한 학습 컨텐츠를 확인하세요!
swexpertacademy.com
cin, cout을 하면 시간 초과가 되므로 printf, scanf를 사용.
float 형으로 변수를 받아와서 처리하면 된다.
#include <iostream>
#include <cstdio>
using namespace std;
int main(void)
{
ios::sync_with_stdio(false);
cin.tie(0);
cout.tie(0);
int t;
//cin >> t;
scanf("%d", &t);
for(int tc = 1; tc <= t; tc++)
{
float a, b, c, d;
float r1, r2;
//cin >> a >> b >> c >> d;
scanf("%f %f %f %f", &a, &b, &c, &d);
r1 = float(a / b);
r2 = float(c / d);
if(r1 > r2)
//cout << "#" << tc << " " << "ALICE" << endl;
printf("#%d ALICE\n", tc);
else if(r1 < r2)
//cout << "#" << tc << " " << "BOB" << endl;
printf("#%d BOB\n", tc);
else
//cout << "#" << tc << " " << "DRAW" << endl;
printf("#%d DRAW\n", tc);
}
return 0;
}
728x90
반응형
'SW Expert Academy' 카테고리의 다른 글
(SWEA c++)4299. 태혁이의 사랑은 타이밍 (0) | 2020.11.10 |
---|---|
(SWEA c++)4047. 영준이의 카드 카운팅 (0) | 2020.11.10 |
(SWEA c++)3809. 화섭이의 정수 나열 (0) | 2020.11.09 |
(SWEA c++)3750. Digit sum (0) | 2020.11.09 |
(SWEA c++)3499. 퍼펙트 셔플 (0) | 2020.11.09 |