摘要: 思路: 找最大最小值、求和. 没有什么特别的地方. #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 阅读(101) 评论(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 阅读(140) 评论(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 阅读(137) 评论(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 阅读(118) 评论(0) 推荐(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 >> 阅读全文
posted @ 2020-01-31 21:06 域Anton 阅读(142) 评论(0) 推荐(0)
摘要: 思路: 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 阅读全文
posted @ 2020-01-31 21:02 域Anton 阅读(135) 评论(0) 推荐(0)
摘要: 思路: 求圆的面积: S = PI * r2. 题目已给 PI = atan(1.0) * 4 或 PI=3.14159265358979323. 1 #include <iostream> 2 #include <cstdio> 3 #include <cmath> 4 using namespa 阅读全文
posted @ 2020-01-31 20:55 域Anton 阅读(124) 评论(0) 推荐(0)
摘要: 思路: 直接打表, 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 阅读全文
posted @ 2020-01-31 20:46 域Anton 阅读(140) 评论(0) 推荐(0)