/* --------------------------> BISMILLAHIR RAHMANIR RAHIM <------------------------------ */
/* ------------------------> Tafhim Ul Islam [ CSE-09@IIUC ] <--------------------------- */
#include <cstdio>
#include <iostream>
#include <cmath>
#include <cstring>
#include <string>
#include <map>
#include <stack>
#include <queue>
#include <cstdlib>
#include <vector>
#include <climits>
#define MI INT_MAX
#define ULONG unsigned long long
#define LLONG long long
#define swap(a,b) {int t=a ; a=b ; b=t; }
#define sz(a) sizeof(a)
#define FOR(i, a, b) for (i=a ; i<b ; i++)
#define QSORT(a,n,s,f) qsort(a,n,sizeof(s),f)
using namespace std;
LLONG f(int x, int a, int b, int c)
{
return (LLONG)(a*x*x + b*x + c);
}
int main()
{
LLONG a, b, c, d, l, count, i;
while (cin >> a >> b >> c >> d >> l)
{
if (!a && !b && !c && !d && !l)
break;
count = 0;
FOR (i, 0, l+1)
{
if (!(f(i,a,b,c)%d))
count++;
}
cout << count << endl;
}
return 0;
}
Sunday, August 21, 2011
[UVa] 11934 - Magic Formula
Subscribe to:
Post Comments (Atom)
Connect Rapoo MT750S with Linux (Tested on Manjaro)
I bought this obvious copy of MX Master 2S in hopes of having the device switching functionality along with a lightweight body because I ha...
-
I like coding a lot, keeps me glued to the PC for hours. For that reason it's a need to edit the Syntax Highlighter to suit my eyes for...
-
I bought this obvious copy of MX Master 2S in hopes of having the device switching functionality along with a lightweight body because I ha...
-
Method: The problem at first glance seems too straightforward but it's not that much. Think a bit about the lines "Erin can add ...
No comments:
Post a Comment
Post your comment here. If you want to say something about programming problems, scripts, software etc, please try to be as descriptive as possible.