当前位置: 代码迷 >> 综合 >> 优越数 oj
  详细解决方案

优越数 oj

热度:13   发布时间:2024-01-14 23:13:44.0

优越数


Time Limit: 1000MS Memory Limit: 65536KB
Problem Description


给定3个数,如果有两个数大于他们的平均数则称这组数为优越数。(定义纯属虚构)

Input


输入第一行是一个整数: 表示测试数据的组数。
对于每组测试数据,仅一行3个整数。

Output


对于每组输入数据输出一行,判断它是否为一组优越数,如果是输出“Yes”(输出不包括引号),否则输出“No”。

Example Input
2
1 2 3
1 4 4
Example Output
No
Yes
#include<stdio.h>
int main()
{int a,b,c,temp;float p;int i=0;scanf("%d",&i);while(i--){scanf("%d%d%d",&a,&b,&c);if(a>b){temp = a;a = b;b = temp;}if(a>c){temp = a;a = c;c = temp;}if(b>c){temp = b;b = c;c = temp;}p = (a + b + c)/3.0;if(b > p)printf("Yes\n");elseprintf("No\n");}return 0;
}


  相关解决方案