zoukankan      html  css  js  c++  java
  • POJ2105【进制转化】

    直接瞎写就可以水过。我记得STL有很多好的函数,哎。水过去补多校的题。

    //#include <bits/stdc++.h>
    #include<cstdio>
    #include<iostream>
    #include<math.h>
    #include<string.h>
    #include<algorithm>
    using namespace std;
    typedef long long LL;
    typedef unsigned long long ULL;
    const double eps=1e-6;
    const double pi=acos(-1.0);
    const int mod=998244353;
    const LL INF=0x3f3f3f3f;
    
    const int N=1e5+10;
    int main()
    {
        int i,n,len;
        cin>>n;
        while(n--){
            char ss[40];
            scanf("%s",ss);
            int k;
            int a1,a2,a3,a4;
            a1=a2=a3=a4=0;
            k=1;
            for(i=7;i>=0;i--){
                a1+=(ss[i]-'0')*k;
                k*=2;
            }
            k=1;
            for(i=15;i>=8;i--){
                a2+=(ss[i]-'0')*k;
                k*=2;
            }
            k=1;
            for(i=23;i>=16;i--){
                a3+=(ss[i]-'0')*k;
                k*=2;
            }
            k=1;
            for(i=31;i>=24;i--){
                a4+=(ss[i]-'0')*k;
                k*=2;
            }
            printf("%d.%d.%d.%d
    ",a1,a2,a3,a4);
        }
    
    }
  • 相关阅读:
    在centos上搭建Git服务器
    glog日志库移植Android平台
    水葱
    路易斯安娜鸢尾
    再力花
    矮生百慕大
    洒金珊瑚
    八角金盘
    锦绣杜鹃
    茶梅球
  • 原文地址:https://www.cnblogs.com/keyboarder-zsq/p/5934422.html
Copyright © 2011-2022 走看看