傻逼题,要是考试只能得0分。。

提供几组傻逼数据,这要是在真实的生活中一定是错的。。。

还是要好好读题吧,全凭自己的感觉就得0分

albw:x
4
ls -a docu
Case 1: -a
ls -w -w
Case 2: -w -w
#include<cstdio>
#include<cstring>
#include<algorithm>
#include<iostream>
#include<queue>
#include<cmath>
#include<map>
#include<stack>
#include<set>
#include<bitset> using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef pair<int, int> pii;
#define pb(x) push_back(x)
#define cls(x, val) memset(x, val, sizeof(x))
#define fi first
#define se second
#define mp(x, y) make_pair(x, y)
#define inc(i, l, r) for(int i=l; i<=r; i++)
const int inf = 0x3f3f3f3f;
const int maxn = 2000+10;
bool have[maxn];
bool exist[maxn];
struct Node{
string s;
string var;
bool prin;
}node[26];
int n;
vector<string> split; vector<string> process(char *s){
int st = 0;
vector<string> temp;
string t;
int len = strlen(s);
for(int i=0; i<len; i++){
if(s[i] == ' '){
t = "";
for(int j=st; j<i; j++){
t+=s[j];
}
temp.push_back(t);
st = i+1;
}
}
t = "";
for(int j=st; j<len; j++){
t+=s[j];
}
temp.push_back(t);
return temp;
} int main(){
ios::sync_with_stdio(false);
char op[300];
scanf("%s", op);
int len = strlen(op);
for(int i=0; i<len; i++){
if(op[i]>='a'&&op[i]<='z'){
exist[op[i]-'a'] = true;
if(i+1<len && op[i+1] == ':'){
have[op[i]-'a'] = true;
i++;
}
}
} int kase = 1;
scanf("%d", &n);
getchar();
while(n--){
gets(op);
for(int i=0; i<26; i++) node[i].prin = false;
split = process(op); int sz = split.size();
// for(int i=0; i<sz; i++){
// printf("%s ", split[i].c_str());
// }
for(int i=1; i<sz; i++){
string temp = split[i];
if(temp[0] == '-'){
int c = temp[1]-'a';
if(!exist[c]) break;
if(have[c] == true){
if(i==sz-1) break;
else {
node[c].prin = true;
node[c].var = split[i+1];
}
i++;
}
else{
node[c].prin = true;
} }
else break;
}
//cout<<"Case "<<kase++<<":";
printf("Case %d:", kase++);
for(int i=0; i<26; i++){
if(node[i].prin){
//cout<<" -"<<char(i+'a');
printf(" -%c", char(i+'a'));
if(have[i]){
//cout<<" "<<node[i].var;
printf(" %s", node[i].var.c_str());
}
} }
printf("\n");
}
return 0;
}

最新文章

  1. 批量解密SQLSERVER数据库中的各种对象的工具dbForge SQL Decryptor
  2. Codeforces Round #384 (Div. 2)D-Chloe and pleasant prizes
  3. Facebook不相信所谓的员工能力等级。《长效商业英雄》(《哈佛商业评论》2016年11期),4星。
  4. mysql重点--正确使用
  5. MySQL导入.sql文件及常用命令
  6. Silverlight 限制 规则输入(正整数或小数)的另一种“技巧”写法
  7. Log4j 2.0在开发中的高级使用具体解释—配置简单的控制台输出(三)
  8. IO口输入输出模式理解
  9. ThinkPHP系统变量,常量,序列化,反序列化,缓存
  10. [js高手之路] javascript面向对象写法与应用
  11. 关于NIM博弈结论的证明
  12. Using $this when not in object context in
  13. Linux 每日命令行
  14. Djang之cookie和session
  15. node.js 使用 net 模块模拟 websocket 握手,进行数据传递。
  16. C# Chart使用总结 2 ----属性
  17. python 学习 面向对象编程
  18. scrapy 项目通过scrapyd部署
  19. golang实现kafka的消息推送
  20. Go语言中结构体的使用-第1部分结构体

热门文章

  1. sar-CPU统计数据
  2. linux性能监视工具sar
  3. 【CodeVS】1978 Fibonacci数列3
  4. wordpress主题之后台菜单编辑,小工具
  5. QT应用qmake添加应用图标
  6. console 中的格式化打印(占位符),和样式定义
  7. OSGi教程:Resource API Specification
  8. bnd.bnd属性文件格式
  9. linux 添加文字、图形、线条、箭头的 截图
  10. 微信端的user-Agent