//No.542 1円玉と5円玉 #include #include #include using namespace std; int main() { int A, B; cin >> A >> B; vector money; for (int i=0; i <= A; i++) { for (int j = 0; j <= B; j++) { if (i == 0 && j == 0)continue; money.push_back(i * 1 + j * 5); } } sort(money.begin(), money.end()); for (int i = 0; i < money.size(); i++) { if (i != 0 && money[i - 1] == money[i])continue; cout << money[i] << endl; } return 0; }