几道C语言ACM的练习题,求解。

来源:百度知道 编辑:UC知道 时间:2024/05/31 05:21:37
http://acm.buaa.edu.cn/oj/problem_show.php?c=0&p=1054
http://acm.buaa.edu.cn/oj/problem_show.php?c=0&p=1053
http://acm.buaa.edu.cn/oj/problem_show.php?c=0&p=1052
http://acm.buaa.edu.cn/oj/problem_show.php?c=0&p=1051
http://acm.buaa.edu.cn/oj/problem_show.php?c=0&p=1050
http://acm.buaa.edu.cn/oj/problem_show.php?c=0&p=1049

2.7
#include <stdio.h>

#define SWAP(x,y) (t=x,x=y,y=t)

int main()
{
int a, b, c, n, t;
for (scanf("%d", &n); n--; )
{
scanf("%d%d%d", &a, &b, &c);
if (a <= 0 || b <= 0 || c <= 0) {puts("0"); continue;}
if (a > c) SWAP(a, c);
if (b > c) SWAP(b, c);
printf("%d\n", a*a + b*b == c*c);
}
return 0;
}

2.6
#include <stdio.h>

#define SWAP(x,y) (t=x,x=y,y=t)

int main()
{
int n;
double a, b, c;
for (scanf("%d", &n); n--; )
{
scanf("%lf%lf%lf", &a, &b, &c);
if (a <= 0 || b <= 0 || c <= 0) {puts("0"); continue;}
printf("%d\n", a+b>c && b+c>a && c+a>b);
}
return 0;
}

2.2
#include <stdio.h>

char a[6];

int main()
{