题解 | #HTTP状态码#
HTTP状态码
http://www.nowcoder.com/practice/99dba043761e43c2a6f931e2c5c247c7
#include<stdio.h>
int main() {
int HTTP;
while (scanf("%d", &HTTP) != EOF) {
if (HTTP >= 100 && HTTP <= 600) {
if (HTTP == 200) printf("OK\n");
else if (HTTP == 202) printf("Accepted\n");
else if (HTTP == 400) printf("Bad Request\n");
else if (HTTP == 403) printf("Forbidden\n");
else if (HTTP == 404) printf("Not Found\n");
else if (HTTP == 500) printf("Internal Server Error\n");
else if (HTTP == 502) printf("Bad Gateway\n");
} else printf("\n");
}
return 0;
}
int main() {
int HTTP;
while (scanf("%d", &HTTP) != EOF) {
if (HTTP >= 100 && HTTP <= 600) {
if (HTTP == 200) printf("OK\n");
else if (HTTP == 202) printf("Accepted\n");
else if (HTTP == 400) printf("Bad Request\n");
else if (HTTP == 403) printf("Forbidden\n");
else if (HTTP == 404) printf("Not Found\n");
else if (HTTP == 500) printf("Internal Server Error\n");
else if (HTTP == 502) printf("Bad Gateway\n");
} else printf("\n");
}
return 0;
}