当前位置:网站首页>Syntax basics (variables, input and output, expressions and sequential statement completion)
Syntax basics (variables, input and output, expressions and sequential statement completion)
2022-08-05 02:45:00 【attack siege lion】
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 学如逆水行舟,不进则退
边栏推荐
猜你喜欢
【OpenCV 图像处理2】:OpenCV 基础知识
[LeetCode Brush Questions] - Sum of Numbers topic (more topics to be added)
01 [Foreword Basic Use Core Concepts]
How Jin Cang database correctness verification platform installation file
VSCode Change Default Terminal how to modify the Default Terminal VSCode
J9数字货币论:web3的创作者经济是什么?
View handler 踩坑记录
Apache DolphinScheduler, a new generation of distributed workflow task scheduling platform in practice - Medium
OpenGL 工作原理
dmp(dump)转储文件
随机推荐
tree table lookup
【LeetCode刷题】-数之和专题(待补充更多题目)
undo问题
汉字转拼音
C language implements a simple number guessing game
行业案例|世界 500 强险企如何建设指标驱动的经营分析系统
The 20th day of the special assault version of the sword offer
nodeJs--封装路由
QT语言文件制作
倒计时 2 天|云原生 Meetup 广州站,等你来!
Access Characteristics of Constructor under Inheritance Relationship
22-07-31周总结
协作D2D局部模型聚合的半分散联合学习
QStyle平台风格
shell语句修改txt文件或者sh文件
627. 变更性别
程序员的七夕浪漫时刻
云原生(三十二) | Kubernetes篇之平台存储系统介绍
[Fortune-telling-60]: "The Soldier, the Tricky Way"-2-Interpretation of Sun Tzu's Art of War
Pisanix v0.2.0 发布|新增动态读写分离支持