zoukankan      html  css  js  c++  java
  • UVA 12169 不爽的裁判

    #include<iostream>
    #include<string>
    #include<string>
    #include<string.h>
    #include<stdio.h>
    #include<queue>
    #include<math.h>
    #include<vector>
    #include<stdlib.h>
    #include<algorithm>
    #define maxn 210
    using namespace std;
    typedef long long LL;
    
    void gcd(LL a , LL b ,LL &d, LL &x,LL &y){
        if(!b){
            d = a ;
            x = 1;  y = 0;
            return ;
        }
        else{
            gcd(b , a % b ,d , y , x);
            y -= x * (a / b);
            return ;
        }
    }
    int main(){
        LL  f[maxn],a,b,k;
        int flag,t;
       cin>>t;
        memset(f,0,sizeof(f));
        for(int i=1;i<2*t;i+=2){
            cin>>f[i];
        }
        for(int i=0;i<=10000;i++){
            a=i;flag=1;
            LL k , b , d;
            LL c = (f[3] - a * a * f[1]);
            gcd(10001, a + 1, d , k, b);
            if(c% d) continue;
            b = b * c / d;
                for(int j=2;j<=2*t;j++){
                   if(j&1){
                    if(f[j]!=((a*f[j-1]+b)%10001)){
                        flag=0;
                        break;
                     }
                   }else{
                       f[j]=(a*f[j-1]+b)%10001;
                   }
                }
                if(flag)
                    break;
    
         }
                for(int j=2;j<=2*t;j+=2){
                        cout<<f[j]<<endl;
                    }
    
       return 0;
    }
  • 相关阅读:
    redis搭建集群
    redis搭建主从
    redis与python交互
    redis数据操作篇
    redis配置篇
    node 淘宝镜像
    java 深copy
    springmvc配置访问静态文件
    centos 启动 oracle
    List 分隔多次执行 且在同一个事物当中
  • 原文地址:https://www.cnblogs.com/wintersong/p/5259272.html
Copyright © 2011-2022 走看看