zoukankan      html  css  js  c++  java
  • OJ笔记

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

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

    1 set<int>::iterator it=ans.begin();
    2 while(it!=ans.end()){
    3     if(it!=ans.begin())
    4         O(" ");
    5     O("%05d",*it);
    6     it++;
    7 }
    8 OL("");

    AC代码:

     1 if(ans.size()>0){
     2     set<int>::iterator it=ans.begin();
     3     while(it!=ans.end()){
     4         if(it!=ans.begin())
     5             O(" ");
     6         O("%05d",*it);
     7         it++;
     8     }
     9     OL("");
    10 }

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

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

  • 相关阅读:
    UESTC
    Education Round 8 A
    Gym
    Gym
    hdoj 1159 Common Subsequence
    UVA
    UESTC
    51Nod 1068 Bash游戏 V3 (这规律不好找)
    51Nod 1066 Bash游戏
    51Nod 1002 数塔取数问题
  • 原文地址:https://www.cnblogs.com/TQCAI/p/8005291.html
Copyright © 2011-2022 走看看