当前位置:网站首页>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 学如逆水行舟,不进则退
边栏推荐
- leetcode - a subtree of another tree
- [Decryption] Can the NFTs created by OpenSea for free appear in my wallet without being chained?
- C语言实现简单猜数字游戏
- Semi-Decentralized Federated Learning for Cooperative D2D Local Model Aggregation
- Chinese characters to Pinyin
- 【解密】OpenSea免费创造的NFT都没上链竟能出现在我的钱包里?
- Matlab map with color representation module value size arrow
- leetcode 15
- 1484. 按日期分组销售产品
- [ROS](10)ROS通信 —— 服务(Service)通信
猜你喜欢

Matlab map with color representation module value size arrow

正则表达式,匹配中间的某一段字符串

特殊矩阵的压缩存储

Matlab drawing 3

2022-08-04:输入:去重数组arr,里面的数只包含0~9。limit,一个数字。 返回:要求比limit小的情况下,能够用arr拼出来的最大数字。 来自字节。

The 2022 EdgeX China Challenge will be grandly opened on August 3

C语言日记 9 if的3种语句

Common hardware delays

Apache DolphinScheduler, a new generation of distributed workflow task scheduling platform in practice - Medium

View handler 踩坑记录
随机推荐
post-study program
627. Change of gender
Pisanix v0.2.0 released | Added support for dynamic read-write separation
Apache DolphinScheduler新一代分布式工作流任务调度平台实战-中
C学生管理系统 指定位置插入学生节点
[Decryption] Can the NFTs created by OpenSea for free appear in my wallet without being chained?
【OpenCV 图像处理2】:OpenCV 基础知识
J9 Digital Currency: What is the creator economy of web3?
[Fortune-telling-60]: "The Soldier, the Tricky Way"-2-Interpretation of Sun Tzu's Art of War
注意潍坊开具发票一般需要注意
RAID磁盘阵列
Access Characteristics of Constructor under Inheritance Relationship
基于左序遍历的数据存储实践
22-07-31周总结
1527. 患某种疾病的患者
1667. Fix names in tables
开源协议说明LGPL
leetcode 15
627. 变更性别
剑指offer专项突击版第20天