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

Re:请问为什么只有60种状态

Posted by 489365227 at 2015-05-07 17:30:58 on Problem 1185
In Reply To:Re:请问为什么只有60种状态 Posted by:Idy002 at 2014-08-14 20:48:02
> 枚举+判断:
> #include <iostream>
> using namespace std;
> bool isok( int c ) {
> 	return !(c&(c<<1)||c&(c<<2)||c&(c>>1)||c&(c>>2));
> }
> int main() {
> 	int count=0;
> 	for( int i=0; i<1024; i++ )
> 		count += isok(i);
> 	cout<<count<<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