#include <iostream> using namespace std; #define ll long long int main() { while (true) { ll a, b, c, d, L; cin >> a >> b >> c >> d >> L; if (a == 0 && b == 0 && c == 0 && d == 0 && L == 0) break; ll divisible_fx_count = 0; for (ll x = 0; x <= L; x++) { if ((a * x * x + b * x + c) % d == 0) divisible_fx_count++; } cout << divisible_fx_count << endl; } return 0; }
No comments:
Post a Comment