poj 3087
来源:互联网 发布:aframe.js 加载obj 编辑:程序博客网 时间:2024/06/11 19:42
</pre><p>简单的模拟题目 </p><p>一开始理解题目错了,把 拆分后的s1,s2弄反了,答案错误。</p><p>不过代码的速度太慢了,32ms</p><p>大神都是0ms的。T~T</p><pre name="code" class="cpp">#include <iostream>#include <memory>#include <string>using namespace std;int n,c,time,i;string no;string s1,s2,s;int shuffle(){ int i,j; string t1=s1,t2=s2; do { string temp; for(i=0;i<c;i++) //合并 temp=temp+t2[i]+t1[i]; for(i=0;i<c;i++) //拆分 t1[i]=temp[i]; for(j=0;j<c;i++,j++) t2[j]=temp[i]; time++; // cout<<t1<<" "<<t2<<" "<<temp<<endl; if(temp==s) return time; }while(t1!=s1&&s2!=t2); return -1;}int main(){ cin>>n; for(i=1;i<=n;i++) { time=0; cin>>c; cin>>s1; cin>>s2; cin>>s; cout<<i<<" "<<shuffle()<<endl; }}
0 0
- POJ 3087
- poj 3087
- POJ 3087
- poj-3087
- poj 3087
- poj 3087
- 3087POJ
- poj--3087
- POJ 3087
- poj 3087
- POJ 3087
- POJ 3087
- POJ 3087
- poj 3087解题报告
- Poj 3087 (bfs)
- poj 3087 模拟
- poj 3087 模拟
- poj 3087 模拟题
- R语言从字符串中读取dataframe方法
- POJ 3083-Children of the Candy Corn(dfs+bfs)
- 案例说明stm32官方库函数使用方法 (库版本v3.5, Keil MDK 5)
- hdu 1050 Moving Tables(贪心)
- uva572
- poj 3087
- FastDFS
- LINK : fatal error LNK1123: failure during conversion to COFF: file invalid or corrupt
- zoj 2750 Idiomatic Phrases Game
- SOJ.The hardest problem
- 《Java和Android开发实战详解》
- Owl Carousel 2强大的响应式jQuery旋转木马插件
- 关于php socket编程中遇到的一些问题
- Spring+CXF 全注解版