
#include<iostream>
using namespace std;
int main() {
int year;
cin>>year;
if (year % 400 == 0) {
cout<<year<<"是闰年"<<endl;
} else {
if (year % 4 == 0) {
if (year % 100 == 0) {
cout<<year<<"是闰年"<<endl;
} else {
cout<<year<<"不是闰年"<<endl;
}
} else {
cout<<year<<"不是闰年"<<endl;
}
}
return 0;
}
#include<iostream>
using namespace std;
int main() {
int n;
cin>>n;
if (n % 3 == 0)
if (n % 5 == 0)
cout<<n<<"是15的倍数"<<endl;
else
cout<<n<<"是3的倍数,但不是5的倍数"<<endl;
cout<<"结束"<<endl;
return 0;
}
#include<iostream>
using namespace std;
int main() {
int n;
cin>>n;
if (n % 3 == 0) {
if (n % 5 == 0)
cout<<n<<"是15的倍数"<<endl;
}
else cout<<n<<"不是3的倍数"<<endl;
cout<<"结束"<<endl;
return 0;
}
#include<iostream>
#include<cmath>
using namespace std;
int main(){
float a,b,c;
float p;
float s;
cin>>a>>b>>c;
if(a+b>c&&a+c>b&&b+c>a){
p=(a+b+c)/2;
s=sqrt(p*(p-a)*(p-b)*(p-c));
cout<<"三角形的面积为:"<<s<<endl;
}else{
cout<<"不能构成三角形"<<endl;
}
return 0;
}
#include<iostream>
#include<cmath>
using namespace std;
int main(){
float a,b,c;
float p;
float s;
cin>>a>>b>>c;
if(a+b<=c||a+c<=b||b+c<=a){
cout<<"不能构成三角形"<<endl;
}else{
p=(a+b+c)/2;
s=sqrt(p*(p-a)*(p-b)*(p-c));
cout<<"三角形的面积为:"<<s<<endl;
}
return 0;
}
#include<iostream>
using namespace std;
int main() {
float a, b, c, maxn;
cin>>a>>b>>c;
if (a > b && a > c)
maxn = a;
else if (b > a && b > c)
maxn = b;
else
maxn = c;
cout<<"最大数为:"<<maxn<<endl;
return 0;
}
#include<iostream>
using namespace std;
int main() {
float a, b, c, maxn;
cin>>a>>b>>c;
maxn = a;
if (b > maxn) maxn = b;
if (c > maxn) maxn = c;
cout<<"最大数为:"<<maxn<<endl;
return 0;
}
#include<iostream>
using namespace std;
int main() {
float a, b, c;
cin>>a>>b>>c;
if (a > b) { //确定a在b的前面,接着确认c的位置
if (b > c) //确定b在c的前面
cout<<a<<","<<b<<","<<c;
else { //确定c也在b的前面,接着确认a和c谁在前面
if (a > c)
cout<<a<<","<<c<<","<<b;
else
cout<<c<<","<<a<<","<<b;
}
} else { //确定b在a的前面,接着确认c的位置
if (b > c) { //确定b也在c的前面,接着确认a和c谁在前面
if (a > c)
cout<<b<<","<<a<<","<<c;
else
cout<<b<<","<<c<<","<<a;
} else
cout<<c<<","<<b<<","<<a;
}
return 0;
}
#include<iostream>
using namespace std;
int main() {
float a, b, c, temp;
cin>>a>>b>>c;
if (a < b) { //交换a和b的值
temp = a;
a = b;
b = temp;
}
if (a < c) { //交换a和c的值
temp = a;
a = c;
c = temp;
}
if (b < c) { //交换b和c的值
temp = b;
b = c;
c = temp;
}
cout<<a<<","<<b<<","<<c;
return 0;
}
#include<iostream>
#include<cmath>
using namespace std;
int main() {
double l, s, x1, x2;
double d;
cin>>l>>s;
d = l * l / 4 - 4 * s;
if (d < 0) {
cout<<"找不到这样的矩形"<<endl;
} else {
if (d == 0) {
x1 = x2 = 1 / 4;
} else {
x1 = (l / 2 + sqrt(d)) / 2;
x2 = (l / 2 - sqrt(d)) / 2;
}
cout<<"矩形的长和宽分别为:"<<x1<<","<<x2<<endl;
}
return 0;
}
#include<iostream>
using namespace std;
int main() {
double dis;
double t1, t2;
cin>>dis;
t1 = dis / 3 + 27 + 23;
t2 = dis / 1.2;
if (t1 > t2)
cout<<"walk"<<endl;
else if (t1 == t2)
cout<<"same"<<endl;
else
cout<<"bike"<<endl;
return 0;
}
#include<iostream>
using namespace std;
int main() {
double dis;
double t1, t2;
cin>>dis;
t1 = dis * 2 + (27 + 23) * 6;
t2 = dis * 5;
if (t1 > t2)
cout<<"walk"<<endl;
else if (t1 == t2)
cout<<"same"<<endl;
else
cout<<"bike"<<endl;
return 0;
}
#include<iostream>
using namespace std;
int main() {
int x, y, m, n;
bool chicken, egg;
cin>>n>>m>>x>>y;
chicken = 0;
egg = 0;
if ((y + m - x) % 2 == 0 && n - x >= (y + m - x) / 2 && (y + m - x) / 2 >= 0 && x >= (y - m + x) / 2 && (y - m + x) / 2 >= 0)
chicken = 1;
if (0 <= (y + n - m - x) / 2 && (y + n - m - x) / 2 <= n - x && (m + x + y - n) / 2 >= 0 && (m + x + y - n) / 2 <= x && (m + x + y - n) % 2 == 0)
egg = 1;
if (chicken == 0 && egg == 0)
cout<<"this is a lie"<<endl;
if (chicken == 0 && egg == 1)
cout<<"egg"<<endl;
if (chicken == 1 && egg == 0)
cout<<"chicken"<<endl;
if (chicken == 1 && egg == 1)
cout<<"Ambiguous"<<endl;
return 0;
}