摘要: 1. 两数之和 思路: 暴力遍历 代码: class Solution { public: vector<int> twoSum(vector<int>& nums, int target) { int lenNums = nums.size(); int a, b; for(int i = 0; 阅读全文
posted @ 2020-09-23 15:42 nonameless 阅读(140) 评论(0) 推荐(0) 编辑
摘要: 题目链接 A - Decrease the Sum of Digits 思路: 记录以下到那个位置会大于 \(s\),然后前一个位置的数加一,之后的全部变为零即可。 注意特判到某个位置刚好等于 \(s\) 的情况。 代码: int main(){ int t; cin >> t; while(t - 阅读全文
posted @ 2020-09-23 15:36 nonameless 阅读(224) 评论(0) 推荐(1) 编辑