当前位置:网站首页>[introduction to C language] zzulioj 1006-1010
[introduction to C language] zzulioj 1006-1010
2022-07-26 02:26:00 【Death margin~】
ZZULIOJ 1006: Find the sum of the arithmetic sequence
Title Description
Give three integers , Respectively represent the first term of the arithmetic sequence 、 Last item and tolerance , Find the sum of the sequence .
Input
Enter three integers , Space between . The first 1 Number as the first item , The first 2 Number as the last term , The first 3 Number as tolerance .
Output
Output takes up one line , Contains an integer , Is the sum of the arithmetic sequence .
The sample input
2 11 3Sample output
26#include <stdio.h>#include <stdlib.h>int main(){int x ,y ,z ;scanf ("%d %d %d",&x,&y,&z);printf("%d",(x+y)*((y-x)/z+1)/2);return 0;}
ZZULIOJ 1007: Chicken and rabbit in the same cage
Title Description
The chicken and the rabbit are kept in a cage , Chicken has 2 One foot , The rabbit has 4 One foot , No exceptions . It is known that you can now see in the cage m Size and n One foot , Ask how many chickens and rabbits there are ?
Input
Enter two integers heads and feet, They represent the number of heads and feet in the cage .( hypothesis heads and feet Are within the legal data range )
Output
Output the number of chickens and rabbits in turn .( The number is 0 Also output )
The sample input
12 40Sample output
4 8#include <stdio.h>#include <stdlib.h>int main(){int x,y,m,n;scanf("%d %d",&m,&n);x=2*m-0.5*n;y=0.5*n-m;printf("%d %d",x,y);return 0;}
ZZULIOJ 1008: US dollars and RMB
Title Description
The dollar is falling more and more , It doesn't seem a good thing to have too many dollars on hand . Quickly calculate how much RMB your dollars are worth . Suppose the exchange rate between us dollar and RMB is 1 Exchange US dollars for 6.5573 RMB , Write a program to enter the amount in US dollars , Output convertible RMB amount .
Input
Enter a real number , Amount in US dollars .
Output
Output the value of convertible RMB . Output reserved 2 Decimal place .
The sample input
100Sample output
655.73#include <stdio.h>#include <stdlib.h>int main(){double m;scanf("%lf",&m);printf("%.2lf\n",m*6.5573);return 0;}
ZZULIOJ 1009: Average score
Title Description
Know a student's math 、 Grades in English and computer courses , Find the average score of the student's three courses .
Input
Enter three integers , Data is separated by spaces .
Output
Output takes up one line , Contains a real number , The average score of three courses , Keep two decimal places .
The sample input
87 73 93Sample output
84.33#include <stdio.h>#include <stdlib.h>int main(){double a ,b, c;scanf("%lf %lf %lf",&a,&b,&c);printf("%.2lf\n",(a+b+c)/3);return 0;}
ZZULIOJ 1010: Find the circumference and area of a circle
Title Description
Enter the radius of the circle , Find the circumference and area of a circle . It is required to define the PI as the following macro constant #define PI 3.14159
Input
Enter the radius r Value , Is a real number .
Output
Output one line , Including perimeter and area . The data is separated by a space , Keep the data to the last two decimal places .
The sample input
3Sample output
18.85 28.27#include <stdio.h>#include <stdlib.h>#define PI 3.14159int main(){double r,c,s;scanf("%lf",&r);c=2*PI*r;s=PI*r*r;printf("%.2f %.2f\n",c,s);return 0;}
边栏推荐
- Digital warehouse: on the construction practice of digital warehouse in banking industry
- Pytorch的API总览
- scipy.sparse.vstack
- Quick start of adding, deleting, modifying and checking business
- 微信小程序解密并拆包获取源码教程
- 2. Login - verification code function and saving login status
- 如何加速矩阵乘法
- npm link的简单介绍及使用
- [C] Explain language file operation in detail
- I.MX6UL核心模块使用连载-Iot-6ULX核心模块简要介绍 (一)
猜你喜欢

ES6高级-利用原型对象继承方法

博云容器云、DevOps 平台斩获可信云“技术最佳实践奖”

Exclusive interview with ringcentral he Bicang: empowering future mixed office with innovative MVP

Sword finger offer 28. symmetric binary tree

力扣148:排序链表

增删改查业务的快速上手

Ti am335x industrial control module uses the Debian system of beaglebone (BBB)

Wechat applet - get user location (longitude and latitude + city)

Bo Yun container cloud and Devops platform won the trusted cloud "technology best practice Award"

HLS Experiment 1 -- multiplier
随机推荐
C language -- program environment and preprocessing
商业智能BI全解析,探寻BI本质与发展趋势
[cloud native] 4.1 Devops foundation and Practice
SQL how to return all data when the input query condition is empty
National standard gb28181 protocol video platform easygbs message pop-up mode optimization
2022-07-17
[red team] att & CK - using bits services to achieve persistence
020-024 polymorphism review
npm link的简单介绍及使用
[xxl-job] xxl-job learning
Prometheus + redis exporter + grafana monitor redis service
I came to the library applet check-in process analysis
prometheus+blackbox-exporter+grafana 监控服务器端口及url地址
1. Mx6ul core module serial WiFi test (VIII)
What can EAM system help enterprises do?
Postman reported JSON serialization error
I.MX6UL核心模块使用连载-Iot-6ULX核心模块简要介绍 (一)
Prove that perfect numbers are even
Obsidian mobile PC segment synchronization
Handling process of the problem that the virtual machine's intranet communication Ping fails