| ||||||||||
| Online Judge | Problem Set | Authors | Online Contests | User | ||||||
|---|---|---|---|---|---|---|---|---|---|---|
| Web Board Home Page F.A.Qs Statistical Charts | Current Contest Past Contests Scheduled Contests Award Contest | |||||||||
Re:请问为什么只有60种状态In Reply To:请问为什么只有60种状态 Posted by:cotton at 2011-07-23 12:01:13 枚举+判断:
#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: |
All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator