POJ 1677 Girls' Day
来源:互联网 发布:楚天数控编程代码 编辑:程序博客网 时间:2024/06/06 18:30
大模拟。。。。。。。。。
#include<stdio.h>#include<string.h>#include<iostream>using namespace std;char girl[8][256];int gx[8];char wish[32][256];char beautiful[]="beautiful";char pretty[]="pretty";char lovely[]="lovely";int main(){ int g,m; while(~scanf("%d%d",&g,&m)) { getchar(); for(int i=0;i<g;i++) gets(girl[i]); for(int i=0;i<m;i++) { gets(wish[i]); for(int j=0;wish[i][j]!=0;j++) if(wish[i][j]<='Z'&&wish[i][j]>='A') wish[i][j]+=32; bool name=false; bool goodword=false; memset(gx,0,sizeof(gx)); char word[256]; int ii=0; int wordnum=0; for(int j=0;wish[i][j]!=0;j++) { if(wish[i][j]!=' '&&wish[i][j]!='!') word[ii++]=wish[i][j]; else if(wish[i][j+1]!=' '&&wish[i][j+1]!='!')//Get a word successfully { wordnum++; word[ii]=0; ii=0; for(int k=0;k<g;k++) { if(gx[k]==false&&strcmp(word,girl[k])==0) { gx[k]++;// if(name)// putchar(' ');// printf("%s",girl[k]); name=true; } }//Find name if(goodword==false&&(strcmp(word,beautiful)==0||strcmp(word,pretty)==0||strcmp(word,lovely)==0)) goodword=true; } } if(ii!=0) { wordnum++; word[ii]=0; ii=0; for(int k=0;k<g;k++) { if(gx[k]==false&&strcmp(word,girl[k])==0) { gx[k]++;// if(name)// putchar(' ');// printf("%s",girl[k]); name=true; } }//Find name if(goodword==false&&(strcmp(word,beautiful)==0||strcmp(word,pretty)==0||strcmp(word,lovely)==0)) goodword=true; } if(name==false) printf("All"); else { bool output=false; for(int j=0;j<g;j++) { if(gx[j]) { if(output) putchar(' '); printf("%s",girl[j]); output=true; } } } printf(": "); if(wordnum<=9) puts("oh"); else if(goodword==true) puts("xixi"); else puts("hehe"); } }}
0 0
- POJ 1677 Girls' Day
- POJ 1677 Girls' Day 笔记
- Girls' Day
- poj1677-Girls' Day
- hdu_2574 Hdu Girls' Day
- hdu2574 Hdu Girls' Day
- HDU Hdu Girls' Day
- HDU 2574 Hdu Girls' Day
- HDU 2574 Hdu Girls' Day
- POJ 1466 Girls and Boys
- poj 1466 Girls and Boys
- POJ 1466 Girls and Boys
- POJ-1466-Girls and Boys
- poj 1466 Girls and Boys
- POJ 1466 Girls and Boys
- Poj--1466 Girls and Boys
- POJ 1466 Girls and Boys
- poj 1466 Girls and Boys
- Spring的JdbcTemplate
- 01-分数规划专题
- 理清浏览器Window对象&window对象&this对象
- java-基础-数组探究
- scala基础7-数组进阶
- POJ 1677 Girls' Day
- QT 学习
- 欢迎使用CSDN-markdown编辑器
- 游泳
- 73. Set Matrix Zeroes
- C++中的map和multimap容器
- Spring MVC 实现RESTful 返回JSON格式数据
- Hadoop YARN公平调度(FairScheduler)介绍
- <c:import>标签说明