Codeforces 443 B. Kolya and Tandem Repeat
and Codeforces repeat 443
2023-09-14 09:08:06 时间
纯粹练JAVA....
import java.util.*; public class Main { public static void main(String[] args) { Scanner cin=new Scanner(System.in); String str=cin.next(); int k=cin.nextInt(); int ans=2; while(k-->0) { str=str+"*"; for(int len=ans/2;2*len<=str.length();len++) { for(int i=0;i+2*len-1<str.length();i++) { boolean flag=true; int u=i,v=i+len; for(int j=0;j<len&&flag;j++) { if(str.charAt(u+j)=='*'||str.charAt(v+j)=='*') continue; if(str.charAt(u+j)==str.charAt(v+j)) continue; else flag=false; } if(flag) ans=Math.max(ans,len*2); } } } System.out.println(ans); } }
版权声明:来自: 代码代码猿猿AC路 http://blog.csdn.net/ck_boss
相关文章
- codeforces Fedor and New Game
- [PWA] Add Push Notifications to a PWA with React in Chrome and on Android
- [TypeScript] Make Properties and Index Signatures Readonly in TypeScript
- [Git] git Ignore a File that has Already been Committed and Pushed
- [Vue @Component] Handle Errors and Loading with Vue Async Components
- [TS] Class Properties Public, Private and Read Only Modifiers
- [Ruby] LEVEL 2 Methods and Classes
- [Javascript] Drawing Paths - Lines and Rectangles
- [Javascript] Webpack Loaders, Source Maps, and ES6
- CDATA and comment
- Atitit.实现继承的原理and方法java javascript .net c# php ...
- 【Codeforces 158C】Cd and pwd commands
- 【Codeforces 1106C】Lunar New Year and Number Division
- 【Codeforces Round #457 (Div. 2) A】 Jamie and Alarm Snooze
- 【19.05%】【codeforces 680D】Bear and Tower of Cubes
- 【codeforces 546B】Soldier and Badges
- 【codeforces 798D】Mike and distribution
- 【codeforces 755F】PolandBall and Gifts
- 【codeforces 508C】Anya and Ghosts
- 【codeforces 803E】Roma and Poker
- Codeforces 385 C Bear and Prime Numbers
- CodeForces 462B Appleman and Card Game(贪心)
- GN Language and Operation *****
- 神经网络贷款风险评估(base on keras and python )
- 【CSAPP随笔】CH3:Bits, Bytes, and Integers