HLD2039麦森数

数学题  求2^p-1的位数
代码:

 1 #include<iostream>
 2 #include<string.h>
 3 #include<stdio.h>
 4 #include<cmath>
 5 using namespace std;
 6 
 7 int main()
 8 {
 9     int p;
10     while(cin>>p)
11     {
12         cout<<int(p*log10 (2.0))+1<<endl;
13     }
14     return 0;
15 }
View Code

  

posted @ 2014-02-27 21:02  悠悠我心。  阅读(113)  评论(0编辑  收藏  举报