随笔分类 - 蓝桥杯练习系统
摘要:注意long long string存+反向迭代(其实没必要) 1 #include <iostream> 2 using namespace std; 3 typedef long long ll; 4 5 int main() 6 { 7 string s; 8 cin >> s; 9 ll a
阅读全文
摘要:1 #include <iostream> 2 #include <stack> 3 using namespace std; 4 5 stack<int> s; 6 char arr[16] {'0', '1', '2', '3', '4', '5', '6', '7', 7 '8', '9',
阅读全文
摘要:思路: 取每一位, 第一位和第四位相同, 第二位和第三位相同即回文数. 1 #include <iostream> 2 using namespace std; 3 4 int main() 5 { 6 ios::sync_with_stdio(false); 7 cin.tie(0); 8 9 f
阅读全文
摘要:思路: 水仙花数, 取到每一位求立方的和判断. 1 #include <iostream> 2 using namespace std; 3 4 int main() 5 { 6 ios::sync_with_stdio(false); 7 cin.tie(0); 8 9 for (int i =
阅读全文
摘要:思路: 让二维数组初始化为0, pas[0][0] = 1, 然后就能模拟了. pas[i][j] = pas[i - 1][j - 1] + pas[i - 1][j]; 1 #include <iostream> 2 using namespace std; 3 4 int pas[50][50
阅读全文
摘要:思路: 开数组初始化为0, 下标对应数, 值对应数第一次出现的位置. 每输入一个数, 看在数组中的值是否为0进行操作. 1 #include <iostream> 2 using namespace std; 3 4 int arr[10005]{0}; 5 6 int main() 7 { 8 i
阅读全文
摘要:思路: 找最大最小值、求和. 没有什么特别的地方. #include <iostream> using namespace std; int main() { ios::sync_with_stdio(false); cin.tie(0); int n; cin >> n; int maxn = -
阅读全文
摘要:思路1: 先设法输出前缀(逆序的部分), 再输出后面的部分. 特别要小心范围. 1 #include <iostream> 2 using namespace std; 3 4 char letters[27] = "ABCDEFGHIJKLMNOPQRSTUVWXYZ"; 5 6 int main
阅读全文
摘要:思路: 最简单的方法, 五重循环输出每一位. 1 #include <iostream> 2 using namespace std; 3 4 int main() 5 { 6 ios::sync_with_stdio(false); 7 cin.tie(0); 8 9 for (int a = 0
阅读全文
摘要:思路: 闰年: 年份是4的倍数而不是100的倍数; 年份是400的倍数. 注意大小写. 1 #include <iostream> 2 using namespace std; 3 4 int main() 5 { 6 ios::sync_with_stdio(false); 7 cin.tie(0
阅读全文
摘要:思路: A+B, 没有什么特别的. 1 #include <iostream> 2 using namespace std; 3 4 int main() 5 { 6 ios::sync_with_stdio(false); 7 cin.tie(0); 8 9 int a, b; 10 cin >>
阅读全文
摘要:思路: 1 ≤ n ≤ 1,000,000,000,需要用long long存. 1 #include <iostream> 2 using namespace std; 3 typedef long long ll; 4 5 int main() 6 { 7 ios::sync_with_stdi
阅读全文
摘要:思路: 求圆的面积: S = PI * r2. 题目已给 PI = atan(1.0) * 4 或 PI=3.14159265358979323. 1 #include <iostream> 2 #include <cstdio> 3 #include <cmath> 4 using namespa
阅读全文
摘要:思路: 直接打表, fib[n]即为所求. 注意取模运算的规则: (a + b) % c = (a % b + b % c) % c 1 #include <iostream> 2 using namespace std; 3 4 int fib[1000005]; 5 6 int main() 7
阅读全文

浙公网安备 33010602011771号