diophantine equation

Правка en2, от t3rminated, 2017-01-16 22:36:35

In this question isn't it enough to check the gcd(A,B) divisibility with each number? i am getting wrong answer!

code--

#include <bits/stdc++.h>
using namespace std;
#define ll long long
//utility function to find the GCD of two numbers
ll gcd(ll a, ll b)
{
    return (a%b == 0)? abs(b) : gcd(b,a%b);
}
 
int main() {
	// your code goes here
	int t;
	cin >> t;
	while(t--)
	{
	    ll n, x, y;
	    cin >> n >> x >> y;
	    ll gdc = gcd(x,y);
	    ll a[n+1];
            ll c  =0;
	    for(int i = 0; i < n; i++)
	    {
	        cin >> a[i];
	        if((a[i]%gdc == 0))
	        c++;
	        
	        
	    }
	    cout << c << " " << n-c << "\n";
	    
	}
	return 0;
}

История

 
 
 
 
Правки
 
 
  Rev. Язык Кто Когда Δ Комментарий
en2 Английский t3rminated 2017-01-16 22:36:35 28
en1 Английский t3rminated 2017-01-16 22:35:40 816 Initial revision (published)