1 条题解
-
0
C :
#include<stdio.h> int main() { int a; int b; int c; scanf("%d %d %d",&a,&b,&c); if(a*a+b*b==c*c) { printf("yes\n"); } else if(b*b+c*c==a*a) { printf("yes\n"); } else if(a*a+c*c==b+b) { printf("yes\n"); } else { printf("no\n"); } }C++ :
#include<stdio.h> int main() { int a,b,c; scanf("%d%d%d",&a,&b,&c); if(a*a+b*b==c*c) printf("yes"); else if(a*a+c*c==b*b) printf("yes"); else if(b*b+c*c==a*a) printf("yes"); else printf("no"); return 0; }Java :
import java.util.Scanner; public class Main { public static void main(String[] args) { Scanner input = new Scanner(System.in); double a=input.nextDouble(),b=input.nextDouble(),c=input.nextDouble(); if(a*a+b*b==c*c||a*a+c*c==b*b||b*b+c*c==a*a) System.out.println("yes"); else System.out.println("no"); } }Python :
# coding=utf-8 #!/usr/bin/python2 import sys import re import math a,b,c=(int(x) for x in raw_input().split(' ')) if a*a+b*b==c*c or a*a+c*c==b*b or b*b+c*c==a*a: print "yes" else: print "no"C# :
using System; using System.Collections.Generic; using System.Linq; using System.Security.Cryptography; using System.Text; using System.Threading.Tasks; namespace ConsoleApp2 { internal class Program { static void Main() { //int[] days = { 31,28,31,30,31,30,31,31,30,31,30,31}; /*int n = Convert.ToInt32 (Console.ReadLine()); string[] a1 = Console.ReadLine().Split(); double r = Convert.ToDouble(a1[0]); double b = Convert.ToDouble(a1[1]); double c = Convert.ToDouble(a1[2]); float pi = 3.1415926f; string S = ((r + b+c) / n).ToString("0.00"); */ string[] n = Console.ReadLine().Split(' '); int a = Convert.ToInt16(n[0]); int b = Convert.ToInt16(n[1]); int c = Convert.ToInt16(n[2]); int max =0; int e = 0; int d = 0; if (a >= b && a >= c) { max=a; d = b; e = c; } else if (b >= a && b >= c) { max = b; d = c; e = a; } else { max = c; d = a; e = b; } string T = "no"; if (Math.Pow(d, 2) + Math.Pow(e, 2) == Math.Pow(max, 2)) { T = "yes"; } Console.WriteLine(T); ; Console.ReadKey(); } } }
- 1
信息
- ID
- 24
- 时间
- 1000ms
- 内存
- 128MiB
- 难度
- 2
- 标签
- 递交数
- 0
- 已通过
- 0
- 上传者