Codeforces Round #185 (Div. 2) A. Whose sentence is it? 水题
A. Whose sentence is it?
Time Limit: 20 Sec
Memory Limit: 256 MB
题目连接
http://codeforces.com/contest/312/problem/A
Description
One day, liouzhou_101 got a chat record of Freda and Rainbow. Out of curiosity, he wanted to know which sentences were said by Freda, and which were said by Rainbow. According to his experience, he thought that Freda always said "lala." at the end of her sentences, while Rainbow always said "miao." at the beginning of his sentences. For each sentence in the chat record, help liouzhou_101 find whose sentence it is.
Input
The first line of the input contains an integer n (1 ≤ n ≤ 10), number of sentences in the chat record. Each of the next n lines contains a sentence. A sentence is a string that contains only Latin letters (A-Z, a-z), underline (_), comma (,), point (.) and space ( ). Its length doesn’t exceed 100.
Output
For each sentence, output "Freda's" if the sentence was said by Freda, "Rainbow's" if the sentence was said by Rainbow, or "OMG>.< I don't know!" if liouzhou_101 can’t recognize whose sentence it is. He can’t recognize a sentence if it begins with "miao." and ends with "lala.", or satisfies neither of the conditions.
Sample Input
5
I will go to play with you lala.
wow, welcome.
miao.lala.
miao.
miao .
Sample Output
Freda's
OMG>.< I don't know!
OMG>.< I don't know!
Rainbow's
OMG>.< I don't know!
HINT
题意
给你一行字符串,如果前5个字符是miao.,那么这句话就是R说的
如果最后五个字符时lala.,那么这句话就是F说的
给你一个字符串,问你能否分辨出是谁说的呢?
题解:
水题啦,只用判断前五个和后五个字符啦
代码:
#include<iostream>
#include<stdio.h>
#include<math.h>
using namespace std; string s;
int main()
{
int n;
scanf("%d",&n);getchar();
for(int i=;i<n;i++)
{
getline(cin,s);
if(s.size()<)
{
printf("OMG>.< I don't know!\n");
continue;
}
int flag1 = ,flag2 = ;
int len = s.size();
if(s[]=='m'&&s[]=='i'&&s[]=='a'&&s[]=='o'&&s[]=='.')
flag1 = ;
if(s[len-]=='l'&&s[len-]=='a'&&s[len-]=='l'&&s[len-]=='a'&&s[len-]=='.')
flag2 = ;
if(flag1==flag2)
printf("OMG>.< I don't know!\n");
else if(flag1)
printf("Rainbow's\n");
else if(flag2)
printf("Freda's\n");
}
}
Codeforces Round #185 (Div. 2) A. Whose sentence is it? 水题的更多相关文章
- Codeforces Round #368 (Div. 2) A. Brain's Photos (水题)
Brain's Photos 题目链接: http://codeforces.com/contest/707/problem/A Description Small, but very brave, ...
- Codeforces Round #373 (Div. 2) C. Efim and Strange Grade 水题
C. Efim and Strange Grade 题目连接: http://codeforces.com/contest/719/problem/C Description Efim just re ...
- Codeforces Round #373 (Div. 2) A. Vitya in the Countryside 水题
A. Vitya in the Countryside 题目连接: http://codeforces.com/contest/719/problem/A Description Every summ ...
- Codeforces Round #371 (Div. 2) A. Meeting of Old Friends 水题
A. Meeting of Old Friends 题目连接: http://codeforces.com/contest/714/problem/A Description Today an out ...
- Codeforces Round #355 (Div. 2) B. Vanya and Food Processor 水题
B. Vanya and Food Processor 题目连接: http://www.codeforces.com/contest/677/problem/B Description Vanya ...
- Codeforces Round #310 (Div. 2) B. Case of Fake Numbers 水题
B. Case of Fake Numbers Time Limit: 20 Sec Memory Limit: 256 MB 题目连接 http://codeforces.com/contest/5 ...
- Codeforces Round #309 (Div. 2) B. Ohana Cleans Up 字符串水题
B. Ohana Cleans Up Time Limit: 20 Sec Memory Limit: 256 MB 题目连接 http://codeforces.com/contest/554/pr ...
- Codeforces Round #309 (Div. 2) A. Kyoya and Photobooks 字符串水题
A. Kyoya and Photobooks Time Limit: 20 Sec Memory Limit: 256 MB 题目连接 http://codeforces.com/contest/5 ...
- Codeforces Round #331 (Div. 2) A. Wilbur and Swimming Pool 水题
A. Wilbur and Swimming Pool Time Limit: 20 Sec Memory Limit: 256 MB 题目连接 http://codeforces.com/conte ...
随机推荐
- LINUX启动ORACLE监听和服务
可通过secureCRT或者telnet直接连 启动监听命令:lsnrctl start 成功启动后:sqlplus /nolog 回车 conn / as sysdba 回车 startup 回车 ...
- [转] ArcEngine 产生专题图
小生原文 ArcEngine 产生专题图 ArcEngine提供多个着色对象用于产生专题图,可以使用标准着色方案,也可以自定义着色方案,ArcEngine提供8中标准着色方案. 一.SimpleRen ...
- HDU5790 Prefix 字典树+主席树
分析:这个题和spoj的d_query是一个题,那个是求一段区间里有多少个不同的数字,这里是统计有多少个不同的前缀 用字典树进行判重,(和查询不同的数字一样)对于每个不同的前缀,只保留它最后一次出现的 ...
- python的Requests模块使用tips
post方法提交的是表单,要用data放dict get方法请求的是参数,要用params放dict HTTP头部是大小写不敏感的
- hashtable,hashMap,vector和ArrayList
关于vector,ArrayList,hashMap和hashtable之间的区别 vector和ArrayList: 线程方面: vector是旧的,是线程安全的 ArrayList是java ...
- Tkinter教程之Canvas篇(4)
本文转载自:http://blog.csdn.net/jcodeer/article/details/1812091 '''Tkinter教程之Canvas篇(4)''''''22.绘制弧形'''# ...
- Tkinter教程之Scale篇
本文转载自:http://blog.csdn.net/jcodeer/article/details/1811313 '''Tkinter教程之Scale篇'''#Scale为输出限定范围的数字区间, ...
- web.py处理文件上传
#coding=utf8 import web urls = ('/','Home', '/upload', 'Upload') app = web.application(urls, globals ...
- 小C的填数游戏
题意: 给出一张n个点的无向图 i连向i-1和i-2 边权为wij 有两个点权ai和bi ai为0或1 在给m个操作 1.将ai异或1 2.将区间x到y的点都填上一个数ci 使得Σ(bi*(ai^ci ...
- 使用PowerDesigner 设计SQL Server 数据库
工具: Sybase PowerDesigner 12.5 Microsoft SQL Server 2005 第一步:概念数据模型 打开PowerDesigner 软件,设计“概念数据模型”(Co ...