CodeForces 735A Ostap and Grasshopper
来源:互联网 发布:淘宝违规词查询工具 编辑:程序博客网 时间:2024/05/21 18:41
题目大意:从G点跳到T点,每次跳k步,不能跳到#,但是跳过去没问题,问能否到达T
#include<iostream>#include<algorithm>using namespace std;int main(){ int n,k; cin>>n>>k; char str[n]; cin>>str; int st,en; for(int i=0;i<n;i++){ if(str[i]=='G') st=i; if(str[i]=='T') en=i; } if(st>en) swap(st,en); int flag=0; for(int i=st;i<n;i+=k){ if(str[i]=='#') break; else if(i==en){ flag=1; break; } } if(flag) cout<<"YES"<<endl; else cout<<"NO"<<endl;}
阅读全文
0 0
- CodeForces 735A - Ostap and Grasshopper(思维)
- codeforces - 735A-Ostap and Grasshopper
- 735 A. Ostap and Grasshopper codeforces
- codeforces 735 A Ostap and Grasshopper
- CodeForces 735A Ostap and Grasshopper
- Codeforces Round #382 (Div. 2) 735A - Ostap and Grasshopper
- codeforces 735 A. Ostap and Grasshopper (简单题)
- CodeForces 735 A.Ostap and Grasshopper(水~)
- Codeforces Round #382 (Div. 2) 735A Ostap and Grasshopper
- A. Ostap and Grasshopper
- Codeforces Round #382 (Div. 2) A. Ostap and Grasshopper
- Codeforces Round #382 (Div. 2) A. Ostap and Grasshopper
- Codeforces Round #382 (Div. 2) A. Ostap and Grasshopper
- Codeforces Round #382 (Div. 2)-735A. Ostap and Grasshopper(BFS)
- Codeforces735A Ostap and Grasshopper
- Ostap and Grasshopper
- 【64.22%】【codefoces round 382A】Ostap and Grasshopper
- Codeforces 733A Grasshopper And the String
- android添加menudrawer
- Date与String的互换以及日期的获取显示
- Dubbo的自产自销
- 数据结构-双端链表
- java打印从1到最大的n位数
- CodeForces 735A Ostap and Grasshopper
- 学习jdbc的总结
- Scrapy爬虫爬取天气数据存储为txt和json等多种格式
- 排序算法——希尔排序
- grep命令中文手册(info grep翻译)
- 安迪的第一个字典,紫书P112UVa10815
- 智能管家(二)——工具类封装与首页引导页开发
- 数的全排列
- Ubuntu的那些事儿