立即注册 登录
萝卜钛客 返回首页

charles的个人空间 https://robotaics.com/?680 [收藏] [复制] [RSS]

日志

c++20250613

|已有 89 次阅读|2025-6-13 17:49

1.判断是否能构成三角形
#include<iostream>
using namespace std;

int main() {
int a, b, c;
cin >> a >> b >> c;
if (a + b > c && a + c > b && b + c > a) {
cout << "yes"; //TODO
} else {
cout << "no";
}
return 0;
}
2.判断闰年
#include<iostream>
using namespace std;

int main() {
int a;
cin>>a;
if((a%4==0&&a%100!=0)||a%400==0){
cout<<"yes"; //TODO
} else{
cout<<"no";
}
return 0;
}
3.鸡兔同笼
#include<iostream>
using namespace std;

int main() {
int n,m;
cin>>n>>m;
if(n*2>m){
cout<<"no answer";
} else{
cout<<(n*4-m)/2<<" "<<n-(n*4-m)/2;//TODO
}
return 0;
}

全部作者的其他最新日志

评论 (0 个评论)

facelist doodle 涂鸦板

您需要登录后才可以评论 登录 | 立即注册

返回顶部