当前位置:网站首页>[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;}
边栏推荐
- Illustration leetcode - 3. longest substring without repeated characters (difficulty: medium)
- Explain the principle of MySQL master-slave replication in detail
- Basic method of black box (function) test
- Sum of two numbers and three numbers
- Introduction to MySQL engine and InnoDB logical storage structure
- leetcode-6125:相等行列对
- ZigBee IOT development platform (Industrial IOT)
- 两数,三数之和
- Programmer's Guide to health quenching 5: introduction to sports Basics
- 租房二三事
猜你喜欢

Leetcode-6125: equal row and column pairs

Record the transfer of domain names from Alibaba cloud service providers to Huawei cloud

Unity vs -- the default debugging in VS is to start rather than attach to unity debugging

基于腾讯地图实现精准定位,实现微信小程序考勤打卡功能
![[advanced drawing of single cell] 07. Display of KEGG enrichment results](/img/60/09c5f44d64b96c6e4d57e5f426e4ed.png)
[advanced drawing of single cell] 07. Display of KEGG enrichment results
![[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

Cesium polygon gradient texture (canvas)

Compilation and operation of program

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

476-82(322、64、2、46、62、114)
随机推荐
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
SSH private key realizes login to remote target server
kali修改更新源(无法安全的用该源更新)
Vivo official website app full model UI adaptation scheme
Miscellaneous notes -- a hodgepodge
Leetcode-6130: designing digital container systems
Cesium polygon gradient texture (canvas)
Test cases and defect report templates
Google guava is just a brother. What is the real king of caching? (glory Collection Edition)
What's special about Huawei's innovative solutions to consolidate the foundation of ERP for small and medium-sized enterprises?
浅谈web性能优化(一)
resize函数的作用「建议收藏」
I live far away. Is there a good way to open an account? Is it safe to open a stock account by mobile phone?
Brush questions with binary tree (4)
如何自动生成短链?如何在线批量生成带UTM参数的链接?
IEC61131 address representation
Database SQL statement exercise "suggestions collection"
[FAQ] access the HMS core push service, and the server sends messages. Cause analysis and solutions of common error codes
接口测试工具 restlet client
preprocessor directives