Online Judge【CodeForces】[366A]Dima and Guards问题描述 问题分析初看题以为是非常麻烦的题但Special Judge的好处就是只要满足题意得输出都可以所以只需要在四个中找出一组满足的输出就好找不到就输出-1 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 #include<stdio.h> int main() { int n; while(scanf("%d",&n)!=EOF) { int rest=-1,res; for(int i=1; i<5; i++) { int a,b,c,d; scanf("%d %d %d %d",&a,&b,&c,&d); if((a<b?a:b)+(c<d?c:d)<=n) rest=i,res=(a<b?a:b); } if(rest==-1) printf("-1\n"); else printf("%d %d %d\n",rest,res,n-res); } return 0; }题目地址:【CodeForces】[366A]Dima and Guards