有木有大神帮忙看一下这一题下面的代码哪里出错了,笔试时一直不通过。。。
#include <iostream>
using namespace std;
int main()
{
    int n;
    while (cin >> n)
    {
        int num = 3 * n;
        int *arr = new int[num];
        for (int i = 0; i < num; i++)
            cin >> arr[i];
        for (int i = 0; i < num; i = i + 3)
        {
            int a = arr[i];
            int b = arr[i+1];
            int c = arr[i+2];
            if ((c == 0)|| ((a% b)==c))
                cout << "YES" << endl;
            else
            {
                for (int j = 2;; j++)
                {
                    if ((j*a)%b == c)
                    {
                        cout << "YES" << endl;
                        break;
                    }
                    else if(((j*a)%b)== (a% b))
                    {
                        cout << "NO" << endl;
                        break;
                    }
                }
            }
        }
        delete[] arr;
    }
    return 0;
}