题解 | #HTTP状态码#
HTTP状态码
https://www.nowcoder.com/practice/99dba043761e43c2a6f931e2c5c247c7
#include <cstdio> #include <algorithm> #include <map> #include <string> using namespace std; int main(){ map<int,string> myMap; myMap[200] = "OK"; myMap[202] = "Accepted"; myMap[400] = "Bad Request"; myMap[403] = "Forbidden"; myMap[404] = "Not Found"; myMap[500] = "Internal Server Error"; myMap[502] = "Bad Gateway"; int n; while(scanf("%d",&n) != EOF){ printf("%s\n",myMap[n].c_str()); } return 0; }