随笔分类 - 练习
通往成功之路
1928. 灵能矩阵 -- dp,bitmask
摘要:1 #include <bits/stdc++.h> 2 using namespace std; 3 using LL = long long; 4 int mp[505][505], ans[505][505]; 5 bool dp[505][505]; 6 int n, m; 7 int ma
阅读全文
1939-一颗姜会长多高-binary search
摘要:1 /*第一行输入两个整数 n,m (1≤n,m≤10^5),表示姜的个数以及询问次数。 2 第二行输入 n 个整数 a1,a2,…,an (1≤ai≤10^9),表示 n 颗姜的初始高度。 3 接下来输入 m 行,每行两个整数 xi,yi (0≤xi≤10^18,0≤yi<n),表示两种魔法的施法
阅读全文
1842-上三角形矩阵的和-代数式变形,模拟
摘要:1 #include<bits/stdc++.h> 2 using namespace std; 3 long long sum[100005] = { 0 }; 4 long long square[100005] = { 0 }; 5 long long ans[10] = { 0 }; 6 v
阅读全文
1935-买装备-backtracking,dp
摘要:1 #include <stdio.h> 2 3 long long s[20], x[20] = { 0 }, c,sum=0; int n; 4 //回溯法解决子集和问题 ,子集中的那个数若存在则记为1,否则为0 5 int backtrack(int t) { 6 static int cou
阅读全文
1845-安全的密码-质因数分解
摘要:1 #include<bits/stdc++.h> 2 using namespace std; 3 vector<char> str(50000,0); 4 vector <long long> pri; 5 //**开始定义一个全局变量数组,每个下表对应的值默认为0** 6 int pm[200
阅读全文
1940-回文对称
摘要:1 #include<bits/stdc++.h> 2 char s1[10005], s2[10005]; 3 void judge() { 4 int len2 = 0; 5 for (int j = 0; s1[j] != '\0'; j++) { 6 len2++; 7 if (s1[j]
阅读全文
1952-分披萨-sorting,implementation
摘要:1 #include<bits/stdc++.h> 2 /*第一行两个整数n,d (1≤n≤10^5,1≤d≤20),表示切披萨的刀数和小明希望的 d 的大小。 3 接下来一共 n 行,每行一个整数 wi(0≤wi≤359),表示第 i 刀切的位置。*/ 4 #define N 100005 5 i
阅读全文
1910-hwf的涨分策略-greedy
摘要:1 #include<stdio.h> 2 #include<string.h> 3 int l, k, j, i, p; 4 int tim[5] = { 0 }; 5 int tim_sum[120][5] = { 0 }; 6 int ans[120] = { 0 }; 7 int table
阅读全文
1945-祖安say hello-string
摘要:1 #include<bits/stdc++.h> 2 char str[100][40]; 3 char s[1005]; 4 5 int remark[2000][2] = { 0 }; 6 /*第一行为一个整数 n,表示违禁词库有 n(1≤n≤100) 个。 7 第 2 行到第 n+1 行,每
阅读全文
1945-祖安 say hello-String
摘要:1 #define _CRT_SECURE_NO_WARNINGS 1 2 #include<bits/stdc++.h> 3 char str[100][40]; 4 char s[1005]; 5 6 int remark[2000][2] = { 0 }; 7 /*第一行为一个整数 n,表示违
阅读全文
1888-jerry99的数列--factorial
摘要:jerry99的数列,只能算比较小的时候的部分
阅读全文
阶乘之和
摘要:#include<stdio.h> #include<math.h> int step(int a) { int power=0; if (a == 1 || a == 0) power = a; if (a > 1) power= a*step(a-1); return power; } int
阅读全文
6174黑洞(新手算法)
摘要:#include<stdio.h> int div(int array[4], int b) { int c = 0, i = 3;//细节 while (b > 0) { c = b % 10; array[i] = c; b = b / 10; i--; } return 0; } void M
阅读全文