Codeforces 802H. Fake News (medium)
題目
題意:構造兩個字串
s,
p,使
p在
s中作為子序列的出現次數恰好等於
n。
其中
n≤1000000;
s,
p的長度不能超過
200。
在構造過程中保證使
s=pu
x為新字元
k→2k+1 : 令
s′=pxuxx,p′=px(
s′中含有
px,pux,pux)
k→2k+2 : 令
s′=pxxuxx,p′=px
#include<bits/stdc++.h>
using namespace std;
string p,s;
int n;
void dfs(int n,char c){
if (n==1){
s+=c,p+=c;
return;
}else if (n==2){
s+=c,s+=c,p+=c;
return;
}
if (n&1){
dfs(n/2,c+1);
s=p+c+s.substr(p.size(),s.size()-p.size()+1)+c+c,p+=c;
}else{
dfs(n/2-1,c+1);
s=p+c+c+s.substr(p.size(),s.size()-p.size()+1)+c+c,p+=c;
}
}
int main(){
scanf("%d",&n);
dfs(n,'a');
cout<<s<<' '<<p;
}
相關推薦
Codeforces 802H. Fake News (medium)
題目 題意:構造兩個字串 s s s,
codeforce 802 H. Fake News (medium) 構造 套路題
H. Fake News (medium)time limit per test1 secondmemory limit per test256 megabytesinputstandard input
CF802G Fake News (easy)
ref space ant other clas mes == sed str CF802G Fake News (easy) 題意翻譯 給定一個字符串詢問能否聽過刪除一些字母使其變為“heidi” 如果可以輸出
CodeForces - 958 F2 Lightsabers (medium) . (尺取法)
cloc const urn algorithm sync 序列 names lan 多少 傳送門 題意:給你一個n和m,再給你一個長為n的序列和一個長為m的序列,問最少要刪除多少元素,才能使第一個序列中的某個連續子串中恰好滿足第二個序列對數字的要求 題解:尺取法,設l為左
'With fake news, the people are the first line of defe LTE Router nce'
www.inhandnetworks.de Our podcast this week takes aim at fake news and how Sweden’s lining up against it. Also, gender battles in France – and why
論文研讀 “Liar, Liar Pants on Fire”:A New Benchmark Dataset for Fake News Detection
給十月畫個句號 最近上的很喜歡的一門課中,老師要求我們研讀一篇頂會論文並進行分享,好久沒能靜靜地坐下來寫一篇部落格了,接下來希望自己能夠多讀論文的同時把論文的思路以部落格的形式輸出~ 論文來源 “Liar, Liar Pants on Fire”:A New Benchmar
France’s ‘fake news’ playbook, Uber’s settlement & why we give away our personal data
“All of the people, all of the internet, all of the time”. Working for digital equality #ForEveryone. Founded by Sir Tim Berners-Lee, inventor of the web.
Detecting fake news at its source
Lately the fact-checking world has been in a bit of a crisis. Sites like Politifact and Snopes have traditionally focused on specific claims, which is admi
Detecting Fake News, At Its Source
Summary: Researchers have created a new deep learning system that can determine if a news outlet is accurate or biased based on only 150 articles published
Even the best AI for spotting fake news is still terrible
When Facebook chief executive Mark Zuckerberg promised Congress that AI would help solve the problem of fake news, he revealed little in the way of how. Ne
MIT shows how to tackle fake news using AI and ML
After the recent uproar about "fake news", it is again all quiet in India. Well, not until, another lynching or riot happens. Whatsapp is busy spreading th
Algorithm Outperforms Humans at Spotting Fake News Digital Trends
An artificial intelligence system that can tell the difference between real and fake news -- often with better success rates than its human counterparts --
[D] Fake news | AITopics
There are lots of different ways. Fake news is a broad topic. Most of the papers published on it have stated two main aspects- Text and User. You can work
Shadow Politics: Meet the Digital Sleuth Exposing Fake News
This story is for Medium members.Continue with FacebookContinue with GoogleMedium curates expert stories from leading publishers exclusively for members (w
A Mathematical Model Captures the Political Impact of Fake News
This story is for Medium members.Continue with FacebookContinue with GoogleMedium curates expert stories from leading publishers exclusively for members (w
Confessions of a Fake News Writer
I’ve been a freelance writer for years. During that time, I’ve put my all into decent work that has appeared under my byline. But despite researching and w
Codeforces 804F Fake bullions
題意 有N個幫派,每個幫派有Si個人,其中一些人有真金條 給出一張競賽圖,若圖上存在一條邊u->v,那麼如果u中一人i,v中一人j,滿足 i &n
Detecting Fake News With NLP
Which one is fake?As an example of the problem, let’s try to detect the fake news from the 4 headline given down below.It is hard to detect at first sight,
CodeForces - 802B Heidi and Library (medium)
不用 rar cout while eas medium data 保持 con Whereas humans nowadays read fewer and fewer books on paper, book readership among marmots has s
Codeforces 958C2 Encryption (medium) (區間dp優化)(*2100)
https://codeforces.com/contest/958/problem/C2 這道題是明顯的區間dp,我們跑三重for迴圈,模擬S的長度從1-n,分成的區間數(1-k),用二維陣列dp[n][k]表示 狀態轉移方程 f[i][j]=max(f[k][j−1]+