上一页 1 2 3 4 5 6 ··· 49 下一页
摘要: "P0505" n!=1 2 3 4 ....... (n 1) n, n!末尾的0的是由因子2和5造成的。 可以这么想,先将1到n每个数做关于2和5的因数分解,其实想法十分简单就是在计算阶乘时将所有因数2和5都不乘进去。而是用a,b分别记录2的个数和5的个数。 ans记录的是n!末尾非零的数字,初 阅读全文
posted @ 2019-02-10 22:03 A-Little-Nut 阅读(467) 评论(2) 推荐(0) 编辑
摘要: "素因子去重" cpp include include include using namespace std; bool isprime(long long int n){ if(n==1) return false; for(int i=2; i n; set s; while(!isprime 阅读全文
posted @ 2019-02-09 21:46 A-Little-Nut 阅读(433) 评论(0) 推荐(1) 编辑
摘要: "时间转换" cpp include using namespace std; int main(){ int t; cin t; cout 阅读全文
posted @ 2019-02-06 20:50 A-Little-Nut 阅读(179) 评论(0) 推荐(0) 编辑
摘要: "字符串对比" cpp include include using namespace std; int main(){ string s1, s2; cin s1 s2; if(s1==s2) cout 阅读全文
posted @ 2019-02-06 20:45 A-Little-Nut 阅读(110) 评论(0) 推荐(0) 编辑
摘要: "分解质因数" cpp include include include include using namespace std; vector vi(10001); int main(){ int a, b; cin a b; for(int i=2; i::iterator it=vi[i].be 阅读全文
posted @ 2019-02-06 20:34 A-Little-Nut 阅读(122) 评论(0) 推荐(0) 编辑
摘要: "矩形面积交" cpp include include using namespace std; int main(){ double m1, n1, m2, n2, a1, b1, a2, b2, d1=0, d2=0; cin m1 n1 m2 n2 a1 b1 a2 b2; if(m1 m2) 阅读全文
posted @ 2019-02-05 15:09 A-Little-Nut 阅读(114) 评论(0) 推荐(0) 编辑
摘要: 整数快速幂: 为了引出矩阵的快速幂,以及说明快速幂算法的好处,我们可以先求整数的幂。 如果现在要算X^8:则 XXXXXXXX 按照寻常思路,一个一个往上面乘,则乘法运算进行7次。 (XX)(XX)(XX)(XX) 这种求法,先进行乘法得X^2,然后对X^2再执行三次乘法,这样去计算,则乘法运算执行 阅读全文
posted @ 2019-02-05 15:07 A-Little-Nut 阅读(287) 评论(0) 推荐(0) 编辑
摘要: "矩阵乘法" cpp include include using namespace std; int n, m; vector Mul(vector t1, vector t2){ vector temp(n, vector(n, 0)); for(int i=0; i QuickMul(vect 阅读全文
posted @ 2019-02-05 14:49 A-Little-Nut 阅读(206) 评论(0) 推荐(0) 编辑
摘要: "完美的代价" cpp / 提示:是考的贪心策略 / include using namespace std; int main(){ int n, flag=0, cnt=0; cin n; string str; cin str; for(int i=0; i=i; j ){ if(j==i){ 阅读全文
posted @ 2019-02-03 20:49 A-Little-Nut 阅读(172) 评论(0) 推荐(0) 编辑
摘要: "数的读法" cpp include include include using namespace std; string p[]={"ling", "yi", "er", "san", "si", "wu", "liu", "qi", "ba", "jiu", "shi", "bai", "qi 阅读全文
posted @ 2019-02-03 20:46 A-Little-Nut 阅读(227) 评论(0) 推荐(0) 编辑
上一页 1 2 3 4 5 6 ··· 49 下一页