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 ...
随机推荐
- Android 仿百度网页音乐播放器圆形图片转圈播放效果
百度网页音乐播放器的效果 如下 : http://www.baidu.com/baidu?word=%E4%B8%80%E7%9B%B4%E5%BE%88%E5%AE%89%E9%9D%99& ...
- 【DFS深搜初步】HDOJ-2952 Counting Sheep、NYOJ-27 水池数目
[题目链接:HDOJ-2952] Counting Sheep Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 32768/32768 ...
- 【转】Android 异步消息处理机制 让你深入理解 Looper、Handler、Message三者关系
转载请标明出处:http://blog.csdn.net/lmj623565791/article/details/38377229 ,本文出自[张鸿洋的博客] 很多人面试肯定都被问到过,请问Andr ...
- POJ 3977 Subset
Subset Time Limit: 30000MS Memory Limit: 65536K Total Submissions: 3161 Accepted: 564 Descriptio ...
- C#主线程等待子线程运行结束
佐左佑右 原文 C#主线程等待子线程运行结束 由于主程序中调用matlab的dll文件进行计算要用较长的时间,主界面会有很长时间的卡顿,造成的用户感受十分不好,因此我想在调用时,将调用放入子线程中,然 ...
- (原创)LAMP教程4-用VirtualBox安装64位的centos6.4
(原创)LAMP教程4-用VirtualBox安装64位的centos6.4 好的,今天就要开始正式的讲一些有营养的东西了,是的,没有错就是讲如何用VirtualBox安装64位的centos6.4 ...
- web自动化框架之一介绍与环境搭建(Selenium+Eclipse+Python)
看到一篇环境搭建文章,详细又全面,这里就不一一重复了 http://blog.csdn.net/dyllove98/article/details/9390649 其它: 1.框架介绍 整个 ...
- CodeForce---Educational Codeforces Round 3 D. Gadgets for dollars and pounds 正题
对于这题笔者无解,只有手抄一份正解过来了: 基本思想就是 : 二分答案,对于第x天,计算它最少的花费f(x),<=s就是可行的,这是一个单调的函数,所以可以二分. 对于f(x)的计算,我用了nl ...
- PHP+Apache+MySQL+phpMyAdmin在win7系统下的环境配置
配置方法在网上可以搜到很多,一步步来就好了,但是由于步骤比较多,需要耐心仔细一点点,这是我自己记录的成功步骤: 1.PHP+Apache+MySQL的安装:PHP网站开发 2.phpMyAdmin的配 ...
- JVM内存结构
前言 在Java语言开发过程中,out of memory错误是很常见的一种错误.对于JVM的内存结构有更深入的了解,更更好的帮我们排查此类问题,有效的避免此类问题发生.在JAVA 8中内存结构有进行 ...