51Nod题解
浮躁的社会,保留意思平静。
徐伯莱
Stay Hungry, Stay Foolish.
展开
-
1028 大数乘法 V2
FFT简单应用#include<iostream> #include<complex> #include<cstdio> #include<cstdlib> #include<cstring> #include<algorithm> using namespace std; typedef complex<double...原创 2018-05-29 12:59:44 · 262 阅读 · 0 评论 -
1625 夹克爷发红包
#include<iostream> #include<vector> #include<algorithm> #include<cstdio> using namespace std; typedef long long ll; const int MAXN = 11; const int MAXM = 201; ll money[MAXN][MA...原创 2018-05-24 23:08:31 · 134 阅读 · 0 评论 -
1009 数字1的数量
#include<iostream> using namespace std; int l, r = 1, temp, m, sum = 0; int main(){ cin >> m; l = m; while(l){ temp = l % 10; if(temp == 0){ sum += m / (r * 10) * r; } else if(...原创 2018-05-24 19:22:47 · 285 阅读 · 0 评论 -
1639 绑鞋带
#include<iostream> using namespace std; int main(){ ios::sync_with_stdio(false); int n; cin >> n; double ans = 1; for(int i = 2; i <= n; ++i) ans *= (2.0 * i - 2.0) / (2.0 * i -...原创 2018-04-24 18:25:57 · 128 阅读 · 0 评论 -
1873 初中的算术
pow(n) : n power to raise this BigDecimal to(返回大数的指数方)stripTrailingZeros() : a numerically equal BigDecimal with any trailing zeros removed.(把末尾多余的0去掉)toPlainString():a string representation of this B...原创 2018-04-11 18:42:33 · 187 阅读 · 0 评论 -
1649 齐头并进
求两条最短路的最大的那一条,啊啊啊啊啊, 没看清题目就直接下手,wa了好多次。。。。#include<iostream> #include<algorithm> using namespace std; const int INF = 0x3f3f3f3f; const int N = 510; int e[N][N], dis[N]; bool visit[N]; int...原创 2018-04-21 12:00:01 · 184 阅读 · 0 评论 -
1640 天气晴朗的魔法
#include<iostream> #include<algorithm> #include<vector> #include<map> using namespace std; const int MAXN = 2e5 + 7; pair<int, pair<int, int> > e[MAXN]; int father[...原创 2018-04-23 08:36:13 · 148 阅读 · 0 评论 -
1007 正整数分组
变形的01背包#include<iostream> #include<algorithm> #include<cstdio> using namespace std; int dp[10005], a[105]; int n, sum; int main(){ scanf("%d", &n); for(int i = 0; i < n; ++i...原创 2018-04-11 19:08:45 · 150 阅读 · 0 评论 -
1413 权势二进制
#include<algorithm> #include<cstdio> using namespace std; int main(){ int n; scanf("%d", &n); int m = 0; while(n){ m = max(m, n % 10); n /= 10; } printf("%d\n", m); return 0...原创 2018-04-21 13:16:10 · 141 阅读 · 0 评论 -
1428 活动安排问题
#include<iostream> #include<vector> #include<algorithm> #include<queue> using namespace std; struct node{ int s, t; bool operator < (const node &a) const { return s...原创 2018-04-21 15:00:17 · 226 阅读 · 0 评论 -
1432 独木舟
#include<iostream> #include<cstdio> #include<algorithm> #include<vector> using namespace std; int main(){ int n, m; scanf("%d%d", &n, &m); int sum = 0; vector<in..原创 2018-04-21 15:04:13 · 180 阅读 · 0 评论 -
1417 天堂里的游戏
#include<iostream> #include<cstdio> using namespace std; typedef long long ll; ll gcd(ll a, ll b){ return b == 0 ? a : gcd(b, a % b); } int main(){ int t; scanf("%d", &t); while(t-...原创 2018-04-21 15:31:34 · 261 阅读 · 0 评论 -
1629 B君的圆锥
数学公式:#include<iostream> #include<cmath> #include<cstdio> using namespace std; const double PI = acos(-1); int main(){ double s; scanf("%lf", &s); printf("%f", s * sqrt(s / (72...原创 2018-04-21 15:52:36 · 175 阅读 · 0 评论 -
1279 扔盘子
#include<iostream> #include<cstdio> #include<algorithm> using namespace std; const int MAXN = 5e4 + 10; const int INF = 0x3f3f3f3f; int width[MAXN]; int m, n; int main(){ scanf("%d%...原创 2018-04-22 06:21:55 · 185 阅读 · 0 评论 -
1278 相离的圆
#include<iostream> #include<cstdio> #include<algorithm> using namespace std; const int MAXN = 5e4 + 10; struct node{ int l, r; bool operator < (const node &a) const { ret...原创 2018-04-22 06:44:37 · 183 阅读 · 0 评论 -
1266 蚂蚁
#include<iostream> #include<algorithm> using namespace std; const int INF = 0x3f3f3f3f; int main(){ ios::sync_with_stdio(false); int n, m, x, minn = 0, maxn = 0; cin >> n >>...原创 2018-04-22 06:43:54 · 225 阅读 · 0 评论 -
1596 搬货物
哎,一开始没一点思路,心里作用想去看题解。最后感觉自己真的是菜,每次遇到难题都想去看题解,自己不思考一下。这一次我就逼着自己不要去看题解,最后还是勉强的写出来了。。。要自己思考#include<stdio.h> #define MAXN 1000000 + 115 int n, x, sum; int a[MAXN]; int main(){ scanf("%d", &n)...原创 2018-04-11 20:13:35 · 114 阅读 · 0 评论 -
1138 连续整数的和
给定一个正整数n,将n分解成若干个连续自然数和的形式。等差数列: d = 1, Sn = n;Sn = i * a + i * (i - 1) / 2;a = (n - i * (i - 1) / 2 ) / i;i * (i - 1) / 2 < n;i <= sqrt(2 * n) ;len = sqrt(2 * n)#include<stdio.h> #include...原创 2018-04-11 20:58:12 · 244 阅读 · 0 评论 -
1433 0和5
9整除的话,各个位的数相加mod9等于0。 那么90整除的话,表示各个位的数相加mod9等于0,再多一个0即可#include<cstdio> using namespace std; int main(){ int numFive = 0, numZero = 0, n, x; scanf("%d", &n); for(int i = 0; i < n; ++i)...原创 2018-04-21 13:02:57 · 156 阅读 · 0 评论 -
1315 合法整数集
#include<iostream> #include<cstdio> using namespace std; int a[36], b[36]; int n, x, y, index, ans; int main(){ scanf("%d%d", &n, &x); for(int i = 0; i < n; ++i){ scanf("%d"...原创 2018-04-21 17:19:23 · 211 阅读 · 0 评论 -
1126 求递推序列的第N项
#include<iostream> #include<algorithm> #include<vector> #include<cstdio> typedef long long ll; using namespace std; typedef vector<ll> vec; typedef vector<vec> mat;...原创 2018-04-22 07:39:52 · 299 阅读 · 0 评论 -
1119 机器人走方格 V2
#include<iostream> #include<cstdio> using namespace std; typedef long long ll; #define Mod 1000000007 ll extmod(ll a, ll b, ll &x, ll &y){ ll d = a; if(b == 0){ x = 1, y = 0; ...原创 2018-04-22 08:22:33 · 188 阅读 · 0 评论 -
1095 Anigram单词
#include<iostream> #include<string> #include<map> #include<algorithm> using namespace std; int main(){ ios::sync_with_stdio(false); int n, m; map<string, int> mp1, mp2...原创 2018-04-22 10:23:02 · 152 阅读 · 0 评论 -
1031 骨牌覆盖
#include<iostream> #include<algorithm> using namespace std; const int Mod = 1e9 + 7; typedef long long ll; ll f[1005] = {0, 1, 2}; int main(){ int n; ios::sync_with_stdio(false); cin &g...原创 2018-04-22 10:43:56 · 214 阅读 · 0 评论 -
1396 还是01串
#include<iostream> #include<string> using namespace std; const int MAXN = 1000000 + 10; int cntOne[MAXN], cntZero[MAXN]; int main(){ ios::sync_with_stdio(false); string s; cin >> ...原创 2018-04-24 18:09:10 · 147 阅读 · 0 评论