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

我也来晒晒代码

Posted by 785815369 at 2010-08-01 15:17:15 on Problem 2105
#include<iostream>
using namespace std;
int map[8]={1,2,4,8,16,32,64,128};
int main()
{
	char str[35];
	int t,a[4];
	cin>>t;
	while(t--)
	{
		cin>>str;
		memset(a,0,sizeof(a));
		for(int i=31;i>=0;i--)
		{
			int p=i/8;
			int q=(7-i%8);
			a[p]+=(str[i]-'0')*map[q];
		}
		for(int i=0;i<4;i++)
			if(i==0)cout<<a[i];
			else cout<<"."<<a[i];
		cout<<endl;
	}
}

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