Submission #3471

#TimeUsernameProblemLanguageResultExecution timeMemory
3471pl0892029Jogging (kriii1_J)C++98
0 / 1
1000 ms3224 KiB
#include <stdio.h> #include <stdlib.h> #include <math.h> int main(void){ int n, m; // n은 별의 (x, y) 개수 // m은 휴식 취하는 x좌표(z) 개수 scanf("%d %d", &n, &m); int *x = (int *)malloc(sizeof(int)*n); int *y = (int *)malloc(sizeof(int)*n); int *z = (int *)malloc(sizeof(int)*m); double *res = (double *) malloc(sizeof(double)*m); for(int i=0; i<n; i++){ scanf("%d %d", &x[i], &y[i]); } for(int i=0; i<m; i++){ scanf("%d", &z[i]); double max = 0.0000000; for(int j=n-1; j>=0; j--){ if(z[i] <= x[j]){ res[i] = atan((double)y[j] / (x[j] - z[i])); // printf("%lf\n", res[i]); if(res[i]>max){ max=res[i]; } } else{ res[i] = max; break; } } res[i] = max; } for(int i=0; i<m; i++){ printf("%.7lf\n", res[i]); } // while(true); }
#Verdict Execution timeMemoryGrader output
Fetching results...