显然,A+B+C = 315 - 105 * 2 = 105
标题:完美正方形
如果一些边长互不相同的正方形,可以恰好拼出一个更大的正方形,则称其为完美正方形。
历史上,人们花了很久才找到了若干完美正方形。比如:如下边长的22个正方形
2 3 4 6 7 8 12 13 14 15 16 17 18 21 22 23 24 26 27 28 50 60
如【图1.png】那样组合,就是一种解法。此时,
紧贴上边沿的是:60 50
紧贴下边沿的是:26 28 17 21 18
22阶完美正方形一共有8种。下面的组合是另一种:
2 5 9 11 16 17 19 21 22 24 26 30 31 33 35 36 41 46 47 50 52 61
如果告诉你该方案紧贴着上边沿的是从左到右依次为:47 46 61,
你能计算出紧贴着下边沿的是哪几个正方形吗?
请提交紧贴着下边沿的正方形的边长,从左到右,用空格分开。
不要填写任何多余的内容或说明文字。
参考答案:
50 33 30 41
---------------------
点评:
完美正方形问题如果完全没有线索来求解,十分困难。
不过此题给出了诸多线索,暴力破解是可行的。
首先可以确定大正方形的边长。
接下来只要先去枚举3条未知边的所有可能组合情况,剩下中间的情况就很少了。
#include <iostream> #include <String.h> using namespace std; int a[]={2, 5 ,9 ,11 ,16, 17, 19, 21, 22, 24, 26, 30, 31, 33, 35, 36, 41, 50 ,52 };//正方形 int vis[19]; //访问数组 int que[30]; // 存储最下行每个正方形大小 int fon=0; //最下行正方形索引 int map[154][154]; //填充为1 未填充为0 void make(int x,int y,int k,int u) //填充和清除正方形 u为1为填充 否则为清空 { if(u==1) for(int i=x;i<x+k;i++) for(int j=y;j<y+k;j++) { map[i][j]=1; } else for(int i=x;i<x+k;i++) for(int j=y;j<y+k;j++) { map[i][j]=0; } } int panduan(int x,int y,int k) // 当前点 x y 填充大小k { if(x+k>154) return 0; if(y+k>154) return 0; //判断将被填入的正方形部分是否有已经被填充部分 for(int i=x;i<x+k;i++) for(int j=y;j<y+k;j++) { if(map[i][j]==1)return 0; } return 1; } int f(int k) //k为遍历数组的索引 { if(k>=19) //完成遍历 { for(int i=0;i<fon;i++) cout<<que[i]<<" "; cout<<endl; return 1; } for(int j=0;j<154;j++) for(int i=0;i<154;i++) { if(map[i][j]==0) //如果未填充 { for(int z=0;z<19;z++) //搜索数组中的正方形 { if(vis[z]==0 && panduan(i,j,a[z])) //如果正方形未使用并且符合填充要求 { int flog=0; if(i+a[z]==154) { que[fon++]=a[z]; flog=1; } vis[z]=1; make(i,j,a[z],1); if(f(k+1)) return 1; //如果满足要求填充下一块 if(flog) //如果填过一块,从前一块开始填 fon--; vis[z]=0; make(i,j,a[z],0); } } return 0; } } return 0; } int main() { make(0,0,47,1); make(0,47,46,1); make(0,93,61,1); f(0); return 0; }
输入:
askfjsahsiafsahifhgafghghhsaggggfhsafsaaskfjsahsiafsahifhgafghghhsaggggfhsafsa
1
hahhgggs
输出:
4
输入:
iskfjhhhsiafsahifgsafghgghssgaasfhsafsaaskfjsghsiafsahifhgaiaaghhaaggggfhisfskaskfjgsssfafhahihhgafghghhsaggggfhhafgaaskajsaasshasaaifahafghghhssgsgsfhsafsghakfjsagsiafsasifhgafghghhsagggffhsafsghskfjshhsaafsagifggsfghghhagggggshfhfsagskfjsfhsiafgghifhgafghghaaaghgaahsafsafskfjsafsiaisahiffgafahghssaggggfhsgfsaaskfjsahssafsahifhgafghghhaagggafhsafsgasffjssfsiafhahifhgafhhghhssgaggghsgfsaaskajsghsigffahifhgafifgshsaggggfhsafsiaskfjsahgiahsahjfhsafghghssggaagshgafsagskfjsahsiafsahifhgaggkghhsfgahffhaafsaaskfjfahsiassahifhgaffhghsgaahggfhaahsaaakgjgaasifhsahifsgafghghhhagaggfasafsahsshfsahsiafhahafhgafahghhsaggagfhhafss
1
hhhggsag
输出:
5
输入:
aakiafahsihasahifhgsfghihhsggahishhsfaaaskfjsahsiafaahgfhgafghghhsaggggfhsafsaaskhjsahgiafsahifhgafhhgfhsafgggfasafsafskfjsaksffffahiahgafghgihssagggfhsasssaakfgsahsiahsahishgafghkhgsahggsihsaisaaakfjsahsihfsaffghfshghghhsagghgihssfsaaakfjsahsiggsahishgafghghasafgggfasafsafhgfjsahshafsahsahgafaagsfsaggggfksahhaaskfjjahsiafsahifhgafghghhsaggggghsafsaasgaisafsisssahhfsgafghhhishggggghsafsaahkaisahsfafsasjghgashhghhsaggggfffafsafsghjahhsiafsihifhgafghghhsaagggfhsfgsagskfjsahsiassahiffgafghghhsfggghfgsafsafskfsssgfiafsahifhgkfghfhgsagaggfhsafgaaskfjsahsgafaahafhgafghghhgaggggfhsaffajfsfjashsiafsahgfhaafghgfhaajggjfhsafss
10
hggagghs
sjfssakh
hfhaggfi
sahsfias
sksjsahf
ifgfahhg
sasifhaj
akjfshas
iasihaff
saijhsaf
输出:
44
输入:
askfjaahsiafssaihhgafghghhsaggfgfhsakgaaskhjsahsiafsasishgafghghhsaggggfhsafsaaskfjsassiafsahifagffghghhsaggggfhsafsaafkfjsahsiassahifggafahghksjggggfhsafhaiskfjsassiagsahifhgafghghhsaggggfhsafsaaskfasghsiafsjjiahgafghghhsagggggfsaasaasffafahsiaasahhfggafghghhshgfhgfgsafiaasggjsghsiafsahifhgafghghhsasgggfhsahsaaskffsahsgafsahifhgffgsgihsaggagfhsafsaafhfjsassigfaahighgafghahhhagiggfhahfsaaskagfghsisfsahifhgafghghhsaggshfhaafsaaskfjssfsiafsahifggsfghfhssaggggfhsassaasgfjsahsiafsahifhgafghghhsaggggfhaafssskafasafsiagsahifsgafghghhkagfggfhsasshaskfjsahsiafsahsfhhafghghasagghgfhsafsaaskfjsahsiagshhifhgafghahhsaagggfhsafshaakfjsaasiafsahhfhgsfghghhsgggggshsassaaskhjsahsiafsahifhgagghghhsaggggfhsafsaaskfjsshsiagsahifhgafghahhfaggggfhsafsasskfjsahsiafsahsfhgafggghhgaigggfhsafsaaskajsahsiafsahihhkafgagghfagggsghfafsfaskfjsassiafsahihhgafghghhsagggafhsafsaaskfjsahsiafgahifhgafghghhsaggggfhsafsaaskfjsahsgakshhifhgafggghhssfgggfgsafiaaskfjsaasiafgahifhgakghgihsagfggfhsafsaahkfjsshiihfsahifhhaighhhhsaggghafsagsasskhjsahaiafhahifhgafggghhshgggffhsafsaasffjsahsaafshhifhgafghghhsaggggfhsafsaaskfjsahsiafsghifhgafgkghhsaggggfgsgffahakfjsahfhafsahifhgafghghhhaggggfhsafgaaskfjsaaaiafsahihhgafgkjhhsaggagfhsafsaaskfjsahsiafsahifhgafghghhsafgggfhsafsaashfjsahhisfaahiahgafghghhsaggakfhsafsajskfhsahgiagsahjfhgafghghhsaggggfhsgfsasskfgsahsiaasahifhgafghhhhsaggggfhsaffiaskfjfahsiafsahifhfafghgafsaggggffsafsaaskfjsahsiafsahifhfafghghhsaagggfhsafsasskfjgghsasfsahifhgafgsghgsahaggfhsafsaasafjsghgaafsahifigafgsgfhgaghjhfhsahsgasifjsahfiafsaisfhaafghghhsaggsgfhsafshasksjsahsgffaahgfhgsfghghhsaggggfhsafsaaskajsahsiafsaaifhgafghghhsgggggfhgsfsaasgfjsahgiaasahifhgafihahhsaggsgagsafsaaskfjsahaiaasahifhgafghshhhaggagfhsafsaaakfjfahsiafsahafhgafhhgghsaggggagsafsaaskfjhahsiafsasifigafghghhsaagggfhsafgassgfjsahsiafsahifhgagghggasaggggfhfafhaaskfjsahsiafsahiahfafghgghsaggggahsafsaaskfjaghsiafsahgfhgafagghhsaggagfhiafsaaskfjsahhiafsaaifhghfshgghsahgggfhsgfsaaskfjsahskafsahifaggfghghhsaggkghhsagshasafjsahsigfsahifhghgghghhsaggggfhsafsaashffsahsiafsahifhgsfghghhsaggggfhssfsaaagfjsahsigfsahighgffghghjsagskgfhsajsaaskahaahsiafsahifhgafjhghssagggffhaafsahskfhsahssafsahifhfafghghhsaggggagsafsaasafssahgiafsahifhgafghghhsaggggfhssfsaaskajhahsiafsahifhgafghghhsaggggfhsafsafskfjfassiafsahifhgafghghhsaggggfhsafsggskfjsahsiafsahifhgsfgaghhsaggggfhsafsaaskfjsgfsifssahifhasfhhghhsaggsgfhskfhaaskhjsahsisfsahifhjffghghhshggggfgsafsaaskfjsahsiassagighgsfghghhsagaggfhsafsafskfjsfhsisfsahifghafghghhsagggkfhfafsiaskgjsahsaafsagifhgafgaghhaaggggahsaffaaskfjiahsiafsahifhgafghghhsaggggfhsaffaaskfsaahsiafsahifhgafghghhsaggggshsafsaaskfassfsiafsfiiffhafghghhsagggsfhaafsaaskfjsghsiafhahifhgafghghhsaggggfhsafsaaskfjsahsiafsaiifsgafghgshsaggggfgsafsaassfhjahsisfsahhfhgagghghhsahgggfhsaffasskfjsahsaassahifhgaighghhsaggggfhsafsaaskfjsahsiafsahifhaafahghhsaggggfhshfsfaskfjsagsiafsahijhgahshghhsagaisfafafsaaskfjsahsiafsahhfhghfghhhhsaggggfhsafsassafjsahasaffahifhfafghfhhssggggfhsafsigskfjsahiiafsahifhgafghghssagaghfhasfsafskfhsahsiassahifagafghghhsagjggfhsafsaahkhssaisiafsahifhggfghghhsagggffhsafsasskfjsshsiafsahsfhgafghfhhsaggggfhsffsaashgjgahaiafsagifhgafghghhsaggggfhsafsaaskfjhhhsiafsahishgafhhghhsaggsffhsafsaakkfjsahsiafsahiahgafghghksfggggfhsafsfaskiasahsiafsahffhsahghghhsaggggghsafsaaikfjiifhiafaafifggafaagfhsagghgghsafsaaakfjsahsiafsahifhgasggghhsaggggfhsafssaskfjsahghafsahifhgasghghhsagggsfhsafsaaskfjsahsiafsihaffgafghghhsaagggfhsafsaaskfjsahsiafshhifhgafghihgsagfggfhsafsaaskijsahsiafgasifhgafgaahfssghggfhsfasgaskfjsahsiafsahifhgasghghhsagghgfhsafsaaskfjsahsiafsjhifhaafshgghsagggsshsafshaskhjsahsiafhahifhggfghghhsagfggfhshfsaahkfjsahaiafsgjifhfafggghhsaggggfjsafsaassffsahiiafsahffhgafghghhsaggggfhsafskasffasahsiafsahifhgafgaghhsaisgsfhhafjaaskfjsahgiaasahifhgafghgfhsaggfgfhfhssaaskfasahsiafgasifhgafghgghsagghgfksffsaaskfjsahsiafsahifhgafghghhsaagghshsffsasikfjhahsiahsafgfhgafahghhsafgfgfhhsfsaaskfjfagsfaisahiffgasghshssaggggfhsahsassafjgahsiaafahifhhafhhghfsagkggahsgfsaaskfjhahsiafhahgfgkaffhghhsaagggfhgafsahskgjsaisiafsahighfkfghgahsaggggfhsifsaaskfjshhsiafsahhfhgagfhgfhsagaggfifafsaaskfjsahsiafsahifhkahghshhsgsgggfhsafsaaskjssaggiafhahifhggfghgihsaggghffsafsaaasfjgahsasfsaiifhgafgaghhsakghffhsagsaaskfjsahsiafsaaifhfhfghfshsaggggfhsafsiasksjsahsiafsahifhgafghghhsafgggfhsassaasafasahsiafhshifhgifgfgahsaggggfhsafsaaskgjsjhsaafsfhifhgafghghhaaggggfhsafsaaskfgsahsiafsahifhhafghghhshggghfhsafsaaskffsahsiafsahifhgafgaghhsaggggfhsafsaasksjaagsiafsahafhghfghghhgaggghfhsafsaaskfjsahaiafsahifhgafghgghsaggggfhsafsaaskfjsahsiafsahafhgafshghhsssgggfhshfsaaskgjsahsiafgshifhgahghghhiaggggfhsagsaaskfjfahsiafhahshfgafghghhsaggggfhshfhaasfhjsahsiafsahifhgafghghhsafgggfhsffsaafkfjsfhsiagaffiahgafghghhsjghgafhsafaaaskfhsahsfaffahfahgafghghhsaggggfhsassaahkfasahsihasahifhkafghgfhkaggggfhsaffaaskfjshhsiafsahifshafghghhfagaggshaaasafskfjfahsiagsahgfhgafshghhsagghafhgafsaafkfksahsiafsahifhgafahghhsaggggfhsahsfahkfjsahsiahsahifhgjfgsghhgaahggghsafsaaskfjgkhiiaasahifhgafgggahsksgggfhsafsaaskjjsahssafhghijhgafghghhsaggggfhsafsaissfjsahsiafsahifhgafghgahsaggggghsafsaaskfjsahsiafsahifhgafghgahsaigsgfhsafsaaskfgsahsiafsaaifhgafggghhsaghghfhsafsaaskijsassiafsahifhgafahgfhsaggggahsahsaaskfasahsiafsahifhfafghghhsaggggfhsafsaskkfgsahsiafsahifsgafghghfsagggsfhsagsahskfjsahaigfsahishgafghghksaggfgfhsafsaasifjsahsiafsaahaggafghgshsagsggfksafsaaskfjsjhsiafsgagfhgafggghhsaggggfhsafsaaagfjsahsiafgahafkgafghghhsaggggffssgfaaskhjsagsgafsasifhgafghghhsagggffhgsfsaasgfjsahsiafaahifhgafghghhsgsgggahsafhfaskfjsahsiassahafhgafghghhhaggggfssafsaaskfisahsijfsahifhgaggaghhsahaggfhhhfsaaskfhsahsiafsahifhgafihghhsaggggghsafsaaskfjsahsiafsagijhhafghghhsaggggfhsafsaaskfjsahsiafsafifhgafghghhsaggagfhsafsagskfjffhsisfsghifhaafhhghhfaggggfhsaffaaskfjsahgiafsahighgafghghhssggggfhshffaaskfjashfiafsshhfaggfghghhsfggggfhsafsasskfjsassiafsahifhgafghghhsaggggfhsafsaaskijsagsiafsahifhgahghghhsfggggfhsafgagskfafshsiafsahighgafshgahsaggggfhsafsaasgfjsahgiahsahifhgafsaghssaggigfhiafsiasffjsahsiakhahifhgafghahfsaiggafhsafsaaskfjsahsiafsaaffhgagahghhsagjgshhsafsjiskfjsahaiafsahifhgafghgshsaghggfhsafsafskffsahsaafsahifhgafasgigsahgggfhsafskaskfjaahsiafsahifhgafghghhsaigggffsafsfaskfjhahsiafsahffhgafghgakhagggghhsafsaaskfjsaisiafsshifhgafghfhhsagggsfhsafssaskajgahhiafsaaishjafghghhssggggsgsafaaasgsjsahsasfsahifhgafghghhsaggggfhhafgaaskffsaassafgahighgafghghhsaggiffgssfsaaskfjaahsiafsahifhgafhhghhsaggggfhgaffsaskfgsahsiafsahifhgafghshssahggghhsafsaaskfjsahsiafsasifhgafghghhsaggggffsaasaifkfjsahsiafsahifhggfghgahskfgagajsafsafakfjsahsiafsahifhgafgaghhsaggggfhsifgifskfjsahsiafsahhfagahghghhsaghghfahafsafskfjsihsiafsahifasafghghhsaggagfhsafsaaagfjsahsiahskhifhgahgsghhsaggggfhaafsaaggfjsahsiafshhafhgahghghhsassggfhsafsaahafhsaasiafsahifhgafggghhsaggjgfhsafsaaskajsagsiafsahifhghfghhhhsaggggfhsafsaaskfjsahsiafsahgffgjfgsghhsaggggfhsafsaaskfjsahsiafhihifhgagghghhsaggggshsaassaskfjhaasiafsahifhgafghghgsagggsfhsafsaassfjsjhshgfaahifhgafgsghhsaagggagsafsaaskfjsahsiafshhhfhgafghghhsaggsgfgsafsaaskfjsahjiaffahhfhgafghghhgaskgsfhsafsaashfgsahsigfsaiihfgafahghhsaggggfhshfaaasffhsafsiafsasifhgafghghhsaghgafhsaffaaskfjsahsiafsahifhgafghghhsiggggfhiafsaaskfjsahsihfjahifhgagjhihhsagaggfhsafsaaskhjsahsiffsahifhhagghshhsaggfgfhsafsaaskfjsahsigfsahifhgafshghhssggggfasafsaafkfjsahsiafsahifsgafgighhhagfggfhshasaaskajsahsiafaahifhgafghhahsaggfgshsaffhaskfjsahshafaghifhgafghghhsaggggfhsafsaaskfjsghsiifsahighgafghghfsagsggahsafsaaskfjsafsiaasahhahgafghghhssgggsfhsafsaaskfjsahsiafsafifhgafghahhskgfggfhsafsaaakfasafsiafsahifhgafghakhsaggggshsafsaaskfjaahsiafsahifhgafghhhhsfggggfhsajsaassfjshhsiafsahifhgafghghhgaggggfhsaaaaahkfjsahsifasahgfhgafghghgsaggggfhhafgaaskfjsahsiafjahifhgafhsfhhsaggggfhhafsaaskfjsagsihfsahifhgafghghhsaggggfhsafsaahkfjsahsiafsahifhgafgaghhsasgggfhfafsaasksjsahsiffsahihhgaaghhhhsaggggfhshfsaashfjaaasgafsahihfgafghghhgaggggfhshgsaaskfgsahsihfsshifhgafahghhsaggggfaaahsaasifjsshsiafsahifhaafgagsfsagggifhsafsaaskfjsahsiafhahifhgafghghhsaggggfhsafsaaskfjsahssafsahishgafghghhsagggghhsagaafskfjsahagafsahishgafghghhsaggfgfhsfhsaaskfjshhsiassahifhgafghghhsaggagfhsaasaaskfashhsiafsajifhghfghghhsaggggfhsafsaaakjjsahhsafsshifhaafihghhsahgggfhsassfassfjsahsihfsahifhgafghgassaggggfhaafsaasasjfaasiafsshishgafghghfsaggggfgsafsaaskfgsahsiafsjhifhfafghghhsagkggfhsaasagsksjsahsigfsahffhaafghghasahgggfhsahsaiskfjsahsiafsfhifsgafghghssaggggfhsafsaaskfjsahsfafsahsfhgsfghgghssgggffgsafsaasafjfahsiafsaaifhghfghghhhaggggfhsahsaagkfjsahsiffsajiajgafgaghgsasgggfhssfsfaskfjsahsiafsahifhgaffhghhsahgggfhaafsaasgfasahsiffsahifhgsfghgahsaggggfhaafsafskfjsahsiahssgifhghfghghsiaggggfhsaffaaskfgsahfiafsahishhafghghgsagfggfhsafssagkfjahhsiafsahifhgafghghhsaggggghsafsaasggjsahfiafsahifhgafghghisaggggihsgsshaikfjsahsiafsahifhgafgashhsaggfgfhaafshaskffsagsiafsaiifhgafghghhsagggsfhsafsaaskfjsahsiafsahifhggfghghhsaagggfhsafsaaskfjgahsiafaahifhgafggghhsagjsgfhhagsaaskfgsagsgafsahifsgafggghhsaggggfhsafsfaskkjsfhsiafsahsfhgafahghhsaggggfhaafsaaskfjsahsiafgahiahhagghghhsagkggfhsafsaaskfjsahsiafsahafhgafshghhsaggggfhsafsaagafjsahgiafsffsfhhafghhfhsfsgghfhssfsaaskgjsahsiafsghijhsafghghhsfggggfhsafsaaskfjsahsiafsahgfhgsfghghhsaggggahskfshaskfssahsiafshhifhgafghhhhsaagggfhsahgaaskfjsahsiffgahifhgaaahghasaggggfhgafsaaskfjaahsiafsahifhkhfghghhsaggggfhsffahaskfjsahsiafshhighgafggshhsaggggshsafsaaskgjsaakgafssgifhgafgsgkssaggggfhsafsaaskfjsahssaahahifhgakghghhsagaggfhsafskahkajsahsigfsahifhgafghghhsaggggfhsafsaaskfjsahsiafskhifhahfghfhhsfgsggfhgafsaggkfjhahasgfsahifhgafghghhsaggggfhsagsaasafjsahaiafsahifhgafghgghsaggggshsassaasafjsahsaafsahifhgafggghhsagggafhsaksaaskfjsahsiafsahifhgafghghhsaggggfhsafsaaskfjihhsiafsahifhgafghghhsaggggahsafshasafjaafsiafsahafhggfghghhsaagggfhsafaaaskfjsfashafsashfhgafghghhsaggggfhsafsaaasgjsahaiffsahsfhgafghghhsaggggfhsjfsggskfjsagsiafsahsfhgahghghhssggggfssaashasafjsghsiafsahifhgafhgghhshggggfhsafsaaskfjsahsssfaagifhgafhhghhaaggggfisafsaasffjsahgiafsghifhgahghghhsaggggfhsafsaashhjsaksiafsahifhgafghghhsaggghfhsafsaaskfjsghaiaffjfifhgafghfhhssgsggffsafsa
10
faashhig
hhgagggs
sfsaihas
ghghsgga
ghghhsag
ffhaiggh
hhgghsag
shghghaf
ghgfahsh
ghgsggfa
输出:
1840
输入:
abbbccccaabbccbabbaaabcccccaabbccbabbaaabbccccaabbccbabbaaabbccccaabbccbabbaaabbccccbabbccbabbaaabbccccaabbccbabbaaabbccccaabbccbabbaaabbccccaabbccbacbaaabbccccaabbccbabbaaabbccccaabbccbabbaaabbccccaabbccbabbaaabbccccaabbcbbabbaaabbccccaabbccbbbbaabbbcccaaabbccbabbaaabbccccaabbccbabbaabbbccccaabbccbabbaaabbccccaabcccbabbababbccccaabbccbabbaaabbccccaabcccbabbcaabbccccaabbccbabbaaabbccccaabbccbabbaaabbccccabbbccbabbaaabbcccbaabbccbabbaabbbccccaabbccbabbaaabbbcacaabbccbabbababbccccaabbccbabbaaabbccccaabbccbabbaaabbccccaabbccbabbaaabbccccaabbccbabbaaabbccccaabbccbabbaaabbccccaabbccbabbaaabbccccaabbccbabbaaabbcbccaabbcbbabbaaabbccccaabbccbabbaaabbccccaabbcababbaaabbccccaabbccbabbaaabbccccaabbccbabbaaabbccccaabbbcbabbaaabbccccaabbccbabbaaabbacccaabbccbabbaaabbccccaacbccbabcaaabbccccaabbccbabbaaabbcccbaabbccbabbaaabbccccaabbccbabbcaabbccccaabbccbabbaaabbccccaacaccbabbaaabbccccaabbccbabbaaaabccccaabbccbabbaaabbcccbaabbccbabbaaabaccccaabbccbabbacabbccccaabbccbabbaaabbccccaabbccbabbaaabbccccaabbccbabbaaabbccccaabbccbabbaaabbccccaabbccbabbaaabbccbcaabbccbaabaaabbccccaabbccbabbaaabbccccaabbccbabbaaabbccccaabbccbabbaaabbccccaabbccbaabaaabbccccaabbccbabbaaabbccccaabbccbaabaaabbccccaabbccbabbaaabbccccaabbccbabbaaabbccccaabbbcbabbaaabbccccaabbccbabbaaabbccccacbbcccabbaaacbccccaabbccbabbaaabbccccacbbccbabbaaaabccccaabbccbabbaaabbccccaabbccbabbaaabbccccaabbccbacbaaabbcaccaabbccbabbaaabbccccaabbacbabbaaabbccccaabbccbabbacabbccccaabbccbabbaaabbccccaabbccbabbaaabbcbccaabbccbabbaaabbcccccabbccbcbbaaabbccccaabbccbabbaaabbacccaabbccbabbaaabbccccaabbccbabbaaabbccccaabbbcbbbbaaabbccccaabbccbabbaaabaccccaabbccbabbaaabbccacaabbccbabbaaabbccccaabbccbabbaaabbccccaabbccbabbaaabbccccaabbccbabbaaaabccccaabbccbabbaaabbccccaabbccbabbaaabbccccaabbcababbaaabbccccaabbccbabbaaabbccccaabbccbabbaaabbcaccaabbccbabbaaabbacccaaabccbabbaaabbccccaabbacbabbaabbbccccaabbccbacbaaabbccccaabbccbabbaaabbccccaabbccbabbaaabbccccaabbccbabcaaabbccccaabbcababbaabbbccccaabbccbabbcaabbccccaabbccbabbaaabbccccaabbccbabbaaabbccccaabbccbabbaaabcccccaabcccbabbaaabbccccaabbccbabbaaabbccccbabbccbabbaaabbccccaabbccbbbbaaabbccccaabbcbbabbaaabbcaccaabbccbabcaaabbccccaabbcccabbaaabbccccaabcccbabbaaabbccccaabbccbabbaaabbccccaabbccbacbaaabbccccaabbccbabbaaabbccccaabbccbabbaaabbccccaabbccbabbaaabbccccaabbccbabbaaabbccccaabbccbabbaaabbccccaabbccbabbaaabbccccaabcccbabbaaabcccccaabbccbabbaaabbccccaabbccbabbaaabbccccaabbccbabbaaabbccccaabbccbabbaaabbccccaabbccbabbaaabaccccaabbccbabbaaabbccccaabbccbabbaaabbcbccaabbccbabbbaabbccccaabbccbabbaaabbccccaabaccbabbaaabbccccaabbccbabbaaabbccccaabbccbabaaaabbccccaabbccbabbabacbccccaabbccbabbaaabbccccaabbccbabbaaabbccccaabbccbabbaaabbccccaabbccbabbcaabbccccaabbccbabbaaabbcaccaabbccbabbaaabbccccaabbccbabbaaabbcccaaabbccbabbababbcbccaabbccbabbaaabcccccaabbccbabbaaabbccccaabbccbabbaaabbccccaabbccbabbaaabbccccaabbccbabbaaabbccccaabbccbabbaaabbccccaabbccbabbaabbcccccaabbccbabbaaabbccccaabbccbabbaaabbccccaabbccbabbbaabbccccaabbccbabbaaabbccccaabbccbabbaaabbccccaabbccbabbaabbbccccaabaccaabbaaabbccccaabbcccabbaaabbccccaabbccbacbaaabbccccaabcccbabbaaabbccccacabccbabbaacbbccccaabbccbabbaaabbccccaabbcccabbcaabbccccaabbccbabbaaabbccccaabbccbabbaaabbacccaabbccbabbaaabbccccaabbccbabbaaabbccccaabbccbabbaaabbccccaacbccbabbaaabbccccaabbccbabbaaabbccccaabbccbabbaaaabccccaabbccbabbaaabcccccaabcccbabbaaabbccccaabbccbabbaaabbccccaabbccbabbaaabbccccaabbccbabbaaabbccccaabbccbcbbaaabbccccaabbccbabbaaabcccccaabbccbabbaaabbccccaabbccbabbaaabbccccaabbccbabbaaabbccccaabbccbabbaaabbbccaaabbccbabbaaabbccccaabbcbbabbaaabbccccaabbccbabbaaaabccacaabbccbabbaaabbccccaabbccbabbaaabbacccaabbccbabaaaabbccccaabbccbabbaaabbccccaacbccbabbaaabbccccaabbccbabbaaabbccccaabbccbabbbaabbccccaabbccbabbaaabbccccaabbccbabbaaabbccccaacbccbcbbaaabbccbcaabaccbabbaaabbcccccabaccbabbaaabbccccaababcabbbacabbccccaabbbcbabbaaabbccccaabbccbabbaaabbccccaabbccbabbaaabbccccaabbccbabbaaabbccccaabbccbabbaaabaccccaabbccbabbaaabbccccaabbccbabbaabbbccccaabbccbabbaaabbccbcaabbccbabbaaabbccccaabbacbabbaaabbccccaabbccbabbaaabbccacaabbccbabbaaabbccccaabbccbabbaaabbcbccaabbccbabbaaabbccccaabbccbabbababbccccaabbccbabbaaabbcccbbabbccaabbaaabbccccaabbccbabbaaabbccccaabbccbabbaaabbccccaabbccbabbaaabbccccaabbccbabbaaabbccccaabbccbabbaaabbccccaabbbcbabbaaabbccccaabbccbabbaaabbccccaacbccbabbaaabbacccaabbccbabbaaabbccccaabbccbabbaabbbccccaaabccbabbaaabbccccaabbccaabbaaabbccccaabbccbabbaaabbccccaabbccbabbaaabbccccaabbccbabbaaabbccccaabbccbabbaaabbccccaabbccbabbaaabbacccaabbacbabbaaabbccccaabbccbabaaaabbccccaabbccbabbaaabbccccaabbccbbbbaaabbccccaabbccbabbaaabbccccaabbccbabbaaabbccccaabbccbabbaaabbccccaabbccbabbaacbbccccabbbccbabbaaabbccccaabbccbabbaaabbccccaabbccbabbaaabbccccaabbccbabbaaabbccccaabbccbabbaaabbcccbaabbccbabbaaabbccccaabbccbabbaaacbccccaabbccbabbaabbbccccaabbccbabbaaabbcccaaabbccbabbaaabbccccaabbccbabbaaabaccccaabaccbabbaaabbccccaabbccbcbbaaabbccccaaabccbabbaaabbccccaabbccbabbaaabbccccacbbccbabbaaabbcccaaabbccbabbaaabbccccaabbccbabbaaabbcaccaabbccbabbaaabbccccaabbbcbabbaabbbccccaabbccbabbaaabbccccaabbccbabbaaabbccccaabbccbabbaaabbccccaabbccbabbaaabbccccaabbccbabbaaabbccccaabbccbabbbaabbccccaabbccbabbaaabbccccaabbccbabbaaabbccccaaabccbabbaaabbccccaabbccbabbaaabbccccaabbccbabbaaabbcaccbabbcccabaaabbbccccbabbccbabbaaabbccccaabbccbabbaaabbccccaabbccbabbaaabbccbcaabbccbabbccabbccccaabbccbabbaaabbccccaabbccbabbaaabbccccaabbccbabbaaabbccccaaabccbabbaaabbccccaabbccbabbaaabbccccaabbccbabbaaabbccccaabbccbabbbaabbccccaabbccbabbaaabbccccacbbccbabbaaabbccccaabbccbabbaaacbccccaabbccbabbaaabbccccaabbccbabcaaabbccccaabbccbabbaaabbccccaabbccbbbbaacbcccccaabbccbacbaaabbccccaabbccbabbaaabbccccaabbccbabbaaabbccccaabbacbabbaaabbccccaabbccbabbaaabbccccaabbccbabbbaabbccccaabbccbabbaaabbccccaabbccbabbaaabbccccaabbccbabbaaabbccccaabbccbabbaaabbccccaabbccbabbaaabbccccaabbccbabbaaabbccccaabbccbabbaaabbcccaaacbccbabbaaabbccccaabbacbabbaaabbccccaabbcccabbaaabbccbcaabbccbabbaaabbccccaabbccbabbaaabcccccaabbacbabbaaabbccccaabbccbabbaaabbcccccabbcababbaaabbccccaabbccbabbaaabbccccaabbcccabbaaabbccccaabbccbabbaacbbbcccaabbccbabbaaabbccccaabbccbabbaaabbccccaabbccbabbaaabbccccaabbccbabbaaabbacccaabbccbabbaaabbccccaabbccbabbaaabbccccaabbcbbabbaaabbccccaabbccaabbaaabbbccaaabbccbabbaaabbccccaabbccbabbaaabbccccaabbccbabbaaabaccccaabbccbabbaaabbccccaabbccbabbaaabbccccabbbccbabbaaabbccccaabbccbabbaaabbccccaabbccbabbaaabbccccaabbccbabbaaabbccccaabbcbbabbaaabbccccaabbccbabbaaabbbcccabbbccbabbaaabbcccaacbbccbabbaaabbbcccaabbccbabbaaabbccccaabbccbabbaaabbccccaabbccbabbaaabbccccaabbccbabbaaabbccccaabbccbabbaaabcccccaabbccbabbaaabbccccaabbcbbabbababbccccaabbccbabbaaabbccccaabbccbabbaaabbccccaabbccbabbaaabbccccaabbccbabbaaabbccccaabbccbabbacabbccccaabbccbabbaaabbccacaabbccaabbaaabbccccaabbccbabbaaabbccccaabbccbabbaacbbccccaabbccbabbaaabbccccaabbccbabbaaabbccacaabbccbabbaaabbccccaabbccbabbbaabbccccaabbccbbbbaaabbccccaabbccbabbaaabbccccaabbccbabbaaabbcccbaabbccbabbaaaabccccaabbbcbabbaaabbccccacbbccbabbababbccccaabbccbabbaaabbccccaabbccbabbaaaabccacaaabccbabbaaabbccccaabbccbabbaaabbccccaabbccbabbaaabbccccaabbacbabbaaabbccccaabbacbaabaaabbccccaabbccbabbaaabbccccaabbccbabbaaabbccccaabbccbabbaaabbccccaabbccbabaaaabcccccaabbccbabbaaabbccccaabbccbabbaaabbccccbabbccbabbaaabbccccaabbccbabbaaabbccccaabbcababbaaabaccccaabbccbaabaaabbccccaabbccbabbaacbbccccaabbccbabbaaabbccccaabbccbabbbbabbccccaabbccbabbaaabbccccaabbccbabbaaabbccccaabbccbabbaaabbccccaabbccbabbaaabbccccaabbccbabbaaabcccccaabcccbabbacabbccccaabbccaabbaaabbccccaabbccbabbaaabbccccaabbccbabbaaabbccccaabbccbabbaaabbccccaabbccbabbaaabcccccaabbccbabbaaabbccccaabbccbabbaaabbccccaabaccbabbaaabbccccaabbccbabbaaabbccccaabbccbabbaaabbccccaabbcbbabbaaabbccccacbbccbabbacabbccccaabbccbabbaaabbccccaabbccbabbacabbccccaabbccbabbaaabbccccaabbccbaabaaabbccacaabbccbabbaaabbccccaabbccbabbaaabbcaccaabbbcbabbaaabbccccaabbccbabbaaabbccccaabbccbabbaaabbccccaabbccbabbaaabbcbccaabbcababbaaabbccccaabbccbabbaaabbccccaabaccbabbaaabbccccaabbccbabbaaabbccccaabbccbabbaaabbccccaabbccbabbaaabbccccaabbccbabbaaabcacccaabbccbabbaaabbccccaabbccbabbaabbbcaccaabbccbabaaaabbccccaabbccbabbaaabbccccbabbccbabbaaabbccccaabbccbabbaaabbccccaabbccbabbaaabbccccaabbccbabbaaabbccccaabbacbabbaabbbccccaabbacbabbaaabbccccaabbccbabbaaabbccccaabbccbabbaaabbccccaabbccbabbbaabbccccaabbccbabbaaabbccccaabbccbabbaaabbccccaabbccbabbaaabbccccaabbccbabbaaabbccbcaabbbccacbaaabbccccabbbccbabbaaabbccccaabbccbabbaaabbccccaabbccbabbaaabbccccaabbccbabbaaabbccccaabbccbabbaaabbccccaabbccbabbaaabbccccaabbccbabbaaabbccccaabbccbcbbaaabbccccaabbccbabbaaabbccccaabbccbabbaaabbccccaabaccbabbaaabbccccaabbccbabbaaabbccccaabbcababbaaabbccccaaabccbabbaaabbccccacbbccbabbaaabbccccbaabcbbabbaaabbccccaabbcbbabbaaabbccccaabbccbabbaaabbacccbabbccbabbaaabbccccaabbccbabbaaabbcbccaabbccbabbaaabbccccaabbccbabcaaabbccccaabbccbabbaaabbccccaabbccbabbaabbbccccaabaccbabbaaabaccccaaabccbabbaaabbbcccaabbccbabbaaabbccccaabbccbabbaaabbccccaabbccbabbaaabbccccaabbccbbbbaaabbccccaabbccbabbaaabbccccaabbccbabbaaabbccccaabbccbabbaacbbccccaabbccbabbaaabbccccaabbccbbbbaaabbccccaabbccbabbaaabbcccccabbccbabbaaabbccccaabbccbabbaaabaccccaabbccbabbaaabbccccaabbccbabbaaabbccccaabbccbbbbaaabbccccaabbccbabbaaabbacccaabbccbabbaaabbccccacbbcababbaaabbccccaabbccbacbaaabbccccaabbbcbabbababbccccaabbccbabbacabaccccaabbccbabbaaabbccccaabbccbabbaaabbccccaabbccaabbaaabaccccaabbccbbbbaaabbccccaabbccbabbababbccccaabbccbabbaaabbccccaabaccbabbaaabbccccabcbccbcbbaaabbccccaabbccbabbaabbbccccaabbccbabbaaabbccacaabbccbabbaaabbccccaabbccbabbaaabbccccaabbccaabbaaabbccccaaabccbabbaaabbccccaabbccbabbaaabbccccaabbccbabbaaabbccccabbbccbabbaaabbcccbaabbccbabbaaabbccccaabbccbabbaaabbccccaabbbcbabbaaabbccccaabbccbabbaaabbccccaabbccbabbaaabbccccbabbccbabbaaabbccccaabbccbabbaaabbccccaabbccbabbaaabbccccaabbccbabbaaabbcccbaabbccbabbaabbbccccaabbccbabbaaabbccccaabbccbcbbaaabbccccaabbccbabbaaabbccccaabbccbabbaaabbccccaabbccbabbaaabbccccaabbccbabbaaabbccccaabbccbabbaaabbcccbaabbccbabbaaabbccccaabbccbabbaaabbbcccaabbccbabbaaabbccccaabbccbabbacabbccccaabbccbabbaaabbccccaabbccbabbaaabbccccaabbcccabbaaaabccccaabbcccabbacabaccccaabbccbabbaaabbccccaabbccbabbaabbbccccaabbccbabbaaabbccccaabbccbabcaaabcccccaabacccabbaaabbccccaabbccbabbaaaabccccaabbccbabbaaabbccccaabbccbabbaaacbccccaabbccbabbaaabbccccaabbacbabbaaabbcbccacbbccbabbaaabbccccaabbccbabbaacbbccccaabbccbabbaaabbccccaabbccbabbaaabbccccaabbccbabbaaabbccccaabbccbabbbaabbccccaabbccbacbaaabbccccaabbccbabbaaabbccccaabbccbacbaaabbccccaabbccbabbaaabbccccaabbccbabbaaabbccccaabbccbabbaaabbccccaabbccbabbaaabbccccaabbbcbabbaaabbccccaabbccbabbaaabbccccaabbccbabbaaabbccccaabbccbacbaaabbccccaabbccbabbaaabbbcccaabbccbabbaaaabccccaabbccbabbaacbbccccaabbccbabbaaabcccccaabbccbabbaaabbccccaabbccbabbaaabbccccbabbccbabbaaabbccccaabbccbabbaaabbccccaabbccbabbaaabbccccaabbcababbaaabbccccaabbcbbabbaaabbccccaabbccbabbaaabbccccaabbcbbabbaaabbccccaabaccbabbacabbccccaabbccbabbaaabbcaccaabbccbabbababbccccaabbccbabbaaabbccccaabbccbabbaaabbccccaabbccbabcaaabbcccbaabbccbabbaaabbccccaabbccbabbaaabbccccaabbccbabbaaabbccccaabbccbabbaaabbbcccaabcccbabbaaabbccacaabbccbabbaaabbccccaabbccbabbaaabbccccaabbccbabbaaabbcbccaabbccbabbaaabbccccaabbccbabbaaabbccccaabbccbabbaaabbbcccaabbccbabbaaabbcaccaabbccbabbaaabbccccaabbccbabbaaabbccccaabbccbabbaabbbccccaabbccbabbcaabbccccaabbccbabbaaabbccccaabbccbabbbaabbccccaabbccbabbaaabbccccaabaccbabbaaacbccccaabbccbabbaaabbccccaabbccbabbaaabbccccaabbccbabbaaabbccccaabbccbabbaaacbccccaabcbcbabbaaabbccccaabbccbabbaaabbccccaabbccbabbaaabbacccaabbccbabaaaabbccccaabbccaabbababbccccaabbacbabbaaabbccccaabbccbabbaaabbcbccaabbccbabbaaabbccccabbbccbabbaaabbccccaabbccbabbaaaabccccaabbccbabbaaabbccccaabbccbabbaaabbccccaabbccbccbaaabbccccaabbccbabbacabbcccbaabbccaabbaaabbccccabbbccbabbaaabbccccaabbbcbabbaaabbccccaabbccbabbaaabaccccaabbccbabbaaabbccccaabbccbabbaaabbccccaabaccbabbaaabbccccacbbccbabbcaabbccccbabbccbabbaaabbccccaabbccbabbaaabbcaccaabbccbabbaaabbccccaabbccbabbababbcccccabbccbabbaabbbccccaabbccbabbaaabbccccaabbccbabbababbcccccabbccbabbaaabbccccaabbccbabbaacbbccccaabbccbabaacabbccccaabbbcbabbaaabbccccaabbccbabbaaabbccccaabbccbabbaaabbccccaabbccbabbaaabbccccaabbccbabbaaabbccccaabbccbabbaaabbccccaabbccbabbaaabbccccaabbccbabbaaaabccccaabbccbabbaaabbccccaabbccbabbaaabbcccbaabbacbabbaacbbccccaaabccbabbaaacbccccaabbccbabbaaabbccccaabbccbabcaaabbccccaabbccbabbaaabbccacaabbccbabbaaabbccccaabbccbabbaaabbccccaabbccbabbaaabbccccaabbccbabbaaabbccccaabbacbabbbaabbccccaabbccbabbaaabbccccaabbccbabbaaabbcccaaabbccbabbaaabbccccaabbccbabcaaabbccccaabbccbabbaaabbccccaabbccbabbaaabbccccaabbccbabbaaabbccccaabbccbabbaaabbccccaabbccbabbaaabbccccaabbccbabbaaabbccccaabbccbabbaaabbccccaabbccbabbaaabbccccaabbccbabbaaabbccccaabbccbabbaaacbccccaabbccbabaaaabbccccaabbccbbbbaacbbccccaabbccbabbaaabbcbccaabaccbabbaaabbccccaabbccbabbaaabbccccaabbccbabbaaabbccccaabbccbabbaaabbccccaabbcbbabbaaabbccccaabbccbcbbaaabbccccaabbccaabbaaabbccccaabbccbabbaaabbccccaabbccbabbaaabbccccaabbccbabbaaabbccccaabbcbbabbaaabbacccaabbccbabbaaabbccccaabbccbabbaaabbccccaabbccbabbababbccccaabbccbabbaaabbccccaabbbcbabbaaabbccccaabbccbabbaaabbccccaabbccbabbcabbbccccaabbccbabbaaabbccccaabbccbabbaaabbccccaabbccbabbaaabbccccbabbccbabbaaabbccccaabbccbabbaaabbccccaacbccbabbaaabbccccbabbcccabbaabbbccccaabbacbabbaaabbccccaabbccbabbaaabbcccbaabbccbabbaaabbccccaabbccbabbaaabbccccaabbccbabbaaabbccccaabbccbabbaaabbccccaabbccbabbaaabbccccaabbccbabbaaabbccccaabbccbabbaaabbccccaabbccbabbaaabbccccaabbccbabbaaabbccccaabbccbabbaaabbccccaabbccbabbaaabbccccaabbccbbbbaaabbccccaabbccbabbaaabbccccaabbccbabbacabbccccaabbccbabbaaabbccccaabbccbabbaaabbccccaabbccbabbaaabcccccaabbccbabbaaacbccccaabbccbabbaaabbccccaabbcababbaaabbccccaabbccbabbaaabbccccacbbccbabbaaabbcaccaabbccbabbaaabbccccaabbccbabbaaabbccccaabbccbabbcaabbccccaabbccbabbaaabbccccaabbccbabbaaabbccccaabbccbabbaaabbccccacbbccbabcaaabbccccaabbccbabbaaabbccccaabbccbabbaaabbccccaabbccbabbaaabbccccaabbccbabbaaabbccccaabbccbabbaaabbccccaabbccbabbaaabbccbcaabbccbcbbaaabbccccaabbccbabbaaabbccccaabbccbabbaaabbccccaabbccbabbaaabbccccaabbccbabbaaabbacccaabbccbabbaaabbccccaabbccbabbaaabbccccaabbccbabbaaabbccccaabbccbabbaaabbccccaabbccbabbaaabbcccaaabbccbabbaaabbccccaabbccbabbaaabbccccaabbccbabbaaabbccccaabbccbabbaaacbccccaabbccbabbaaabbccccaabbcbbabbaaabbccccaabbccbabbaaabbbcccaabbccbabbaaabbccccaabbccbabbaaabbccccaabbccbabbaaabbccccaabbacbabbaaabbccccaabbccbabbaaabbccccaabbccbabbaaabaccccaabbccbabbaaabbccccaabbccbabbacbbbccccaabbccbabbaaabbccccbabbccbabbaaabbccccaabbcccabbaaabbccccaabbccbabbacabbccccaabbccbabbaaabbccccaabbccaabbaaabbccccaabbccbabbaaabbcccaaabbccbaabaaabbcccaaabbccbabbaaabbccccaabbccbabbaaabbccccaabbccbbbbaaabbccccaabbccbabbaaabbccccaabbccbabbaaabbccccaabbccbabbaaabbccccaabbccbabbaaabbccccaabbccbabbababbccccaabbccbabbaaabbcacccabbccbabbaaabbccccaabbcababbaaabbccccaabbbcbabbaaabbccccaabbccbabbaaabbccccaabbccbabbaaabbccccaabbccbabbaaabbccccaabbccbabbaaabbacccaabbccbabbaaabbccccaabbccaacbaaabbccccaabbcbbabbaaabbccccaabbccbabbaaabbbcccaabbccbabbaaabbccccaabbccbabbaaabbccccaabbccbabcaaabbccccaabbccbabbaaabbccccaabbccbabbaaabbccccaabbccbabbaaabbccccaabbcababbaaabbccccaabbccbabbaaabbcccbabbbcccabbaaabbccccaabbccbabbaaabbccccaabbccbabbaaabbcbccaabbccbaabaaabbccccaabbccbabbaaabbccccaabbccbabbaaabbccccaabbccbabbaaabbcccccbbbccbabbaaabbacccaabbccbabbaaabbccccaabbccbabbaaabbccccaabbccbabbaaabbccccaabbccbabbaaabbccccaabbccbabbaaabbccccaabbccbabbaaabbccccaabbccbabbaaabbccccaabbccbabbaaabbccccaabbccbabbaaabbccccaabbccbabbaaabbccccaabbccbabbaaacbccccabbbacbabcaaabbccccaabbccbabbaaabbccccaabbccbabbaaabbccccaabbccbabbaaabbccccaabbccbabbaaabbccccaabbccbabbaaabbccccaabbccbabbaaabbccccaabbccbabbaaabbccccaabbccbbcbaabbbccccaabbccbabbacabbccccaabaccbabbbaabbccccaabbccbabbaaabaccccaabbcbbabbaaabbccccaabbccbabbaaabbccccaabbccbcbbacabbccccaabbccbabbaaabbbcccaabbccbabbaaabbccccaabbccbabbaaabbccccaabbccbabbaaabbccccaabbccbabbaaabaccccaabbccbabbaaabbccbcaabbccbabbaaabbccccaabbccbabbbaabbccccaabbccbabbaaabbbcccaabbccbabbaaabbccccaabbccbabbaaabbccccaabbccbabbaacabccccaabbccbabbaaabbccccaaabccbabbaaabaccccaabbccbabbaaabbccccaabbccbabbaaabbccccaabbccbabbaaabbccccbabbcccabbaaabbccacaabbccbabbaaabbccccacbbccbabbaaabbacbcaabbccbabbaaabbccccaabbccbabbaaabbccacaabbccbabbaacbbccccaacbccbabbaaabbccccaaabccbabbaaabbccccaabbccbabbaaabbccccaabbccbabbaaabbccccaabbccbabbaaabbccccaabbccbabbaaabaacccaabbccbabbaaabbccccacbbccbabbaaabbccacaabbccbabbaaabbccccaabbccbbbbaaabbcbccaabbccbabbaaabbccbcaabbccbabbaaabbccccaabbccbabbaacbbccccaabbccbabbaaabbcaccaabbccbabbaaabbccccaacbccbabbaaabcccccaabbccbabbaaabbccccaabbccbabbaabbbccccaabbccbabbaaabbccccaabbccbabbaabbbccccaabbccbabbaaabcbcccaabbccbabbbaabbccccaabbccbabbaaabbcccccabbccbabbaaabbccccaabbccbabbaaabbccacaabbccbabbaaabbccccaabbccbabbaaabbccccaabbbcbabbaabbbccccaabbccbabbaaabbccccaabbccbabbaaabbccccaabbccbabbaaabbccccaabbccbabbaaabbccccaabbccbabbaaabbccccaabbccbabbaaaabccccaabbccbabbaaabbccccaabbccbabbbaabbccccaabbacbabbaaabbccccaabbccbacbaaabbccccaabbccbabbaaabbccccaabbccbabbaaabbccccaabaccbabbaaabbccccaabbcababbaaabbccccaabbccbabbaaabbccccaabbccbabbaaabbccccaabbccbabbaaabbccccaabbccbabbaaabbccccaabbccbabbaaabbccccaabbccbabbacabbccccaabbccbabbaaacbccccaabbccbabbaaabbccccaabbccbabbaaabbccccaabbccbabbbaabbccccaabbccbabbaaabbcbccaabbccbabbbaabbccccaabbccbabbaaabbacccaabcccbabbaaabbccccaabbccbabbaaabbccccaabbccbabbababbccccaabbccbabbaaabbccccaabbccbabbaaabbccccaabbccbabbaaabbccccaabbccbabcaaabbccacaabbccbabbaaabbccccaabbccbabbaaabbccccaabbccbabbaaabbccccaabbccbabbaaabbccccaabbccbabbaaabbccccaabbccbabbaaabbccccaabbccbabbaaabbccccaabbccbabbaaabbcaccaabbccbabbaaabbccccaabbcababbaaabbccccaabbccbabbaaabbccccaabbccbabbaaabbccccaabbccaaabaaabaccccaabbccbabbaaabbccccaabbcababbaaabbccccacbbccbabbababbccccaabbccbabbaaabbccccaabbccbabbaaabbcccbaabbccbabbaaabbccccaacbccbabbaaabbccccaabbccbabbaaabbcccaaabbccbabbaaabbcaccaabbccbabbacabbccccaabbccbabbaaabbccccaabbccbabbaaabbacccaabbccbabbaaabbccccaabbccbabbaaabbccccaabbacbabbaaabbccccaabbccbabbaaabbccccaabbcababbaaabbcccbaabbccbabbaaabbccccaabbccbabaaaabbccccaabbccbabbaaabbccccaabbccbabbaaabbccccaabbccbabbaaabbccccaabbccbaabaaabbccccaabbccbabbaaabbccccaabcccacbbaaabbccccaabbccbabbaaabbccccaabbccbabbaaabbccccaabbccbabbaaabbccbcaabbccbabbaaabbccccaabbccbabcaaabbccccaabbccbabbaaabbccccaabbccbabbaaabbcaccaabbccbabbaacbbccccaabbccbabbaaabbccccaabbccbabbaaabbccccaabbccbabbaaabbccccaabbccbabbaaabbbcccaabbccbabbaaabbccccaabbccbabbaaabbccccaabbccbabbaaabbccccaabbccbabbaaabbccccaabcccbabbaaabbccccaabbcbbabbaaabbccccbabbccbabbaaabbccccaabbccbabbaaabbccccaabbccbabbaaabbccccaabbacbabbaaabbccccaabbccbcbbaaabbccccaaabccbacbaaabbccccaabbccbabbaaabbccccaabbccbabbaaabbccccaabbcbbabbaaabbccccaabbccbabbaaabbccccaabbccbabbaaabbcccbaabbccbabbaaabbcaccaabbccbabbaaabbccccaabbccbabbaaabbcccaaabbccbabbbaabbccccaabbccbabbaaabbccccaabbccbabbaaabbccacaabbccbabbaaabbccccaabcccbabbaaabbccccaabbccbabbaaabbccccaabbccbaabacabbccccaabbccbabbaaabbccccaabbccbabbaaabbccccacbbccbabbaaabbccccaabbccbabbaaabbccccaabbccbabbaaabbccccaabbccbabbaaabbccccaabbccbabbaaabbccccaabbccbabbaaabbccccaabbccbabbaaabbccccaabbccbabbababbccccaabbccbabbaaabbccbcaabbcababbaaabbcccccbbbccbabcaaabbccccaabbacbabbaaabbacccabbbccbabbaaabbccccbabbccbabbaaabbccccaabbccbabbababbccacaabbccbabbaaabbccccaabbccbabbaaabbccccaabbccbabbaaabbccccaabbccbabbaaabbccccaabbccbabbaaabbccccaabbccbabbaaabbccccaabbccbabbaaabbccccbabbccbabbaaabbccccaabbccbabbaaabbccccabbbccbabbaaabbcbccaabbccbabbaaabbccccaabbccbabbaaabbccccaabbccbabbaaabbccccaabbccbabbaaabbccccaabbccbabbaaabbccccaabbccbbbbaaabcccccaabbccbabbaaabbccccaabbccbabbaaabbccccaabbccbabbaaabbccccaabbccbabbaacbbccccaabbccbaabaaabbccccaabbccbabbaaabbccccaabbccbabbaaabbccccaabbccbabbaaabbccccabbbccaabbaaabbccccaacbccbabbaaabbccccaabbccbabbaaabbccccaabbccbabbaaabbccccaabbccbabcaaabbcbccaabbccbabbaaabbccccaabbccaabbaaabcccccaabaccbabbcaabbccccaabbccbabbaaabbccccaabaccbabbaaabbccccaabbcccabbaaabbccccaabbccbabbaaabbccccaabbccbabbaaabbccccaabbbcbabbbaabbccccaabcccbabbaaabbccccaabbccbabbaaabbccccaabbccbacbaaabbccccaabbccbabbaaabbccccaabbccbabbaaabbccbbaabbcaaabbaaabbccccaabbccbabbaaabbccccaabbccbabbaaabbccccaabbccbabbaaabbccccaabbccbabbaaabbcaccaabbccbabbaaabbccccaabbccbabbaaabbccccaabbccbabaaaabbccccaabbccbabbaaabbccccaabbccbabbaaabbccccaabbccbabbaaabbccccaabbccaacbaaabbccccaabbccbbbbaaabbccccbabbccbabbaaabbccccaabbccbabbaaabbccccaabbccbabbaaabbccccaabbccbabbaaabbccccaabbccbabbaaabbccccaabbccbabbaaaabccccaabbccbabbbaabbccccaabbbbbabbaaabbccccaabbccbabbaaabbccccaabbcbbabbaaabbccccaabbccbabbaaabbccccaabbccaabbaaabbccccaabbccbabbaacbbccccaabbccbabbaaabbcccaaabbcccabbaaabbcccaaabbccbabbaaabbccccaabbccbabbaaabbcccccabbccbabbaaabbccccaabbccbabbaaabbccccaabbccbabbaaabbccccaabbccbabbaabbbccccaaabccbabbaaabbccccaabbccbabbaaabbccccaabbccbaabaaabaccccaabbccbabbaabcbccccaabbccbabbaacbbccccaabaccbabbaaabbccccaabbccbabbaaabbccccaabbccbabbaaabbccccaabbccbabbaaabbccccaabbccbabbaaabbcccccabbccbabbacabbcacaaabbccbaabaaabbccccaabbccbabaaaabbccccaabbccbabcaaabbccccaabbccbabbaaabbccccaabbccbabbaaabbccccacbbbcbabbaaabbccccaaabccbabbaaabbccccaabbccbabbaaabbccccaabbccbabbaaabbcccaaabbccbabbaaabbccccaabbccbabbaaabbccccaabbccbabbaaabbccccaabbccbabbaaabbccccaabbbcbabbaaabbccccaabbccbabbaaabbccccaabbccbabbaaabbccccaabbccbabbbaabbccccbabbccbabbaaabaccccaabbccbabcaaabbccccaabbccbabbababbccccaabbccbabbaaabbccccaabbccaabbaaabbccccabbbccbabbaaabbccccaabbccbabbaaabbccccaabbccbabbaaabbccccaabbccbabbaaabcccccaabcccbabbbaabbccccaabbccbabbababbccccaabbccbabbaaabbccccaabbccbabbaaabbccccaabbccbabbaaabbccccaabbccbabbaaaabccbccabbccbabbaaabbccccaabbccbabbaaabbccccabbbccbabbaaabbccccaabbcababbaaabbcbccaabbccbabbaaabbcbccaaabccbabbaaabbccccaabbcababbaaabbccccaabbccbabbaaabbccccaabbccbabbaaabbccccaabbccbabbaaabbccccaabbccbabbaaabbccccaabbccbabbaaabbccccacbbccbabbaaabbccccaabbccbabbbaabbccccaabbccbabbcaabbccccaabbccbcbbaaabbccccaabbccbbbbaaabbccccaabbccbaabaaabbccccaabbccbabbaaabbccccaabbccbabbcaabbccccaabaccbabbaaabbccccaabbccbabbaaabbccccaabbccbabbaaaabccccaabbacbabbaaabbccccabbbccbabbaaabbccccaabbccbabbaaabbccccbabbccbabbaaacbccccaabbccbabbaaabbccccaabbccbabbaaabaccccaabbccbabbaacbbccccaabbccbabbaacbbccccaabbccbabbaaabbccccaabbccbabbababbcaccaabbccbabbaaabbccbcaaabccbabbbaabbccccaabbccbabbaabbbccccaabbccbabbaaabbcacccabbccbabbaaabbccccaabbcbbabbaaabbccccaabbccbabaaaabbccccaabbccbabbaaabbccccaabbccbabbaaabbccccaabbacbabbaaabbccccaabbccbabbababbccccaabcccbabbaaabbccccacbbccbaabaaabbccccaacbccbabbaaabbccccaabbccbabbaaabbccccaabbccbabbaaabbccccaabbccaabbaaabbccccaabbccbabbcaabbccccaabbccbabbaaabbccccaabbccbabbaaabbccccaabbccbabbaaabbccccaabbacbabbaaabbccccaabbccbabbaaabbcaccaabbccbabcaacbbcbccaabbccbabbaaabbcccaaabbccbabbaaabbccbcaabbccbabbaaabbccccaabbccbabbababbccccaabbccbabbaaabbccccaabbccbabaaaabbcccbaabbccbabbaaabbccccaabbbcbcbbaaabbccccaabbcbbabbaaabbccccaabbccbabbaaabbcccccabbccbabbaaabbccccaabbccaabbaaabbccccaabbccbabbaaabbccccaabbccbabbaaabbccccaabbccbabbaaabbccbcaabbccbabbaaabbccccaabbccbabbaaabbccccaabbcccabbaaabbccccaabbccbabbaaabbccccbabbccbabbaaabbccccaabbccbabbaaabbccccaabbccbabbacabbbcccaabbccbabbaaabbccccaabbccbabbaaabbacccaabbccbabbaaabbccccaabbccbabbaaabbccccaabbccbabbaaabbccccaabbccbaabaaabbccccaabbccbabbaaabbccccaabbccbabbaaabbccccaabbccbabbaaabbccccaabbccbabbaaabbccccaabcccbabbaaacbccccaabbccbabbaaabbccccaabbccbabbaaabbccccaabbccbabbaaabbccccaabbccbabbaaabbccccaacbccbabbaaabbccccacbbccbabbaabbbccccaabbccbabbaaabbccccaabbccbabbaaabbccccbabbccbabbaaabbccccaabbccbabbaaabbccccaabbccbabbaaabbccccaabbccbabbaaabbccccaabbccbabbcaabbccccaabbccbabbaaaabccccaabbccbabbaaabbccccaabbccbabbaaabbccccaabbccbabbaaabbccccabbbccbabbaaabbccccaabbccbabbaaabbccccaabbccbabbbaabbccccaabbccbabbaaabbccccaabbccbabbaacbbccccaabbccbabbaaabbccccaabbccbabbaaabbccccaabbccbabbaaabbccbcaabbbcbabbaaabbccccaabbccbabbaaabbccccaabbccbabbaaabbccccaabbccbabbaabbbccccaabbcccabbaaabbccccaabbccaabbaaabbccccabbbccbabbaaabbccccaabbccbabbaaabbccccaabbccbabbaaabbccccaabbcbbabbababbccccaabbccbabbaaabbccccaabbccbabbaaabbccccaabbccbabbaaabbccccaabbccbacbaaabbccccaabbccbabbaaabbccccaabbccbcbbaaabbccccaabbccbabbaaabbccccaabbccbabbaaabbccccaabbccbabbaaabbccacaabbccbabbaaabbccccaabbccbabbaaabbbcccaabbccbabaaaabbccccaabbccbabbaaabbccccaabbccbabbaaabbccccaabbacbabbacabbccacaabbccbabbaaabbccccaabbccbabbaaabbccccaabbccbabbaaabbccccaabbccbabbaaabbccccaabbccbabbaaabbccccaabbccbabbaaabbccccaabbccbabbaaabbccccaabbccbabbaaabbccccaabbccbabbaaabbcaccaabbccbcbbaaabbccccaabbccbabbaaabbccccaabbccbabbaaabbccccaabbccbabbacaabccacaabbcccabbababbccccaabbccbabbaaabbccccacbbccbabbaaabbccccaabbccbabbaaabbccccaabbccbabbaaacbccccaabbccbabbaaabbccccaabbccbabbaaabbccccaabbccbabbaaabbccccaabbccbabbaaabbccccaabbccbabbaaabbccccaabbccbcbbaaabbccccaabbccbabbaaabbccccaabbccbabbaaabbcccbaabbccbabbaaabbccccaabbccbabbaaabbcccccabbccbabbaaabbccccaabbbcbabbaaabbccbcaabbccbabbaaabbccccaabbccbabbaaabbccccaabbccbabbaaabbacccaabbccbabbaabbbccccaabbccbabbaaabbccccaabbccbabbaaabbccccaabbccbabbaacbbcccaaabbccaabbaaabbccccaaabccbabbaaabbccccaabbccbabbacabbccccaabbccbabbaaabbccccaabbccbabbaaabbccccaabbccbabbaaabbcbccaabbccbabbaaabbccccaabbccbabbaaabbccacaabbccbabbaaabbcaccaabbccbabbaaabbccccaabbccbabbaaabbccbcaabbccbacbaaabbccccaabbccbabbaaabbccccaabbccbabbababbccccacbbccbabbaaabbccccaabbacbabbaaabbccccaabbccbabbaaabbccccaabbccbabbacabbccccaabbccbabbaaabbbcccaabbccbabbaaabbcbacaabbccbabbaaabbccccaabbccbabbaaabbccccaabbbcbabbaaabbccccaabbccaabbaaabbccccaabbccbabbaabbbccccaabbccbabbaaabbccccaabbccbaabaaabbccccaabbccbabbaaabbccccaabbccbabbaaabbcccccabbccbabbaaabbccccaabbccbabbaacbbccccaabbccbabbaabbbccccaabbccbabbaaabbccccaacbccbabbaaabbccccaabbccbabbaaabbccccaabbcababbaaabbccccaabbccbabbaaabbccccaabbccbabbaaaccccccaabbccbabbaaabbccccaabbccbabbbcabbccccaabbccbabbaaabbccccaabbccaabbaaabbccccaabbccbabbaaabbcccccabbccbabbaaabbccccaabbccbabbaaabbccccaabbccbabbaaabbccccaabbccbaabaaabbccccaabbccbabbaaabbcccbaabbccbaabaaabaccccbabbccbabbaaabbccccaabbccbabbaaabbccbcaabbccbabbaaabbcccaaabbccbabbaaabbccccaabbcbbabbaaabbccccaabbbcbabbaaabbccccbabbccbabbaaabbccccaabbccbabbaaabbccccaabbccbabbaaabbccccaabcccbabbaaabbccccaabbccbabbaaabbccacaabbccbabbbaabbccccaabcccbabbaaabaccccaabbccbabbaaabbccccaabbccbabbaaabbcccbaabbccbabbaaabbccccaabbccbabbaaabbccccaabbccbabbaaabbccccaabbccbabbaaabbccccaabbccaabbaaacbccccaabbccbabbaaabbccccaabbccbabbaaabbccccaabbccbabbaaabbccccaabbccbabbaaabbccccaabbccbabbaaabbccccaabbccbabbaaabaccccaabbccbabbaaabbccccaabaccbabbaaabbccccaabbccbabbbaabbccccaabbccbabbaaabbccccaabbccbabbaaabbcbccaabbccbbbbaaabbccccaabbccbabbaaabbccccaabbabbabbacabbccccaabbccbabbaaabbccccaacbcababbaaabbccccaabbccbcbbaaabbccccaabbccbacbaaabcccccaabbccbabbaaabbccccaabbccbabbaaabbccccaabbccbabbaaabbccccaabbccbabbaaabbcccbaabbccaabbaaabbccccaabbccbabbaaabbccccaabbcbbabbaaabbccccaabbccbabbaaabbccccaabbccbabbaaabbccccaabbccaabbaaabbccccaabbccaabbaaabbcbccaabbccbabbaaabbccccaabbccbabbaaabbccccaabbccbabbaaabbccccacbbccbabbaaabbccccaabbccbabbaaabbcbccaabbccbabbaaabbccccaabbccbabbaaabbccccaabbccbabbaaabbccccaaabccbabbaaabcccccaabbccbabbaaabbccccaabcccbabbaaabbccccaabbccbabbaaabbccccaabbccbabbaaabbccccaabbccbacbaaabbccccaabbccbabbaaabbccccaabbccbabbaaabbccccaabbccbabbaaabbccccbabbcccabbaabbbacccaabbccbabbaaabbccccaabbccbabbaaabbccccabbbccbabbaaabbccbcaabbccbabbaaabbccccaabbccbabcaaabbccccaabbccbabbaaabbccccaabbccbabbaaabbccccaabcccbabbaaabbcaccaabbccaabbaaabbcbccaabbccbabbaaabbccccaabbccbabbaaabbccccaabbccbabbaaabbccccaabbccbabbaaabbccccaabbccbabbacabcccccaabbccbabbaaabbccccaabbccbbbbaaabbacccaabbccbbbbaaabbccccaabbccbbbbaaabbccccaabbccbabbaaabbcccbaabbccbabbaaabbccccaabbccbabbaaabbccccaabbccbabbaaabbccccaabbccbabbaaabbccacaabbccbabbaaabbccccaabbccbabbaaabbccccaabbccbabbaaabbccccacbbcbbabbaaabbccccaaabccbabbaaabbccccaabbccbabbaaabbccccaabbccbabaaaabbccccaabbccbabbaaabaccccaabbccbabbaaabbccccaacbbcbbbbaaabbccbcaabbccbabbaaabbccccbabbccbaabaaabbccccaabbcccabbaaabbccccaabbccbabbaaabbccccaabbccbabbaaabbacccaabbccbabbaaabbccccaabbccbabbaaabbccccaabbccbabbaaabbccccaabbccbabbaaabbcccccabbccbabbaaabbccccaabbccbabbaaabbccccaabbccbabbaaabbccccaabbccbabbaaabbccccaacbccbabbaaabbccccaabbccbabbaaabbccccaabbccbabbaaabbccbcaabbccbabbaaabbccccaabbccbabbaaacbccccaabbccbabbaaabbccccaabbccbabbaaabbccccaabbccbabbaaabbccccaabcccbabcaaabbccccaabbccbabbaaabbccccaabbccbabbaaabbccccaabbccbabbaaabbccccaabbccbabbaaabbccccaabbccbabbababbcaccaabbccbabbaacbbccccaabbbcbabbaaabbbcccbabbccbabbaaabbacccaabbccbabbaaabbccccaabbccbabbaaabbccccaabbccbabbaaabbccccaabbccbabbaaabbccccaabbccbabbaaabbccccaabbccbabbaaabbccccaacbccbabbaaabbccccaabbccbabbacabbccccaaabccbabbaaabbccccaabbccbabbcaabbccccabbbccbabbaaabbccccaabbccbabbaaabbccccaacbccbabbaaabaccccaabbccbabbaaabbccccaabbccbabbaaabbccccaabbccbabbaaabbccccaabbccbabbaaabbccccaabbccbabbaaacbccccaabbccbabbaaabbccccaabbccbabbaaabbccccaabbccbabbaaabbccccaabbccbabbaaabbccccaabbccbabbaaabbccccaabbccbabbbabbbccccaaabccbabbaaabbccccaabbccbabbaaabbccccaabbccbabbaaabbccccaabbccbabbaabbbccccaabbbcbabbaaabbccccaabbccbabbaaabbccccabbbccbabbaaabbccccaabbcbbabcaaabbccccaabcbcbabbaaabbacccaabbccbabbaaabbccccaabbccbabbaaabbccccaabbccbabbaaabbccccaabbccbabbcaabaccccaabbacbabbaaabbccccaabbccbabbaaabbccccaabbccbabbaaabbccccaabbccbabbccabbccccaabbccbabbaaabbacccaabbccbabbaaabbccccaabbccbaabaaabbccccaabbccbabbaaabbccccaabbccbabbaaabbccccaabbccbabbaaabbccccacbbccbabbaaabbccccaabbccbabbaaabbccccaabbccbabbaaabbccccaabbccbabcaaabcccccaabbccbabbaaabbccccaabbccbabbaaabbccccaabbccbabbaaabbccccaabbccbabbaaabbccccaaabccbabbaaabbccccaabbccbabbaaabbccccaabbccbabbaaabbccccaabbccbabbaaabbccccaabbccbabbaaabbccbcaabbccbabbaaabbccccaabbccbabbaaabbbcccaabbccbabbaaabbccccaabbccbabbaaabbccccaabbccbabbaaabbcccbaabbccbabbaaabbccccaabbccbabbaaabbccccaabbccbabbaaabbccccaabbccbabbaaabaccccaabbccbabbaaabbccccaabbccbabbaaabbccccaabbccbabaaaabbccccabbbccbabbaaabbccccaabbccbabbaaabbcbccaabbccbabbaaaabccccacbbccbabbaaabbccccaabbccbabbbaabbccccaabbccbabbaaabbcbccaabbacbabbaaabbccccaabbccbabbaaabbccccaabbccbabbaaabbccccaabbcababbaacbbccccaabbccbabbaaabbccccaabbccbabbaaabbccccaabbccbabbaaabbccccaabaccbabbaaabbccbcaabbccbabbaaabbccccaabbccbcbbaaabbccccaabaccbabbaaabbcccaaabbccbabaaaabbccccaabbccbabbaaabbccccaabbccbabbaaabbccccaabbcababbaaabaccccaabbccbabbaaabbccccaabbccbabbaaabbccccaabbccbabbaaabbccccaabbccbabbaaabbccccaabbccbabbaaabbacccaabbccbabbaaabbcaccaabbcccabbaaabbcccccabbccbabbaaabcccccaabbccbabbaaabbccccaabbccbabbaaaabccccaabbccbabbcaabbccccaabbccbabbaaabacccbaabbccbabbaaabbccccaabbccbabaaaabbccccaabbccbabbaaabaccccaabcccbabbaaabbccccaabbccbabaaaabbccccaabcccbabbaaabbccccaabbccbabbaaabaccccaabcccbabbaaabbccccaabbccbabbaaabbccccaabbccbabbacabbccccaabbccbabbaaabbccccaabbccbacbaaabbccccaabbccbabbcaabbccccaabbccbabbaaabbccccaabbccbabbaaabbccbcaabbccbabbaaabbccccaabbccbbbbaaabbccccaabbccbabbaaabbccccaabbccbabbaaabbccccaabbccbabbaaacbccccaabbccbbbbaaacbccccabbbccbabbaaabbccccaabbccbabbbaabbccccaabbccbabbaaabbccccaabbccbabbaaabbccccaabbccbbbaaaabbccccaabbccbabbaaabbccccaabbccbabbaaabbccccaabbacbabbaaabbccccaabbccbabbaaabbccccaabbccbabbaaabbacccaabbccbabbaaabbccccaabbccbabbaaabbccccaabbccaabbaaabbccccaabbccbabbaaabbccccaabbccbabbaacbbccccaabbccbabbaaabbccccaabbccbabbaaabbccccaabbccbabbaaabbccccaabbccbabbaacabccccaabbccbabbaaabbccccaabbacbabbaabbbccccaabbccbabbaaabbccccaabbccbabbaaabbccccaabbccbabbaaabbccccaabbccbabbaaabbccccaacbccbabbaaabbccccaabbccbabbaaabbccccaaabcbbabbaaabbccccaabbccaabbaaabbcaccaabbccbabbaaabbccccaabbacbabbaaabbccccaabbcccabbaaabbccccaabbccbabbaaabbccccaabbccbabbaaabbccccaabbccbabbaaabbccccaabbccbabbaaabbccccaabbacbcbbaaabaccccaabbccbabbaaabbccccaabbccbabbaaabbcbcbaabbccbabbaaacbccccabbbccbabbbaabbccccaabbccbabbababbccccaabbccbabbbaabbccccaabbccbabbaaabbccccaabbccbabbaaabbccccaaacccbabbaaabbccccaabbccbabbaaabbccccaabcccbabbaaabbccccaabbccbabcaaabbccccbabbccbcbbaaaabccccaabbccbabbaaabbcccbaabbccbabbaaabbccccaabbccbabbaaabbccccaabbccbabbaaabbccccaabbccbabbaabbbcaccaabbccbabbaaabbccccaabbccbabbaaabbccccaabaccbabbaaabbccccaabbccbabbaaabbccccaabbccbabbaaabbccccaabbccbabbaaabbccccaabbccbbbbaaabbccccaabbccbabbaaabbccccaabbccbbbbbaabbccccaabbcccabbaacbbccbcaabbccbabbaaabbccccaabbccbabbaaabbccccaabbccbabbaaabbccccaabbccbabbaaabbccccaabbccbabbaaabbccccaabbccbabbaaacbccccacbbccbabbaaabbccccaabbccbabbaaabbccccaabbccbabbaaabbccccaabbccbabbaaabbccccaabbccbabbcaabbccbcaabbccbabaaaabbccccaabbccbabbaaabbccccaabbccbacbcaabbccccaabbcbbabbaaabbccccaabbccbabbaaabbccccaacbcababbaaabbccccaabbccbabbaaabbacccaabbccbabbaaabbccccacbbccbcbbaaabbccccabbbccbabbaaabbccbcaabbccbabbaaabbccccaabbccbabbaaabaccccaabbccbabbaaabbccccaabbccbabbaaabbccccaabbccbabbbaabbccccaabbccbabbaaacbccccaabbccbcbbaaabbccccaabbccbabbaaabbccccaabbccbabbaaabbccccaabbccbabbaaabbcbccaabbccbabbaaabbccccaabbccbabbaaabbccccaabbccbabbaaabbccccaabbcababbaaabbccccaabbccbabbaaabbccccaabbccbabbaaabbccccaabbccbabbaaabbccccaabbccbabbaaabbccccaabbacbabbaaabaccccaabcccbabbaaabbccccaabbccbabbaaabbccccaabbccbabbaaabbccccaabbccbabbaaabbccccaabbcbbabbaaabbccccabbbccbabbaaabbccccaabbccbabbaabbbccccaabbccbabaaaabbccccaabbccbbbbaaabbccccaabbccbabbaaabbccccaabbccbabbaaabbccccaabbccbabbaaabbccccaabbbcbabbaaabbccccaabbccbabbaaabbccccaabbccbabbaaabbccccaabbbcaabbaacbbccccaabbccbabbaaabbccbcaabbccbabbaaabbccccaabbccaabbaaabbccccaabbccbabbaaabbccccaabbccbabbababbccccaabbccbabcaaabbccccaabbccbabbaaabbccccaabbccbabbaaabbccccaabbccbabbaaabbccccaabaccbabbaaabbccccaabbccbabbaaabbccccaabbccbabbaaabbccccaabbccbabbaaabbccccaabbccbabbaaacbccccaabbccbabbaaabbccccaabbccbabbaaabbccccaabbccbabbaaabbccccaabbccbabbaaabbccccaabbccbabbaaabbccacaabbccbabbaaabbccccaabbccbabbacabbccccaabbccbabbaaabbcccccabbccbabbaaabbccccaabbbcbabbaaabbccccaabbccbabbaaabbccccaabbccbabbaaabbccccaabbccbabbaaabbccccaabbccbabbaaabbccccaabbccbabcaaabbccccaabcccbabbaaabbccccaabbccbabbaaabbccccaabbccbabbaaacbccccaaabcccbbbaaabbccccaabbccbabbaaabbccccaabbccbabbaaabbccccaabbccbbbbaaabbccccaabbccbabbaaabbccccaabbccbabbababbccccaabbccbabbaaabbccccaabbccbaabaaabaccccaabbccbabbaaabbccccaabbccbabbaaabbccccaabbccbabbaaabbccccaabbccbabbaaabbccccaabbccbabbaaabbccccaabbccbabbaaabbccccaabbccaabbaaabbccccaabbccbabbaaabbcbccaabbccbabbaaabbccccaabbccbabbaaabbccccaabbccbabbaaabbccccbabbccbabbaaabbccccaabbccbabbaaabbcccccabbccbabbaaabbccccaabbccbabbabacbccccaabbccbabbaaabbccccaabbacbabbaaabbccccaabbccbabbaaabbccccaabbccbabbaaabbccccaabbccbabbababbccccaabbccbabbaaabbacccaabbccbabbaaabbccccaabbcababbaaabbccccaabbccbabbaaabbccccaabaccbabbaaabbccccaabbccbcbbaaabbccccaabbacbabbaaabbccccaabbccbabbaaabbccccaabbccbabbaaabbccccaabbccbabbaaabbccccaabbccbabbaaabcccccaabbccbbbbaaabbccccaabbccbabbaaabbccccaabbccbabbaaaabccccaabbccbcbbaaabbccccaabbccbabbaaabbccccaabbccbaabaaabbccbcaabbccbabbaaabbccccaabbccbabbaaabbccccaabbccbabbaaabacccccabbccbabbaaabbccccaabbccbabbaaabbccccaabbccbabbaaabbccccaabbccbabbaaabbccccaabbbcbabbaaabbccccaabbccbabbaaabbccccaacbccbbbbaaabbccccaabbccbabcaaabbccccaabbccbabbaaabbcbccaabbccbabbaaaabccccaabbccbabbaaabbccccaabbccbabbaaabbccccaabcacbabbaaabbccccaabbccbabbaaabbccccaabbccbabcaaabbccccaabbccbabbaaabbccccaabbccbabbaaabbccccaabbccbabbaaabbccccaabbccbabbaabbbccccaabbccbabbaaabbccccaabbccbabbaaaabccccaabbccbabbaaaabccccaaabccbabbaaabbccccaabbccbabbaaabbccccaabbccbabbaaabbccccaabbccbabbababbccccaabbccbabbaaabbccccaabbccbabbaacbbccccaabbccbabbbaabbccccaabbccbabbaaabbccccaabcccbabbaaabbccccaabbccbabbaaabbccccaabbccbabbaaabbccccaabbccaabbaaabbccccaabbccbabbaaabbccccaabbccbabbaaabbccccaabbccbabbaaabbccacaabbccbabbaaabbccccaabbacbabbaaabbccccaabbccbabbaaabbaaccaabbccbabbaaabbcaccaabbccbabbaacbbccccaabbccbabbacabbccccaabbccbabbaaabbccccaabbccbabbaaabbccccaabbccbbbbaaabbccccaabbcccabbaaabbccccaabbccbabbaaabbcbccaabbccbabbaaabbccccaabbcbbabbababbccccacbbccbabbaaabbccccaabbccbabbababbccccaabbccbabbaaabbccccaabbccbabbaaabbccccaabbccbabbaaabbccccaabbccbabbaaabbccccaabbccbabbacabbccccaabbccbabbaaabaccccacbbccbabbaaabbccccaaabccbabbaaabbccccaabbccbabbaaabbccccaabbccbabbaaabbccccaabbccbabbaaabbccccaabaccbabbaaabbccccaabbccbabbaaabbccccaabbccbabbaaabbccccaabbccbabbaaabbccccaabbccbabbaaabbccccaabbccbabbaaabbccccaabbccbabbaaabbccccabbbccbaabaaabbccccaabbccbabbaaabbccccaabbccbabbaaabbccccaabbccbabbaaabbccccaabbccbabbaaabbccccacbbccbabbaaabbccccaabbccbabbaaabbccccaabbccbabbababbcbccaabbccbabbaaabbccccaabbccbabbaaabbccbbabbbccbabbaaabbccccaabbccbabbaaabbccccaabbccbabbaaabbccccaabbccbabbaaabbcccbaabbccbabbaaabbccccaaabccbabbaaabcccccaabbccbabbaaabbccccaabbccbabbaaabbccccaabbccbabbaaabbccccaabbccbabbaaabbccccaabbccbabbacabbccccaabbccbabbaaabbccccaabbccbabbaaabbccccaabbccbabbababcccccaabbccbabbaaabbccccaabbccbabbaaabbcccccabbccbabbaaabbccccaabbccbabbaaabbccccaabbccbabbaaabbccccaabbccbabbaaabbccccaabbccbabbaaabcccccaabbccbabbaaabbccccaabbccbabbaaabbccccaabbcccabbaaabbcccaaabbccbabbacabbccccaabbccbabbaaabbccccaabbccbabbaaabbaccbaabbccbabbaaabbccccaabaccbabbaaabbccccaabbccbabbaaabbccccaabbccbabbaaabbccccaabbccbcbbaaabbccccaabbccbabbaaabbccccaabbccbabbaaabbccccaabbcababbaaabbccccaabbccbbbbaaabbccccaabbccbabbaaabbccccaabbccbcbbaaabbccccaabbccbabbaaabbccccaabbccbabbaaabaccccaabbccbabbaaabbcccaaabbccbabbaaabbccccaabbccbabbaaabbccccaabbccbabbaaabbccccaabbccbabbaaabbccccaabbccbcbbaaabbccccaaabccbabbaaabbccccaabaccbabbaaabbccccaabbccbabbaaabbccccaabbccbabbaaabbccacaabbccbbbbaaabbccccaabbccbabbaabbbccccaabbccbabaaaabbccccaabbccbabbaacbbccccaabbccbabbaaabbccccaabbccbabbaaabbccccaaabccbabbaaabbccccaaabccbabaaaabaccccaabbccbabbaaabbccccaabbccbabbaaabbccccaabbcbbabbaaabbccccaabbccbabbaaabbccccaabaccbabbcaabbccccaabbccbabbaaabbccccaabbccbabbaaabbccccaabbccbabbaaabbccccaabbccbabbaaabbccccacbcacbabbaaabbccccaabbccbabbaaabbccccaabbccbacbaacbbccccaabbcababbaaabcccccaabbccbabbaaabbccccaabbccbabbaaabaccccaabbccbabbaaabbccccaabbccbabbaaabbccccaabbbcbabbaaabbccccaabbccbabbaaabbccccaabbccbabbaaabbccccaabcccbabbaaabbccccaabbccbabbaaabbccccaabbccbabaaaabbccccaabbccbabbaaabbcbccaabbccbabbaaabbccccaabbccbabbaaabbccccaabbccbabbaaabbccccaabbccbabbaaabbccccaabbccbabbaaabbccccaabbcababbaaabcccccaabbccbbbbaabbbccccaabbacbabbaaabbccccaabbccbabcaaabbccccaabbccbabbaaabbccccaabbccbabbaaabbccccaabbccbabbaaabbccccaabbccbabbaaabbccccaabbccbabbaaabbccccaabbccbabbaaabbccccaabbccbabbaaabbcccccabbccbabbaaabbccccaabbccbabbaaabbccccaabbccbabbaaabbccccaabbccaabbaaabbccccaabbccbabbaaabbbcccaabbccbabbaaabbccccaabbccbabbaaabbccccaabbccbabbaabbbccccaabbacbabbaaabbccccaabbccbabbaaabbccccaabbccbabbaacbbccccaabbccbabbacabbccccaabbccbbbbaaabbccccbabbccbabbaaabbccccaabbccbabbaacbbcccbaabbccbabbaaabbccccbabbccbabcaaabbccccaabbccbabbaaabbccccaabbccbabbaaabbbcccaabbccbabbaaabbccccaabbccbabbaaabbccccaabbcccabbaaabbccccaabbbcbabbaaabbccccaabbccbabbaaabbccccaabbccbabbaaabbcccbaabbccbabbaaabaccccaabbccbabbaaabbccccaabbbcbabbaaabbcccccabbccbabbaaabbccccaabbccbabbaaabbccacaabbccbabbaaabbbaccaabbccbabbaaabbccccaabbccbabbaaabbcaccaabbccbabbaaabbccccaabbccbabbacabbccccaabbccbabbaaabbccccaabbcababbaaabbcccccabbccbacbaaabbcaccaabbccbabbaaabbccccaabbccbabbaaabbccccaabbccbabbaaabbccccaabbccbabbaaabbccbcaabbcbbabbaaabbccccaabbcbbabbaaabbccccaabbccbabbaaabbccccaabbccbabbaaabbccccaabbccbabbbabbbccccaabbccbabbaaabbccccaabbccbabbaaabbccccacbbccbabbaaabbccccaabbccbabbaaabbccccaabbccbabbaaabbccccaabbccbabbacabbccccaabbccbabbaaabbccccaabbccbabbaacbbccccaabbcbbabbaabbaccccaabbccbabbaaabbccccaabbccbabbaaabbccccaabbccbabbaaabbccccaabbccbabbaaabbcbccaabbcbbabbaaabbccccaabbccbabbaaabbccccacbbacbabbaaabbccccaabbccbbbbaaabbbcccacbbccbabbaaabbcaccaabbcccabbaacbbbcccaabbccbabbababbccccaabbbcbabba
500
bcbcabba
babbccbb
bacbaccb
ccacbabc
acbcabbc
bbacccca
bcacbbca
bccbacac
aabbbccb
acbbccac
acbbbcab
cbbbbcab
cccabacb
ccbcacba
abccabcc
aabbbccb
cbacabcb
ccbbccaa
bccccaab
abcccabc
cbccbaca
accbbacc
cabbccac
accabcbc
ccbcacab
caaccbcb
aabbaccb
bbcacaab
abbcccac
cabaccbc
aaccbbcc
cbcccbaa
cccabbac
cbabccba
ccbcbaac
abbacccc
babcacba
ccaabcbc
bccabcca
abbccacc
baccacbc
acaccbcb
cacabbbb
bacccabc
babaccba
cabcbbba
ccbccaba
cacccbab
accbcbac
acccbcba
accacbbc
cbaacbab
aabbccbc
bacacbcc
bcaacbcc
acabbcbb
bbacbcbb
cacacbbc
cbacabbb
cbbcacca
bcabbcca
bcbbabac
acbbbcab
acbccbac
accccbba
cbbacacb
aaaccbbb
aaccbccb
cbbcccaa
ccaacbbc
cbbcacac
aabccccb
cbbcbbba
ccbacbac
ccababcc
ccacbacb
cbccbcaa
cacbbbca
aabbaccb
cccbbaab
cbcbacca
bbacbbbc
bcbcacac
cababccb
baaccccb
abccbbbb
ccaabbcc
ccbaabcc
bccccaba
cccababc
bbccacac
cbbcacca
cbcbcaab
bacccbca
cacabbcc
bbcaccca
baaccbcc
bcbacacc
bccacacb
caccbacb
bccabacc
cccbbaca
ccaabbcc
abccccab
acabcccb
ccbacbac
babbacac
cbcccbaa
bbcccaca
cbbabcbb
cbaacccb
ccacbcab
cbccbaac
bcaacbcc
bcbcbaab
aabcbcba
babbccbb
bbbccbaa
caabbcbc
abccbcac
bacacbbb
ccabbacc
bccbabca
acbbcbca
acabcbba
cbbcbabb
bbbcbcab
cbbcbbab
cccbacab
cccabbca
bbacccca
accccabb
caabcccb
bbbccabb
cabccabc
cabcbbaa
bcbccaca
cbbaccac
bbccaacc
bccabacc
bbbcabca
cccababc
bcbcccaa
accbbacb
abcccacb
bcabccac
bbaccbbb
cbaaccbc
cabbcacc
bbaacccc
abbacbbc
caabbccb
ccbcabca
accacbbc
bacbccac
bccaacbc
cabccbca
cacbaccb
cabccbac
aabccbbb
acbccbac
bacccabc
bbbbcabc
cccaabbc
cbabccca
acbbbaca
accabccb
bbccbaba
babcccca
cbcbcaca
abbacbcb
babbacbc
cabbbcaa
abbabccc
aabbccbc
ccabbacc
ccbcaacb
abcaccbc
bacccbac
cabccabc
ccabbcac
cbccabca
accbaccb
cbbcacac
acbacabb
ccababbb
bcaacccb
cabcabcc
accbbbaa
bcccabac
bbbbaacc
abccbabb
accbaccb
abccaccb
cabccacb
bcbbacaa
bcbbacab
bccbabbb
ccbbbcaa
bcacbcca
ccacbcba
accbaabb
acbbccca
bccccaab
abcccacb
acbacbcc
bccbbbab
cbccbcaa
acbcccba
cabacbcc
accbabcc
abccbcca
cbacbcca
abaaccbb
abcccacb
ccaabbcc
bcabcaba
cbaacbbc
baacbccc
ccabcbac
cacccbab
cbbaacbc
bacccbca
bcccbcaa
cccaacbb
bbbbcbac
abcccacb
cabaccbc
bcabcbba
cbaccbca
bbcccaca
bccbacca
cabbcaab
aacbcbcc
bbacccca
bccbaacc
cacbbacb
cccbbaba
caabcccb
bccacbca
bbacacbb
aabccccb
acbccabc
cccbaabc
cbaaccbc
bccaaccb
cabacbcc
abbccbba
acccabbc
bacabccc
ccbcabca
ccbbbabb
acaacbbb
abccaccb
acbcbacc
acabbcba
bacccbac
abbbbcac
bccaaccb
bbacccca
bbbcabbc
bbacbbbc
aacbbccc
cbcacbac
bbbbabcc
ccbcbcaa
bbabbccb
acabccbc
bacbbcaa
bbacbbbc
bccccaab
accaccbb
abbcccac
cbcabcab
ccbbacac
baccabcc
bacaccbc
bbcaccca
cbbacacc
ccbbbaac
cbbabcca
ccbaabcc
ccbabacc
bccaacbc
cbbaaccc
acbbacba
cccaabbc
cacabcbc
cabcbcca
cbbcbaab
cabcaccb
abcabcbb
bacccbca
ccbacacb
acccbbac
bbacbbcb
bcbccaac
cabccacb
cbbaacba
acbcaabb
cbbaabcb
cbcbbabb
babbccac
bccccbaa
bbbcacba
accccabb
cbbbaacc
cbcbbabb
ccacbacb
acbacccb
cbacccab
cbcbbcaa
cbcbacca
caabbccb
bccaccab
abbccbba
abbcccca
caaccbbc
bacabccc
bccaccab
bcabaccc
ccacabbc
bbbcabcb
bbbccabb
caacccbb
ccacbbca
abbcccca
ccabaabb
aacccbcb
cbcbcaac
ccccabba
cbcccaab
bcabaccc
cbccaabc
bccbacac
cbbbcabb
aacbcbba
acbacbcc
caacbccb
bbcaccca
cccacbba
bcaacbcc
bcaacbbc
cbcccaab
bcccacba
abbccacc
accbcacb
ccbbacca
abcbbcca
aaabbcbc
bbbabccb
caccabcb
bccbbbab
accabccb
babccacc
bcaccbac
babbccca
ccacbbac
cababccc
ccabcbac
bbcacacc
cccbaabb
abcabccc
acacbbcc
bacbccac
cacbccab
acacbccb
bcbcacca
abbcbbbc
acbccbca
acbaacbb
cbbbcaaa
abaccbba
cabcbbbb
babccbbb
bcaabccc
ccbccbaa
bccccbaa
bcbcbaab
bcacbacc
abcbaccc
bbccccaa
acccbabc
bbccacac
cbabccca
bacabccc
abbacbbc
cbccacba
babcaccc
cbbaccca
bcaccbca
bcaacbcc
cbccaabc
ccabccba
cacaccbb
baacbccb
acacccbb
bcaaccbc
ccccabab
cccabbac
ccbbbabb
bbbacaca
cbcacacb
cabbcabb
accbabcc
bcbbaaca
acbacccb
abbbcabc
bacaccbc
abccbcba
babbcaca
cbcccaab
baccabcc
cccaabbc
cbacabbb
ccacbbac
abbbacca
acbabbcb
bbacbcba
cbbcbabb
caccabbb
bcbccaca
aabcbcab
acccacbb
bcbbcabb
cbcabacc
acbbcaba
bbcaccac
ccbcabac
ccaccabb
cccacbab
bbcaccca
bbaacbbc
bbabcacb
abacbccc
cabcabcc
caccacbb
acbabccc
baacbbbc
ccbccaab
accbcbac
cccbabca
cacccbba
cbcabcab
cbbbcaba
bcbaccca
abcaccbc
abacccbc
bcccacab
bbccbbba
aaccccbb
aabccbcc
bbabbccb
cccbcbaa
caacbbcb
baaccbcc
cbccacab
aabcbccc
cabcacbc
aabcbccc
cbacbcac
aacccbbc
ccccabab
bcaacccb
cbbaccca
bbaacccc
accbcbac
bbbabcbc
bbacccca
accacbbc
aaabccbb
bbcbcbba
acbcbacc
cbccacab
cbabbacc
abcacccb
bccaaccb
acccabcb
bcbbaaac
acccbabc
ccaccbab
ccbcabca
ccbcaacb
cbcbccaa
babcbacb
babcbcab
cabaccbc
bbccabbb
caccabbb
acbcbcac
bccbbabb
abbccacc
bccacabc
cbacbcca
bbcbbacb
accbccab
cacbcbca
ccacacbb
cbbbcabb
cccacabb
输出:
4253348
#include<iostream> #include<algorithm> #include<cstdio> #include<cstdlib> #include<map> #include<string> #include<vector> using namespace std; #define MAX(a,b) ((a)>(b)?(a):(b)) #define MIN(a,b) ((a)<(b)?(a):(b)) int main() { time_t START=clock(); freopen("/home/lu/鏂囨。/绗竷灞婃澀宸炲喅璧涘笀璧勫煿璁細璧勬枡/甯堣祫鍩硅浼?2016-鏉窞/寰€灞婄湡棰?2015鐪熼-瑙i鎬濊矾-婧愮爜/鍐宠禌/C++澶уB缁?4/娴嬭瘎鐢ㄤ緥/in4.txt","r",stdin); string s; cin>>s; map<string,int>mp; for(int i=7;i<s.size();++i) { string buf; buf.assign(s.begin()+i-7,s.begin()+i+1); sort(buf.begin(),buf.end()); ++mp[buf]; } int n; cin>>n; int sum=0; while(n--) { cin>>s; sort(s.begin(),s.end()); if(mp.find(s)!=mp.end()) sum+=mp[s]; } cout<<sum<<endl; cout<<"cost time:"<<(double)(clock()-START)/CLOCKS_PER_SEC<<"s"<<endl; return 0; }
#include<iostream> #include<algorithm> #include<cstdio> #include<cstdlib> #include<map> #include<string> #include<vector> using namespace std; #define MAX(a,b) ((a)>(b)?(a):(b)) #define MIN(a,b) ((a)<(b)?(a):(b)) #define ll long long struct P { int n,dis; ll sum; bool kh; }; P*ini(vector<int>&v,int n,int l) { P*p=new P[n+1]; for(int i=0;i<n;++i) { p[i].kh=false; cin>>p[i].dis>>p[i].n; } p[0].sum=p[0].n; for(int i=1;i<n+1;++i) p[i].sum=p[i-1].sum+p[i].n; if(p[n-1].dis==l) { p[n-1].kh=true; p[n-1].n=0; v.push_back(n-1); } v.push_back(n); p[n].kh=true; p[n].dis=l; p[n].n=0; return p; } void built_khd(vector<int>&v,P*p,int n) { int index_khd=0; int khd=v[index_khd++]; int maxcost_index=-1; ll maxcost=-1; for(int i=0;i<n;++i) { if(khd<i) khd=v[index_khd++]; ll cost=p[khd].dis-p[i].dis; cost*=p[i].sum; if(cost>maxcost) { maxcost=cost; maxcost_index=i; } } v.insert(upper_bound(v.begin(),v.end(),maxcost_index),maxcost_index); p[maxcost_index].kh=true; p[maxcost_index].n=0; for(int i=0;i<n;++i) if(p[i].kh) p[i].sum=0; else if(i>0) p[i].sum=p[i].n+p[i-1].sum; else p[i].sum=p[i].n; } ll work(int n,int l) { vector<int>v; P*p=ini(v,n,l); for(int i=0;i<3;++i) built_khd(v,p,n); int index=0; int khd=v[index++]; ll cost=0; for(int i=0;i<n;++i) { while(p[khd].dis<p[i].dis) khd=v[index++]; cost+=(ll)(p[khd].dis-p[i].dis)*p[i].n; } return cost; } int main() { time_t START=clock(); freopen("/home/lu/鏂囨。/绗竷灞婃澀宸炲喅璧涘笀璧勫煿璁細璧勬枡/甯堣祫鍩硅浼?2016-鏉窞/寰€灞婄湡棰?2015鐪熼-瑙i鎬濊矾-婧愮爜/鍐宠禌/C++澶уB缁?5/娴嬭瘎鐢ㄤ緥/in1.txt","r",stdin); int n,l; cin>>n>>l; if(n<4) { cout<<"0"<<endl; return 0; } cout<<work(n,l)<<endl; cout<<"cost time:"<<(double)(clock()-START)/CLOCKS_PER_SEC<<"s"<<endl; return 0; }