zoukankan      html  css  js  c++  java
  • POJ 2105

    #include <iostream>
    #include <cmath>
    #include <string>
    using namespace std;
    
    int main()
    {
        //freopen("acm.acm","r",stdin);
        int num;
        int i;
        int j;
        int tem;
        int index;
        int sum;
        string s;
        cin>>num;
        getchar();
        while(num --)
        {
            index = 0;
            getline(cin,s);
            for(i = 0; i < 4; ++ i)
            {
                sum = 0;
                for(j = index; j < 8+index; ++ j)
                {
                    tem = s[j] - '0';
                    if(tem == 1)
                        sum += pow(double(2),index+8-j-1)*tem;
                }
                index += 8;
                if(i != 3)
                    cout<<sum<<".";
                else 
                    cout<<sum;
            //    cout<<"    index "<<index<<endl;
            }
            cout<<endl;
        }
    }

    关注我的公众号,当然,如果你对Java, Scala, Python等技术经验,以及编程日记,感兴趣的话。 

    技术网站地址: vmfor.com

  • 相关阅读:
    Emacs教程
    华为上机测试 2015
    奇偶排序
    C语言中的EOF和回车不一样
    jquery 使用方法
    1116
    1115
    1109
    Oracle14~23
    get与post的区别
  • 原文地址:https://www.cnblogs.com/gavinsp/p/4566655.html
Copyright © 2011-2022 走看看