delete pics to save space

This commit is contained in:
2023-08-03 09:22:52 +08:00
commit de60cd6ed4
1334 changed files with 66221 additions and 0 deletions

55
2.12166.cpp Normal file
View File

@ -0,0 +1,55 @@
#include <iostream>
#include <string>
#include <map>
#include <cstdio>
#include <algorithm>
using namespace std;
typedef long long LL;
string line;
map<LL,int> base; //LL±íʾ×ÜÖØÁ¿£¬int±íʾ³öÏֵĴÎÊý
int sum;
void dfs(int depth,int s, int e)
{
if(line[s]=='[')
{
int p=0;
for(int i=s+1;i!=e;++i)
{
if(line[i]=='[')++p;
if(line[i]==']')--p;
if(p==0&&line[i]==',')
{
dfs(depth+1,s+1,i-1);
dfs(depth+1,i+1,e-1);
}
}
}
else
{
LL w =0;
for(int i=s;i<=e;++i) w=w*10+line[i]-'0';
++sum;++base[w<<depth];
//³ÓíȵÄ×ÜÖØÁ¿(w<<depth)³öÏֵĴÎÊý+1£¬³ÓíÈ×ÜÊý(sum)+1£»
}
}
int main()
{
#ifdef local
freopen("pro.in","r",stdin);
#endif
ios::sync_with_stdio(false); //È¡ÏûcinºÍstdinͬ²½£¬Ê¹µÃcinËÙ¶ÈÏ൱ÓÚscanf
int T;
cin>>T;
while(T--)
{
cin>>line;
base.clear(); //Çå¿Õmap
sum =0; //×ÜÊýÇåÁã
dfs(0,0,(int)line.size()-1);
int maxn=0;
for(auto it = base.begin();it != base.end(); ++it)
maxn = max(maxn,it->second);
cout<<sum-maxn<<endl;
}
return 0;
}