Choose Integers(数论)

题目链接:传送门

题意:给你A,B,C,问:(n×A)%B==C这个式子是否成立。

可能说得不对。以后会更正的。

            (A*x)%B==C

            (A*x+B*y)%B==C   %B

                A*x+B*y=C        (x,y 存在某个值使他成立)

                证明A和B是否能找到一个x和y构成C

                这个就是欧几里德,C%gcd(A,B)==0就证明有解。

                

#include<bits/stdc++.h>
using namespace std;
int main()
{
    int a,b,c;
    cin>>a>>b>>c;
    if(c%__gcd(a,b)==0){
        printf("YES\n");
    }else{
        printf("NO\n");
    }
    return 0;
}

Integer slices are a way to extract a subset of elements from a list or array of integers. In Python, you can use the slice notation to extract a range of elements from a list or array. For example: ``` my_list = [1, 2, 3, 4, 5] slice_1 = my_list[1:3] # returns [2, 3] slice_2 = my_list[2:] # returns [3, 4, 5] slice_3 = my_list[:4] # returns [1, 2, 3, 4] ``` In the above examples, `my_list` is a list of integers. The slice notation `[1:3]` extracts the elements at index 1 and 2 (not including 3), which are `2` and `3`. The slice notation `[2:]` extracts all elements from index 2 to the end of the list. The slice notation `[:4]` extracts all elements from the beginning of the list up to (but not including) index 4. Integer slices can also be used with arrays of integers in languages such as C and Java. In these languages, you can use the array indexing notation to extract a range of elements from an array. For example: ``` int my_array[] = {1, 2, 3, 4, 5}; int slice_1[] = Arrays.copyOfRange(my_array, 1, 3); // returns [2, 3] int slice_2[] = Arrays.copyOfRange(my_array, 2, my_array.length); // returns [3, 4, 5] int slice_3[] = Arrays.copyOfRange(my_array, 0, 4); // returns [1, 2, 3, 4] ``` In the above examples, `my_array` is an array of integers. The `Arrays.copyOfRange` method is used to extract a range of elements from the array. The first argument is the array to extract from, the second argument is the starting index, and the third argument is the ending index (not including).
评论 2
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值