当前位置:网站首页>语法基础(变量、输入输出、表达式与顺序语句完成情况)
语法基础(变量、输入输出、表达式与顺序语句完成情况)
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 学如逆水行舟,不进则退
边栏推荐
- Pisanix v0.2.0 released | Added support for dynamic read-write separation
- How OpenGL works
- 2022-08-04:输入:去重数组arr,里面的数只包含0~9。limit,一个数字。 返回:要求比limit小的情况下,能够用arr拼出来的最大数字。 来自字节。
- select 标签自定义样式
- nodeJs--封装路由
- C学生管理系统 头添加学生节点
- shell statement to modify txt file or sh file
- 海量服务实例动态化管理
- Using OpenVINO to implement the flying paddle version of the PGNet inference program
- VSCode Change Default Terminal 如何修改vscode的默认terminal
猜你喜欢
OpenGL 工作原理
Pisanix v0.2.0 released | Added support for dynamic read-write separation
What should I do if the self-incrementing id of online MySQL is exhausted?
虚拟内存原理与技术
从零到一快速学会三子棋
【LeetCode刷题】-数之和专题(待补充更多题目)
SuperMap iDesktop.Net之布尔运算求交——修复含拓扑错误复杂模型
The 2022 EdgeX China Challenge will be grandly opened on August 3
蚁剑高级模块开发
[ROS] (10) ROS Communication - Service Communication
随机推荐
post-study program
优炫数据库的单节点如何转集群
SDC简介
蚁剑高级模块开发
Optimizing the feed flow encountered obstacles, who helped Baidu break the "memory wall"?
The design idea of DMicro, the Go microservice development framework
1484. 按日期分组销售产品
DAY23:命令执行&代码执行漏洞
02 [Development Server Resource Module]
Snapback - same tree
Cloud Native (32) | Introduction to Platform Storage System in Kubernetes
HDU 1114: Piggy-Bank ← The Complete Knapsack Problem
Semi-Decentralized Federated Learning for Cooperative D2D Local Model Aggregation
数据增强Mixup原理与代码解读
软链接引发的物理备份问题
从零到一快速学会三子棋
转:查尔斯·汉迪:你是谁,比你做什么更重要
SuperMap iDesktop.Net之布尔运算求交——修复含拓扑错误复杂模型
nodeJs--封装路由
使用SuperMap iDesktopX数据迁移工具迁移ArcGIS数据