小c数论题 同余 中国剩余定理

 

 

 
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;

inline int read(ll &x){
    int f=0;x=0;char ch=getchar();
    for(;!isdigit(ch);ch=getchar())f|=(ch=='-');
    for(;isdigit(ch);ch=getchar())x=x*10+ch-'0';
    if(f)x=-x;
}

const ll A=23;
const ll B=233;
const ll C=2333;
ll a,b,c,x;

int main(){
    ios::sync_with_stdio(false);
    read(a);
    read(b);
    read(c);
    x=(c==0?C:c);
    while(x%A!=a||x%B!=b){
        x+=C;
    }
    cout<<x<<endl;
    return 0;
}

 

posted @ 2020-05-12 21:34  INFP  阅读(128)  评论(1编辑  收藏  举报