#include <iostream>
using namespace std;
int a, b;
int main()
{
cin >> a >> b;
if (a % b == 0 || b % a == 0) cout << "Sao Multiplos";
else cout << "Nao sao Multiplos";
return 0;
}
零食
#include <iostream>
using namespace std;
int main() {
double priceList[6] = {0, 4.00, 4.50, 5.00, 2.00, 1.50};
int no, num;
scanf("%d%d", &no, &num);
printf("Total: R$ %.2lf\n", priceList[no] * num);
return 0;
}
#include<bits/stdc++.h>
using namespace std;
int s,e;
int ans;
int main()
{
scanf("%d%d",&s,&e);
if(e<=s)
{
e=e+24;
}
ans=e-s;
printf("O JOGO DUROU %d HORA(S)\n",ans);
return 0;
}
DDD
#include<iostream>
#include<string>
using namespace std;
int main()
{
int x;
cin >> x ;
int a[] ={61,71,11,21,32,19,27,31};//务必在定义数组时确保两数组对应位置相同
string b[]={"Brasilia","Salvador","Sao Paulo","Rio de Janeiro","Juiz de Fora","Campinas",
"Vitoria","Belo Horizonte"};
string t="a"; //工具变量t,存在目的:确定输入的x是否在a数组中;
int i ;
for(i=0;i<8;i++) {
if(x == a[i]) {
t = b[i]; //将a与b联系起来
break; //程序运行过程中满足if则运行break结束循环,在这里结束for循环;提高运行效率。
}
}
if(t == "a") printf("DDD nao cadastrado");
else cout<<t;
return 0;
}