提交时间:2024-07-10 17:49:39

运行 ID: 49415

#include<bits/stdc++.h> using namespace std; int n,m; void out_nsm(int n,int m) { if(n==2) { cout<<5<<endl; cout<<"2 devils."<<endl; cout<<"1 devil."<<endl; cout<<"2 fathers"<<endl; cout<<"1 father"<<endl; cout<<"1 father and 1 devil."<<endl; } if(n%2==0) { cout<<5<<endl; cout<<n/2<<" fathers and "<<n/2<<" devils."<<endl; cout<<1<<" father and "<<1<<" devil."<<endl; cout<<n/2<<" fathers and "<<n/2<<" devils."<<endl; cout<<1<<" fathers and "<<1<<" devils."<<endl; cout<<2<<" fathers and "<<2<<" devils."<<endl; } else { if(n>3) { cout<<5<<endl; cout<<n/2<<" fathers and "<<n/2<<" devils."<<endl; cout<<1<<" father and "<<1<<" devil."<<endl; cout<<n/2<<" fathers and "<<n/2<<" devils."<<endl; cout<<1<<" fathers and "<<1<<" devils."<<endl; cout<<2<<" fathers and "<<2<<" devils."<<endl; } else { cout<<5<<endl; cout<<"3 devils."<<endl; cout<<"2 devils."<<endl; cout<<"3 fathers."<<endl; cout<<"1 devil."<<endl; cout<<"3 devils."<<endl; } } } int main() { cin>>n>>m; out_nsm(n,m); }