Skip to content

Commit c9cb7d3

Browse files
committed
Initial commit
1 parent 8355a4f commit c9cb7d3

File tree

2 files changed

+79
-0
lines changed

2 files changed

+79
-0
lines changed
Lines changed: 49 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,49 @@
1+
//author @Nishant
2+
3+
#include<bits/stdc++.h>
4+
using namespace std;
5+
6+
int main(){
7+
int n, k, start;
8+
cin >> n >> k;
9+
string s;
10+
cin >> s;
11+
for(int i = 0; i < n; i++){
12+
if(s[i] == 'G'){
13+
start = i;
14+
}
15+
}
16+
bool flag = false;
17+
int x = start;
18+
while(x >= 0){
19+
if(flag){
20+
break;
21+
}
22+
if(s[x] == '#'){
23+
break;
24+
}
25+
if(s[x] == 'T'){
26+
flag = true;
27+
}
28+
x -= k;
29+
}
30+
x = start;
31+
while(x < s.size()){
32+
if(flag){
33+
break;
34+
}
35+
if(s[x] == '#'){
36+
break;
37+
}
38+
if(s[x] == 'T'){
39+
flag = true;
40+
}
41+
x += k;
42+
}
43+
if(flag){
44+
cout << "YES";
45+
}else{
46+
cout << "NO";
47+
}
48+
return 0;
49+
}
Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
//author @Nishant
2+
3+
#include<bits/stdc++.h>
4+
using namespace std;
5+
6+
int main(){
7+
int x, y;
8+
cin >> x >> y;
9+
int i = 1;
10+
int turn = 1;
11+
while(x != 0 || y != 0){
12+
if(turn == 1 && x >= i){
13+
x -= i;
14+
i++;
15+
turn = 0;
16+
}else if(turn == 0 && y >= i){
17+
y -= i;
18+
i++;
19+
turn = 1;
20+
}else{
21+
break;
22+
}
23+
}
24+
if(turn){
25+
cout << "Vladik";
26+
}else{
27+
cout << "Valera";
28+
}
29+
return 0;
30+
}

0 commit comments

Comments
 (0)