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 lijinwu at 2010-03-20 15:33:17 on Problem 2453
#include <iostream>
#include <bitset>
#include <algorithm>
#include <string>
using namespace std;

unsigned long i,t;
string str;
int main()
{
	while(cin>>i&&i)
	{
		bitset<8*sizeof(unsigned long)> j(i);
		str=j.to_string();
		next_permutation(str.begin(),str.end());
		bitset<8*sizeof(unsigned long)> k(str);
		t=k.to_ulong();
		cout << t << endl;
	}
	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