Add two linenumber

Add Two LineNumber

hint:

题目的意思就是给出两个link,然后类似于反方向十进制加法,并有进位。
题目理解起来不难,但是这个题需要注意的要点比较多。
首先需要分情况,两个串的长度可能不一样;
再者需要设计一个carry变量来记录进位;
话不多说,下面贴上代码:
  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
第一个空: ```c++ void TaintGraphTraversal::printICFGPath(std::vector<const ICFGNode *> &path){ std::stringstream ss; ss << "START: "; for(auto node: path){ ss << node->getId(); if(node->getOutDegree() > 0){ ss << "->"; } } ss << "END"; std::string pathStr = ss.str(); paths.insert(pathStr); std::ofstream file("ICFGPaths.txt", std::ios_base::app); if(file.is_open()){ file << "{ln:" << path.front()->getInst()->getLine() << " cl:" << path.front()->getInst()->getColumn() << " fl:" << path.front()->getInst()->getFilename() << "}"; for(auto node: path){ file << " -> "; file << "{ln:" << node->getInst()->getLine() << " cl:" << node->getInst()->getColumn() << " fl:" << node->getInst()->getFilename() << "}"; } file << "\n"; file.close(); } } ``` 第二个空: ```c++ void TaintGraphTraversal::readSrcSnkFromFile(const string& filename){ std::ifstream file(filename); if(file.is_open()){ std::string line1, line2; std::getline(file, line1); std::getline(file, line2); std::regex re("\\{([^\\}]*)\\}"); std::smatch match; std::vector<std::string> srcVec, snkVec; while(std::regex_search(line1, match, re)){ srcVec.push_back(match[1]); line1 = match.suffix().str(); } while(std::regex_search(line2, match, re)){ snkVec.push_back(match[1]); line2 = match.suffix().str(); } file.close(); } } ``` 第三个空: ```c++ bool TaintGraphTraversal::aliasCheck(const CallICFGNode *src, const CallICFGNode *snk) { const SVFFunction *srcFunc = src->getCallee(); const SVFFunction *snkFunc = snk->getCallee(); const SVFVariable *retVar = srcFunc->getRetVar(); std::vector<const SVFVariable *> paramVars = snkFunc->getParamVars(); for(auto paramVar: paramVars){ if(paramVar->alias(retVar)){ return true; } } return false; } ```
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值