1 条题解
-
0
练3.2 雪花
解题思路
先输出 1+2+3+4=,再计算四个数的和。
正确性说明
1+2+3+4=10,表达式与结果均按要求输出。
易错点
表达式中间不加空格。
复杂度
本题规模固定,时间 O(1),额外空间 O(1)。
参考代码(C++11)
#include <bits/stdc++.h> using namespace std; int main() { ios::sync_with_stdio(false); cin.tie(nullptr); cout << "1+2+3+4=" << 1 + 2 + 3 + 4 << "\n"; return 0; }
- 1