-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMagicFunction.cpp
More file actions
39 lines (32 loc) · 949 Bytes
/
Copy pathMagicFunction.cpp
File metadata and controls
39 lines (32 loc) · 949 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
#include <iostream>
using namespace std;
#define endl '\n'
#define FO(i, b) for (int i = 0; i < (b); i++)
#define FOR(i, a, b) for (int i = (a); i < (b); i++)
#define rFOR(i, a, b) for (int i = (a); i > (b); i--)
#define TR(v, arr) for(auto& (v) : (arr))
#define pint(x) printf("%d\n", x);
#define pll(x) printf("%lld\n", x);
#define si(x) scanf("%d", &x);
#define sl(x) scanf("%lld", &x);
#define all(x) x.begin(), x.end()
void solve() {
}
int main() {
int a,b,c,d,l;
cin >> a >> b >> c >> d >> l;
while(a != 0 || b != 0 || c != 0 || d != 0 || l != 0){
int fx = 0;
int cont = 0;
for(int i=0; i<=l ; i++){
fx = (a*(i*i)+b*(i)+c);
if(fx%d == 0){
cont++;
}else{
continue;
}
}
cout << cont << endl;
cin >> a >> b >> c >> d >> l;
}
}