1.未考虑程序没有输出导致的格式错误:

原代码:(即使没有输出,ans集合元素为0,也输出了空格)

 set<int>::iterator it=ans.begin();
while(it!=ans.end()){
if(it!=ans.begin())
O(" ");
O("%05d",*it);
it++;
}
OL("");

AC代码:

 if(ans.size()>){
set<int>::iterator it=ans.begin();
while(it!=ans.end()){
if(it!=ans.begin())
O(" ");
O("%05d",*it);
it++;
}
OL("");
}

2.编程时尽量避开程序已经定义的词汇,例如time

今天编多重标尺的单源最短路径的题目(做了一个晚上,敲了200行代码,吐了),最后还编译失败,就是因为定义了time

OJ笔记的更多相关文章

  1. C++笔记(6)——关于OJ的单点测试和多点测试

    单点测试 PAT使用的就是单点测试(LeetCode应该也是单点测试).单点测试中系统会判断每组数据的输出结果是否正确,正确则通过测试并获得这则测试的分值.题目的总得分等于通过的数据的分值之和. 代码 ...

  2. 算法学习笔记(LeetCode OJ)

    ================================== LeetCode的一些算法题,都是自己做的,欢迎提出改进~~ LeetCode:http://oj.leetcode.com == ...

  3. Leetcode 笔记 113 - Path Sum II

    题目链接:Path Sum II | LeetCode OJ Given a binary tree and a sum, find all root-to-leaf paths where each ...

  4. Leetcode 笔记 112 - Path Sum

    题目链接:Path Sum | LeetCode OJ Given a binary tree and a sum, determine if the tree has a root-to-leaf ...

  5. Leetcode 笔记 110 - Balanced Binary Tree

    题目链接:Balanced Binary Tree | LeetCode OJ Given a binary tree, determine if it is height-balanced. For ...

  6. Leetcode 笔记 100 - Same Tree

    题目链接:Same Tree | LeetCode OJ Given two binary trees, write a function to check if they are equal or ...

  7. Leetcode 笔记 99 - Recover Binary Search Tree

    题目链接:Recover Binary Search Tree | LeetCode OJ Two elements of a binary search tree (BST) are swapped ...

  8. Leetcode 笔记 98 - Validate Binary Search Tree

    题目链接:Validate Binary Search Tree | LeetCode OJ Given a binary tree, determine if it is a valid binar ...

  9. Leetcode 笔记 101 - Symmetric Tree

    题目链接:Symmetric Tree | LeetCode OJ Given a binary tree, check whether it is a mirror of itself (ie, s ...

随机推荐

  1. ES集群7.3.0设置快照,存储库进行索引备份和恢复等

    说明:三台ES节点组成ES集群,一台kibana主机,版本均是7.3.0,白金试用版 官方地址:https://www.elastic.co/guide/en/elasticsearch/refere ...

  2. (原创)如何搭建PLC+上位机监控系统达到成本的最小化?

    以西门子PLC举例; 西门子PLC有几个型号:S7-200SMART,S7-1200,S7-300,S7-400,S7-1500,价格从低到高. 1个项目中要求的IO数量:600点的DI+DO,若干个 ...

  3. js图片压缩+ajax上传

    图片压缩用到了localresizeimg 地址: https://github.com/think2011/localResizeIMG 用起来比较简单 <input type="f ...

  4. Mybatis 原理分析

    对于入门程序的流程分析 使用过程 读配置文件 读取配置文件时绝对路径和相对路径(web工程部署后没有src路径)都有一定问题,实际开发中一般有两种方法 使用类加载器,它只能读取类路径的配置文件 使用S ...

  5. Springboot - java.lang.IllegalStateException: Failed to load property source from location 'classpath:/application.yml'

    Caused by: org.yaml.snakeyaml.scanner.ScannerException: while scanning a simple key in 'reader', lin ...

  6. ASP.NET Core 2.2在中间件内使用有作用域的服务

    服务生存期 为每个注册的服务选择适当的生存期.可以使用以下生存期配置ASP.NET Core服务: 暂时 暂时生存期服务 (AddTransient) 是每次从服务容器进行请求时创建的. 这种生存期适 ...

  7. 编写可维护的JavaScript-随笔(三)

    UI层的松耦合 本章提出了一个概念就是耦合 假设修改一个组件的时候需要修改很多其他的组件的话则表示组件之间存在紧耦合 如果修改一个组件而不需要修改其他组件的时候就做到了松耦合 页面是由HTML.CSS ...

  8. echarts的地图省份颜色自适应变化

    在使用echarts的地图的时候省份的颜色可能随着数据的多少显示不同的颜色,但是当后台返回的数据的变化较大时可能就不好控制了,所以需要设置根据后台的数据进行自适应 将后台返回的数据中的value放入一 ...

  9. Web前端2019面试总结2

    1.js继承: 想要继承,就必须要提供个父类(继承谁,提供继承的属性) 组合继承(组合原型链继承和借用构造函数继承)(常用) 重点:结合了两种模式的优点,传参和复用 特点:1.可以继承父类原型上的属性 ...

  10. AttributeError: module 'matplotlib' has no attribute 'verbose'

    AttributeError: module 'matplotlib' has no attribute 'verbose' 翻译:attributeError:模块“matplotlib”没有“ve ...