当前位置:网站首页>Grammar Basics (Judgment Statements)
Grammar Basics (Judgment Statements)
2022-08-10 06:32:00 【attack siege lion】
作者:进击攻城狮
个人主页:欢迎访问我的主页
首发时间:2022年8月9日星期二
订阅专栏:刷题
个人信条:星光不问赶路人,岁月不负有心人.
如果文章有错误,欢迎在评论区指正.
支持我:点赞+收藏️+留言
文章目录
671. DDD
给定一个整数,Please determine and output the corresponding city name according to the table below:
If the input number is not in the above table,则输出 DDD nao cadastrado
.
输入格式
共一行,包含一个整数.
输出格式
The output corresponds to the city name,If there is no corresponding city name,则输出 DDD nao cadastrado
.
输入样例:
11
输出样例:
Sao Paulo
#include<iostream>
using namespace std;
int main(){
int a;
cin>>a;
if(a==11)
printf("Sao Paulo");
else
if(a==61)
printf("Brasilia");
else
if(a==71)
printf("Salvador");
else
if(a==21)
printf("Rio de Janeiro");
else
if(a==32)
printf("Juiz de Fora");
else
if(a==19)
printf("Campinas");
else
if(a==27)
printf("Vitoria");
else
if(a==31)
printf("Belo Horizonte");
else
printf("DDD nao cadastrado");
}
662. 点的坐标
给定两个保留一位小数的浮点数 X,YX,Y,用来表示一个点的横纵坐标.
Please judge the position of the point in the coordinate system.
输入格式
共一行,包含两个浮点数 X,YX,Y,表示点的横纵坐标.
输出格式
If the point is in the first quadrant,则输出 Q1
,在第二象限,则输出 Q2
,以此类推.
If the point is at the origin,则输出 Origem
.
否则,如果点在 xx 坐标上,则输出 Eixo X
,在 yy 坐标上,则输出 Eixo Y
.
数据范围
−10.0≤X,Y≤10.0−10.0≤X,Y≤10.0
输入样例1:
4.5 -2.2
输出样例1:
Q4
输入样例2:
0.0 0.0
输出样例2:
Origem
#include<iostream>
using namespace std;
int main(){
double a,b;
cin>>a>>b;
if(a>0&&b>0)printf("Q1");
else if(a<0&&b>0) printf("Q2");
else if(a==0&&b==0) printf("Origem");
else if(b==0) printf("Eixo X");
else if(a==0)printf("Eixo Y");
else if(a<0&&b<0) printf("Q3");
else printf("Q4");
return 0;
}
666. 三角形类型
读取表示三角形三条边的 33 个浮点数 A,BA,B 和 CC 并按降序排列,使 AA 边是三边中最大的一边.
接下来,According to the following conditions,Determine the types of triangles they can form:
- 如果 A≥B+CA≥B+C,It means that three sides cannot form a triangle,请输出:
NAO FORMA TRIANGULO
- 否则,Explain that three sides can form a triangle,Then output as follows:
- 如果A2=B2+C2A2=B2+C2,请输出:
TRIANGULO RETANGULO
- 如果A2>B2+C2A2>B2+C2,请输出:
TRIANGULO OBTUSANGULO
- 如果A2<B2+C2A2<B2+C2,请输出:
TRIANGULO ACUTANGULO
- If all three sides are the same length,请输出:
TRIANGULO EQUILATERO
- If only two sides are the same length and the third is different,请输出:
TRIANGULO ISOSCELES
- 如果A2=B2+C2A2=B2+C2,请输出:
输入格式
共一行,包含三个浮点数 A,B,CA,B,C.
输出格式
输出 A,B,CA,B,C The type of triangle that is formed.
注意,More than one of the above conditions may be satisfied,In this case all type names will be used,Output in the order of topic introduction,One output per line.
数据范围
0<A,B,C≤10.00<A,B,C≤10.0
输入样例:
7.0 5.0 7.0
输出样例:
TRIANGULO ACUTANGULO
TRIANGULO ISOSCELES
#include<iostream>
#include<cmath>
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))printf("NAO FORMA TRIANGULO\n");
else
if(a*a==(b*b+c*c)) printf("TRIANGULO RETANGULO\n");
else
if(a*a>(b*b+c*c)) printf("TRIANGULO OBTUSANGULO\n");
else
if(a*a<(b*b+c*c)) printf("TRIANGULO ACUTANGULO\n");
if(a==b&&b==c) printf("TRIANGULO EQUILATERO");
else
if(a==b||a==c||b==c)
printf("TRIANGULO ISOSCELES");
}
668. 游戏时间2
读取四个整数 A,B,C,DA,B,C,D,用来表示游戏的开始时间和结束时间.
其中 AA 和 BB 为开始时刻的小时和分钟数,CC 和 DD 为结束时刻的小时和分钟数.
请你计算游戏的持续时间.
比赛最短持续 11 分钟,最长持续 2424 小时.
输入格式
共一行,包含四个整数 A,B,C,DA,B,C,D.
输出格式
输出格式为 O JOGO DUROU X HORA(S) E Y MINUTO(S)
,表示游戏共持续了 XX 小时 YY 分钟.
数据范围
0≤A,C≤230≤A,C≤23,
0≤B,D≤590≤B,D≤59
输入样例1:
7 8 9 10
输出样例1:
O JOGO DUROU 2 HORA(S) E 2 MINUTO(S)
输入样例2:
7 7 7 7
输出样例2:
O JOGO DUROU 24 HORA(S) E 0 MINUTO(S)
输入样例3:
7 10 8 9
输出样例3:
O JOGO DUROU 0 HORA(S) E 59 MINUTO(S)
#include<iostream>
using namespace std;
int main(){
int a,b,c,d;
cin>>a>>b>>c>>d;
if(c>a){
if(d-b<0) printf("O JOGO DUROU %d HORA(S) E %d MINUTO(S)",c-1-a,d+60-b);
else
printf("O JOGO DUROU %d HORA(S) E %d MINUTO(S)",c-a,d-b);
}
else
if(c<a){
if(d-b<0) printf("O JOGO DUROU %d HORA(S) E %d MINUTO(S)",c+24-1-a,d+60-b);
else
printf("O JOGO DUROU %d HORA(S) E %d MINUTO(S)",c+24-a,d-b);
}
else
if(a==c&&b==d)
printf("O JOGO DUROU %d HORA(S) E %d MINUTO(S)",24,0);
else
if(a==c&&b<d)
printf("O JOGO DUROU %d HORA(S) E %d MINUTO(S)",0,d-b);
else
printf("O JOGO DUROU %d HORA(S) E %d MINUTO(S)",23,d+60-b);
}
1 学如逆水行舟,不进则退
边栏推荐
- Unity screen coordinates to world coordinates, mouse click to get 3D position
- Parallax Mapping: More Realistic Texture Detail Representation (Part 1): Why Use Parallax Mapping
- 交换机的功能和ipv4
- UnityShader入门精要-纹理动画、顶点动画
- Qt程序字体初始化引起的白屏问题
- webSocket教程
- unity瓦片地图调整图片大小
- 个人实现的可任意折叠QToolBox——AdvancedToolBox
- Kernel Image File Format
- socket实现进程间通信
猜你喜欢
随机推荐
什么是MQTT网关?与传统DTU有哪些区别?
Two-dimensional cartoon rendering - coloring
vscode + ccls环境配置
动态规划——从0-1背包问题到leetcode正则匹配
Unity object pool implementation
QEMU guest与host通过网络通信——bridge/hostfwd/guestfwd
强化学习_08_Datawhale针对连续动作的深度Q网络
关于MongoDb查询Decimal128转BigDecimal问题
ebp/栈帧/call stack
Can‘t find bundle for base name jdbc, locale zh_CN解决方法
机器学习_LGB调参汇总(开箱即食)
tqdm高级使用方法(类keras进度条)
程序员的十楼层。看看自己在第几层。PS:我的目标是:30岁第四层
进制的前缀表示和后缀表示
C语言文件操作
UnityShader入门精要-unity shader基础
UnityShader入门精要-高级光照基础
order by注入与limit注入,以及宽字节注入
强化学习_12_Datawhale深度确定性策略梯度
Unity screen coordinates to world coordinates, mouse click to get 3D position