当前位置:网站首页>【C语言入门】ZZULIOJ 1031-1035
【C语言入门】ZZULIOJ 1031-1035
2022-07-29 03:43:00 【逝缘~】
ZZULIOJ 1031:判断点在第几象限
题目描述
从键盘输入 2 个整数 x、y 值,表示平面上一个坐标点,判断该坐标点处于第几象限,并输出相应的结果。
输入
输入 x,y 值表示一个坐标点。坐标点不会处于 x 轴和 y 轴上,也不会在原点。
输出
输出对应的象限,用数字 1,2,3,4 分别对应四个象限。>
样例输入
1 1
样例输出
1
#include <stdio.h>
#include <stdlib.h>
int main()
{
int a,b;
scanf("%d %d",&a,&b);
if(a>0&&b>0)
printf("1");
if(a<0&&b>0)
printf("2");
if(a<0&&b<0)
printf("3");
if(a>0&&b<0)
printf("4");
return 0;
}
ZZULIOJ 1032:员工薪水
题目描述
某公司规定,销售人员工资由基本工资和销售提成两部分组成,其中基本工资是 1500 元/月,销售提成规则如下:销售额小于等于 10000 元时,按照 5%提成;销售额大于 10000 元但小于等于 50000 元时,超出 10000 部分按照 3%提成;销售额大于 50000 元时,超出 50000 部分按照 2%提成。编写程序,根据销售额计算员工收入。
输入
输入一个整数表示销售额
输出
输出员工的薪水,保留 2 位小数。
样例输入
30000
样例输出
2600.00
#include <stdio.h>
#include <stdlib.h>
int main()
{
int a;
double m;
scanf("%d",&a);
if(a<=10000)
m=a*0.05+1500;
if(a>10000&&a<=50000)
m=(a-10000)*0.03+1500+500;
if(a>50000)
m=(a-50000)*0.02+1500+500+1200;
printf("%.2lf",m);
return 0;
}
ZZULIOJ 1033:五级制成绩
题目描述
给定一个百分制成绩, 请根据百分制成绩输出其对应的等级。转换关系如下:90 分及以上为’A’,80~89 为’B’, 70~79 为’C’, 60~69 为’D’,60 分以下为’E’。
输入
一个百分制成绩(0~100 的整数)。
输出
输出对应的等级。
样例输入
100
样例输出
A
#include <stdio.h>
#include <stdlib.h>
int main()
{
int m;
scanf("%d",&m);
if(m>=90)
printf("A");
if(m>79&&m<90)
printf("B");
if(m>69&&m<80)
printf("C");
if(m>59&&m<70)
printf("D");
if(m<60)
printf("E");
return 0;
}
ZZULIOJ 1034:夏季促销
题目描述
商场夏季促销,购物 500 元以下,不打折;购物 500 元(含)以上,95 折;购物 1000 元(含)以上,9 折;购物 3000 元(含)以上,85 折;购物 5000 元(含)以上,8 折。根据消费金额,确定用户实际需要支付的数目。
输入
输入一个实数,表示消费金额。
输出
输出一个实数,表示用户实际需要支出的数目,保留两位小数。
样例输入
5100
样例输出
4080.00
#include <stdio.h>
#include <stdlib.h>
int main()
{
int m;
double n;
scanf("%d",&m);
if(m>=5000)
n=0.8*m;
if(m>=1000&&m<3000)
n=0.9*m;
if(m>=500&&m<1000)
n=0.95*m;
if(m<500)
n=m;
if(m>=3000&&m<5000)
n=0.85*m;
printf("%.2f",n);
return 0;
}
ZZULIOJ 1035:分段函数求值
题目描述
已知:y 是 x 的函数,当 x<-2 时,y=7-2x;当 x>=-2,且 x<3 时,y=5-|3x+2|;当 x>=3 时,y=3x+4
输入
任意输入一个整数 x。
输出
输出为一个整数,即 x 对应的函数值。
样例输入
2
样例输出
-3
#include <stdio.h>
#include <stdlib.h>
#include <math.h>
int main()
{
int x,y;
scanf("%d",&x);
if(x<-2)
y=7-2*x;
if(x>=-2&&x<3)
y=5-fabs(3*x+2);
if(x>=3)
y=3*x+4;
printf("%d",y);
return 0;
}
边栏推荐
- (newcoder 15079)无关(容斥原理)
- NXP i.mx8mp-deepviewrt
- 1985-2020(8个版次)全球地表覆盖下载与介绍
- How fast does it take to implement a super simple language
- AI platform, AI midrange architecture
- Notes on letter symbol marking of papers
- Deep into C language (1) -- operators and expressions
- Arm architecture and neural network
- 2 neural network toolbox NN
- 消费行业数字化升级成 “刚需”,weiit 新零售 SaaS 为企业赋能!
猜你喜欢
从2019 年开始,你一定停止使用了这个营销策略…
Realize multi-level linkage through recursion
How to understand clock cycle and formula CPU execution time = number of CPU clock cycles / dominant frequency
Sleuth+Zipkin 来进行分布式服务链路的追踪
Exness: dove resolution helped gold rebound, and the focus turned to U.S. GDP
Rdkit II: use rdkit screening to screen 2D pharmacophores of chemical small molecules
Understanding of p-type problems, NP problems, NPC problems, and NP hard problems in natural computing
@Configuration (proxybeanmethods = false) what's the use of setting this to false
Arm architecture and neural network
新零售O2O 电商模式解析
随机推荐
1. Mx6u driver development-2-led driver
MOS tube - rapid recovery application notes (II) [parameters and applications]
AI_ Drug: VAE of molecular generation model (I)
How do programmers use code to completely end those things in the system?
《陌路曾相逢》夏陌沈疏晏_夏陌沈疏晏最新章节
Sleuth+zipkin to track distributed service links
Environment configuration stepping pit during colab use
(newcoder 15079) irrelevant (inclusion exclusion principle)
How to realize multi line annotation in MATLAB
1. 头文件-注释-命名空间-标准输入输出流
2 neural network toolbox NN
How to understand clock cycle and formula CPU execution time = number of CPU clock cycles / dominant frequency
"The programming is not standardized, and my colleagues are in tears!"
新零售O2O 电商模式解析
Install the packet capturing certificate
后缀自动机(sam)板子 from jly
Whole process record of yolov3 target detection
(2022 Hangdian multi school III) 1011 link is as bear (thinking + linear basis)
Simple understanding of CDN, SDN and QoS
Code ~ hide or disable the status bar and virtual keys