Skip to content

Instantly share code, notes, and snippets.

@uenoku
Last active April 1, 2017 05:02
Show Gist options
  • Save uenoku/18c88604c370c4782a23fc3ceb8db0a4 to your computer and use it in GitHub Desktop.
Save uenoku/18c88604c370c4782a23fc3ceb8db0a4 to your computer and use it in GitHub Desktop.
//https://titech-is-cs115.github.io/lecture/assignments/lx00a
#include <iostream>
#include <map>
int out(int x)
{
return int(x <= 0 || x > 3);
}
int main()
{
for (int i = 0; i < 10; i++) {
for (int j = 0; j < 10; j++) {
for (int k = 0; k < 10; k++) {
for (int l = 0; l < 10; l++) {
int m[11] = {};
m[1] = 2, m[2] = 1, m[3] = 2;
m[i]++, m[j]++, m[k]++, m[l]++;
if (m[1] == i && m[2] == j && m[3] == k) {
int cnt = 0;
cnt = out(i) + out(j) + out(k) + out(l);
if (cnt == l) {
std::cout << i << " " << j << " " << k << " " << l << std::endl;
}
}
}
}
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment