zoj 3867 Earthstone: Easy Version(模拟)
#include<cstdio> #include<iostream> #include<cstring> #include<cmath> #include<stdlib.h> #include<queue> #include<stack> #include<vector> #include<algorithm> #define LL long long using namespace std; const int MAXN=10; const int INF=0x3f3f3f3f; const double eps=1e-9; int a[120]; int main() { int kase,a1,h1,a2,h2; int lh1,lh2; scanf("%d",&kase); while(kase--) { scanf("%d %d %d %d",&a1,&h1,&a2,&h2); if(a1==0) { printf("Invalid\n"); continue; } else { lh1=h1-a2; lh2=h2-a1; //printf("lh1%d lh2%d\n",lh1,lh2); if(lh1<=0) { printf("Discard "); } else { printf("%d %d ",a1,lh1); } if(lh2<=0) { printf("Discard\n"); } else { printf("%d %d\n",a2,lh2); } } } return 0; }