题目在此 http://www.spoj.com/problems/ARMY/
总体来说就是求最大值。。
#include<cstdio> #include<cstring> int x,n,t,i,a,b; int max,pos; int main(){ scanf("%d",&t); while(t--){ scanf("%d%d",&a,&b); max=0; for (i=1;i<=a;i++){ scanf("%d",&x); if (x>max){max=x;pos=1;} } for (i=1;i<=b;i++){ scanf("%d",&x); if (x>max){max=x;pos=2;} } if (pos==1)printf("Godzilla\n");else printf("MechaGodzilla\n"); } }
时间: 2024-10-25 03:12:41