浙江理工大学入队200题——13H
问题 H: 零基础学C/C++143——绝对公正的裁判
题目#
现在,要求如果输入一个缩写短语,要求输出原型,具体看样例。
输入#
The first line is integer T(T <= 20), the number of test cash case 第一行为一个数T(T<=20),为测试数据的数目 接下来,有T行分别输入一个缩写(缩写只包括AC,PE,WA,RE,TLE,MLE,OLE,CE)
输出#
对于每组测试数据输出一行为着这缩写的原型
样例输入 Copy#
8
AC
PE
WA
RE
TLE
MLE
OLE
CE
样例输出 Copy#
Accepted
Presentation Error
Wrong Answer
Runtime Error
Time Limit Exceeded
Memory Limit Exceeded
Output Limit Exceeded
Compilation Error
题解#
本题考查判断字符串是否相等,使用strcmp,如不清楚>https://www.runoob.com/cprogramming/c-function-strcmp.html<
代码(AC)#
点击查看代码
#include <iostream>
#include <cstdio>
#include <cstring>
int main (){
int t;
scanf("%d",&t);
char a[5];
getchar();
for(int i=0;i<t;i++)
{
scanf("%s",&a);
if(strcmp(a,"AC") == 0) printf("Accepted\n");
if(strcmp(a,"PE") == 0) printf("Presentation Error\n");
if(strcmp(a,"WA") == 0) printf("Wrong Answer\n");
if(strcmp(a,"RE") == 0) printf("Runtime Error\n");
if(strcmp(a,"TLE") == 0) printf("Time Limit Exceeded\n");
if(strcmp(a,"MLE") == 0) printf("Memory Limit Exceeded\n");
if(strcmp(a,"OLE") == 0) printf("Output Limit Exceeded\n");
if(strcmp(a,"CE") == 0) printf("Compilation Error\n");
}
return 0;
}
作者:shany212
出处:https://www.cnblogs.com/codeshany/p/zstu_200_13H.html
版权:本作品采用「署名-非商业性使用-相同方式共享 4.0 国际」许可协议进行许可。
本博文版权归本博主所有,转载请标明出处
分类:
浙江理工大学入队200题
标签:
浙江理工oj入队200题
【推荐】国内首个AI IDE,深度理解中文开发场景,立即下载体验Trae
【推荐】编程新体验,更懂你的AI,立即体验豆包MarsCode编程助手
【推荐】抖音旗下AI助手豆包,你的智能百科全书,全免费不限次数
【推荐】轻量又高性能的 SSH 工具 IShell:AI 加持,快人一步
· 分享一个免费、快速、无限量使用的满血 DeepSeek R1 模型,支持深度思考和联网搜索!
· 使用C#创建一个MCP客户端
· ollama系列1:轻松3步本地部署deepseek,普通电脑可用
· 基于 Docker 搭建 FRP 内网穿透开源项目(很简单哒)
· 按钮权限的设计及实现