Created
February 26, 2019 06:22
-
-
Save peter0749/305299b58d4c5b18dd68dd4a2743a5ed to your computer and use it in GitHub Desktop.
bored.cpp
This file contains 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
#include <iostream> | |
#include <iomanip> | |
#include <algorithm> | |
int main(void) { | |
int a[9]; | |
for (int i=0; i<9; ++i) a[i]=i+1; | |
do { | |
if ( | |
a[0]-a[1]==a[2] && | |
a[4]*a[5]==a[3] && | |
a[6]+a[7]==a[8] && | |
a[2]*a[5]==a[8] | |
) { | |
for (auto v:a) std::cout<<v<<' '; | |
std::cout<<std::endl; | |
} | |
} while(std::next_permutation(a,a+9)); | |
return 0; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment