当前位置:网站首页>[introduction to C language] zzulioj 1031-1035
[introduction to C language] zzulioj 1031-1035
2022-07-29 03:48:00 【Death margin~】
ZZULIOJ 1031: What quadrant is the judgment point
Title Description
Input from keyboard 2 It's an integer x、y value , Represents a coordinate point on the plane , Judge which quadrant the coordinate point is in , And output the corresponding results .
Input
Input x,y Value represents a coordinate point . The coordinate point will not be in x Axis and y On the shaft , Nor at the origin .
Output
Output the corresponding quadrant , Use numbers 1,2,3,4 Corresponding to four quadrants respectively .>
The sample input
1 1
Sample output
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: Staff salaries
Title Description
Regulations of a company , The salary of salesperson consists of basic salary and sales commission , The basic salary is 1500 element / month , The sales commission rules are as follows : Sales volume is less than or equal to 10000 Yuan time , according to 5% Royalty ; Sales greater than 10000 Yuan but less than or equal to 50000 Yuan time , beyond 10000 Partly according to 3% Royalty ; Sales greater than 50000 Yuan time , beyond 50000 Partly according to 2% Royalty . Programming , Calculate employee income based on sales .
Input
Enter an integer to represent sales
Output
Output employees' salaries , Retain 2 Decimal place .
The sample input
30000
Sample output
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: Five grade system
Title Description
Given a 100 point score , Please output the corresponding grade according to the hundred mark system . The transformation relationship is as follows :90 Points and above are ’A’,80~89 by ’B’, 70~79 by ’C’, 60~69 by ’D’,60 It is divided into the following ’E’.
Input
A hundred mark mark (0~100 The integer of ).
Output
Output corresponding level .
The sample input
100
Sample output
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: Summer sales
Title Description
Shopping mall summer promotion , shopping 500 Yuan of the following , No discount ; shopping 500 element ( contain ) above ,95 fold ; shopping 1000 element ( contain ) above ,9 fold ; shopping 3000 element ( contain ) above ,85 fold ; shopping 5000 element ( contain ) above ,8 fold . According to the consumption amount , Determine the amount that the user actually needs to pay .
Input
Enter a real number , Indicates the consumption amount .
Output
Output a real number , It indicates the actual amount that the user needs to spend , Keep two decimal places .
The sample input
5100
Sample output
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: Piecewise function evaluation
Title Description
It is known that :y yes x Function of , When x<-2 when ,y=7-2x; When x>=-2, And x<3 when ,y=5-|3x+2|; When x>=3 when ,y=3x+4
Input
Enter any integer x.
Output
The output is an integer , namely x The corresponding function value .
The sample input
2
Sample output
-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;
}
边栏推荐
- 路西法98-生活记录ing
- 一文学透MySQL表的创建和约束
- lodash库常用方法
- Form verification of landline
- JS cookie usage
- LVS+KeepAlived高可用部署实战应用
- [BGP] small scale experiment
- Lvs+keepalived high availability deployment practical application
- Why is continuous integration and deployment important in development?
- three. JS Part 54 how to pass structure array to shader
猜你喜欢
实例搭建Flask服务(简易版)
从2019 年开始,你一定停止使用了这个营销策略…
Lvs+keepalived high availability deployment practical application
大厂们终于无法忍受“加一秒”了,微软谷歌Meta等公司提议废除闰秒
MOS tube - rapid recovery application notes (II) [parameters and applications]
向日葵远程控制为何采用BGP服务器?自动最优路线、跨运营商高速传输
(2022杭电多校三)1002-Boss Rush(状压DP+二分)
Sleuth+zipkin to track distributed service links
【BGP】小型实验
Shopify seller: EDM marketing should be combined with salesmartly to easily get the conversion rate
随机推荐
1. Header file - Comment - namespace - standard input / output stream
Since 2019, you must have stopped using this marketing strategy
Lvs+keepalived high availability deployment practical application
《陌路曾相逢》夏陌沈疏晏_夏陌沈疏晏最新章节
力扣每日一题-第44天-205. 同构字符串
Spark dataframe replaces empty characters (or other values) in each column with null
How to understand "page storage management scheme"
Why don't programmers work blindly?
The function parameters of the new features of ES6 are assigned initial values and rest parameters
向日葵远程控制为何采用BGP服务器?自动最优路线、跨运营商高速传输
How to understand clock cycle and formula CPU execution time = number of CPU clock cycles / dominant frequency
最新二开版漫画小说听书三合一完整源码/整合免签接口/搭建教程/带采集接口
华为天才少年稚晖君做了一把模块化机械键盘,引起极客圈地震,网友:这才是真正的客制化...
Shutter start white screen
[redis series] string data structure
OPENSQL快速学习
Casbin入门
With more than 5 years of work experience and a salary of 15K, would you accept it if you were me?
Typescript from introduction to proficiency (XXIV) using import syntax
Uni app internationalization