2 条题解

  • 4
    @ 2025-10-25 21:10:14
    使用**裴蜀定理**优化
    #include<stdio.h>
    long long gcd(long long a, long long b) {
    	if (a % b == 0) {
    		return b;
    	}
    	return gcd(b, a % b);
    }
    int main() {
    	int n;
    	scanf("%d", &n);
    	long long a, b, c;
    	while (n--) {
    		scanf("%lld%lld%lld", &a, &b, &c);
    		int t = gcd(a, b);
    		if (c % t == 0) {
    			printf("Yes\n");
    		}
    		else {
    			printf("No\n");
    		}
    	}
    }
    

    👍 👍

    • @ 2025-10-31 20:40:20

      别人解题靠枚举,你解题靠‘预判’——这思路简直是‘动态规划大师’+‘贪心算法本贪’,连bug见了你都得绕道走!

    • @ 2025-11-1 18:48:18

      大佬求带

  • 2
    @ 2023-11-10 10:58:07
    #include<stdio.h>
    int main()
    {
        int t;
        scanf("%d",&t);
        while(t--){
            int a,b,n;
            scanf("%d%d%d",&a,&b,&n);
            int t;
            while(t=a%b){
               a=b;
               b=t; 
            }
            if(n%b==0){
                printf("Yes");
            }
            else{
                printf("No");
            }
            printf("\n");
        }
        return 0;
    }
    
    • @ 2024-12-2 16:40:16

      以 1 3 8 7为例,应该不对吧

    • @ 2024-12-5 11:28:51

      x=5,y=-1

    • @ 2024-12-5 23:05:53

      okok,看错范围了,以为x,y>0@

  • 1

信息

ID
175
时间
2000ms
内存
128MiB
难度
8
标签
(无)
递交数
991
已通过
158
上传者