Last active
June 20, 2016 03:27
-
-
Save msly/80d99b06c6143bae8c3a to your computer and use it in GitHub Desktop.
百度开灯问题
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| // 百度开灯问题 | |
| void light() { | |
| vector<bool> vec(100, true); | |
| for (int i=1; i<101; ++i) { | |
| for (int j=0; j<vec.size(); j=j+i+1) { | |
| vec[j] = !vec[j]; | |
| } | |
| } | |
| for (int i=0; i<vec.size(); ++i) { | |
| if (vec[i]) { | |
| cout << i << endl; | |
| } | |
| } | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment