1. 程式人生 > >2018 CCPC網絡賽 幾道數學題

2018 CCPC網絡賽 幾道數學題

col 鏈接 blog htm 也有 not n) eight freopen

1002 Congruence equation

題目鏈接 : http://acm.hdu.edu.cn/showproblem.php?pid=6439

題解 : https://www.zybuluo.com/yang12138/note/1262592

相關定理 : 裴蜀定理

在數論中,裴蜀定理是一個關於最大公約數(或最大公約式)的定理。裴蜀定理得名於法國數學家艾蒂安·裴蜀,說明了對任何整數a、b和它們的最大公約數d,關於未知數x和y的線性丟番圖方程(稱為裴蜀等式): ax + by = m有解當且僅當m是d的倍數。裴蜀等式有解時必然有無窮多個整數解,每組解x、y都稱為裴蜀數,可用輾轉相除法求得。 例如,12和42的最大公因子是6,則方程12x + 42y = 6有解。事實上有(-3)×12 + 1×42 = 6及4×12 + (-1)×42 = 6。 特別來說,方程 ax + by = 1 有解當且僅當整數a和b互素。 裴蜀等式也可以用來給最大公約數定義:d其實就是最小的可以寫成ax + by形式的正整數。這個定義的本質是整環中“理想”的概念。因此對於多項式整環也有相應的裴蜀定理。

ax+by=1

1003 Dream

http://www.cnblogs.com/xiuwenli/p/9534918.html

技術分享圖片
#include<bits/stdc++.h>
using namespace std;
const int maxn =1e5+5;
typedef long long LL;

int main()
{
    #ifndef ONLINE_JUDGE
        freopen("in.txt","r",stdin);
        freopen("out.txt","w",stdout);
    #endif
int p; int T; scanf("%d",&T); while(T--){ scanf("%d",&p); for(int i=0;i<p;++i){ for(int j=0;j<p;++j){ printf("%d%c",(i+j)%p,j==p-1?\n: ); } } for(int i=0;i<p;++i){ for(int j=0
;j<p;++j){ printf("%d%c",(i*j%p),j==p-1?\n: ); } } } return 0; }
View Code

1004 Find Integer

費馬大定理 (話說今年的題使費馬出的嘛, 比較簡單的簽到題)

1005 GuGu Convolution

2018 CCPC網絡賽 幾道數學題