随笔分类 -  ACM-字符串与链表

摘要:这题是水题,主要是用到了C++字符串和cmath中的pow函数。 最近课程有点多,做POJ时间不够,还是要抓紧一些,尤其是动态规划、搜索题等要多练。#include <iostream>#include <string>#include <cmath>using namespace std;int main(){ string s; while(1){ cin>>s; if (s == "0") break; long result = 0; int k = 1; string::iterator it; for (it = 阅读全文
posted @ 2010-11-30 22:24 yangleo 阅读(328) 评论(0) 推荐(0)
摘要:这题很简单,但由于审题不清WA了很多次,太不应该Any non-alphabetical character should remain the same, and all alphabetical characters will be upper case.即只要不是字母就不变,如下写法错误if(*it == ' ' || *it == ',') continue;另外,对C++ String的使用中如何将空格也输入也是一个难点,getline不太好用,这里用了一个C的string作为中间量,借助C函数gets完成#include <iostream&g 阅读全文
posted @ 2010-11-26 17:06 yangleo 阅读(248) 评论(0) 推荐(0)