这套题很有意思2333
蠢了……首先先判总共加起来等不等于\(n\),不是的话就不行 然后dfs记录\(n\)不断分下去能分成哪些数,用map记录一下,判断是否所有数都能被分出来就是了//minamoto#include#define int long long#define fp(i,a,b) for(register int i=a,I=b+1;i I;--i)using namespace std;char buf[1<<21],*p1=buf,*p2=buf;inline char getc(){return p1==p2&&(p2=(p1=buf)+fread(buf,1,1<<21,stdin),p1==p2)?EOF:*p1++;}int read(){ int res,f=1;char ch; while((ch=getc())>'9'||ch<'0')(ch=='-')&&(f=-1); for(res=ch-'0';(ch=getc())>='0'&&ch<='9';res=res*10+ch-'0'); return res*f;}const int N=1e5+5;int n,sum,x,m,a[N];map mp;void dfs(int n){ if(mp[n])return;mp[n]=1; dfs(n/2),dfs(n-n/2);}signed main(){// freopen("testdata.in","r",stdin); n=read(),m=read(); fp(i,1,m)a[i]=read(),sum+=a[i]; if(sum!=n)return puts("ham"),0; dfs(n);fp(i,1,m)if(!mp[a[i]])return puts("ham"),0; return puts("misaka"),0;}