当前位置:网站首页>【C语言入门】ZZULIOJ 1016-1020
【C语言入门】ZZULIOJ 1016-1020
2022-07-25 21:09:00 【逝缘~】
ZZULIOJ 1016:银行利率
题目描述
设银行 1 年期定期存款年利率为 2.25%,存款本金为 capital 元,试编程计算并输出 n 年后的本利之和。
(注: 目前银行活期存款的利息是按单利计息的。如果是定期存款,连本带息转入下一个存期,那么会继续计入定期的,相当于是复利。)
输入
输入一个正整数和一个实数,分别代表存款年数和存款本金。
输出
输出一个实数为 n 年后的本利之和,小数点后保留 6 位数字。
样例输入
2 100.0样例输出
104.550625#include <stdio.h>#include <stdlib.h>int main(){ int n;double c;scanf("%d %lf",&n,&c);printf("%.6f\n",c*pow(1+0.0225,n));return 0;}
ZZULIOJ 1017:判断正整数位数
题目描述
给定一个不多于 5 位的正整数,判断它是几位数,并输出。
输入
一个不多于 5 位的正整数。
输出
输出正整数的位数,单独占一行。
样例输入
111样例输出
3提示
使用函数 log10(n),求出 n 的以 10 为底的对数,这个对数的整数部分,就是 n 的科学计数法中的指数,这个整数加 1 就是 n 的位数。
#include <stdio.h>#include <stdlib.h>int main(){int m,n;scanf("%d",&m);for(n=0;m>0;n++){m=m/10;}printf("%d\n",n);return 0;}
ZZULIOJ 1018:奇数偶数
题目描述
输入一个整数,判断该数是奇数还是偶数。
输入
输入整数 n。
输出
如果该数是奇数就输出“odd”,偶数就输出“even”(输出不含双引号)。
样例输入
-3样例输出
odd#include <stdio.h>#include <stdlib.h>int main(){int m;scanf("%d",&m);if(m%2==0)printf("even");elseprintf("odd");return 0;}
ZZULIOJ 1019:公园门票
题目描述
某公园门票的票价是每人 50 元,一次购票满 30 张,每张可以少收 2 元。试编写自动计费系统程序。
输入
输入一个正整数,表示购票的数量。
输出
输出一个整数,表示用户实际需要支付的金额。
样例输入
30样例输出
1440#include <stdio.h>#include <stdlib.h>int main(){int m,n;scanf("%d",&m);if(m>=30)n=48*m;elsen=50*m;printf("%d",n);return 0;}
ZZULIOJ 1020:两整数排序
题目描述
从键盘输入两个整数 x,y,按从小到大的顺序输出它们的值。
输入
输入两个整数 x,y。
输出
按从小到大的顺序输出它们的值。数据之间以空格间隔。
样例输入
20 16样例输出
16 20#include <stdio.h>#include <stdlib.h>int main(){ int x,y;scanf("%d %d",&x,&y);if(x<y){printf("%d %d",x,y);}else{printf("%d %d",y,x);}return 0;}
边栏推荐
- A detailed explanation of SCP command
- 一道golang中defer和函数结合的面试题
- When MySQL imports data, it has been changed to CSV utf8 file and the file name is English. Why does it still fail to import
- How to obtain the subordinate / annotation information of KEGG channel
- Based on pexels image material API, sort out the material resource library
- Character function and string function (2)
- Solution to oom exceptions caused by improper use of multithreading in production environment (supreme Collection Edition)
- 一道golang中关于接口和实现的面试题
- Leetcode-919: complete binary tree inserter
- Miscellaneous notes -- a hodgepodge
猜你喜欢

476-82(322、64、2、46、62、114)

DDD go practice
![[depth] the new LAAS agreement elephant: the key to revitalizing the development of the defi track](/img/ef/33f93225171e2c3e14b7d090c68196.png)
[depth] the new LAAS agreement elephant: the key to revitalizing the development of the defi track

Vivo official website app full model UI adaptation scheme

Pychart automatically enters the test mode when running the program

KEGG通路的从属/注释信息如何获取

leetcode-6125:相等行列对

LeetCode刷题——猜数字大小II#375#Medium

leetcode-919:完全二叉树插入器

【单细胞高级绘图】07.KEGG富集结果展示
随机推荐
leetcode-6127:优质数对的数目
Opencv learning Fourier transform experience and line direction Fourier transform code
Illustration leetcode - 3. longest substring without repeated characters (difficulty: medium)
wokerman 自定义写入日志文件
[advanced drawing of single cell] 07. Display of KEGG enrichment results
Sum of two numbers and three numbers
牛客-TOP101-BM37
CTS test steps (Casio cts200 test)
Implementation of simple registration and login
A detailed explanation of SCP command
Success factors of software R & D effectiveness measurement
Niuke-top101-bm38
An interview question about concurrent reading and writing of map in golang
JMeter distributed pressure measurement
Detailed explanation of document operation
ES6---4个强大运算符(??、??=、?.、?:)
Hello, I'd like to ask questions about C and database operation.
CV image flipping, emgucv image rotation "recommended collection"
ZigBee IOT development platform (Industrial IOT)
Remote—基本原理介绍