随笔分类 - 数论
摘要:As you probably know, Anton goes to school. One of the school subjects that Anton studies is Bracketology. On the Bracketology lessons students usuall
阅读全文
摘要:LL quick_mod(LL a, LL b) { LL ans = 1; a %= p; while(b) { if(b & 1) { ans = ans * a % p; b--; } b >>= 1; ...
阅读全文
摘要:void Init() { memset(vis,0,sizeof(vis)); mu[1] = 1; cnt = 0; for(int i=2; i<N; i++) { if(!vis[i]) { prime[cnt++] = i; mu[i] = -1; }...
阅读全文
摘要:Description 小 X 自幼就很喜欢数。但奇怪的是,他十分讨厌完全平方数。他觉得这些 数看起来很令人难受。由此,他也讨厌所有是完全平方数的正整数倍的数。然而 这丝毫不影响他对其他数的热爱。 这天是小X的生日,小 W 想送一个数给他作为生日礼物。当然他不能送一 个小X讨厌的数。他列出了所有小X
阅读全文
摘要:Problem Description There are m stones lying on a circle, and n frogs are jumping over them.The stones are numbered from 0 to m−1 and the frogs are nu
阅读全文
摘要:这就是这个题目的意思,真的感觉这个思想是太神奇了,我这种菜逼现在绝壁想不到这样的证明的过程的,还有就是这个题的推道过程,以下思路纯属借鉴卿学姐的,还是自己太菜了,,,, 讲道理这种问题我真的想不到用容斥原理来做啊,那现在我就用容斥原理来讲一下这个问题,,, |!A1∩!A2∩!A3∩....!An|
阅读全文
摘要:B. Pasha and Phone time limit per test 1 second memory limit per test 256 megabytes input standard input output standard output Pasha has recently bou
阅读全文
摘要:Problem Description Given 5 integers: a, b, c, d, k, you're to find x in a...b, y in c...d that GCD(x, y) = k. GCD(x, y) means the greatest common div
阅读全文
摘要:LL mult(LL a, LL k, LL m){ LL res = 0; while(k){ if(k & 1LL) res = (res + a) % m; k >>= 1; a = (a << 1) % m; } return res; }
阅读全文
摘要:Problem Description When ?? was born, seven crows flew in and stopped beside him. In its childhood, ?? had been unfortunately fall into the sea. While
阅读全文
摘要:E. Devu and Flowers time limit per test 4 seconds memory limit per test 256 megabytes input standard input output standard output Devu wants to decora
阅读全文