C++模板进阶指南:SFINAE 空明流转(https://zhuanlan.zhihu.com/p/21314708) SFINAE可以说是C++模板进阶的门槛之一,如果选择一个论题来测试对C++模板机制的熟悉程度,那么在我这里,首选就应当是SFINAE机制. 我们不用纠结这个词的发音,它来自于 Substitution failure is not an error 的首字母缩写.这一句之乎者也般难懂的话,由之乎者 —— 啊,不,Substitution,Failure和Error三个词构成…
求数列的和 Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 65536/32768 K (Java/Others) Total Submission(s): 53004 Accepted Submission(s): 32615 Problem Description 数列的定义如下: 数列的第一项为n,以后各项为前一项的平方根,求数列的前m项的和. Input 输入数据有多组,每组占一行,由两个整数n(n<10000)和m(…
简单的考察对浮点数使用的水题 HDOJ2009_求数列的和 #include<iostream> #include<stdio.h> #include<stdlib.h> #include<string> #include<math.h> using namespace std; int main() { int n,m; int i,j; while(scanf("%d %d",&n,&m)!=EOF) {…
D - Disjoint Set of Common Divisors Problem Statement Given are positive integers AA and BB. Let us choose some number of positive common divisors of AA and BB. Here, any two of the chosen divisors must be coprime. At most, how many divisors can we c…
// 快速幂,求a^b mod p int power(int a, int b, int p) { int ans = 1; for (; b; b >>= 1) { if (b & 1) ans = (long long)ans * a % p; a = (long long)a * a % p; } return ans; } // 64位整数乘法的O(log b)算法 long long mul(long long a, long long b, long long p) {…