/*
You should use the statndard input/output
in order to receive a score properly.
Do not use file input and output
Please be very careful.
*/
#include <stdio.h>
#include <stdlib.h>
#include <math.h>
int Answer;
int main(void)
{
int T, test_case;
int dart[20] = { 6, 13, 4, 18, 1, 20, 5, 12, 9, 14, 11, 8, 16, 7, 19, 3, 17, 2, 15, 10 };
int x,y;
int A,B,C,D,E;
int N;
int i;
double angle;
double radian;
int value;
int score = 0;
int dist;
/*
The freopen function below opens input.txt file in read only mode, and afterward,
the program will read from input.txt file instead of standard(keyboard) input.
To test your program, you may save input data in input.txt file,
and use freopen function to read from the file when using scanf function.
You may remove the comment symbols(//) in the below statement and use it.
But before submission, you must remove the freopen function or rewrite comment symbols(//).
*/
freopen("input.txt", "r", stdin);
/*
If you remove the statement below, your program's output may not be rocorded
when your program is terminated after the time limit.
For safety, please use setbuf(stdout, NULL); statement.
*/
setbuf(stdout, NULL);
scanf("%d", &T);
for(test_case = 0; test_case < T; test_case++)
{
/////////////////////////////////////////////////////////////////////////////////////////////
/*
Implement your algorithm here.
The answer to the case will be stored in variable Answer.
*/
scanf("%d %d %d %d %d",&A,&B,&C,&D,&E);
scanf("%d",&N);
for(i = 0; i < N; i++) {
scanf("%d %d",&x,&y);
dist = sqrt(x*x + y*y);
if(dist < A) { // bull
score += 50;
}
else {
angle = atan2(y, x);
angle = angle * (double)(180 / 3.14159265358979) + 9;
if(angle < 0) {
angle += 360;
}
angle = fmod(angle, 360);
value = (int)angle / 18;
if(B < dist && dist < C) { // triple
score += dart[value] * 3;
}
else if(D < dist && dist < E) { // double
score += dart[value] * 2;
}
else if(dist > E) { // out board
}
else { // single
score += dart[value];
}
}
}
Answer = score;
/////////////////////////////////////////////////////////////////////////////////////////////
// Print the answer to standard output(screen).
printf("Case #%d\n", test_case+1);
printf("%d\n", Answer);
}
return 0;//Your program should return 0 on normal termination.
}
https://www.codeground.org/practice/practiceProblemView
답은 134 맞게나오는데 채점 프로그램이 이상한거 아님?
난 맞앗는뎅
부동소수점 다루는 부분이 문제일 수 있겠는데