随笔分类 -  数论

摘要:"题目链接" "参考博客" 关于check()函数,相隔p 1取出来,提出一个公因数后,剩下的为$x^{p 1},x^{2 (p 1)}…x^{n (p 1)}$,x与p互质,各项的幂取余p的欧拉函数为0。 cpp include "bits/stdc++.h" using namespace st 阅读全文
posted @ 2019-07-29 19:35 Albert_liu 阅读(168) 评论(0) 推荐(0)
摘要:"题目链接" 比赛的时候找到d之后就卡住了,不知道怎么找$i^j$中有多少个d的倍数,没有想到可以先固定j,然后看对于当前j有多少个i 快速幂的时候long long 溢出了…… 阅读全文
posted @ 2019-07-26 14:00 Albert_liu 阅读(281) 评论(0) 推荐(0)
摘要:Happy Equation Time Limit: 1 Second Memory Limit: 65536 KB Little Sub has just received an equation, which is shown below, as his birthday gift. $ a^x 阅读全文
posted @ 2019-05-14 21:58 Albert_liu 阅读(767) 评论(0) 推荐(0)
摘要:g = gcd(a+k,b+k),设 a+k = g*x,b + k = g*y,则g(x-y) = a-b, 所以 g|(a-b),枚举a-b的所有约数,按照题意取出最小答案 阅读全文
posted @ 2019-04-25 00:26 Albert_liu 阅读(202) 评论(0) 推荐(0)
摘要:题目描述 有一个球形空间产生器能够在n维空间中产生一个坚硬的球体。现在,你被困在了这个n维球体中,你只知道球面上n+1个点的坐标,你需要以最快的速度确定这个n维球体的球心坐标,以便于摧毁这个球形空间产生器。 输入 第一行是一个整数n(1<=N=10)。接下来的n+1行,每行有n个实数,表示球面上一点 阅读全文
posted @ 2019-04-23 17:06 Albert_liu 阅读(175) 评论(0) 推荐(0)
摘要:题目描述 石头游戏在一个 n 行 m 列 (1≤n,m≤8) 的网格上进行,每个格子对应一种操作序列,操作序列至多有10种,分别用0~9这10个数字指明。操作序列是一个长度不超过6且循环执行、每秒执行一个字符的字符串。每秒钟,所有格子同时执行各自操作序列里的下一个字符。序列中的每个字符是以下格式之一 阅读全文
posted @ 2019-04-21 20:47 Albert_liu 阅读(375) 评论(0) 推荐(0)
摘要:题目描述 Given a n × n matrix A and a positive integer k, find the sum S = A + A2 + A3 + … + Ak. 输入 The input contains exactly one test case. The first li 阅读全文
posted @ 2019-04-19 16:24 Albert_liu 阅读(367) 评论(0) 推荐(0)
摘要:题目描述 You are given an integer n.You are required to calculate (n mod 1) xor (n mod 2) xor ... xor (n mod (n - 1)) xor (n mod n).The “xor” operation me 阅读全文
posted @ 2019-04-10 21:19 Albert_liu 阅读(748) 评论(0) 推荐(0)
摘要:题目描述 给出正整数n和k,计算j(n,k)=k mod 1 + k mod 2 + k mod 3 +⋯+ k mod n的值。其中k mod i表示k除以i的余数。例如j(5,3)=3 mod 1 + 3 mod 2 + 3 mod 3 + 3 mod 4 + 3 mod 5 = 0 + 1 + 阅读全文
posted @ 2019-04-10 19:37 Albert_liu 阅读(181) 评论(0) 推荐(0)
摘要:#include <iostream> #include <bits/stdc++.h> using namespace std; const int maxn = 1e6 + 100; const int inf = 0x3f3f3f3f; const int mod = 998244353; t 阅读全文
posted @ 2019-04-05 20:59 Albert_liu 阅读(258) 评论(0) 推荐(0)
摘要:题目描述 The branch of mathematics called number theory is about properties of numbers. One of the areas that has captured the interest of number theoreti 阅读全文
posted @ 2019-04-04 11:57 Albert_liu 阅读(176) 评论(0) 推荐(0)
摘要:题目描述 Given a matrix M with r rows and c columns. It is obviously that we need r × c elements to store this matrix.However, for a specifi matrix M , we 阅读全文
posted @ 2018-09-06 11:05 Albert_liu 阅读(740) 评论(0) 推荐(0)
摘要:Dream Problem Description Freshmen frequently make an error in computing the power of a sum of real numbers, which usually origins from an incorrect e 阅读全文
posted @ 2018-08-25 20:22 Albert_liu 阅读(222) 评论(0) 推荐(0)
摘要:一、费马小定理,快速幂(需mod为质数) 二、扩展欧几里得算法 三、 非原创 当p是个质数的时候有inv(a) = (p - p / a) * inv(p % a) % p 证明:设x = p % a,y = p / a于是有 x + y * a = p(x + y * a) % p = 0移项得 阅读全文
posted @ 2018-03-20 15:00 Albert_liu 阅读(202) 评论(0) 推荐(0)
摘要:题目描述 求关于 x 的同余方程 ax ≡ 1 (mod b)的最小正整数解。 输入 输入只有一行,包含两个正整数 a, b,用一个空格隔开。 输出 输出只有一行,包含一个正整数 x0,即最小正整数解。输入数据保证一定有解。 样例输入 样例输出 提示 对于 100%的数据,2 ≤a, b≤ 2,00 阅读全文
posted @ 2018-03-20 12:45 Albert_liu 阅读(198) 评论(0) 推荐(0)
摘要:题目描述 给定一个多项式(by+ax)^k,请求出多项式展开后x^n * y^m 项的系数。 输入 共一行,包含5 个整数,分别为 a ,b ,k ,n ,m,每两个整数之间用一个空格隔开。0≤k≤1000, 0≤n,m≤k 且 n+m=k, 0≤a,b≤100,000 输出 输出共1 行,包含一个 阅读全文
posted @ 2018-03-20 12:43 Albert_liu 阅读(217) 评论(0) 推荐(0)
摘要:Co-prime Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 32768/32768 K (Java/Others)Total Submission(s): 6224 Accepted Submission(s): 2506 Proble 阅读全文
posted @ 2018-02-05 22:33 Albert_liu 阅读(181) 评论(0) 推荐(0)