2016北京賽區網賽C(模擬)

2021-07-23 03:33:04 字數 1701 閱讀 4222

思考:

1、別忘了清空陣列等

2、想好了再寫

**寫得比較冗餘。其實主要**段就是

int l = strlen (s);

for (int i = 0; i <= l; i++) else

first.clear();

second.clear();

maxnum = max (maxnum, mp[s2]);

}first.clear();

flag1 = 1;

flag2 = 1;

} else

if (s[i] == ' ') else

if (flag1 == 2) else

first = second;

second.clear();

maxnum = max (maxnum, mp[s2]);

}} else

}

用map儲存所有的短語出現過的次數,最後掃一遍找出現最多次的短語就好了。

上面的哪一段**實現的功能是把所有的短語都加入到map裡。這道題是純模擬,比較麻煩,不過處理好了短語之後,也就好做多了。

#include 

#include

#include

#include

#include

#include

#include

#include

#include

#include

using

namespace

std;

const

int maxn = 600;

map mp;

int main()

else

first.clear();

second.clear();

maxnum = max (maxnum, mp[s2]);

}first.clear();

flag1 = 1;

flag2 = 1;

} else

if (s[i] == ' ') else

if (flag1 == 2) else

first = second;

second.clear();

maxnum = max (maxnum, mp[s2]);

}} else

}while (gets (s)) else

first.clear();

second.clear();

maxnum = max (maxnum, mp[s2]);

}first.clear();

flag1 = 1;

flag2 = 1;

} else

if (s[i] == ' ') else

if (flag1 == 2) else

first = second;

second.clear();

maxnum = max (maxnum, mp[s2]);

}flag2 = 1;

} else }}

map::iterator it;

for (it = mp.begin(); it != mp.end(); it++) }}

return

0;}

2014 ACM ICPC 北京賽區現場賽總結!!

北京三天之行就這樣結束了,帶著些許遺憾,就這樣告別我的第一場regional,以後再見吧!比賽前 14號下午,匆匆忙忙考完數電,然後回寢室補作業,這麼拼的我也是醉了,之後就在百忙之中把作業搞定了 好像都是亂做的 匆匆之間補完作業就去和sh回合了,然後和wzy還有y學長風風火火離開學校了,之後就是去和...

2017ICPC網路賽北京賽區 I題

2017icpc網路賽北京賽區 i題 描述 you are given a list of integers a0,a1,a2 k 1.you need to support two types of queries output minx,y l,r let ax y.輸入 the first l...

2018 ACM ICPC亞洲區域賽 北京賽區

hihocoder 1870 給n對關係,每對關係表示為a 比b 厲害,如果a比b厲害,b比c厲害,那麼a比c厲害,即關係具有傳遞性。如果這n對關係存在矛盾,則輸出矛盾的哪乙個關係,否則輸出0 如果a比b厲害,b比a厲害就和之前的關係矛盾,構成乙個環,使用dfs判斷有向圖是否有環即可 include...