HDOJ 题目3456 Universal Oracle(模拟,水)
来源:互联网 发布:windows为什么要激活 编辑:程序博客网 时间:2024/06/05 19:37
Universal Oracle
Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 32768/32768 K (Java/Others)Total Submission(s): 586 Accepted Submission(s): 242
Problem Description
In computer science, an oracle is something that gives you the answer to a particular question. For this problem, you need to write an oracle that gives the answer to everything. But it's not as bad as it sounds; you know that 42 is the answer to life, the universe, and everything.
Input
The input consists of a single line of text with at most 1000 characters. This text will contain only well-formed English sentences. The only characters that will be found in the text are uppercase and lowercase letters, spaces, hyphens, apostrophes, commas, semicolons, periods, and question marks. Furthermore, each sentence begins with a single uppercase letter and ends with either a period or a question mark. Besides these locations, no other uppercase letters, periods, or question marks will appear in the sentence. Finally, every question (that is, a sentence that ends with a question mark) will begin with the phrase "What is..."
Output
For each question, print the answer, which replaces the "What" at the beginning with "Forty-two" and the question mark at the end with a period. Each answer should reside on its own line.
Sample Input
Let me ask you two questions. What is the answer to life? What is the answer to the universe?
Sample Output
Forty-two is the answer to life.Forty-two is the answer to the universe.
Source
2009 Stanford Local ACM Programming Contest
Recommend
zhengfeng | We have carefully selected several similar problems for you: 2196 2242 1520 3454 3457
有个坑,当开始是what 但是以.结尾时不用换,,还有刚开始没看清题,以为多组输入数据,写成while!=EOF型的一直超时,,,额,,水死了
ac代码
#include<stdio.h>#include<string.h>int main(){char s[100010];char *p,*m,*i,*j;gets(s);p=strstr(s,"What is");m=p;while(p){for(i=p+4;;i++){if(*i=='?'){printf("Forty-two");for(j=p+4;j<i;j++){printf("%c",*j);}printf(".\n");break;}if(*i=='.')break;}p=strstr(i+1,"What is");}}
0 0
- HDOJ 题目3456 Universal Oracle(模拟,水)
- HDOJ 题目5444 Elven Postman(BST模拟水啊。。。)
- HDOJ 题目1035 Robot Motion(模拟)
- HDOJ 题目3257 Hello World!(模拟)
- hdoj.3456 Universal Oracle【水题】 2015/03/26
- HDOJ题目1022Train Problem I(栈的模拟)
- HDOJ 题目1276士兵队列训练问题(队列,模拟)
- HDOJ 题目1302 The Snail(模拟,水题)
- HDOJ 题目5097 Page Rank(矩阵运算,模拟)
- hdu 3456 Universal Oracle
- HDOJ 题目1840 Equations(水,数学)
- HDOJ 题目 1300 Pearls(DP水)
- hdoj 密码 2043 (模拟水)
- hdoj Machine 5670 (模拟)水
- HDOJ 题目4500 小Q系列故事——屌丝的逆袭(模拟)
- hdoj简单题目(一)
- hdoj简单题目(二)
- hdoj简单题目(三)
- rubymine 安装破解
- 【HDU3094】A tree game 博弈,树形删边游戏
- 通过代码创建Java项目
- 迷你浏览器——WebView学习
- jquery去除回车换行
- HDOJ 题目3456 Universal Oracle(模拟,水)
- 论文中的图目录与表目录
- nagios插件之监控单个tomcat线程数
- Java网络编程-代理
- 程序存储问题
- 大数相加
- THREE.js -- 沿物体表面放置对象
- Clouder CDH Hadoop安装
- HashMap练习题