当前位置:网站首页>语法基础(变量、输入输出、表达式与顺序语句完成情况)
语法基础(变量、输入输出、表达式与顺序语句完成情况)
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 学如逆水行舟,不进则退
边栏推荐
猜你喜欢
随机推荐
Solve connect: The requested address is not valid in its context
优炫数据库的单节点如何转集群
[LeetCode Brush Questions] - Sum of Numbers topic (more topics to be added)
lua learning
转:查尔斯·汉迪:你是谁,比你做什么更重要
SuperMap iDesktop.Net之布尔运算求交——修复含拓扑错误复杂模型
select tag custom style
STM32使用stm32cubemx LL库系列教程
Ant Sword Advanced Module Development
1527. Patients suffering from a disease
The design idea of DMicro, the Go microservice development framework
Apache DolphinScheduler, a new generation of distributed workflow task scheduling platform in practice - Medium
学习笔记-----左偏树
The 20th day of the special assault version of the sword offer
DAY22:sqli-labs 靶场通关wp(Less01~~Less20)
VSCode Change Default Terminal how to modify the Default Terminal VSCode
重新审视分布式系统:永远不会有完美的一致性方案……
1527. 患某种疾病的患者
Optimizing the feed flow encountered obstacles, who helped Baidu break the "memory wall"?
SuperMap支持的国产环境汇总








![[LeetCode Brush Questions] - Sum of Numbers topic (more topics to be added)](/img/ee/6b52072c841af99488dc0c1141c74c.png)