1 条题解
-
0
【例3.1】 输出表达式的值
解题思路
先输出表达式文字,再输出 1234 与 5678 的乘积。
正确性说明
乘法表达式计算出要求的数值,并与固定前缀拼接。
易错点
星号与等号两侧均有空格。
复杂度
本题规模固定,时间 O(1),额外空间 O(1)。
参考代码(C++11)
#include <bits/stdc++.h> using namespace std; int main() { ios::sync_with_stdio(false); cin.tie(nullptr); cout << "1234 * 5678 = " << 1234 * 5678 << "\n"; return 0; }
- 1