Tuesday, July 19, 2016

uva 11934 solution

Unknown
#include<cstdio>
#include<cmath>
using namespace std;

int main()
{
    int a,b,c,d,l,cnt;
    while (scanf("%d%d%d%d%d",&a,&b,&c,&d,&l)==5)
    {
        if (!a && !b && !c && !d && !l) return 0;
        cnt=0;
        for (int i=0;i<=l;i++)
            if ((a*i*i+b*i+c)%d==0) cnt++;
        printf("%d\n",cnt);
    }
    return 0;
}

Unknown

Studying at Shahjalal University of Science and Technology, Sylhet.

0 comments:

Post a Comment

Coprights @ 2016,