Run ID 作者 问题 语言 测评结果 时间 内存 代码长度 提交时间
49415 pqwa20 神父过河 C++ 解答错误 1 MS 252 KB 1115 2024-07-10 17:49:39

Tests(1/19):


#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); }


测评信息: