2013年12月30日

uva 123 - Searching Quickly

摘要: 这题是wa,现在没时间改,应该是单词搜寻那里有问题,搜th,the也能搜到 1 #include 2 #include 3 #include 4 #include 5 #include 6 using namespace std; 7 typedef struct combine{ 8 string word; 9 int i;10 string replaceword;11 bool operator dictionnary;23 int main(){24 vector igwords;25 vector sentence;26 s... 阅读全文

posted @ 2013-12-30 19:24 云在心 阅读(127) 评论(0) 推荐(0)

2013年12月26日

uva 400 - Unix ls

摘要: 这题其实很简单,但是re了很多次,因为天真到用setw,以及cout 2 #include 3 #include 4 #include 5 #include 6 #include 7 #include 8 using namespace std; 9 int main(){10 int n;11 vector words;12 while(cin>>n){13 getchar();14 string l;15 int max=0;16 for(int i=0;i0)?(n/columnnum+1):(n/c... 阅读全文

posted @ 2013-12-26 21:48 云在心 阅读(166) 评论(0) 推荐(0)

uva 156 - Ananagrams

摘要: 思路:1.先读取单词,把单词都整齐一下,从大写变为小写2.把单词按字母进行排序3.判断接下来的单词和前面的单词是否重复 1 #include 2 #include 3 #include 4 #include 5 #include 6 using namespace std; 7 vector newwords; 8 vector num; 9 vector oldwords;10 int main(){11 string l;12 vector::iterator it;13 while(getline(cin,l)){14 if(l[0]=='#... 阅读全文

posted @ 2013-12-26 20:12 云在心 阅读(190) 评论(0) 推荐(0)

uva 120 - Stacks of Flapjacks (RE)

摘要: 一直runtime error,这题要注意,有可能数字是重复的。 1 #include 2 #include 3 #include 4 #include 5 #include 6 using namespace std; 7 vector q_numb; 8 int len; 9 void q_sort(vector &numb){10 int max=0,pos=0,i=0;11 for(vector::iterator it=numb.begin();it!=numb.end();it++,i++){12 if(max(temp.c_str())));43... 阅读全文

posted @ 2013-12-26 14:41 云在心 阅读(141) 评论(0) 推荐(0)

2013年12月25日

uva 299 - Train Swapping

摘要: 水题。。。 1 #include 2 using namespace std; 3 int main(){ 4 int n; 5 int num[51]; 6 cin>>n; 7 while(n--){ 8 int l,cishu=0; 9 cin>>l;10 for(int i=0;i>num[i];12 for(int i=0;inum[j]){15 int temp=num[i];16 num[i]=num[j];... 阅读全文

posted @ 2013-12-25 20:37 云在心 阅读(190) 评论(0) 推荐(0)

uva 152 Tree's a Crowd

摘要: 突然不能登了,玩了局dota,编了这题,这题还是比较简单,英语拙计啊 1 #include 2 #include 3 #include 4 using namespace std; 5 int x[5010],y[5010],z[5010]; 6 int main(){ 7 int num=0,a[10]; 8 for(int i=0;i>x[num]>>y[num]>>z[num]){11 if(!x[num]&&!y[num]&&!z[num])12 break;13 num++;14 }15 for(... 阅读全文

posted @ 2013-12-25 17:04 云在心 阅读(114) 评论(0) 推荐(0)

uva 10474 Where is the Marble?

摘要: 排序而已。。。。不过时间有点长,以后再考虑考虑怎么写 1 #include 2 #include 3 #include 4 using namespace std; 5 vector num; 6 int main(){ 7 int n,q,cishu=1; 8 vector::iterator result; 9 while(cin>>n>>q){10 if(!n&&!q)11 break;12 int temp;13 for(int i=0;i>temp;15 num.p... 阅读全文

posted @ 2013-12-25 14:12 云在心 阅读(132) 评论(0) 推荐(0)

uva 10420 - List of Conquests

摘要: 这题写的好丑啊,这题感觉就是烦1.先要把单词读到一个数组,并记录次数2.对单词进行排序虽然只有0.022s,感觉写的太丑了不过这题温习了一下vector的用法,还有qsort的用法 1 #include 2 #include 3 #include 4 #include 5 #include 6 #include 7 #include 8 #define MIN(a,b) ((a)>(b))?(b):(a) 9 using namespace std;10 vector v_word;11 vector v_num;12 typedef struct Node{13 string s;.. 阅读全文

posted @ 2013-12-25 13:44 云在心 阅读(185) 评论(0) 推荐(0)

2013年12月23日

uva 340 Master-Mind Hints

摘要: 这题就是判断,先判断正确的,再判断位置不对但是数字对的这题开始提交都是 runtime error因为数组开的太小了,以后开大点。 1 #include 2 using namespace std; 3 int same,diff; 4 void juge(int len,int a[],int b[]){ 5 int tempa[1000],tempb[1000]; 6 same=0,diff=0; 7 for(int i=0;i>n){31 if(n==0)32 break;33 for(int i=0;i>a... 阅读全文

posted @ 2013-12-23 20:43 云在心 阅读(283) 评论(2) 推荐(0)

uva 748 - Exponentiation

摘要: 这是计算指数的,刚开始不知道该怎么做,然后查看了一些网上的代码,只要把小数点去掉后,接下来就是大数相乘了我在做的时候一下几点要注意1.小数点位数要记住2.像0.0100后面的两个0应该去掉在做的时候还wa了一次,主要是格式没对,它要求前置0和后尾0 都去掉下面给出accept的代码 1 #include 2 #include 3 using namespace std; 4 #define MAXN 300 5 struct bign{ 6 int len,s[MAXN]; 7 bign(){ 8 len=1; 9 for(int i=0;i=... 阅读全文

posted @ 2013-12-23 12:22 云在心 阅读(183) 评论(0) 推荐(0)

导航