3 solutions
-
1
题意
计算正方形与长方形的面积并比较。
思路
分别计算,最后判断
代码
#include<iostream> #define lint long long using namespace std; int main(){ void print(lint,lint);//比较并输出 lint square();//计算正方形 lint rectangle();//计算长方形 print(rectangle(),square()); //后面的参数会先执行 return 0; } void print(lint b,lint a){//两人面积 if(a>b) cout<<"Alice"; if(a<b) cout<<"Bob"; } lint square(){ lint a(0); cin>>a; return a*a; } lint rectangle(){ lint a(0); lint b(0); cin>>a>>b; return a*b; }
补充
不要说我代码繁杂,养成这样的习惯平时编游戏、写大模拟、难题有好处。
又看到自己以前的题解了~
- 1
Information
- ID
- 4698
- Time
- 1000ms
- Memory
- 125MiB
- Difficulty
- 1
- Tags
- # Submissions
- 89
- Accepted
- 39
- Uploaded By