题解 | #HTTP状态码#
HTTP状态码
https://www.nowcoder.com/practice/99dba043761e43c2a6f931e2c5c247c7
#include <stdio.h> int main() { int n = 0; while (scanf("%d", &n) != EOF) { int stl[7] = { 200,202,400,403,404,500,502 };//升序数组 char ch[7][50] = { {"OK"},{"Accepted"},{"Bad Request"},{"Forbidden"},{"Not Found"},{"Internal Server Error"},{"Bad Gateway"} }; int i, j = 0; for (i = 0; i < 7; i++,j++) { if (n == stl[i]) { printf("%s\n", ch[j]); } } } return 0; }