72 条题解
信息
- ID
- 652
- 时间
- 1000ms
- 内存
- 16MiB
- 难度
- 4
- 标签
- 递交数
- 8891
- 已通过
- 4396
- 上传者
#include <iostream>
using namespace std;
int main() {
int num1, num2;
// 输入两个整数
cin >> num1 >> num2;
// 计算面积
int area = num1 * num2;
// 判断是否是正方形
if (num1 == num2) {
cout << "Y" << endl;
}
else {
cout << "N" << endl;
}
// 输出面积
cout << area << endl;
return 0;
}
//这道题挺简单的,上代码!!!!!!!!!!!!!!! #include<bits/stdc++.h>//请点一个宝贵的赞!!!!!!!!!!!!!!!!!!! using namespace std; int main() { int a,b; cin>>a>>b; if(a==b) { cout<<"Y"<<endl<<ab; } else { cout<<"N"<<endl<<ab; } return 0; }
先判断矩形的两条边是否相等,相等是正方形,输出Y,不相等是长方形,输出N。再把面积一算,不就出来了?🎉️ ,上代码:
#include
using namespace std;
int main()
{
int n, m;
cin >> n >> m;
if (n == m)
{
cout << "Y" << endl;
}
else
{
cout << "N" << endl;
}
cout << n * m;
return 0;
}
#include <iostream>
using namespace std;
int main()
{
int a,b;
cin >> a >> b;
if (a == b)
{
cout << "Y" << endl;
cout << a * b;
}
else
{
cout << "N" << endl;
cout << a * b;
}
}
int a,b; cin >> a >> b; if (a==b)//判断条件 { cout <<"Y"<<endl;//注意引号 } else { cout <<"N"<<endl; } cout << a*b;
#include <iostream>
using namespace std;
int main()
{
int a,b;
cin >> a >> b;
if (a==b)
{
cout << "Y" << endl << a*b;
}
else
{
cout << "N" << endl << a*b;
}
}
#include <iostream> using namespace std; int main() { int a,b; cin >> a >> b; if (a==b) { cout << "Y" << endl << ab; } else { cout << "N" << endl << ab; } return 0; }
#include <bits/stdc++.h>
using namespace std;
int main()
{
int a,b;
cin >> a >> b;
if(a == b)//判断是否为正方形,若a == b,是正方形,输出Y;否则,为矩形,输出N。
{
cout << "Y" << endl;
}
else
{
cout << "N" << endl;
}
cout << a*b << endl;//输出面积
return 0;
}
点个赞奥😄
#include <iostream>//万能头文件
using namespace std;
int main()
{
int a,b;
cin>>a>>b;//输入两个值,并存入a,b
if (a==b)
{
cout<<"Y"<<endl;//判断是否为正方形,判断两条边是否相等
}
else
{
cout<<"N"<<endl;//不是正方形的情况
}
cout<<a*b;//输出体积
return 0;
}