编号 | 题目 | 状态 | 分数 | 总时间 | 内存 | 代码 / 答案文件 | 提交者 | 提交时间 |
---|---|---|---|---|---|---|---|---|
#25313 | #1138. ddd和鹦鹉 | Compile Error | 0 | 0 ms | 0 K | C / 1.1 K | 呵呵 | 2020-04-25 18:27:46 |
#include <stdio.h>
#include <math.h>
float fun(int a, int b, int c, int d, int e, int f, int k, int z);
int main() {
int a, b, c, d, e, f;
scanf_s("%d %d %d %d %d %d", &a, &b, &c, &d, &e, &f);
int x, y, k, z;
float l, j;
l = (3 * a + e + 2 * c) / 6;
j = (3 * b + f + 2 * d) / 6;
x = (int)l;
y = (int)j;
// printf("%d %d", x, y);
k = x + 1;
z = y + 1;
float s1, s2, s3, s4;
s1 = fun(a, b, c, d, e, f, x, y);
s2 = fun(a, b, c, d, e, f, k, y);
s3 = fun(a, b, c, d, e, f, x, z);
s4 = fun(a, b, c, d, e, f, k, z);
// printf("%d %d %d %d", s1, s2, s3, s4);
if (s1 <= s2 && s1 <= s3 && s1 <= s4) {
printf("%d %d", x, y);
}
if (s2 <= s1 && s2 <= s3 && s2 <= s4) {
printf("%d %d", k, y);
}
if (s3 <= s2 && s3 <= s1 && s3 <= s4) {
printf("%d %d", x, z);
}
if (s4 <= s2 && s4 <= s3 && s4 <= s1) {
printf("%d %d", k, z);
}
return 0;
}
float fun(int a, int b, int c, int d, int e, int f, int k, int z) {
float s;
s = sqrt(3 * ((k - a) * (k - a)) + 3 * ((z - b) * (z - b))) +
sqrt(2 * ((k - c) * (k - c)) + 2 * ((z - d) * (z - d))) + sqrt((k - e) * (k - e) + (z - f) * (z - f));
return s;
}
编译信息
/sandbox/1/a.c:7:2: warning: implicit declaration of function 'scanf_s' is invalid in C99 [-Wimplicit-function-declaration]
scanf_s("%d %d %d %d %d %d", &a, &b, &c, &d, &e, &f);
^
1 warning generated.
/tmp/a-5ef4b9.o: In function `main':
a.c:(.text+0x36): undefined reference to `scanf_s'
clang: error: linker command failed with exit code 1 (use -v to see invocation)