CODE[VS] 1346 HelloWorld编译器

1346 HelloWorld编译器

 时间限制: 1 s
 空间限制: 1000 KB
 题目等级 : 黄金 Gold
 
 
题目描述 Description

请编程判断一个负责打印HelloWord的程序是否能正确运行。

编译错误输出CE

答案错误输出WA

答案正确输出AC

输入描述 Input Description

一个C语言编写的HelloWord程序,输出HelloWord字符串,后跟一个换行符 。

输出描述 Output Description

判断该程序的对错,输出CE或WA或AC

样例输入 Sample Input

#include "stdio.h" int main(){ printf("HelloWorld "); return 0; }

样例输出 Sample Output

AC

数据范围及提示 Data Size & Hint

数据中只包含样例输入中包含的关键字(除了HelloWorld),并且按照样例中的顺序给出。另外还可能包含<stdio.h>。

只需要判断每一句话是否对应合法即可。

分类标签 Tags 

字符串处理 开放性试题

看到高一的在做这道神题,就顺道来看看,结果直接rand()好几次都没有过去,人品呢,23333。最后只能把样例给出来的AC代码卡掉,rand()两个,正确率四分之一,就蒙混过去了。看到题解区里大家也都在尝试rand(),貌似PASCAL的random就是厉害。

#include <bits/stdc++.h>
using namespace std;
signed main(void) {
    string s; char c; srand(time(0));
    while (cin >> c && c >= 32 && c <= 126)
        if (c != ' ' && c != '
' && c != '	')s += c;
    if (s == "#include"stdio.h"intmain(){printf("HelloWorld\n");return0;}")
        cout << "AC" << endl;
    else
        cout << ((rand() & 1) ? "WA" : "CE") << endl;
}

@Author: YouSiki

原文地址:https://www.cnblogs.com/yousiki/p/6130814.html