AcWing 657. 选择练习1
#include <bits/stdc++.h>
using namespace std;
int main(){
int a, b, c, d;
cin >> a >> b >> c >> d;
if(b > c && d > a && c + d > a + b && c > 0 && b > 0 && a % 2 == 0){
cout << "Valores aceitos";
} else {
cout << "Valores nao aceitos";
}
return 0;
}
AcWing 671. DDD
#include <bits/stdc++.h>
using namespace std;int main()
{
int n;
cin >> n;
if(n == 61) cout<< "Brasilia" << endl;
else if(n == 71) cout<<"Salvador" << endl;
else if(n == 11) cout<< "Sao Paulo" << endl;
else if(n == 21) cout<< "Rio de Janeiro" << endl;
else if(n == 32) cout<<"Juiz de Fora" << endl;
else if(n == 19) cout<<"Campinas" << endl;
else if(n == 27) cout<< "Vitoria" << endl;
else if(n == 31) cout<< "Belo Horizonte" << endl;
else cout<< "DDD nao cadastrado" << endl;
return 0;
}
AcWing 662. 点的坐标
#include <iostream>
using namespace std;
int main() {
double x, y;
cin >> x >> y;if (x == 0 && y == 0) printf("Origem\n");
else if (x == 0) printf("Eixo Y\n");
else if (y == 0) printf("Eixo X\n");
else if (x > 0 && y > 0) printf("Q1");
else if (x < 0 && y > 0) printf("Q2");
else if (x < 0 && y < 0) printf("Q3");
else if (x > 0 && y < 0) printf("Q4");return 0;
}
AcWing 666. 三角形类型
#include <bits/stdc++.h>
using namespace std;
int main()
{
double a, b, c;
cin >> a >> b >> c;
if(a < b) swap(a, b);
if(a < c) swap(a, c);
if(b < c) swap(b, c);
if(a >= b + c){
cout << "NAO FORMA TRIANGULO";
}else if(a * a == b * b + c * c){
cout << "TRIANGULO RETANGULO" << endl;
}else if(a * a > b * b + c * c){
cout << "TRIANGULO OBTUSANGULO" << endl;
}else if(a * a < b * b + c * c){
cout << "TRIANGULO ACUTANGULO" << endl;
}
if(a == b && b == c){
cout << "TRIANGULO EQUILATERO" << endl;
}
if(a == b && b != c || b == c && a != b){
cout << "TRIANGULO ISOSCELES";
}
return 0;
}
AcWing 668. 游戏时间2
#include<iostream>
using namespace std;
int main()
{
int a,b,c,d;
cin >> a >> b >> c >>d;
if(a>c&&b>d){
cout<<"O JOGO DUROU "<<c+23-a<<" HORA(S) E "<<d+60-b<<" MINUTO(S)"<<endl;
}
if(a>c&&b<d){
cout<<"O JOGO DUROU "<<c+24-a<<" HORA(S) E "<<d-b<<" MINUTO(S)"<<endl;
}
if(a<c&&b<d){
cout<<"O JOGO DUROU "<<c-a<<" HORA(S) E "<<d-b<<" MINUTO(S)"<<endl;
}
if(a<c&&b>d){
cout<<"O JOGO DUROU "<<c-1-a<<" HORA(S) E "<<d+60-b<<" MINUTO(S)"<<endl;
}
if(a==c&&b==d){
cout<<"O JOGO DUROU "<<24<<" HORA(S) E "<<0<<" MINUTO(S)"<<endl;
}
if(a>c&&b==d){
cout<<"O JOGO DUROU "<<c+24-a<<" HORA(S) E "<<d-b<<" MINUTO(S)"<<endl;
}
if(a<c&&b==d){
cout<<"O JOGO DUROU "<<c-a<<" HORA(S) E "<<d-b<<" MINUTO(S)"<<endl;
}
if(a==c&&b>d){
cout<<"O JOGO DUROU "<<c+23-a<<" HORA(S) E "<<d+60-b<<" MINUTO(S)"<<endl;
}
if(a==c&&b<d){
cout<<"O JOGO DUROU "<<c-a<<" HORA(S) E "<<d-b<<" MINUTO(S)"<<endl;
}
return 0;
}