HIT summer training contest 08——练练手
2011-08-01 22:37
423 查看
在家没事干就要多做做比赛才是。。。
C题是搜索题 N个数字之间放N-1个"+","-","*" ,"/"
使每位不存在为k的数字。。。
注意点,超int,注意除数不为0,当结果为0是特判
View Code
C题是搜索题 N个数字之间放N-1个"+","-","*" ,"/"
使每位不存在为k的数字。。。
注意点,超int,注意除数不为0,当结果为0是特判
View Code
#include<stdio.h> #include<iostream> #include<algorithm> #include<string.h> #include<string> #include<set> #include<map> using namespace std; bool hash[100][10000]; struct data { int no; char ss[299]; }node1[909]; bool cmp(data a,data b) { if(a.no==b.no) return strcmp(a.ss,b.ss)<0; return a.no>b.no; } struct stu { int no; bool use; }; int main() { char temp[299]; int add=-1; set<string> set1; gets(temp); map<string,stu>mm; while(1) { if(temp[0]>='A'&&temp[0]<='Z') { add++; set<string> ss; strcpy(node1[add].ss,temp); while(gets(temp),(temp[0]<'A'||temp[0]>'Z')&&temp[0]!='1'&&temp[0]!='0') { ss.insert(temp); } if(temp[0]=='1'&&temp[0]=='0')break; set<string>::iterator pp; int all=0; for(pp=ss.begin();pp!=ss.end();pp++) { if(mm.find(*pp)==mm.end()) { mm[*pp].no=add; all++; } else { if(mm[*pp].use==0) { node1[mm[*pp].no].no--; mm[*pp].use=1; } } } node1[add].no=all; } if(temp[0]=='1') { mm.clear(); int i; sort(&node1[0],&node1[add+1],cmp); for(i=0;i<=add;i++) { printf("%s %d\n",node1[i].ss,node1[i].no); } for(i=0;i<=100;i++) { node1[i].no=0; } add=-1; gets(temp); } if(temp[0]=='0') return 0; } }
相关文章推荐
- HIT summer training Contest 11 / 解题报告
- HIT summer training Contest 11 / 解题报告
- HIT summer training Contest 11 / A step number
- HIT summer training Contest 11 / A step number
- HIT summer training Contest 11 / B another number game
- HIT summer training Contest 11 / B another number game
- ZZULI-Summer Training Contest(Seven)解题报告
- 【枚举】Petrozavodsk Summer Training Camp 2016 Day 6: Warsaw U Contest, XVI Open Cup Onsite, Sunday, August 28, 2016 Problem G. Equation
- Tri_integral Summer Training 1 (Petrozavodsk Summer 2005. Moscow+Ural Contest) 总结
- 【计算几何】【极角排序】【二分】Petrozavodsk Summer Training Camp 2016 Day 6: Warsaw U Contest, XVI Open Cup Onsite, Sunday, August 28, 2016 Problem J. Triangles
- 【线段树】Petrozavodsk Summer Training Camp 2016 Day 6: Warsaw U Contest, XVI Open Cup Onsite, Sunday, August 28, 2016 Problem H. Hay
- 【推导】【构造】Petrozavodsk Summer Training Camp 2015 Day 2: Xudyh (TooSimple) Contest, Saturday, August 22, 2015 Problem G. Travelling Salesman Problem
- The 3rd ACM-ICPC Summer Training Contest(swjtu)
- 【随机化】Petrozavodsk Summer Training Camp 2016 Day 5: Petr Mitrichev Contest 14, Saturday, August 27, 2016 Problem I. Vier
- ZZULI-Summer Training Contest(Six) 解题报告
- hdu2888Check Corners【二维RMQ】2009 Multi-University Training Contest 9 - Host by HIT
- 2016 Multi-University Training Contest 1 solutions BY HIT
- 2015 Multi-University Training Contest 2
- 2015 Multi-University Training Contest 2 1009 I Wanna Become A 24-Point Master(HDU5308) 构造
- 2015 Multi-University Training Contest 3