题目描述
KiKi访问网站,得到HTTP状态码,但他不知道什么含义,BoBo老师告诉他常见HTTP状态码:200(OK,请求已成功),202(Accepted,服务器已接受请求,但尚未处理。)400(Bad Request,请求参数有误),403(Forbidden,被禁止),404(Not Found,请求失败),500(Internal Server Error,服务器内部错误),502(Bad Gateway,错误网关)。
输入描述:
多组输入,一行,一个整数(100~600),表示HTTP状态码。
输出描述:
针对每组输入的HTTP状态,输出该状态码对应的含义,具体对应如下:
200-OK
202-Accepted
400-Bad Request
403-Forbidden
404-Not Found
500-Internal Server Error
502-Bad Gateway
示例1
输入
200
输出
OK
#include<iostream>
using namespace std;
int main ()
{
int a;
while(cin>>a)
{
if(a==200)
cout<<"OK"<<endl;
else if(a==202)
cout<<"Accepted"<<endl;
else if(a==400)
cout<<"Bad Request"<<endl;
else if(a==403)
cout<<"Forbidden"<<endl;
else if(a==404)
cout<<"Not Found"<<endl;
else if(a==500)
cout<<"Internal Server Error"<<endl;
else if(a==502)
cout<<"Bad Gateway"<<endl;
}
}