摘要:
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 阅读全文
摘要:
其中p为素数 待续 阅读全文
摘要:
监狱有连续编号为1...N的N个房间,每个房间关押一个犯人,有M种宗教,每个犯人可能信仰其中一种。如果相邻房间的犯人的宗教相同,就可能发生越狱,求有多少种状态可能发生越狱 这种问题的话就是典型的排列组合,但是我认为总数是N^M这是明显的不对的,我们可以假设一下每一个人能选择的就是 M的宗教,一共N 阅读全文