当前位置:网站首页>[introduction to C language] zzulioj 1016-1020
[introduction to C language] zzulioj 1016-1020
2022-07-25 21:09:00 【Death margin~】
ZZULIOJ 1016: bank rate
Title Description
Set up a bank 1 The annual interest rate of one-year fixed deposit is 2.25%, The deposit principal is capital element , Try to program, calculate and output n The sum of capital and profit after years .
( notes : At present, the interest of bank current deposits is calculated by simple interest . If it's a time deposit , Transfer the principal and interest to the next deposit period , Then it will continue to be included in the regular , Equivalent to compound interest .)
Input
Enter a positive integer and a real number , Respectively represents the number of years of deposit and the principal of deposit .
Output
Output a real number as n The sum of capital and profit after years , After the decimal point 6 Digit number .
The sample input
2 100.0Sample output
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: Determine the number of positive integer digits
Title Description
Give one no more than 5 Bit positive integer , Judge how many digits it is , And the output .
Input
One no more than 5 Bit positive integer .
Output
Output the number of bits of a positive integer , Take a line alone .
The sample input
111Sample output
3Tips
Using functions log10(n), Find out n The to 10 Log base , The integer part of this logarithm , Namely n The index in scientific counting , Add this integer 1 Namely n Number of digits .
#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: Odd even
Title Description
Enter an integer , Judge whether the number is odd or even .
Input
Input integer n.
Output
Output if the number is odd “odd”, Even numbers output “even”( The output does not contain double quotes ).
The sample input
-3Sample output
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: Park tickets
Title Description
The ticket price of a park is per person 50 element , One time ticket full 30 Zhang , You can charge less each 2 element . Try to write the program of automatic billing system .
Input
Enter a positive integer , Indicates the number of tickets purchased .
Output
Output an integer , Indicates the amount that the user actually needs to pay .
The sample input
30Sample output
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: Two integer sort
Title Description
Enter two integers from the keyboard x,y, Output their values in descending order .
Input
Enter two integers x,y.
Output
Output their values in descending order . Data is separated by spaces .
The sample input
20 16Sample output
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;}
边栏推荐
- Focus on data | Haitai Fangyuan directly hits the construction idea of data security governance in the securities industry
- In June 2021, the interview suffered a Waterloo. Is it so convoluted now
- Brush questions with binary tree (4)
- 7.23
- Compilation and operation of program
- Yolov7 training error indexerror: list index out of range
- Use of C log4net: add file name and line number to the output log content; Repackaged class output file name and line number
- 如何自动生成短链?如何在线批量生成带UTM参数的链接?
- GDB locates the main address of the program after strip
- How to copy all files in one folder to another folder
猜你喜欢

Brush questions with binary tree (4)

Leetcode-6127: number of high-quality pairs

The international summit osdi included Taobao system papers for the first time, and end cloud collaborative intelligence was recommended by the keynote speech of the conference

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

【FiddlerTX插件】使用Fiddler抓包腾讯课堂视频下载(抓不到包解决方案)

Pychart automatically enters the test mode when running the program

matlab----EEGLab查看脑电信号

Canvas fill gradient

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

Add startup software items when the win system starts up
随机推荐
seven point two three
租房二三事
Character function and string function (2)
Pycharm跑程序时自动进入测试模式
Leetcode-6130: designing digital container systems
Detailed explanation of document operation
npm 模块 移除_【已解决】npm卸载模块后该模块并没有从package.json中去掉[通俗易懂]
leetcode-6127:优质数对的数目
leetcode-79:单词搜索
MPI learning notes (II): two implementation methods of matrix multiplication
Unity vs -- the default debugging in VS is to start rather than attach to unity debugging
3阶有向完全图的所有非同构的子图(不同钩子图个数)
leetcode-6130:设计数字容器系统
Leetcode-6129: number of all 0 subarrays
【FiddlerTX插件】使用Fiddler抓包腾讯课堂视频下载(抓不到包解决方案)
cuda_ error_ out_ of_ Memory (out of memory)
Decompile app
cv图像翻转,EmguCV图像旋转「建议收藏」
Kali modify the update source (it is not safe to update with this source)
一道golang中defer和函数结合的面试题