Codeforces Round #256 (Div. 2) B. Suffix Structures(模拟)_html/css_WEB-ITnose
题目链接:http://codeforces.com/contest/448/problem/B
----------------------------------------------------------------------------------------------------------------------------------------------------------
欢迎光临天资小屋:http://user.qzone.qq.com/593830943/main
----------------------------------------------------------------------------------------------------------------------------------------------------------
B. Suffix Structures
time limit per test
1 second
memory limit per test
256 megabytes
input
standard input
output
standard output
Bizon the Champion isn't just a bison. He also is a favorite of the "Bizons" team.
At a competition the "Bizons" got the following problem: "You are given two distinct words (strings of English letters), s and t. You need to transform word s into word t". The task looked simple to the guys because they know the suffix data structures well. Bizon Senior loves suffix automaton. By applying it once to a string, he can remove from this string any single character. Bizon Middle knows suffix array well. By applying it once to a string, he can swap any two characters of this string. The guys do not know anything about the suffix tree, but it can help them do much more.
Bizon the Champion wonders whether the "Bizons" can solve the problem. Perhaps, the solution do not require both data structures. Find out whether the guys can solve the problem and if they can, how do they do it? Can they solve it either only with use of suffix automaton or only with use of suffix array or they need both structures? Note that any structure may be used an unlimited number of times, the structures may be used in any order.
Input
The first line contains a non-empty word s. The second line contains a non-empty word t. Words s and t are different. Each word consists only of lowercase English letters. Each word contains at most 100 letters.
Output
In the single line print the answer to the problem. Print "need tree" (without the quotes) if word s cannot be transformed into word teven with use of both suffix array and suffix automaton. Print "automaton" (without the quotes) if you need only the suffix automaton to solve the problem. Print "array" (without the quotes) if you need only the suffix array to solve the problem. Print "both" (without the quotes), if you need both data structures to solve the problem.
It's guaranteed that if you can solve the problem only with use of suffix array, then it is impossible to solve it only with use of suffix automaton. This is also true for suffix automaton.
Sample test(s)
input
automatontomat
output
automaton
input
arrayarary
output
array
input
bothhot
output
both
input
needtree
output
need tree
Note
In the third sample you can act like that: first transform "both" into "oth" by removing the first character using the suffix automaton and then make two swaps of the string using the suffix array and get "hot".
代码如下:
#include <iostream>#include <algorithm>using namespace std;#define N 47#define M 100000#include <cstring>int a[N],b[N];char s[M+17], t[M+17];void init(){ memset(a,0,sizeof(a)); memset(b,0,sizeof(b));}int main(){ int i, j; while(cin >> s) { init(); cin>>t; int lens = strlen(s); int lent = strlen(t); for(i = 0; i = lens) //表示不存在不交换s子串的顺序能组成t的情况 { p = 1; break; } j++; } if(p == 1) { cout <br> <br> <p></p> <br> <p></p> </cstring></algorithm></iostream>

핫 AI 도구

Undresser.AI Undress
사실적인 누드 사진을 만들기 위한 AI 기반 앱

AI Clothes Remover
사진에서 옷을 제거하는 온라인 AI 도구입니다.

Undress AI Tool
무료로 이미지를 벗다

Clothoff.io
AI 옷 제거제

AI Hentai Generator
AI Hentai를 무료로 생성하십시오.

인기 기사

뜨거운 도구

메모장++7.3.1
사용하기 쉬운 무료 코드 편집기

SublimeText3 중국어 버전
중국어 버전, 사용하기 매우 쉽습니다.

스튜디오 13.0.1 보내기
강력한 PHP 통합 개발 환경

드림위버 CS6
시각적 웹 개발 도구

SublimeText3 Mac 버전
신 수준의 코드 편집 소프트웨어(SublimeText3)

뜨거운 주제











PHP에서 round는 "반올림"을 의미하며 부동 소수점 숫자를 정수로 변환하는 내장 함수입니다. 이 함수는 부동 소수점 숫자를 반올림하고 float 유형의 정수 값을 반환할 수 있습니다. 구문은 "round(number, Precision,mode)입니다. );".

Transformer는 다양한 기계 학습 작업에 널리 사용되며 훌륭한 결과를 얻었습니다. 그렇다면 또 어떻게 사용할 수 있을까요? 상상력이 뛰어난 연구자들은 실제로 이를 사용하여 프로그래밍 가능한 컴퓨터를 설계하고 싶어합니다! "프로그램 가능한 컴퓨터로서의 루프형 트랜스포머"라는 제목의 이 논문의 저자는 프린스턴 대학교와 위스콘신 대학교 출신이며, 트랜스포머를 사용하여 범용 컴퓨터를 구현하는 방법을 탐구하는 것을 목표로 합니다. 특히 저자는 특정 가중치로 프로그래밍하고 루프에 배치함으로써 변압기 네트워크를 범용 컴퓨터로 사용하기 위한 프레임워크를 제안합니다. 이 프레임워크에서

머신 러닝을 통해 컴퓨터 그래픽(CG) 시뮬레이션을 더욱 현실감 있게 만들어보세요! 이 방법은 NFM(Neural Flow Maps)이라고 하며, 4개의 소용돌이로 연기를 정확하게 시뮬레이션할 수 있습니다. 더 복잡한 것 또한 쉽게 실현할 수 있습니다. AI 애플리케이션이 하늘을 날아다니는 이 시대에도 CG 물리 시뮬레이션은 여전히 그렇습니다. 전통적인 수치 알고리즘의 세계입니다. △NFM은 '도약(leapfrog)'을 시뮬레이션합니다. CG에 신경망을 적용하면 눈부신 시각적 효과를 낼 수 있지만 물리적 특성을 엄격하고 확실하게 설명할 수는 없습니다. △NFM이 '잉크 방울'을 시뮬레이션하는 이유는 신경망을 기반으로 한 물리적 시뮬레이션이 아직 개념 증명 단계에 있고, 생성되는 효과가 SOTA와는 거리가 멀기 때문입니다. 이 복잡한 문제를 해결하기 위해,

round() 함수는 부동 소수점 숫자를 지정된 소수 자릿수로 반올림할 수 있는 PHP 숫자 형식 라이브러리의 매우 유용한 함수입니다. 그러나 PHP의 나눗셈 연산은 소수점이 무한하거나 정밀도가 손실될 수 있으므로 제수에 대한 반올림도 필요합니다. 다음으로 PHP의 round() 함수를 사용하여 나누기와 반올림하는 방법을 자세히 설명하겠습니다.

MySQL에서 ROUND 함수를 사용하여 소수 자릿수를 가로채는 방법 MySQL에서는 ROUND 함수를 사용하여 소수 자릿수를 가로챌 수 있습니다. ROUND 함수는 숫자를 지정된 소수 자릿수로 반올림합니다. 다음에서는 ROUND 함수의 사용법을 자세히 소개하고 코드 예제를 제공합니다. 구문: ROUND(X,D)X는 반올림할 숫자를 나타내고, D는 유지할 소수 자릿수를 나타냅니다. ROUND 함수를 사용하여 소수 자릿수를 가로채는 예: produc이라는 테이블이 있다고 가정합니다.

API 테스트 및 시뮬레이션을 위해 GitLab을 사용하는 방법 소개: 소프트웨어 개발 과정에서 API(애플리케이션 프로그래밍 인터페이스, 애플리케이션 프로그래밍 인터페이스) 테스트 및 시뮬레이션은 개발자가 API의 정확성과 성능을 확인하는 데 도움이 될 수 있습니다. 잠재적인 문제를 미리 발견할 수 있습니다. GitLab은 버전 제어 및 팀 협업과 같은 기능을 구현하는 매우 인기 있는 코드 호스팅 플랫폼입니다. 이번 글에서는 Git 사용법을 소개하겠습니다.

PHP 및 WebDriver 확장: 사용자의 스크롤 및 드래그 동작을 시뮬레이션하는 방법 네트워크 애플리케이션이 지속적으로 개발됨에 따라 점점 더 많은 웹사이트와 애플리케이션에서 사용자의 스크롤 및 드래그 동작을 시뮬레이션해야 합니다. 이는 테스터와 개발자가 웹사이트와 애플리케이션이 다양한 시나리오에서 제대로 작동하는지 확인하는 데 매우 중요합니다. 이 기사에서는 PHP 및 WebDriver 확장을 사용하여 사용자 스크롤 및 드래그 동작을 시뮬레이션하는 방법을 소개합니다. WebDriver는 브라우저를 자동화하는 도구입니다.

최근 삼성전자는 로컬 AI 역량을 강화하고 사용자에게 보다 개인화된 AI 경험을 제공하기 위해 영국 지식 그래프 스타트업 옥스포드 시맨틱 테크놀로지스(Oxford Semantic Technologies) 인수를 발표했습니다. 이 회사의 주요 제품은 지식 그래프 기술을 사용해 정보를 상호 연결된 네트워크로 저장하는 AI 엔진인 RDFox입니다. 데이터를 처리하는 방식은 인간이 지식을 획득하고, 기억하고, 회상하고, 추론하는 방식과 유사합니다. 이 기술은 사용자가 사용하는 제품이나 서비스에 대한 기기의 이해도를 높여 신속한 정보 검색 및 추천을 가능하게 합니다. Oxford Semantic Technologies는 2017년 옥스퍼드 대학교 교수 Ian Horrocks, Boris Motik 및 Bernardo Cuenca 세 명이 설립한 것으로 알려져 있습니다.
