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. MQTT --- Retained Message

    保留消息定义 如果PUBLISH消息的RETAIN标记位被设置为1,则称该消息为“保留消息”: Broker会存储每个Topic的最后一条保留消息及其Qos,当订阅该Topic的客户端上线后,Brok ...

  2. 使用国内作者制作的gcr.io镜像安装工具

    项目地址:https://github.com/zhangguanzhang/gcr.io How to use? 拉取 假设需要拉取gcr.io/google_containers/pause:3. ...

  3. maven下载,上传设置

    <settings xmlns="http://maven.apache.org/SETTINGS/1.0.0" xmlns:xsi="http://www.w3. ...

  4. 腕表wacche英语wacche手表

    watch As a noun, from Middle English wacche, Etymology As a noun, from Middle English wacche,See bel ...

  5. 大数据集群环境搭建之一 hadoop-ha高可用安装

    1.如果你使用root用户进行安装. vi /etc/profile 即可 系统变量 2.如果你使用普通用户进行安装. vi ~/.bashrc 用户变量 export HADOOP_HOME=/ex ...

  6. Log4j配置详述

    /** * log4j基础配置步骤阐述: * 1.引入log4j相关的jar包文件. * 2.创建log4j的配置文件.      * 3.测试配置是否成功. */ Log4j 根配置语法 下面引入一 ...

  7. docker-ce添加国内源-阿里docker-hub镜像

    问题现象: WARNING: bridge-nf-call-iptables is disabled WARNING: bridge-nf-call-ip6tables is disabled 问题解 ...

  8. Win10 Microsoft Store 微软商店 Error 0x00000193 解决方法

    0x00 前言 最近使用 CFW 过程中使用 Fiddle Web Debug 设置 Store 的回环代理的过程中发现无论是否使用代理,Store 都无法访问网络的问题,在最下面的提示中出现了 0x ...

  9. centos7 升级最新版内核 并安装 bcc-tools

    centos7 升级最新版内核 升级系统 [root@jikeshijian ~]# yum update -y 安装 ELRepo [root@jikeshijian ~]# rpm --impor ...

  10. Win 8\10系统安装软件报错

    一.问题 Win 8\10系统由于权限管理严格,右键管理员运行安装软件也会出现各种错误: 进度条走到20%闪退,报程序停止运行等等等等 二.解决思路 先确定软件路径安装在D盘(非系统盘). 开启超级管 ...