Run ID | Author | Problem | Lang | Verdict | Time | Memory | Code Length | Submit Time |
---|---|---|---|---|---|---|---|---|
42157 | lmz120809 | 森林之王 | C++ | Compile Error | 0 MS | 0 KB | 451 | 2024-02-24 11:28:39 |
#include<iostream> using namespace std; string s[20]={}; int a[20]; int n,m,j=0,cnt; int mian() { cin>>n>>m; for(int i=0;i<n;i++){ cin>>s[i]; if(s[i]=="tiger"||s[i]=="lion"||s[i]=="dinosaur"){ a[i]=3 } else a[i]=1; } cnt=n; int i=0; while(cnt>1){ if(a[i]>0) j++; if(j==m){ a[i]--; if(a[i]==0) cnt--; j=0; } i++; i%=n; } for(int i=0;i<n;i++){ if(a[i]) cout<<s[i]; } return 0; }