zoukankan      html  css  js  c++  java
  • hdu 1576

    设(A/B)%9973=C,则A = 9973*k*B + B*C;得(B*C)%9973 = A % 9973;

    C一定存在且唯一,所以只要穷举一下就找出来了。

    /*
    * hdu1576/win.cpp
    * Created on: 2011-11-28
    * Author : ben
    */
    #include <cstdio>
    #include <cstdlib>
    #include <cstring>
    #include <cmath>
    #include <ctime>
    #include <iostream>
    #include <algorithm>
    #include <queue>
    #include <set>
    #include <map>
    #include <stack>
    #include <string>
    #include <vector>
    #include <deque>
    #include <list>
    #include <functional>
    #include <numeric>
    #include <cctype>
    using namespace std;

    int main() {
    #ifndef ONLINE_JUDGE
    freopen("data.in", "r", stdin);
    #endif
    int T, B, _B, n;
    const int MOD = 9973;
    scanf("%d", &T);
    while(T--) {
    scanf("%d%d", &n, &B);
    _B = B % MOD;
    for(int c = 0; c < MOD; c++) {
    if((_B * c) % MOD == n) {
    printf("%d\n", c);
    break;
    }
    }
    }
    return 0;
    }



  • 相关阅读:
    每日总结4.25
    每日总结4.24
    每日总结4.23
    每日博客4.22
    每日博客4.21
    每日博客4.20
    每日总结4.19
    每日总结4.16
    每日总结4.15
    每日总结4.14
  • 原文地址:https://www.cnblogs.com/moonbay/p/2265951.html
Copyright © 2011-2022 走看看