http://oj.acm.zstu.edu.cn/JudgeOnline/problem.php?cid=4034&pid=9
C语言版本一
#include <stdio.h>
#include <stdlib.h>
#include <math.h>
/* run this program using the console pauser or add your own getch, system("pause") or input loop */
int main(int argc, char *argv[]) {
float const pi = acos(-1.0);
int n;
//scanf("%d",&n);
n=100;
while(n--){
int a,b,c;
float sa,sb,sc;
scanf("%d %d %d",&a,&b,&c);
sa=sqrt(3)/4 * a * a;
sb=pi*b*b;
sc=c*c;
if(sa>sb&&sa>sc)printf("triangle\n");
if(sb>sa&&sb>sc)printf("circle\n");
if(sc>sb&&sc>sa)printf("square\n");
}
return 0;
}
C++版本一
#include<stdio.h>
#include<math.h>
#include<algorithm>
#include<string.h>
using namespace std;
int main(){
double a,b,c,pi=acos(-1.0);
while(~scanf("%lf%lf%lf",&a,&b,&c)){
a=sqrt(3)/4*a*a;
b=pi*b*b;
c=c*c;
if(c>b&&c>a)printf("square\n");
if(b>c&&b>a)printf("circle\n");
if(a>b&&a>c)printf("triangle\n");
}
return 0;
}