SDUT 选夫婿1 http://acm.sdut.edu.cn/sdutoj/showproblem.php?pid=1569&cid=1211
#include<stdio.h> #include<string.h> void main() { char str[20][100]; int n, i, j, k, high[100], weight[100]; int hl, hr, wl, wr, t1, t2, count=0; char t3[100]; scanf("%d", &n); for(i=0; i<n; i++) { scanf("%s", str[i]); scanf("%d %d", &high[i], &weight[i]); } scanf("%d %d %d %d", &hl, &hr, &wl, &wr); for(i=0; i<n-1; i++) for(j=i+1; j<n; j++) { if(high[i]>high[j]) { t1 = high[i]; high[i] = high[j]; high[j] = t1; t2 = weight[i]; weight[i] = weight[j]; weight[j] = t2; strcpy(t3, str[i]); strcpy(str[i], str[j]); strcpy(str[j], t3); } if(high[i]==high[j] && weight[i] > weight[j]) { t2 = weight[i]; weight[i] = weight[j]; weight[j] = t2; strcpy(t3, str[i]); strcpy(str[i], str[j]); strcpy(str[j], t3); } } for(i=0; i<n; i++) { if(high[i] >= hl && high[i] <= hr && weight[i] >= wl && weight[i] <= wr) { printf("%s %d %d\n", str[i], high[i], weight[i]); count++; } } if(count==0) printf("No\n"); }
每天训练发现我比别人做的好慢,但是理解的更深刻,如果一开始学一个新知识点就搜模板,那么这样的人是走不远的,毕业之后带走的只有思维,什么荣誉,奖杯都已经不重要了。