当前位置:网站首页>[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;}
边栏推荐
- MPI learning notes (II): two implementation methods of matrix multiplication
- day04_ array
- Per capita Swiss number series, Swiss number 4 generation JS reverse analysis
- leetcode-146:LRU 缓存
- How to obtain the subordinate / annotation information of KEGG channel
- cts测试步骤(卡西欧cts200测试)
- Pycharm跑程序时自动进入测试模式
- Scan delete folder problems
- Airtest解决“自动装包”过程中需要输入密码的问题(同适用于随机弹框处理)
- Remote—实战
猜你喜欢

Qixin Jushi cloud spectrum new chapter | Haitai Fangyuan and Sichuan Unicom reach ecological strategic cooperation

Pycharm跑程序时自动进入测试模式

leetcode-114:二叉树展开为链表

leetcode-6129:全 0 子数组的数目

Pychart automatically enters the test mode when running the program

基于腾讯地图实现精准定位,实现微信小程序考勤打卡功能

Leetcode-6129: number of all 0 subarrays

Character function and string function (2)

Decompile app

LeetCode刷题——猜数字大小II#375#Medium
随机推荐
When facing complex problems, systematic thinking helps you understand the essence of the problem
使用oap切面导致controller被重复调用
图片怎么存储到数据库里「建议收藏」
476-82(322、64、2、46、62、114)
resize函数的作用「建议收藏」
cuda_ error_ out_ of_ Memory (out of memory)
Leetcode-6125: equal row and column pairs
Niuke-top101-bm38
Array of arm disassembly
Record the transfer of domain names from Alibaba cloud service providers to Huawei cloud
一道golang中关于接口和实现的面试题
Airtest solves the problem that a password needs to be entered in the process of "automatic packaging" (the same applies to random bullet frame processing)
Leetcode-6127: number of high-quality pairs
作为测试,如何理解线程同步异步
IEC61131 address representation
Differences between seaslog and monolog log systems, installation steps of seaslog [easy to understand]
Oracle views the SQL statements with the slowest execution and the most queries
leetcode-6125:相等行列对
数据库sql语句练习题「建议收藏」
Leetcode-6126: designing a food scoring system