1 solutions

  • 0
    @ 2025-11-5 18:04:31

    C :

    #include <stdio.h>
    #include <assert.h>
    
    int a,b,c;
    main(){
       while (3 == scanf("%d%d%d",&a,&b,&c) && (a || b || c)) {
          if (a*a == b*b + c*c || b*b == a*a+c*c || c*c == a*a+b*b) printf("right\n"); else printf("wrong\n");
       }
       assert (!a && !b && !c);
    }
    
    

    C++ :

    #include<cstdio>
    #include<cmath>
    #include<algorithm>
    using std::swap;
    int main(){
    	double a,b,c;
    	while(scanf("%lf%lf%lf",&a,&b,&c),(int)(a+b+c)){
    		if(a>b) swap(a,b);
    		if(a>c) swap(a,c);
    		if(b>c) swap(b,c);
    		puts(fabs(a*a+b*b-c*c)<0.000001?"right":"wrong");
    	}
    	return 0;
    }
    
    • 1

    Information

    ID
    18759
    Time
    1000ms
    Memory
    128MiB
    Difficulty
    (None)
    Tags
    # Submissions
    0
    Accepted
    0
    Uploaded By