Add More Zero
2017-07-25 18:28
330 查看
题目链接
Total Submission(s): 0 Accepted Submission(s): 0
[align=left]Problem Description[/align]There is a youngster known for amateur propositions concerning several mathematical hard problems.
Nowadays, he is preparing a thought-provoking problem on a specific type of supercomputer which has ability to support calculations of integers between 0 denotes the answer of corresponding case.
[align=left]Sample Input[/align]
[align=left]Sample Output[/align]
Statistic | Submit | Clarifications | Back
思路:
题目是求[0,2^m-1]上的十进制数最大有多少位,即10^k中k的最大值。
显然k=log10(2^m-1),要是2^m就好了,我们算的是位数,如果+1影响到它的位数,说明2^m-1末位是9,显然不可能,则k=log10(2^m)=m*log10(2)。
ac代码:
Add More Zero
Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 131072/131072 K (Java/Others)Total Submission(s): 0 Accepted Submission(s): 0
[align=left]Problem Description[/align]There is a youngster known for amateur propositions concerning several mathematical hard problems.
Nowadays, he is preparing a thought-provoking problem on a specific type of supercomputer which has ability to support calculations of integers between 0 denotes the answer of corresponding case.
[align=left]Sample Input[/align]
1 64
[align=left]Sample Output[/align]
Case #1: 0 Case #2: 19
Statistic | Submit | Clarifications | Back
思路:
题目是求[0,2^m-1]上的十进制数最大有多少位,即10^k中k的最大值。
显然k=log10(2^m-1),要是2^m就好了,我们算的是位数,如果+1影响到它的位数,说明2^m-1末位是9,显然不可能,则k=log10(2^m)=m*log10(2)。
ac代码:
#include<stdio.h> #include<math.h> int m; int main() { int ans; int cas=0; while(~scanf("%d",&m)) { ans= log10(2)*m; printf("Case #%d: %d\n",++cas,ans); } return 0; }
相关文章推荐
- hdu 多校联赛 Add More Zero
- (数学)HDU 6033 Add More Zero
- HDU 2017 多校联赛-1001 Add More Zero
- 1001.Add More Zero
- HDU6033-Add More Zero
- 2017 Multi-University Training Contest - Team 1 Add More Zero
- HDU 6033 (2017 多校训练赛1 1001) Add More Zero
- 杭电第一次多校赛_1001_Add_More_Zero_2017_7_25
- Add More Zero
- Add More Zero
- HUD 6033 Add More Zero(暑期训练1001)
- 2017 Multi-University Training Contest - Team 1:Add More Zero (hdu 6033)
- HDU-Add More Zero
- 2017 Multi-University Training Contest - Team 1 Add More Zero
- 2017 Multi-University Training Contest - Team 1&hdu6033 Add More Zero
- HDU 6033 Add More Zero【】
- 杭电 Add More Zero
- HDU-6033 Add More Zero - 2017 Multi-University Training Contest - Team 1(水之崩心态题)
- HDU6033---Add More Zero(2017多校联赛A题)
- 杭电多校 1001 Add More Zero 题解报告