当前位置:网站首页>Syntax basics (variables, input and output, expressions and sequential statements)
Syntax basics (variables, input and output, expressions and sequential statements)
2022-08-05 02:44:00 【attack siege lion】
作者:进击攻城狮
个人主页:欢迎访问我的主页
首发时间:2022年8月3日星期二
订阅专栏:刷题
个人信条:星光不问赶路人,岁月不负有心人.
如果文章有错误,欢迎在评论区指正.
支持我:点赞+收藏️+留言
文章目录
609.工资
请编写一个程序,可以读取一名员工的员工编号,本月工作总时长(小时)以及时薪,并输出他的工资条,工资条中包括员工编号和员工月收入.
输入格式
输入包含两个整数和一个浮点数,分别代表员工编号,工作时长以及时薪.
每个数占一行.
输出格式
输出共两行,第一行格式为 NUMBER = X
,其中 XX 为员工编号.
第二行格式为 SALARY = U$ Y
,其中 YY 为该员工月收入,保留两位小数.
数据范围
1≤员工编号≤1001≤员工编号≤100,
1≤总工作时长≤2001≤总工作时长≤200,
1≤时薪≤501≤时薪≤50
输入样例:
25
100
5.50
输出样例:
NUMBER = 25
SALARY = U$ 550.00
#include<iostream>
using namespace std;
int main(){
int id;
int time;
double price;
cin>>id>>time>>price;
printf("NUMBER = %d\nSALARY = U$ %.2f",id,time*price);
}
615.油耗
Given the total distance traveled by a car(kmkm)and oil consumption(ll),Please ask for each consumption of the car 11 How many kilometers can a liter of gasoline travel.
输入格式
输入共两行,第一行包含整数 XX,表示行驶总路程.
第二行包含保留一位小数的浮点数 YY,表示消耗的油量.
输出格式
输出格式为 M km/l
,其中 MM 为计算结果,保留三位小数.
数据范围
1≤X,Y≤1091≤X,Y≤109
输入样例:
500
35.0
输出样例:
14.286 km/l
#include<iostream>
using namespace std;
int a;double b;
int main(){
cin>>a>>b;
printf("%.3lf km/l",a/b);
}
616.两点间的距离
给定两个点 P1P1 和 P2P2,其中 P1P1 的坐标为 (x1,y1)(x1,y1),P2P2 的坐标为 (x2,y2)(x2,y2),请你计算两点间的距离是多少.
distance=(x2−x1)2+(y2−y1)2−−−−−−−−−−−−−−−−−−√distance=(x2−x1)2+(y2−y1)2
输入格式
输入共两行,每行包含两个双精度浮点数 xi,yixi,yi,表示其中一个点的坐标.
输入数值均保留一位小数.
输出格式
输出你的结果,保留四位小数.
数据范围
−109≤xi,yi≤109−109≤xi,yi≤109
输入样例:
1.0 7.0
5.0 9.0
输出样例:
4.4721
#include<cstdio>
#include<iostream>
#include <cmath>
using namespace std;
int main()
{
double a,b,c,d,e;
cin>>a>>b>>c>>d;
e=sqrt((c-a)*(c-a)+(d-b)*(d-b));
printf("%.4lf",e);
return 0;
}
653.钞票
在这个问题中,你需要读取一个整数值并将其分解为多张钞票的和,每种面值的钞票可以使用多张,并要求所用的钞票数量尽可能少.
请你输出读取值和钞票清单.
钞票的可能面值有 100,50,20,10,5,2,1100,50,20,10,5,2,1.
输入格式
输入一个整数 NN.
输出格式
参照输出样例,输出读取数值以及每种面值的钞票的需求数量.
数据范围
0<N<10000000<N<1000000
输入样例:
576
输出样例:
576
5 nota(s) de R$ 100,00
1 nota(s) de R$ 50,00
1 nota(s) de R$ 20,00
0 nota(s) de R$ 10,00
1 nota(s) de R$ 5,00
0 nota(s) de R$ 2,00
1 nota(s) de R$ 1,00
#include<iostream>
using namespace std;
int a;
int main(){
cin>>a;
printf("%d\n%d nota(s) de R$ 100,00\n",a,a/100);
printf("%d nota(s) de R$ 50,00\n",(a%100)/50);
printf("%d nota(s) de R$ 20,00\n",((a%100)%50)/20);
printf("%d nota(s) de R$ 10,00\n",(((a%100)%50)%20)/10);
printf("%d nota(s) de R$ 5,00\n",(((((a%100)%50)%20)%10)/5));
printf("%d nota(s) de R$ 2,00\n",((((((a%100)%50)%20)%10)%5)/2));
printf("%d nota(s) de R$ 1,00",(((((((a%100)%50)%20)%10)%5)%2)/1));
}
1 学如逆水行舟,不进则退
边栏推荐
- 软链接引发的物理备份问题
- Intel XDC 2022 Wonderful Review: Build an Open Ecosystem and Unleash the Potential of "Infrastructure"
- 1667. Fix names in tables
- 后期学习计划
- leetcode-另一棵树的子树
- Apache DolphinScheduler, a new generation of distributed workflow task scheduling platform in practice - Medium
- nodeJs--encapsulate routing
- lua学习
- 1873. 计算特殊奖金
- 力扣-二叉树的最大的深度
猜你喜欢
随机推荐
Data to enhance Mixup principle and code reading
Intel XDC 2022 Wonderful Review: Build an Open Ecosystem and Unleash the Potential of "Infrastructure"
【OpenCV 图像处理2】:OpenCV 基础知识
百日刷题计划 ———— DAY2
注意潍坊开具发票一般需要注意
编译预处理等细节
torch.roll()
VSCode Change Default Terminal how to modify the Default Terminal VSCode
语法基础(变量、输入输出、表达式与顺序语句)
采用redis缓存的linux主从同步服务器图片硬盘满了移到新目录要修改哪些指向
The 2022 EdgeX China Challenge will be grandly opened on August 3
Regular expression to match a certain string in the middle
Apache DolphinScheduler, a new generation of distributed workflow task scheduling platform in practice - Medium
02 [Development Server Resource Module]
PostgreSQL数据库 用navicat 打开表结构的时候报错 cannot update secondarysnapshot during a parallel operation 怎么解决?
Matlab drawing 3
OpenGL 工作原理
RAID disk array
C student management system Insert the student node at the specified location
QT语言文件制作