摘要: 注意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 阅读全文
posted @ 2020-03-24 17:12 域Anton 阅读(130) 评论(0) 推荐(0) 编辑
摘要: 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', 阅读全文
posted @ 2020-03-24 16:56 域Anton 阅读(124) 评论(0) 推荐(0) 编辑
摘要: 思路: 取每一位, 第一位和第四位相同, 第二位和第三位相同即回文数. 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 阅读全文
posted @ 2020-02-01 17:02 域Anton 阅读(154) 评论(0) 推荐(0) 编辑
摘要: 思路: 水仙花数, 取到每一位求立方的和判断. 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 = 阅读全文
posted @ 2020-02-01 16:59 域Anton 阅读(119) 评论(0) 推荐(0) 编辑
摘要: 思路: 让二维数组初始化为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 阅读全文
posted @ 2020-02-01 16:53 域Anton 阅读(129) 评论(0) 推荐(0) 编辑
摘要: 思路: 开数组初始化为0, 下标对应数, 值对应数第一次出现的位置. 每输入一个数, 看在数组中的值是否为0进行操作. 1 #include <iostream> 2 using namespace std; 3 4 int arr[10005]{0}; 5 6 int main() 7 { 8 i 阅读全文
posted @ 2020-02-01 16:32 域Anton 阅读(146) 评论(0) 推荐(0) 编辑
摘要: 思路: 找最大最小值、求和. 没有什么特别的地方. #include <iostream> using namespace std; int main() { ios::sync_with_stdio(false); cin.tie(0); int n; cin >> n; int maxn = - 阅读全文
posted @ 2020-01-31 22:32 域Anton 阅读(96) 评论(0) 推荐(0) 编辑
摘要: 思路1: 先设法输出前缀(逆序的部分), 再输出后面的部分. 特别要小心范围. 1 #include <iostream> 2 using namespace std; 3 4 char letters[27] = "ABCDEFGHIJKLMNOPQRSTUVWXYZ"; 5 6 int main 阅读全文
posted @ 2020-01-31 22:26 域Anton 阅读(129) 评论(0) 推荐(0) 编辑
摘要: 思路: 最简单的方法, 五重循环输出每一位. 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 阅读全文
posted @ 2020-01-31 21:23 域Anton 阅读(134) 评论(0) 推荐(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 阅读全文
posted @ 2020-01-31 21:11 域Anton 阅读(105) 评论(0) 推荐(0) 编辑