AcWing 665. 倍数
#include <iostream>
#include <cstring>
#include <algorithm>using namespace std;
int main()
{
int a,b;
cin >> a >> b;
if(a % b == 0 || b % a == 0) printf("Sao Multiplos");
else printf("Nao sao Multiplos");return 0;
}
AcWing 660. 零食
#include <iostream>
#include <cstring>
#include <algorithm>using namespace std;
int main()
{
int a;
float b,c;
cin >> a >> b;
if(a == 1) c = 4.00;
if(a == 2) c = 4.50;
if(a == 3) c = 5.00;
if(a == 4) c = 2.00;
if(a == 5) c = 1.50;
printf("Total: R$ %.2lf",c*b);return 0;
}
AcWing 659. 区间
#include <iostream>
#include <cstring>
#include <algorithm>using namespace std;
int main()
{
float a;
cin >> a;
if(a >= 0 && a <=25) printf("Intervalo [0,25]");
else if(a > 25 && a <=50) printf("Intervalo (25,50]");
else if(a > 50 && a <=75) printf("Intervalo (50,75]");
else if(a > 75 && a <=100) printf("Intervalo (75,100]");
else printf("Fora de intervalo");return 0;
}
AcWing 664. 三角形
#include <iostream>
#include <cstring>
#include <algorithm>using namespace std;
int main()
{
float a,b,c;
cin >> a >> b >> c;
if(a+b > c && a+c > b && b+c > a) printf("Perimetro = %.1lf",a+b+c);
else printf("Area = %.1lf",(a+b)*c/2);return 0;
}
AcWing 667. 游戏时间
#include <iostream>
#include <cstring>
#include <algorithm>using namespace std;
int main()
{
int a,b;
cin >> a >> b;
if(a == b) printf ("O JOGO DUROU 24 HORA(S)");
else if(a > b)printf("O JOGO DUROU %d HORA(S)",24-a+b);
else printf("O JOGO DUROU %d HORA(S)",b-a);return 0;
}
AcWing 669. 加薪
#include <iostream>
#include <cstring>
#include <algorithm>using namespace std;
int main()
{
float N,X,Y;
int z = 0;
cin >> N;
if(N >= 0 && N <= 400){
Y = N*0.15;
X = Y + N;
z = 15;
}
if(N >= 400.01 && N <= 800){
Y = N*0.12;
X = Y + N;
z = 12;
}
if(N >= 800.01 && N <= 1200){
Y = N*0.10;
X = Y + N;
z = 10;
}
if(N >= 1200.01 && N <= 2000){
Y = N*0.07;
X = Y + N;
z = 7;
}
if(N > 2000){
Y = N*0.04;
X = Y + N;
z = 4;
}
printf("Novo salario: %.2lf\nReajuste ganho: %.2lf\nEm percentual: %d %%",X,Y,z);
return 0;
}
AcWing 670. 动物
#include <iostream>
#include <cstring>
#include <algorithm>using namespace std;
int main()
{
string a,b,c;
cin >> a >> b >> c;
if(a[0] == 'v'){
if(b[0] == 'a'){
if(c[0] == 'c') printf("aguia");
else printf("pomba");
}
else{
if(c[0] == 'o') printf("homem");
else printf("vaca");
}
}
else{
if(b[0] == 'a'){
if(c[0] == 'h') printf("sanguessuga");
else printf("minhoca");
}
else{
if(c[2] == 'm') printf("pulga");
else printf("lagarta");
}
}return 0;
}