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. SpringBoot入门初体验

    概述 Java项目开发中繁多的配置,复杂的部署流程和第三方技术集成让码农在开发项目中效率低下,因此springBoot应运而生. 环境 IntelliJ IDEA 2018.3 jkd1.8 开始(傻 ...

  2. mycat在windows环境下安装和启动

    1.下载从如下地址下载mycat的安装包: http://www.mycat.io/ eg:Mycat-server-1.6.6.1-release-20181031195535-win.tar.gz ...

  3. 如何通过 IntelliJ IDEA 来提升 Java8 Stream 的编码效率

    本文翻译整理自:https://winterbe.com/posts/2015/03/05/fixing-java-8-stream-gotchas-with-intellij-idea 作者:@Wi ...

  4. VS web停止调试后关闭浏览器

  5. Springboot vue.js html 跨域 前后分离 Activiti6 shiro 权限

    官网:www.fhadmin.org 特别注意: Springboot 工作流  前后分离 + 跨域 版本 (权限控制到菜单和按钮) 后台框架:springboot2.1.2+ activiti6.0 ...

  6. Java 之 Set 接口

    一.Set 概述 java.util.Set 接口继承 collection 接口,它与 Collection 接口中的方法基本一致,并没有对 Collection 接口进行功能上的扩充,只是比 Co ...

  7. Golang: 常用的文件读写操作

    Go 语言提供了很多文件操作的支持,在不同场景下,有对应的处理方式,今天就来系统地梳理一下,几种常用的文件读写的形式. 一.读取文件内容 1.按字节读取文件 这种方式是以字节为单位来读取,相对底层一些 ...

  8. MySQL数据库中字符串函数之left、right用法

    语法 LEFT(str,len) Returns the leftmost len characters from the string str, or NULL if any argument is ...

  9. Prometheus学习笔记(4)什么是pushgateway???

    目录 一.pushgateway介绍 二.pushgateway的安装运行和配置 三.自定义脚本发送pushgateway 四.使用pushgateway的优缺点 一.pushgateway介绍 pu ...

  10. Miniconda安装 虚拟环境创建 与包管理

    安装python 之前安装python包,导致了python里面的包不兼容,用管理工具卸载也下载不掉,重新安装也安装不上,没有办法只能卸掉python重装. 安装Anaconda Anaconda指的 ...