3011 - 平方值

判断两个数a,b,输出较大数的平方值。所谓平方值就是两个相同的数相乘的积。

题目输入

题目输出

输入/输出样例

题目输入

1 2

题目输出

4

C语言解答

#include<stdio.h>
#include<stdlib.h>
int a,b;
int main()
{
	scanf("%d%d",&a,&b);
	int s=0;
	if(a>s)s=a;
	if(b>s)s=b;
	printf("%d",s*s);
   return 0;
}

C++解答

#include<iostream>
#include<cstdlib>
using namespace std;
int main()
{
	int a,b;
	cin>>a>>b;
	int a1=a*a;
	int b1=b*b;
	if(a>b)
	  cout<<a1;
	else
	  cout<<b1;
	//system("pause");
	return 0;
}

时间限制 1 秒
内存限制 128 MB
讨论 统计
上一题 下一题