2018 CCPC网络赛 几道数学题
1002 Congruence equation
题目链接 : http://acm.hdu.edu.cn/showproblem.php?pid=6439
题解 : https://www.zybuluo.com/yang12138/note/1262592
相关定理 : 裴蜀定理
ax+by=1
1003 Dream
http://www.cnblogs.com/xiuwenli/p/9534918.html
#include<bits/stdc++.h>
using namespace std;
const int maxn =1e5+;
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=;i<p;++i){
for(int j=;j<p;++j){
printf("%d%c",(i+j)%p,j==p-?'\n':' ');
}
}
for(int i=;i<p;++i){
for(int j=;j<p;++j){
printf("%d%c",(i*j%p),j==p-?'\n':' ');
}
}
}
return ;
}
1004 Find Integer
费马大定理 (话说今年的题使费马出的嘛, 比较简单的签到题)
1005 GuGu Convolution
2018 CCPC网络赛 几道数学题的更多相关文章
- 2018 CCPC网络赛
2018 CCPC网络赛 Buy and Resell 题目描述:有一种物品,在\(n\)个地点的价格为\(a_i\),现在一次经过这\(n\)个地点,在每个地点可以买一个这样的物品,也可以卖出一个物 ...
- 2018 CCPC网络赛 hdu6444 Neko's loop
题目描述: Neko has a loop of size n.The loop has a happy value ai on the i−th(0≤i≤n−1) grid. Neko likes ...
- 2018 CCPC 网络赛 Buy and Resell
The Power Cube is used as a stash of Exotic Power. There are n cities numbered 1,2,…,n where allowed ...
- 2018 CCPC网络赛 1010 hdu 6447 ( 树状数组优化dp)
链接:http://acm.hdu.edu.cn/showproblem.php?pid=6447 思路:很容易推得dp转移公式:dp[i][j] = max(dp[i][j-1],dp[i-1][j ...
- 【2018 CCPC网络赛 1004】Find Integer(勾股数+费马大定理)
Problem Description people in USSS love math very much, and there is a famous math problem . give yo ...
- 【2018 CCPC网络赛】1001 - 优先队列&贪心
题目地址:http://acm.hdu.edu.cn/showproblem.php?pid=6438 获得最大的利润,将元素依次入栈,期中只要碰到比队顶元素大的,就吧队顶元素卖出去,答案加上他们期中 ...
- 【2018 CCPC网络赛】1009 - 树
题目地址:http://acm.hdu.edu.cn/showproblem.php?pid=6446 题目给出的数据为一棵树,dfs扫描每条边,假设去掉某条边,则左边 x 个点,右边 n-x 个点, ...
- 【2018 CCPC网络赛】1003 - 费马小定理
题目地址:http://acm.hdu.edu.cn/showproblem.php?pid=6440 这题主要是理解题意: 题意:定义一个加法和乘法,使得 (m+n)p = mp+np; 其中给定 ...
- 【2018 CCPC网络赛】1004 - 费马大定理&数学
题目地址:http://acm.hdu.edu.cn/showproblem.php?pid=6441 Knowledge Point: 1. 费马大定理:当整数n >2时,关于x, y, z的 ...
随机推荐
- js两个箭头 =>()=>()
request(_ action)let withStatus =status =>action=> R.merge(action, (status])let request = with ...
- Petrozavodsk Summer-2017. Moscow IPT Contest
A. A Place For My Head 留坑. B. New Divide 从高位到低位贪心,当这一位是$0$时,要尽量取$1$,维护高维后缀最小值进行判断即可. 时间复杂度$O((n+a)\l ...
- JavaScript(一)
JavaScript介绍 JavaScript是运行在浏览器端的脚步语言,JavaScript主要解决的是前端与用户交互的问题,包括使用交互与数据交互. JavaScript是浏览器解释执行的,前端脚 ...
- 找出数组[1...n]中第k小元素
//问题描述: 试编写一个算法,使之能够在数组L[1...n]中找出第k小的元素(即从小到大排序后处于第k个位置的元素) #include <stdio.h> // 结合快排思想,查找第5 ...
- swift中Cell的内容定制
1.cellForTitle 2.register
- React(七)独立组件间的共享Mixins
(1)ES6的使用 (https://github.com/brigand/react-mixin) 下载依赖包 npm i react-mixin --save (2)导入react-mixin包 ...
- Python 遇到的坑
1. 循环导入 AB 互相引用,或者 中间掺入了更复杂的一些--用局部导入解决
- (87)Wangdao.com第二十天_JavaScript document 节点对象
document 节点对象, 代表整个文档,每张网页都有自己的 document 对象. window.document 当浏览器开始加载文档时就存在了 正常的网页使用 document 或者 win ...
- mysql字符集校对
常用的两种 utf8_general_ci 按照普通的字母顺序,而且不区分大小写(比如:a B c D)utf8_bin 按照二进制排序(比如:A排在a前面,B D a c) ci是 case ins ...
- windows安装虚拟机(VMware)
一.安装虚拟机 1.打开安装包 2.接受协议 3.选择安装位置 4.按照提示下一步即可 5.完成安装 二.安装带有GUI的Redhat7系统 1.选择自定义安装 2.默认虚拟机硬件兼容 3.选择稍后安 ...