上一页 1 ··· 8 9 10 11 12
摘要: 递归 #include <bits/stdc++.h> #define LL long long #define Pi acos(-1.0) #define INF 2147483646 #define eps 1e-9 #define MS 100009 #define mss 17 using 阅读全文
posted @ 2020-06-17 19:06 棉被sunlie 阅读(110) 评论(0) 推荐(0)
摘要: A. Shovels and Swords Polycarp plays a well-known computer game (we won't mention its name). In this game, he can craft tools of two types — shovels a 阅读全文
posted @ 2020-06-13 21:13 棉被sunlie 阅读(286) 评论(0) 推荐(0)
摘要: 直接求解 LL factor(LL x){ LL cnt = 0; for(int i=1;i<=sqrt(x);i++){ if(x%i==0){ if(x/i == i) cnt += i; // ex: 9 = 3 * 3 else cnt += i + x/i; } } return cnt 阅读全文
posted @ 2020-06-13 20:32 棉被sunlie 阅读(417) 评论(0) 推荐(0)
摘要: 什么是数独 数独(shù dú)是源自18世纪瑞士的一种数学游戏。是一种运用纸、笔进行演算的逻辑游戏。玩家需要根据9×9盘面上的已知数字,推理出所有剩余空格的数字,并满足每一行、每一列、每一个粗线宫(3*3)内的数字均含1-9,不重复 [1] 。 数独盘面是个九宫,每一宫又分为九个小格。在这八十一格 阅读全文
posted @ 2020-06-11 17:06 棉被sunlie 阅读(154) 评论(0) 推荐(0)
摘要: 判断素数 int is_prime(int n) { if(n==1)return 0; for(int i=2;i*i<=n;i++){ if(n%i==0) return 0; } return 1; } 普通筛 int p[MS]; memset(p,0,sizeof p); for(int 阅读全文
posted @ 2020-06-11 16:19 棉被sunlie 阅读(23) 评论(0) 推荐(0)
摘要: 公式 代码模拟公式计算 例:C(7,3)则循环三次每次分别为 5 / 1 , 5 * 6 / 1 * 2 , 5 * 6 * 7 / 1 * 2 * 3 C(n,m) #define LL long long LL C(LL n,LL m) // n为下标 m为上标 { LL k,sum = 1; 阅读全文
posted @ 2020-06-11 15:47 棉被sunlie 阅读(143) 评论(0) 推荐(0)
摘要: inline LL read(){ LL x=0,f=1;char ch=getchar(); while (!isdigit(ch)){if (ch=='-') f=-1;ch=getchar();} while (isdigit(ch)){x=x*10+ch-48;ch=getchar();} 阅读全文
posted @ 2020-06-11 15:37 棉被sunlie 阅读(79) 评论(0) 推荐(0)
摘要: #define LL long long LL qmul(LL a,LL b,LL mod){ LL ans = 0; for(;b;b>>=1){ if(b&1) ans = (ans+a)%mod; a = a*2%mod; } return ans; } 阅读全文
posted @ 2020-06-11 15:34 棉被sunlie 阅读(62) 评论(0) 推荐(0)
摘要: 循环 #define LL long long LL qpow(LL n,LL m){ LL ans = 1%mod; while(m>0){ if(m&1) ans = ans*n%mod; n = n*n%mod; m >>= 1; } return ans; } 递归 #define LL l 阅读全文
posted @ 2020-06-11 15:05 棉被sunlie 阅读(21) 评论(0) 推荐(0)
上一页 1 ··· 8 9 10 11 12