1 条题解
-
0
【深基1.例2】简单的分苹果
解题思路
小 A 与 Uim 共拿走 2+4=6 个,剩下 10-6=4 个。
正确性说明
总数减去已取走的数量恰好等于剩余数量。
易错点
本题没有输入;先输出两人合计,再输出剩余。
复杂度
时间 O(1),空间 O(1)。
参考代码(C++11)
#include <bits/stdc++.h> using namespace std; int main() { ios::sync_with_stdio(false); cin.tie(nullptr); cout << 2 + 4 << " " << 10 - 2 - 4 << "\n"; return 0; }
- 1