poj2586
#include<stdio.h> int main() { int s, d, re; while(scanf("%d%d",&s, &d)!=EOF) { if(4*s-d<0) re=10*s-2*d; else if(3*s-2*d<0) re=8*s-4*d; else if(2*s-3*d<0) re=6*s-6*d; else if(s-4*d<0) re=3*s-9*d; else re=-1; if(re<0) printf("Deficit\n"); else printf("%d\n", re); } } #include<stdio.h> int main() { int s, d, re; while(scanf("%d%d",&s, &d)!=EOF) { if(4*s-d<0) re=10*s-2*d; else if(3*s-2*d<0) re=8*s-4*d; else if(2*s-3*d<0) re=6*s-6*d; else if(s-4*d<0) re=3*s-9*d; else re=-1; if(re<0) printf("Deficit\n"); else printf("%d\n", re); } }
补充:软件开发 , C++ ,