HDOJ HDU 1073 Online Judge
来源:互联网 发布:成都网络推广培训 编辑:程序博客网 时间:2024/06/18 12:26
HDOJ 1073 Online Judge
题目
点此查看 HDOJ 1073 Online Judge
分类
字符处理
题意
写个OJ判题程序
Accepted: 提交和答案完全相同
Presentation Error : 提交和答案只有 空格 ’ ’ 制表符tab ‘\t’ 或 回车 ‘\n’ 不同
Wrong Answer : 不符合以上条件
题解
我的思路
先将两组数据全部读入string(包括所有回车、tab、换行)
如果两组数据完全一致则AC
否则将两组数据的格式字符(包括所有回车、tab、换行)
如果经过上述处理的字符串完全一致则PE,否则AW
代码
#include <iostream>#include <cstring>#define maxn 5000using namespace std;string a;string b;bool isdel(char ch);bool ispe();int main(){ int n; string s; cin >> n; cin.get(); while(n--) { a.clear(); b.clear(); while(getline(cin,s) && s != "START"); while(getline(cin,s)) { if(s == "END") break; a += s; a += '\n'; }// cout << a <<endl; while(getline(cin,s) && s != "START"); while(getline(cin,s)) { if(s == "END") break; b += s; b += '\n'; }// cout << b << endl; if(a.length() == b.length() && a == b) { cout << "Accepted" << endl; continue; } if(ispe()) cout << "Presentation Error" << endl; else cout << "Wrong Answer" << endl; } return 0;}bool ispe(){ string aj; string bj; for(int i = 0;i < a.length();i++) if(isdel(a[i])) aj += a[i]; for(int i = 0;i < b.length();i++) if(isdel(b[i])) bj += b[i]; if(aj == bj) return true; else return false;}bool isdel(char ch){ if(ch != ' ' && ch != '\t' && ch != '\n') return true; return false;}
阅读全文
0 0
- HDOJ HDU 1073 Online Judge
- HDOJ/HDU 1073 Online Judge(字符串处理~)
- hdu 1073 Online Judge
- HDU 1073 Online Judge
- HDU 1073 Online Judge
- HDU 1073 Online Judge
- hdu 1073 Online Judge
- HDU 1073 Online Judge
- hdu 1073 Online Judge
- hdu 1073 Online Judge
- hdu 1073 Online Judge
- hdu 1073 Online Judge
- hdu 1073 Online Judge
- hdu 1073 Online Judge
- HDU 1073 Online Judge
- HDU 1073 Online Judge
- hdu 1073 Online Judge
- HDU 1073 Online Judge
- 使用nexus时在setings.xml中需要配置的文件
- thinkphp项目部署到Linux服务器上,报错“模板不存在”
- 第二周 --上机发文章
- 温度
- matlab导入excel数据
- HDOJ HDU 1073 Online Judge
- Linux常用工具网址
- 选择,循环条件
- Jsp注释、小脚本、表达式、声明
- Python3:range()函数
- 什么是最小二乘法
- python集合运算
- What is the difference between call and apply?(关键词:call/apply/invoke)
- 【数据库】谈谈group by