#include <iostream> using namespace std; int main() { int n; cin >> n; int count = 0; for (int x = 1; x <= n; x++) { for (int y = x + 1; y <= n; y++) { int sum = x + y; if (sum % 3 == 0 || sum % 7 == 0) { count++; } } } cout << count << endl; return 0; } /************************************************************** Problem: 1086 User: fandaohan Language: C++ Result: Accepted Time:11 ms Memory:2072 kb ****************************************************************/