当前位置:网站首页>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 学如逆水行舟,不进则退
边栏推荐
- Matlab画图3
- Simple implementation of YOLOv7 pre-training model deployment based on OpenVINO toolkit
- How OpenGL works
- Industry case | insurance companies of the world's top 500 construction standards can be used to drive the business analysis system
- 云原生(三十二) | Kubernetes篇之平台存储系统介绍
- mysql树状结构查询问题
- C student management system Insert the student node at the specified location
- 1873. The special bonus calculation
- 22-07-31周总结
- 继承关系下构造方法的访问特点
猜你喜欢

Matlab画图3

基于左序遍历的数据存储实践

LeetCode使用最小花费爬楼梯----dp问题

Opening - Open a new .NET modern application development experience

shell语句修改txt文件或者sh文件

特殊矩阵的压缩存储

C language diary 9 3 kinds of statements of if

Optimizing the feed flow encountered obstacles, who helped Baidu break the "memory wall"?

Quickly learn chess from zero to one

【C语言】详解栈和队列(定义、销毁、数据的操作)
随机推荐
Error: Not a signal or slot declaration
北斗三号短报文终端露天矿山高边坡监测方案
线性表的查找
[LeetCode Brush Questions] - Sum of Numbers topic (more topics to be added)
Regular expression to match a certain string in the middle
Simple implementation of YOLOv7 pre-training model deployment based on OpenVINO toolkit
mysql tree structure query problem
02 [Development Server Resource Module]
The 20th day of the special assault version of the sword offer
【 2 】 OpenCV image processing: basic knowledge of OpenCV
Common hardware delays
Quickly learn chess from zero to one
[In-depth study of 4G/5G/6G topic-51]: URLLC-16-"3GPP URLLC related protocols, specifications, and technical principles in-depth interpretation"-11-High reliability technology-2-Link adaptive enhancem
VSCode Change Default Terminal how to modify the Default Terminal VSCode
Amazon Cloud Technology joins hands with Thundersoft to build an AIoT platform for industry customers
数据增强Mixup原理与代码解读
View handler 踩坑记录
Review 51 MCU
C language implements a simple number guessing game
你要的七夕文案,已为您整理好!