当前位置:网站首页>语法基础(变量、输入输出、表达式与顺序语句完成情况)
语法基础(变量、输入输出、表达式与顺序语句完成情况)
2022-08-05 02:34:00 【进击攻城狮】

1.A+B
输入两个整数,求这两个整数的和是多少。
输入格式
输入两个整数A,BA,B,用空格隔开
输出格式
输出一个整数,表示这两个数的和
数据范围
0≤A,B≤1080≤A,B≤108
样例输入:
3 4
样例输出:
7
#include<iostream>
using namespace std;
int a,b,c ;
int main(){
cin>>a>>b>>c;
c=a+b;
cout<<c<<endl;
return 0;
}
608.差
读取四个整数 A,B,C,DA,B,C,D,并计算 (A×B−C×D)(A×B−C×D) 的值。
输入格式
输入共四行,第一行包含整数 AA,第二行包含整数 BB,第三行包含整数 CC,第四行包含整数 DD。
输出格式
输出格式为 DIFERENCA = X,其中 XX 为 (A×B−C×D)(A×B−C×D) 的结果。
数据范围
−10000≤A,B,C,D≤10000−10000≤A,B,C,D≤10000
输入样例:
5
6
7
8
输出样例:
DIFERENCA = -26
#include<cstdio>
using namespace std;
int A,B,C,D;
int main(){
scanf("%d%d%d%d",&A,&B,&C,&D);
printf("DIFERENCA = %d\n",A*B-C*D);
return 0;
}
604. 圆的面积
计算圆的面积的公式定义为 A=πR2A=πR2。
请利用这个公式计算所给圆的面积。
ππ 的取值为 3.141593.14159。
输入格式
输入包含一个浮点数,为圆的半径 RR。
输出格式
输出格式为 A=X,其中 XX 为圆的面积,用浮点数表示,保留四位小数。
数据范围
0<R<10000.000<R<10000.00
输入样例:
2.00
输出样例:
A=12.5664
#include<cstdio>
using namespace std;
int main(){
double PI=3.14159;
double R;
scanf("%lf",&R);
printf("A=%.4lf",PI*R*R);
}
606. 平均数1
读取两个浮点数 AA 和 BB 的值,对应于两个学生的成绩。
请你计算学生的平均分,其中 AA 的成绩的权重为 3.53.5,BB 的成绩的权重为 7.57.5。
成绩的取值范围在 00 到 1010 之间,且均保留一位小数。
输入格式
输入占两行,每行包含一个浮点数,第一行表示 AA,第二行表示 BB。
输出格式
输出格式为 MEDIA = X,其中 XX 为平均分,结果保留五位小数。
数据范围
0≤A,B≤10.00≤A,B≤10.0
输入样例:
5.0
7.1
输出样例:
MEDIA = 6.43182
#include<cstdio>
using namespace std;
float A,B;
int main(){
scanf("%f%f",&A,&B);
printf("MEDIA = %.5f",(A*3.5+B*7.5)/11);
}
3 4
样例输出:
7
#include<iostream>
using namespace std;
int a,b,c ;
int main(){
cin>>a>>b>>c;
c=a+b;
cout<<c<<endl;
return 0;
}
1 学如逆水行舟,不进则退
边栏推荐
- [ROS] (10) ROS Communication - Service Communication
- C student management system Find student nodes based on student ID
- C语言日记 9 if的3种语句
- C student management system Insert the student node at the specified location
- Solve connect: The requested address is not valid in its context
- DAY23: Command Execution & Code Execution Vulnerability
- 采用redis缓存的linux主从同步服务器图片硬盘满了移到新目录要修改哪些指向
- QT语言文件制作
- Error: Not a signal or slot declaration
- 【日常训练】1403. 非递增顺序的最小子序列
猜你喜欢

SuperMap iDesktop.Net之布尔运算求交——修复含拓扑错误复杂模型

How OpenGL works

【C语言】详解栈和队列(定义、销毁、数据的操作)
![02 [Development Server Resource Module]](/img/60/f77ed0bb0e5654c9dcd70b73a5bee8.png)
02 [Development Server Resource Module]
![[C language] Detailed explanation of stacks and queues (define, destroy, and data operations)](/img/7b/8b3f1e4f0000aa34fc1f8fff485765.png)
[C language] Detailed explanation of stacks and queues (define, destroy, and data operations)

02 【开发服务器 资源模块】

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

Pisanix v0.2.0 发布|新增动态读写分离支持

View handler 踩坑记录

云原生(三十二) | Kubernetes篇之平台存储系统介绍
随机推荐
Pisanix v0.2.0 发布|新增动态读写分离支持
nodeJs--encapsulate routing
Data to enhance Mixup principle and code reading
编译预处理等细节
[ROS] (10) ROS Communication - Service Communication
学习笔记-----左偏树
特殊矩阵的压缩存储
lua learning
海量服务实例动态化管理
Solve connect: The requested address is not valid in its context
后期学习计划
Programmer's Tanabata Romantic Moment
常见的硬件延迟
Semi-Decentralized Federated Learning for Cooperative D2D Local Model Aggregation
Snapback - same tree
Chinese characters to Pinyin
Unleashing the engine of technological innovation, Intel joins hands with ecological partners to promote the vigorous development of smart retail
Error: Not a signal or slot declaration
[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
采用redis缓存的linux主从同步服务器图片硬盘满了移到新目录要修改哪些指向