ZOJ 1825 Compound Words
Compound Words
This problem will be judged on ZJU. Original ID: 1825
64-bit integer IO format: %lld Java class name: Main
Input
Standard input consists of a number of lowercase words, one per line, in alphabetical order. There will be no more than 120,000 words.
Output
Your output should contain all the compound words, one per line, in alphabetical order.
Sample Input
a
alien
born
less
lien
never
nevertheless
new
newborn
the
zebra
Sample Output
alien
newborn
Source
#include <bits/stdc++.h>
using namespace std;
unordered_set<string>us;
string word[];
int main() {
ios::sync_with_stdio(false);
int tot = ;
while(cin>>word[tot]) us.insert(word[tot++]);
for(int i = ; i < tot; ++i) {
if(word[i].length() > ) {
for(int j = ,len = word[i].length(); j < len; ++j) {
string a = word[i].substr(,j);
string b = word[i].substr(j);
if(us.count(a) && us.count(b)) {
cout<<word[i]<<endl;
break;
}
}
}
}
return ;
}
ZOJ 1825 Compound Words的更多相关文章
- ZOJ 1825 compoud words
题目大意:输入一串递增的单词序列,需要找出符合条件的单词递增输出,条件是:将一个单词拆成左右两个单词后,能在输入中找到这两个单词.例如单词 alien,可以拆成 a 和 lien,而输入中刚好同时有a ...
- ZOJ People Counting
第十三届浙江省大学生程序设计竞赛 I 题, 一道模拟题. ZOJ 3944http://www.icpc.moe/onlinejudge/showProblem.do?problemCode=394 ...
- 【BZOJ 1061】【Vijos 1825】【NOI 2008】志愿者招募
http://www.lydsy.com/JudgeOnline/problem.php?id=1061 https://vijos.org/p/1825 直接上姜爷论文... #include< ...
- ZOJ 3686 A Simple Tree Problem
A Simple Tree Problem Time Limit: 3 Seconds Memory Limit: 65536 KB Given a rooted tree, each no ...
- ZOJ Problem Set - 1394 Polar Explorer
这道题目还是简单的,但是自己WA了好几次,总结下: 1.对输入的总结,加上上次ZOJ Problem Set - 1334 Basically Speaking ac代码及总结这道题目的总结 题目要求 ...
- ZOJ Problem Set - 1392 The Hardest Problem Ever
放了一个长长的暑假,可能是这辈子最后一个这么长的暑假了吧,呵呵...今天来实验室了,先找了zoj上面简单的题目练练手直接贴代码了,不解释,就是一道简单的密文转换问题: #include <std ...
- ZOJ Problem Set - 1049 I Think I Need a Houseboat
这道题目说白了是一道平面几何的数学问题,重在理解题目的意思: 题目说,弗雷德想买地盖房养老,但是土地每年会被密西西比河淹掉一部分,而且经调查是以半圆形的方式淹没的,每年淹没50平方英里,以初始水岸线为 ...
- ZOJ Problem Set - 1006 Do the Untwist
今天在ZOJ上做了道很简单的题目是关于加密解密问题的,此题的关键点就在于求余的逆运算: 比如假设都是正整数 A=(B-C)%D 则 B - C = D*n + A 其中 A < D 移项 B = ...
- ZOJ Problem Set - 1001 A + B Problem
ZOJ ACM题集,编译环境VC6.0 #include <stdio.h> int main() { int a,b; while(scanf("%d%d",& ...
随机推荐
- 浅谈冒烟测试(Smoke Testing)
鉴于之前跟开发提到提测前需要进行冒烟测试,然后几个开发一脸迷茫的问我:什么叫冒烟测试?所以我准备跟大家从以下几个方面简单的分享一下什么是冒烟测试. 一.软件测试的分类 二.冒烟测试(Smoke Tes ...
- 好文应该收藏-----redis 配置自启动
话不多说,请看原作者笔记,亲测,可用 https://blog.csdn.net/qq_42810276/article/details/81296012
- vue 阿里云上传组件
vue 阿里云上传组件 Vue.js上传图片到阿里云OSS存储 测试项目git地址 本测试项目启动方法 示例链接 组件配置项 实践解释 本文主要介绍如何 在vue项目中使用web 直传方式上传阿里云o ...
- Numpy的使用规则
之前安装的python版本是3.7 各种库都是自己一个一个下载安装的 很操心 各种缺功能 后来发现了anaconda 啊 真是一个好东西 简单来说 它就是一个涵盖大部分常用库的python包 一次安装 ...
- 2019-03-28 SQL Server Table
-- table 是实际表 view是虚表.你可以认为view是一个查询的结果 -- 声明@tbBonds table declare @tbBonds table(TrustBondId int n ...
- nginx 查看每秒有多少访问量
nginx访问量统计 1.根据访问IP统计UV awk '{print $1}' access.log|sort | uniq -c |wc -l 2.统计访问URL统计PV awk '{print ...
- Apache Tez on hive
———————————————————— 调配 Hadoop ———————————————————— 1 将 编译好的 TEZ .tar.gz 文件上传到 HDFS 中. hdfs fs -p ...
- vargrind 安卓apk
上层为安卓, 下层为调用c/c++ 库 1.将vargind 按官网方法下载源代码编译 得Inst文件夹 2.通过win 下安卓sdk 中 platform-tools 中的adb push Ins ...
- 使用Xcode-debug模式和release模式
在开发过程中,我们常常须要用到NSLog输出一些信息,甚至有的开发过程.必须在控制台查看输出,有经验的程序猿通过控制台输出就能知道整个数据交互的一个流程. 可是一个公布的程序,里面带有太多的NSLog ...
- spark 朴素贝叶斯
训练代码(scala) import org.apache.spark.mllib.classification.{NaiveBayes,NaiveBayesModel} import org.apa ...