Online JudgeProblem SetAuthorsOnline ContestsUser
Web Board
Home Page
F.A.Qs
Statistical Charts
Problems
Submit Problem
Online Status
Prob.ID:
Register
Update your info
Authors ranklist
Current Contest
Past Contests
Scheduled Contests
Award Contest
User ID:
Password:
  Register

STL学会用!!

Posted by CSUST_14 at 2012-08-25 22:23:01 on Problem 2105
#include <iostream>
#include <cstdio>
#include <cstdlib>
#include <algorithm>
#include <vector>
#include <map>
#include <set>
#include <string>
#include <cstring>
#include <list>
#include <queue>
#include <stack>
#include <cmath>
#include <bitset>

using namespace std;

#define PF(x) (scanf("%d",&x))
#define PT(x,y) (scanf("%d%d",&x,&y))
#define PR(x) (printf("%d\n",x))
#define PRT(x,y)(printf("%d %d\n",x,y))
#define PB(x)(scanf("%I64d",&x))
#define PRB(x)(printf("%I64d\n",(x)))
#define For(i,n) for(int i=0;i<(n);i++)
#define CLR(ar) (memset(ar,0,sizeof(ar)))
#define CLR1(ar) (memset(ar,-1,sizeof(ar)))
#define Max(x,y) (x)>(y)?(x):(y)
#define Min(x,y) (x)>(y)?(y):(x)
#define L(x) (x<<1)
#define R(x) ((x<<1)|1)
#define Mid(x,y) ((x+y)>>1)

typedef __int64 LL;
#define N 100005
#define M 105
#define Mod 1000
#define Inf 0x7fffffff

void init()
{
	int n;
    PF(n);
	while(n--)
	{
		string s;
		cin>>s;
		bitset<32> SS(s);
		s = SS.to_string();
		bitset<8> G(s.substr(0,8));
		bitset<8> G1(s.substr(8,8));
		bitset<8> G2(s.substr(16,8));
		bitset<8> G3(s.substr(24));
		printf("%d.%d.%d.%d\n",G.to_ulong(),G1.to_ulong(),G2.to_ulong(),G3.to_ulong());

	}
	return ;
}

int main()
{
	init();
	return 0;
}



Followed by:

Post your reply here:
User ID:
Password:
Title:

Content:

Home Page   Go Back  To top


All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator