Online Judge | Problem Set | Authors | Online Contests | User | ||||||
---|---|---|---|---|---|---|---|---|---|---|
Web Board Home Page F.A.Qs Statistical Charts | Current Contest Past Contests Scheduled Contests Award Contest |
wa了。。。#include "iostream" #include "string" #include "math.h" using namespace std; int main(){ int i; string str; while (cin >> str && str != "0e00") { int value = str[0]-'0'; value = value * 10 + (str[1]-'0'); for (i = 0;i < str[3]-'0';i++) { value *=10; } int n = (int)(log(value+1.0)/log(2.0)+0.00000001); int temp = value-(pow(2.0,n)-1); if (temp == 0) { cout << 2 * n - 1 << endl; }else{ cout << 2 * temp - 1 << endl; } } return 0; } Followed by: Post your reply here: |
All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator