Search is not available for this dataset
name stringlengths 2 88 | description stringlengths 31 8.62k | public_tests dict | private_tests dict | solution_type stringclasses 2
values | programming_language stringclasses 5
values | solution stringlengths 1 983k |
|---|---|---|---|---|---|---|
p00139 Snakes | In a world, a mysterious snake made of only letters lives. Two types of snakes are currently identified, type A and type B, but there may be other types as well.
For class A, after ">'" is followed by one or more "=", "#" comes, and after the same number of "=" as before, "~" (half-width tilde) finish.
Class B ends w... | {
"input": [
"3\n>'======#======~\n>^Q=Q=Q=Q=Q=Q=Q=Q=Q=~~\n>'===#====~"
],
"output": [
"A\nB\nNA"
]
} | {
"input": [],
"output": []
} | IN-CORRECT | cpp | #include <bits/stdc++.h>
using namespace std;
int main() {
int n;
cin >> n;
while (n--) {
string s;
cin >> s;
int f1 = 0, f2 = 0, k = -1;
bool f;
for (int i = 0; i < s.size(); i++)
if (s[i] == '>') {
k = i;
break;
}
if (k == -1 || s.size() < 5) {
printf("N... |
p00139 Snakes | In a world, a mysterious snake made of only letters lives. Two types of snakes are currently identified, type A and type B, but there may be other types as well.
For class A, after ">'" is followed by one or more "=", "#" comes, and after the same number of "=" as before, "~" (half-width tilde) finish.
Class B ends w... | {
"input": [
"3\n>'======#======~\n>^Q=Q=Q=Q=Q=Q=Q=Q=Q=~~\n>'===#====~"
],
"output": [
"A\nB\nNA"
]
} | {
"input": [],
"output": []
} | IN-CORRECT | cpp | #include <bits/stdc++.h>
using namespace std;
int main() {
int n;
cin >> n;
for (int D = 0; D < n; ++D) {
string s;
cin >> s;
if (s.compare(0, 2, ">'") == 0) {
int bef_eq = 0;
int aft_eq = 0;
int shp = 0;
int pos_shp = 0;
int pos_tld = 0;
for (unsigned int i = 2; i ... |
p00139 Snakes | In a world, a mysterious snake made of only letters lives. Two types of snakes are currently identified, type A and type B, but there may be other types as well.
For class A, after ">'" is followed by one or more "=", "#" comes, and after the same number of "=" as before, "~" (half-width tilde) finish.
Class B ends w... | {
"input": [
"3\n>'======#======~\n>^Q=Q=Q=Q=Q=Q=Q=Q=Q=~~\n>'===#====~"
],
"output": [
"A\nB\nNA"
]
} | {
"input": [],
"output": []
} | IN-CORRECT | cpp | #include <bits/stdc++.h>
using namespace std;
int main() {
int n;
scanf("%d", &n);
for (int i = 0; i < n; i++) {
string snake;
cin >> snake;
if (snake.length() < 2) {
puts("NA");
continue;
}
if (snake[0] == '>' && snake[1] == '\'') {
int cnt = 0;
int j;
for (j = 2... |
p00139 Snakes | In a world, a mysterious snake made of only letters lives. Two types of snakes are currently identified, type A and type B, but there may be other types as well.
For class A, after ">'" is followed by one or more "=", "#" comes, and after the same number of "=" as before, "~" (half-width tilde) finish.
Class B ends w... | {
"input": [
"3\n>'======#======~\n>^Q=Q=Q=Q=Q=Q=Q=Q=Q=~~\n>'===#====~"
],
"output": [
"A\nB\nNA"
]
} | {
"input": [],
"output": []
} | IN-CORRECT | UNKNOWN | require 'pp'
$stdin.gets.chomp.to_i.times do
line = $stdin.gets.chomp
ans = false
if (m = line.match(/>'(=+)#(=+)~$/)) then
if m[1].length == m[2].length then
puts 'A'
ans = true
end
end
if (m = line.match(/>\^(.*?)~~$/)) then
if ((m[1].unpack("a2"*(m[1].length/2))).all? {|x| x == "... |
p00139 Snakes | In a world, a mysterious snake made of only letters lives. Two types of snakes are currently identified, type A and type B, but there may be other types as well.
For class A, after ">'" is followed by one or more "=", "#" comes, and after the same number of "=" as before, "~" (half-width tilde) finish.
Class B ends w... | {
"input": [
"3\n>'======#======~\n>^Q=Q=Q=Q=Q=Q=Q=Q=Q=~~\n>'===#====~"
],
"output": [
"A\nB\nNA"
]
} | {
"input": [],
"output": []
} | IN-CORRECT | UNKNOWN | #include <bits/stdc++.h>
int main(void) {
int quantity, i, j, idx, count = 0;
char snake[200] = {0};
scanf("%d", &quantity);
for (i = 0; i < quantity; i++) {
scanf("%s", snake);
if (snake[0] != '>') {
puts("NA");
break;
} else if (snake[1] == '\'') {
for (j = 2; j < 199; j++) {
... |
p00139 Snakes | In a world, a mysterious snake made of only letters lives. Two types of snakes are currently identified, type A and type B, but there may be other types as well.
For class A, after ">'" is followed by one or more "=", "#" comes, and after the same number of "=" as before, "~" (half-width tilde) finish.
Class B ends w... | {
"input": [
"3\n>'======#======~\n>^Q=Q=Q=Q=Q=Q=Q=Q=Q=~~\n>'===#====~"
],
"output": [
"A\nB\nNA"
]
} | {
"input": [],
"output": []
} | IN-CORRECT | cpp | #include <bits/stdc++.h>
using namespace std;
void a() {
cout << "NA" << endl;
return;
}
int main() {
int n;
vector<string> sample;
string aaa;
cin >> n;
for (int i = 0; i < n; i++) {
cin >> aaa;
sample.push_back(aaa);
}
for (int i = 0; i < n; i++) {
string snake = sample[i];
string::s... |
p00139 Snakes | In a world, a mysterious snake made of only letters lives. Two types of snakes are currently identified, type A and type B, but there may be other types as well.
For class A, after ">'" is followed by one or more "=", "#" comes, and after the same number of "=" as before, "~" (half-width tilde) finish.
Class B ends w... | {
"input": [
"3\n>'======#======~\n>^Q=Q=Q=Q=Q=Q=Q=Q=Q=~~\n>'===#====~"
],
"output": [
"A\nB\nNA"
]
} | {
"input": [],
"output": []
} | IN-CORRECT | cpp | #include <bits/stdc++.h>
using namespace std;
int main() {
int n;
cin >> n;
while (n--) {
string str;
string kp;
string set;
int flag = 0;
int count = 0;
int i = 0;
cin >> str;
for (i = 0; i < 2; i++) kp += str[i]++;
if (kp == ">'") {
while (str[i] != '#') {
if (s... |
p00139 Snakes | In a world, a mysterious snake made of only letters lives. Two types of snakes are currently identified, type A and type B, but there may be other types as well.
For class A, after ">'" is followed by one or more "=", "#" comes, and after the same number of "=" as before, "~" (half-width tilde) finish.
Class B ends w... | {
"input": [
"3\n>'======#======~\n>^Q=Q=Q=Q=Q=Q=Q=Q=Q=~~\n>'===#====~"
],
"output": [
"A\nB\nNA"
]
} | {
"input": [],
"output": []
} | IN-CORRECT | cpp | #include <bits/stdc++.h>
using namespace std;
string vbString(int Number, string Character) {
string res = "";
for (int i = 0; i < Number; i++) res += Character;
return res;
}
string checksnake(string s) {
string t;
for (int i = 1; i < 60; i++) {
t = ">\'" + vbString(i, "=") + "#" + vbString(i, "=") + "~"... |
p00139 Snakes | In a world, a mysterious snake made of only letters lives. Two types of snakes are currently identified, type A and type B, but there may be other types as well.
For class A, after ">'" is followed by one or more "=", "#" comes, and after the same number of "=" as before, "~" (half-width tilde) finish.
Class B ends w... | {
"input": [
"3\n>'======#======~\n>^Q=Q=Q=Q=Q=Q=Q=Q=Q=~~\n>'===#====~"
],
"output": [
"A\nB\nNA"
]
} | {
"input": [],
"output": []
} | IN-CORRECT | UNKNOWN | #include <bits/stdc++.h>
int main(void) {
int quantity, i, j, idx;
char snake[200] = {0};
scanf("%d", &quantity);
for (i = 0; i < quantity; i++) {
int count = 0;
scanf("%s", snake);
if (snake[0] != '>') {
puts("NA");
} else if (snake[1] == '\'') {
for (j = 2; j < 199; j++) {
... |
p00139 Snakes | In a world, a mysterious snake made of only letters lives. Two types of snakes are currently identified, type A and type B, but there may be other types as well.
For class A, after ">'" is followed by one or more "=", "#" comes, and after the same number of "=" as before, "~" (half-width tilde) finish.
Class B ends w... | {
"input": [
"3\n>'======#======~\n>^Q=Q=Q=Q=Q=Q=Q=Q=Q=~~\n>'===#====~"
],
"output": [
"A\nB\nNA"
]
} | {
"input": [],
"output": []
} | IN-CORRECT | UNKNOWN | #include <bits/stdc++.h>
int main(int argc, const char* argv[]) {
int num;
int i, j, k, l;
scanf("%d", &num);
for (l = 0; l < num + 1; l++) {
char snake[200];
int bodyacnt = 0;
int bodybcnt = 0;
int midcnt = 0;
int endacnt = 0;
int endbcnt = 0;
int nacnt = 0;
for (i = 0; i < 200;... |
p00139 Snakes | In a world, a mysterious snake made of only letters lives. Two types of snakes are currently identified, type A and type B, but there may be other types as well.
For class A, after ">'" is followed by one or more "=", "#" comes, and after the same number of "=" as before, "~" (half-width tilde) finish.
Class B ends w... | {
"input": [
"3\n>'======#======~\n>^Q=Q=Q=Q=Q=Q=Q=Q=Q=~~\n>'===#====~"
],
"output": [
"A\nB\nNA"
]
} | {
"input": [],
"output": []
} | IN-CORRECT | cpp | #include <bits/stdc++.h>
using namespace std;
template <class T>
ostream& operator<<(ostream& os, vector<T> v) {
for (typename vector<T>::iterator it_i = v.begin(); it_i != v.end(); ++it_i) {
os << *it_i << ", ";
}
return os;
}
bool checkA(string s) {
set<string> S;
for (int i = 1; i <= 100; ++i) {
S.... |
p00139 Snakes | In a world, a mysterious snake made of only letters lives. Two types of snakes are currently identified, type A and type B, but there may be other types as well.
For class A, after ">'" is followed by one or more "=", "#" comes, and after the same number of "=" as before, "~" (half-width tilde) finish.
Class B ends w... | {
"input": [
"3\n>'======#======~\n>^Q=Q=Q=Q=Q=Q=Q=Q=Q=~~\n>'===#====~"
],
"output": [
"A\nB\nNA"
]
} | {
"input": [],
"output": []
} | IN-CORRECT | cpp | #include <bits/stdc++.h>
using namespace std;
int main() {
int Tc;
string s;
while (cin >> Tc) {
while (Tc--) {
cin >> s;
int const N = s.size();
bool NA = 0;
bool isA;
if (s[1] == '\'') {
if (s.substr(2, (N - 3) / 2) + "~" != s.substr(3 + (N - 3) / 2)) NA = 1;
if... |
p00139 Snakes | In a world, a mysterious snake made of only letters lives. Two types of snakes are currently identified, type A and type B, but there may be other types as well.
For class A, after ">'" is followed by one or more "=", "#" comes, and after the same number of "=" as before, "~" (half-width tilde) finish.
Class B ends w... | {
"input": [
"3\n>'======#======~\n>^Q=Q=Q=Q=Q=Q=Q=Q=Q=~~\n>'===#====~"
],
"output": [
"A\nB\nNA"
]
} | {
"input": [],
"output": []
} | IN-CORRECT | cpp | #include <bits/stdc++.h>
using namespace std;
int main() {
string s;
int n;
cin >> n;
for (int i = 0; i < n; i++) {
cin >> s;
int size = s.size();
string A = "";
string B = "";
for (int i = 0; i < size; i++) {
if (i == 0)
A += ">";
else if (i == 1)
A += "'";
... |
p00139 Snakes | In a world, a mysterious snake made of only letters lives. Two types of snakes are currently identified, type A and type B, but there may be other types as well.
For class A, after ">'" is followed by one or more "=", "#" comes, and after the same number of "=" as before, "~" (half-width tilde) finish.
Class B ends w... | {
"input": [
"3\n>'======#======~\n>^Q=Q=Q=Q=Q=Q=Q=Q=Q=~~\n>'===#====~"
],
"output": [
"A\nB\nNA"
]
} | {
"input": [],
"output": []
} | IN-CORRECT | python3 | def checkA(s):
if s[:2] == ">'" and s[-1] == "~":
body = s[2:-1]
if len(body) >= 3 and body.count("#") == 1 and body.index("#") == len(body) // 2:
return True
else:
return False
else:
return False
def checkB(s):
if s[:2] == ">^" and s[-2:] == "~~":
body = s[2:-2]
if len(body) ... |
p00139 Snakes | In a world, a mysterious snake made of only letters lives. Two types of snakes are currently identified, type A and type B, but there may be other types as well.
For class A, after ">'" is followed by one or more "=", "#" comes, and after the same number of "=" as before, "~" (half-width tilde) finish.
Class B ends w... | {
"input": [
"3\n>'======#======~\n>^Q=Q=Q=Q=Q=Q=Q=Q=Q=~~\n>'===#====~"
],
"output": [
"A\nB\nNA"
]
} | {
"input": [],
"output": []
} | IN-CORRECT | cpp | #include <bits/stdc++.h>
using namespace std;
void a() {
cout << "NA" << endl;
return;
}
int main() {
int n;
cin >> n;
for (int i = 0; i < n; i++) {
string snake;
cin >> snake;
string::size_type aruyon;
if ((aruyon = snake.find(">'")) == 0) {
int equal = 0;
int j;
for (j = 2;... |
p00139 Snakes | In a world, a mysterious snake made of only letters lives. Two types of snakes are currently identified, type A and type B, but there may be other types as well.
For class A, after ">'" is followed by one or more "=", "#" comes, and after the same number of "=" as before, "~" (half-width tilde) finish.
Class B ends w... | {
"input": [
"3\n>'======#======~\n>^Q=Q=Q=Q=Q=Q=Q=Q=Q=~~\n>'===#====~"
],
"output": [
"A\nB\nNA"
]
} | {
"input": [],
"output": []
} | IN-CORRECT | cpp | #include <bits/stdc++.h>
using namespace std;
bool asnake(string s) {
int n = s.size();
string com = ">\'";
for (int i = 0; i < (n - 4) / 2; i++) com += '=';
com += '#';
for (int i = 0; i < (n - 4) / 2; i++) com += '=';
com += '~';
if (s == com)
return true;
else
return false;
}
bool bsnake(stri... |
p00139 Snakes | In a world, a mysterious snake made of only letters lives. Two types of snakes are currently identified, type A and type B, but there may be other types as well.
For class A, after ">'" is followed by one or more "=", "#" comes, and after the same number of "=" as before, "~" (half-width tilde) finish.
Class B ends w... | {
"input": [
"3\n>'======#======~\n>^Q=Q=Q=Q=Q=Q=Q=Q=Q=~~\n>'===#====~"
],
"output": [
"A\nB\nNA"
]
} | {
"input": [],
"output": []
} | IN-CORRECT | cpp | #include <bits/stdc++.h>
using namespace std;
int main() {
int N, j;
cin >> N;
while (N--) {
int runcnt = 0, j;
char S[150] = {0};
cin >> S;
if (S[0] == '>' && S[1] == 39) {
int K = 0;
for (j = 2; j < 1000; j++) {
if (S[j] == '=') {
runcnt++;
K = 1;
... |
p00139 Snakes | In a world, a mysterious snake made of only letters lives. Two types of snakes are currently identified, type A and type B, but there may be other types as well.
For class A, after ">'" is followed by one or more "=", "#" comes, and after the same number of "=" as before, "~" (half-width tilde) finish.
Class B ends w... | {
"input": [
"3\n>'======#======~\n>^Q=Q=Q=Q=Q=Q=Q=Q=Q=~~\n>'===#====~"
],
"output": [
"A\nB\nNA"
]
} | {
"input": [],
"output": []
} | IN-CORRECT | UNKNOWN | #include <bits/stdc++.h>
int main(void) {
int quantity, i, j, idx;
char snake[200] = {0};
char *str;
scanf("%d", &quantity);
for (i = 0; i < quantity; i++) {
int count = 0;
scanf("%s", snake);
if (snake[0] != '>') {
puts("NA");
} else if (snake[1] == '\'') {
for (j = 2; j < 199; j+... |
p00139 Snakes | In a world, a mysterious snake made of only letters lives. Two types of snakes are currently identified, type A and type B, but there may be other types as well.
For class A, after ">'" is followed by one or more "=", "#" comes, and after the same number of "=" as before, "~" (half-width tilde) finish.
Class B ends w... | {
"input": [
"3\n>'======#======~\n>^Q=Q=Q=Q=Q=Q=Q=Q=Q=~~\n>'===#====~"
],
"output": [
"A\nB\nNA"
]
} | {
"input": [],
"output": []
} | IN-CORRECT | cpp | #include <bits/stdc++.h>
using namespace std ;
#define pb(n) push_back(n)
#define fi first
#define se second
#define all(r) (r).begin(),(r).end()
#define gsort(st,en) sort((st),(en),greater<int>())
#define vmax(ary) *max_element(all(ary))
#define vmin(ary) *min_element(all(ary))
#define debug(x) cout<<#x<<": "<<x<<end... |
p00139 Snakes | In a world, a mysterious snake made of only letters lives. Two types of snakes are currently identified, type A and type B, but there may be other types as well.
For class A, after ">'" is followed by one or more "=", "#" comes, and after the same number of "=" as before, "~" (half-width tilde) finish.
Class B ends w... | {
"input": [
"3\n>'======#======~\n>^Q=Q=Q=Q=Q=Q=Q=Q=Q=~~\n>'===#====~"
],
"output": [
"A\nB\nNA"
]
} | {
"input": [],
"output": []
} | IN-CORRECT | UNKNOWN | #include <bits/stdc++.h>
int A_snake(char snake[]);
int B_snake(char snake[]);
int main(void) {
int quantity, i;
char snake[200] = {0};
scanf("%d", &quantity);
for (i = 0; i < quantity; i++) {
scanf("%s", snake);
if (snake[0] != '>') {
puts("NA");
} else if (snake[1] == '\'') {
if (A_sna... |
p00139 Snakes | In a world, a mysterious snake made of only letters lives. Two types of snakes are currently identified, type A and type B, but there may be other types as well.
For class A, after ">'" is followed by one or more "=", "#" comes, and after the same number of "=" as before, "~" (half-width tilde) finish.
Class B ends w... | {
"input": [
"3\n>'======#======~\n>^Q=Q=Q=Q=Q=Q=Q=Q=Q=~~\n>'===#====~"
],
"output": [
"A\nB\nNA"
]
} | {
"input": [],
"output": []
} | IN-CORRECT | UNKNOWN | #include <bits/stdc++.h>
int main(void) {
char str[201];
int i, j, n, cnt1, cnt2, flag;
scanf("%d", &n);
for (i = 0; i < n; i++) {
scanf("%s", str);
cnt1 = 0;
cnt2 = 0;
flag = 0;
if (str[0] == '>') {
if (str[1] == '\'') {
for (j = 2; str[j] != '\0'; j++) {
if (str[j] ... |
p00139 Snakes | In a world, a mysterious snake made of only letters lives. Two types of snakes are currently identified, type A and type B, but there may be other types as well.
For class A, after ">'" is followed by one or more "=", "#" comes, and after the same number of "=" as before, "~" (half-width tilde) finish.
Class B ends w... | {
"input": [
"3\n>'======#======~\n>^Q=Q=Q=Q=Q=Q=Q=Q=Q=~~\n>'===#====~"
],
"output": [
"A\nB\nNA"
]
} | {
"input": [],
"output": []
} | IN-CORRECT | cpp | #include <bits/stdc++.h>
using namespace std;
template <class T>
ostream& operator<<(ostream& os, vector<T> v) {
for (typename vector<T>::iterator it_i = v.begin(); it_i != v.end(); ++it_i) {
os << *it_i << ", ";
}
return os;
}
bool checkA(string s, int k, bool f0, bool f1, bool f2) {
int n = s.size();
if... |
p00139 Snakes | In a world, a mysterious snake made of only letters lives. Two types of snakes are currently identified, type A and type B, but there may be other types as well.
For class A, after ">'" is followed by one or more "=", "#" comes, and after the same number of "=" as before, "~" (half-width tilde) finish.
Class B ends w... | {
"input": [
"3\n>'======#======~\n>^Q=Q=Q=Q=Q=Q=Q=Q=Q=~~\n>'===#====~"
],
"output": [
"A\nB\nNA"
]
} | {
"input": [],
"output": []
} | IN-CORRECT | cpp | #include<iostream>
#include<string>
using namespace std;
int main(){
int n,size;
string s,a,b;
for(cin>>n;n>0;n--){
cin>>s;
size = s.size();
if(size%2){cout<<"NA"<<endl;continue}
a=">'";
b=">^";
for(int i=0;i<size/2-2;i++){a=a+"=";b=b+"Q=";}
a+="#";
for(int i=0;i<size/2-2;i++){a=a+... |
p00139 Snakes | In a world, a mysterious snake made of only letters lives. Two types of snakes are currently identified, type A and type B, but there may be other types as well.
For class A, after ">'" is followed by one or more "=", "#" comes, and after the same number of "=" as before, "~" (half-width tilde) finish.
Class B ends w... | {
"input": [
"3\n>'======#======~\n>^Q=Q=Q=Q=Q=Q=Q=Q=Q=~~\n>'===#====~"
],
"output": [
"A\nB\nNA"
]
} | {
"input": [],
"output": []
} | IN-CORRECT | java | import java.util.Scanner;
public class Main {
/**
* @param args
*/
int solve(String str)
{
final int HEAD=0;
final int EYE_A=1;
final int EYE_B=2;
final int BODY_A1=3;
final int BODY_A2=4;
final int BODY_B=5;
final int STOMACH_A=6;
final int TAIL_A=7;
final int TAIL_B=8;
int state=-1;... |
p00139 Snakes | In a world, a mysterious snake made of only letters lives. Two types of snakes are currently identified, type A and type B, but there may be other types as well.
For class A, after ">'" is followed by one or more "=", "#" comes, and after the same number of "=" as before, "~" (half-width tilde) finish.
Class B ends w... | {
"input": [
"3\n>'======#======~\n>^Q=Q=Q=Q=Q=Q=Q=Q=Q=~~\n>'===#====~"
],
"output": [
"A\nB\nNA"
]
} | {
"input": [],
"output": []
} | IN-CORRECT | cpp | #include <bits/stdc++.h>
using namespace std;
bool check(string s, int n) {
if (s.size() <= n) return true;
return false;
}
void solve() {
string s;
cin >> s;
int n = 0;
if (s[n] == '>') {
n++;
if (check(s, n))
;
else if (s[n] == '\'') {
n++;
int cnt = 0;
while (s[n] == '... |
p00139 Snakes | In a world, a mysterious snake made of only letters lives. Two types of snakes are currently identified, type A and type B, but there may be other types as well.
For class A, after ">'" is followed by one or more "=", "#" comes, and after the same number of "=" as before, "~" (half-width tilde) finish.
Class B ends w... | {
"input": [
"3\n>'======#======~\n>^Q=Q=Q=Q=Q=Q=Q=Q=Q=~~\n>'===#====~"
],
"output": [
"A\nB\nNA"
]
} | {
"input": [],
"output": []
} | IN-CORRECT | cpp | #include <bits/stdc++.h>
using namespace std;
int main() {
int n;
cin >> n;
for (int i = 0; i < n; i++) {
string s;
cin >> s;
if (s[0] == '>' && s[1] == '\'' && s[2] == '=') {
int i = 2;
int cnt = 0;
while (s[i] == '=') {
i++;
cnt++;
}
if (s[i] == '#' && i... |
p00139 Snakes | In a world, a mysterious snake made of only letters lives. Two types of snakes are currently identified, type A and type B, but there may be other types as well.
For class A, after ">'" is followed by one or more "=", "#" comes, and after the same number of "=" as before, "~" (half-width tilde) finish.
Class B ends w... | {
"input": [
"3\n>'======#======~\n>^Q=Q=Q=Q=Q=Q=Q=Q=Q=~~\n>'===#====~"
],
"output": [
"A\nB\nNA"
]
} | {
"input": [],
"output": []
} | IN-CORRECT | UNKNOWN | using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace ConsoleApplication1
{
class Program
{
static readonly string NA = "NA";
static void Main(string[] args)
{
StringBuilder sb = new StringBuilder();
int n = int.Parse(C... |
p00139 Snakes | In a world, a mysterious snake made of only letters lives. Two types of snakes are currently identified, type A and type B, but there may be other types as well.
For class A, after ">'" is followed by one or more "=", "#" comes, and after the same number of "=" as before, "~" (half-width tilde) finish.
Class B ends w... | {
"input": [
"3\n>'======#======~\n>^Q=Q=Q=Q=Q=Q=Q=Q=Q=~~\n>'===#====~"
],
"output": [
"A\nB\nNA"
]
} | {
"input": [],
"output": []
} | IN-CORRECT | cpp | #include <bits/stdc++.h>
using namespace std;
int main() {
int i, n;
string s;
cin >> n;
while (n--) {
cin >> s;
if (s[0] == '>' && s[1] == '\'' && !s.size() % 2) {
for (i = 2; i < s.size(); i++) {
if (i == s.size() / 2 && s[i] != '#') break;
if (i == s.size() / 2) {
i++;... |
p00139 Snakes | In a world, a mysterious snake made of only letters lives. Two types of snakes are currently identified, type A and type B, but there may be other types as well.
For class A, after ">'" is followed by one or more "=", "#" comes, and after the same number of "=" as before, "~" (half-width tilde) finish.
Class B ends w... | {
"input": [
"3\n>'======#======~\n>^Q=Q=Q=Q=Q=Q=Q=Q=Q=~~\n>'===#====~"
],
"output": [
"A\nB\nNA"
]
} | {
"input": [],
"output": []
} | IN-CORRECT | cpp | #include <bits/stdc++.h>
using namespace std;
int main() {
int N;
cin >> N;
while (N--) {
string str;
cin >> str;
bool Aflag, Bflag;
Aflag = Bflag = true;
if (str.substr(0, 2) == ">'")
Bflag = false;
else if (str.substr(0, 2) == ">^")
Aflag = false;
else
Aflag = Bflag... |
p00139 Snakes | In a world, a mysterious snake made of only letters lives. Two types of snakes are currently identified, type A and type B, but there may be other types as well.
For class A, after ">'" is followed by one or more "=", "#" comes, and after the same number of "=" as before, "~" (half-width tilde) finish.
Class B ends w... | {
"input": [
"3\n>'======#======~\n>^Q=Q=Q=Q=Q=Q=Q=Q=Q=~~\n>'===#====~"
],
"output": [
"A\nB\nNA"
]
} | {
"input": [],
"output": []
} | IN-CORRECT | cpp | #include <bits/stdc++.h>
using namespace std;
int main(void) {
string s;
int n;
cin >> n;
while (n--) {
cin >> s;
if (s[1] == '\'') {
int cnt1 = 0;
int i;
for (i = 2; s[i] == '='; i++) {
cnt1++;
}
if (s[i] != '#') {
cout << "NA" << endl;
goto skip;
... |
p00139 Snakes | In a world, a mysterious snake made of only letters lives. Two types of snakes are currently identified, type A and type B, but there may be other types as well.
For class A, after ">'" is followed by one or more "=", "#" comes, and after the same number of "=" as before, "~" (half-width tilde) finish.
Class B ends w... | {
"input": [
"3\n>'======#======~\n>^Q=Q=Q=Q=Q=Q=Q=Q=Q=~~\n>'===#====~"
],
"output": [
"A\nB\nNA"
]
} | {
"input": [],
"output": []
} | IN-CORRECT | UNKNOWN | #include <bits/stdc++.h>
int main(void) {
char snake[200];
int n, cnt1 = 0, cnt2 = 0, i, j;
scanf("%d", &n);
for (i = 0; i < n; i++) {
scanf("%s", snake);
j = 0;
while (1) {
if (snake[j] == '>') {
j++;
if (snake[j] == '\'') {
j++;
while (1) {
if ... |
p00139 Snakes | In a world, a mysterious snake made of only letters lives. Two types of snakes are currently identified, type A and type B, but there may be other types as well.
For class A, after ">'" is followed by one or more "=", "#" comes, and after the same number of "=" as before, "~" (half-width tilde) finish.
Class B ends w... | {
"input": [
"3\n>'======#======~\n>^Q=Q=Q=Q=Q=Q=Q=Q=Q=~~\n>'===#====~"
],
"output": [
"A\nB\nNA"
]
} | {
"input": [],
"output": []
} | IN-CORRECT | UNKNOWN | import scala.io.StdIn.{readInt,readLine}
object Main {
def find(s:String) = {
if(s.length<2) "NA"
else if(s(0)=='>') {
if(s(1) == ''') { // maybeA
var isA = true
val s2 = s.drop(2).dropRight(1)
if(s2(s2.length/2) != '#') isA = false
else {
val s3 = s2.split("#... |
p00139 Snakes | In a world, a mysterious snake made of only letters lives. Two types of snakes are currently identified, type A and type B, but there may be other types as well.
For class A, after ">'" is followed by one or more "=", "#" comes, and after the same number of "=" as before, "~" (half-width tilde) finish.
Class B ends w... | {
"input": [
"3\n>'======#======~\n>^Q=Q=Q=Q=Q=Q=Q=Q=Q=~~\n>'===#====~"
],
"output": [
"A\nB\nNA"
]
} | {
"input": [],
"output": []
} | IN-CORRECT | cpp | #include <bits/stdc++.h>
using namespace std;
string afunc(string str) {
string res = "NA";
for (int i = 0, j = str.size() - 1; i <= j; i++, j--) {
if (i == j) {
if (str[i] == '#') {
res = "A";
}
} else if (str[i] != str[j]) {
break;
}
}
return res;
}
string bfunc(string st... |
p00139 Snakes | In a world, a mysterious snake made of only letters lives. Two types of snakes are currently identified, type A and type B, but there may be other types as well.
For class A, after ">'" is followed by one or more "=", "#" comes, and after the same number of "=" as before, "~" (half-width tilde) finish.
Class B ends w... | {
"input": [
"3\n>'======#======~\n>^Q=Q=Q=Q=Q=Q=Q=Q=Q=~~\n>'===#====~"
],
"output": [
"A\nB\nNA"
]
} | {
"input": [],
"output": []
} | IN-CORRECT | cpp | #include <bits/stdc++.h>
using namespace std;
int main() {
int n;
cin >> n;
for (int D = 0; D < n; ++D) {
string s;
cin >> s;
if (s.compare(0, 2, ">'") == 0) {
int bef_eq = 0;
int aft_eq = 0;
int shp = 0;
int pos_shp = 0;
int pos_tld = 0;
for (unsigned int i = 2; i ... |
p00139 Snakes | In a world, a mysterious snake made of only letters lives. Two types of snakes are currently identified, type A and type B, but there may be other types as well.
For class A, after ">'" is followed by one or more "=", "#" comes, and after the same number of "=" as before, "~" (half-width tilde) finish.
Class B ends w... | {
"input": [
"3\n>'======#======~\n>^Q=Q=Q=Q=Q=Q=Q=Q=Q=~~\n>'===#====~"
],
"output": [
"A\nB\nNA"
]
} | {
"input": [],
"output": []
} | IN-CORRECT | java | import java.util.*;
import java.lang.*;
import java.io.*;
class Main{
private static boolean snake_A(String snake)
{
if(snake.charAt(snake.length()-1) != '~')
return false;
if(!snake.substring(0,2).equals(">'"))
return false;
if(snake.indexOf("#") == -1)
return false;
if(snake.indexOf... |
p00139 Snakes | In a world, a mysterious snake made of only letters lives. Two types of snakes are currently identified, type A and type B, but there may be other types as well.
For class A, after ">'" is followed by one or more "=", "#" comes, and after the same number of "=" as before, "~" (half-width tilde) finish.
Class B ends w... | {
"input": [
"3\n>'======#======~\n>^Q=Q=Q=Q=Q=Q=Q=Q=Q=~~\n>'===#====~"
],
"output": [
"A\nB\nNA"
]
} | {
"input": [],
"output": []
} | IN-CORRECT | UNKNOWN | #include <bits/stdc++.h>
int main(void) {
char A, B;
char snake[256];
int n;
int cnt;
int i, j, len1, len2;
scanf("%d", &n);
for (i = 0; i < n; i++) {
A = B = 0;
scanf("%s", snake);
if (snake[0] == '>' && snake[1] == '\'') {
j = 2;
len1 = 0;
while (snake[j] != '#' && snake[j]... |
p00139 Snakes | In a world, a mysterious snake made of only letters lives. Two types of snakes are currently identified, type A and type B, but there may be other types as well.
For class A, after ">'" is followed by one or more "=", "#" comes, and after the same number of "=" as before, "~" (half-width tilde) finish.
Class B ends w... | {
"input": [
"3\n>'======#======~\n>^Q=Q=Q=Q=Q=Q=Q=Q=Q=~~\n>'===#====~"
],
"output": [
"A\nB\nNA"
]
} | {
"input": [],
"output": []
} | IN-CORRECT | UNKNOWN | #include <bits/stdc++.h>
int main(void) {
char w[201];
int a, i, j, k;
scanf("%d", &a);
for (j = 0; j < a; j++) {
gets(w);
if (w[0] != '>') {
printf("NA\n");
continue;
}
if (w[1] == '\'') {
for (i = 2; w[i] != '#'; i++) {
if (w[i] != '=') {
printf("NA\n");
... |
p00139 Snakes | In a world, a mysterious snake made of only letters lives. Two types of snakes are currently identified, type A and type B, but there may be other types as well.
For class A, after ">'" is followed by one or more "=", "#" comes, and after the same number of "=" as before, "~" (half-width tilde) finish.
Class B ends w... | {
"input": [
"3\n>'======#======~\n>^Q=Q=Q=Q=Q=Q=Q=Q=Q=~~\n>'===#====~"
],
"output": [
"A\nB\nNA"
]
} | {
"input": [],
"output": []
} | IN-CORRECT | python2 | for i in [0]*input():
s=raw_input()
n=(len(s)-4)/2
if s==">'"+"="*n+"#"+"="*n+"~": print "A"
elif s==">^"+"Q="*n+"~~": print "B"
else: print "NA" |
p00139 Snakes | In a world, a mysterious snake made of only letters lives. Two types of snakes are currently identified, type A and type B, but there may be other types as well.
For class A, after ">'" is followed by one or more "=", "#" comes, and after the same number of "=" as before, "~" (half-width tilde) finish.
Class B ends w... | {
"input": [
"3\n>'======#======~\n>^Q=Q=Q=Q=Q=Q=Q=Q=Q=~~\n>'===#====~"
],
"output": [
"A\nB\nNA"
]
} | {
"input": [],
"output": []
} | IN-CORRECT | UNKNOWN | def is_a?(s)
s =~ />(?:[^=])*(=+)#(=+)~/
unless $1 == nil || $2 == nil
return s && $1.size == $2.size
end
false
end
def is_b?(s)
s =~ />\^(Q=)+~~/
end
n = gets.chomp.to_i
n.times do
s = gets.chomp
if is_a?(s)
puts :A
elsif is_b?(s)
puts :B
else
puts :NA
end
end |
p00139 Snakes | In a world, a mysterious snake made of only letters lives. Two types of snakes are currently identified, type A and type B, but there may be other types as well.
For class A, after ">'" is followed by one or more "=", "#" comes, and after the same number of "=" as before, "~" (half-width tilde) finish.
Class B ends w... | {
"input": [
"3\n>'======#======~\n>^Q=Q=Q=Q=Q=Q=Q=Q=Q=~~\n>'===#====~"
],
"output": [
"A\nB\nNA"
]
} | {
"input": [],
"output": []
} | IN-CORRECT | cpp | #include <bits/stdc++.h>
using namespace std;
string solve(string s) {
if (s[0] != '>') return "NA";
if (s.size() % 2 != 0) return "NA";
int i = 0, j;
if (s[1] == '\'') {
for (i = 2; i < s.size(); ++i) {
if (s[i] == '#')
break;
else if (s[i] != '=')
return "NA";
}
int l =... |
p00139 Snakes | In a world, a mysterious snake made of only letters lives. Two types of snakes are currently identified, type A and type B, but there may be other types as well.
For class A, after ">'" is followed by one or more "=", "#" comes, and after the same number of "=" as before, "~" (half-width tilde) finish.
Class B ends w... | {
"input": [
"3\n>'======#======~\n>^Q=Q=Q=Q=Q=Q=Q=Q=Q=~~\n>'===#====~"
],
"output": [
"A\nB\nNA"
]
} | {
"input": [],
"output": []
} | IN-CORRECT | UNKNOWN | #include <bits/stdc++.h>
int main(void) {
int n, i, c1, c2, f;
char s[201];
scanf("%d", &n);
while (n--) {
scanf("%s", s);
f = 1;
if (s[0] != '>') {
puts("NA");
continue;
}
if (s[1] == '\'') {
c1 = c2 = 0;
for (i = 2; s[i] != '#'; i++) {
if (s[i] != '=') {
... |
p00139 Snakes | In a world, a mysterious snake made of only letters lives. Two types of snakes are currently identified, type A and type B, but there may be other types as well.
For class A, after ">'" is followed by one or more "=", "#" comes, and after the same number of "=" as before, "~" (half-width tilde) finish.
Class B ends w... | {
"input": [
"3\n>'======#======~\n>^Q=Q=Q=Q=Q=Q=Q=Q=Q=~~\n>'===#====~"
],
"output": [
"A\nB\nNA"
]
} | {
"input": [],
"output": []
} | IN-CORRECT | java | import java.io.*;
import java.util.*;
public class Main{
public static void main(String[] args){
try{
new Main();
}catch(IOException e){
e.printStackTrace();
}
}
public Main() throws IOException{
BufferedReader in = new BufferedReader(new InputStreamReader(System.in));
List<String> Ans = new Array... |
p00139 Snakes | In a world, a mysterious snake made of only letters lives. Two types of snakes are currently identified, type A and type B, but there may be other types as well.
For class A, after ">'" is followed by one or more "=", "#" comes, and after the same number of "=" as before, "~" (half-width tilde) finish.
Class B ends w... | {
"input": [
"3\n>'======#======~\n>^Q=Q=Q=Q=Q=Q=Q=Q=Q=~~\n>'===#====~"
],
"output": [
"A\nB\nNA"
]
} | {
"input": [],
"output": []
} | IN-CORRECT | cpp | #include <bits/stdc++.h>
using namespace std;
string vbString(int Number, string Character) {
string res = "";
for (int i = 0; i < Number; i++) res += Character;
return res;
}
string checksnake(string s) {
string t;
for (int i = 1; i < 49; i++) {
t = ">\'" + vbString(i, "=") + "#" + vbString(i, "=") + "~"... |
p00139 Snakes | In a world, a mysterious snake made of only letters lives. Two types of snakes are currently identified, type A and type B, but there may be other types as well.
For class A, after ">'" is followed by one or more "=", "#" comes, and after the same number of "=" as before, "~" (half-width tilde) finish.
Class B ends w... | {
"input": [
"3\n>'======#======~\n>^Q=Q=Q=Q=Q=Q=Q=Q=Q=~~\n>'===#====~"
],
"output": [
"A\nB\nNA"
]
} | {
"input": [],
"output": []
} | IN-CORRECT | cpp | #include <bits/stdc++.h>
using namespace std;
int main() {
const string species[] = {"A", "B", "NA"};
string str = "";
int n;
while (getline(cin, str)) {
stringstream ssn(str);
ssn >> n;
if (n == 0) {
break;
}
int i, j;
for (i = 0; i < n; ++i) {
string res = species[2];
... |
p00139 Snakes | In a world, a mysterious snake made of only letters lives. Two types of snakes are currently identified, type A and type B, but there may be other types as well.
For class A, after ">'" is followed by one or more "=", "#" comes, and after the same number of "=" as before, "~" (half-width tilde) finish.
Class B ends w... | {
"input": [
"3\n>'======#======~\n>^Q=Q=Q=Q=Q=Q=Q=Q=Q=~~\n>'===#====~"
],
"output": [
"A\nB\nNA"
]
} | {
"input": [],
"output": []
} | IN-CORRECT | UNKNOWN | #include <bits/stdc++.h>
int main() {
int cnt, cnt2;
int i = 0;
char snake[201];
scanf("%d", &cnt);
while (i != cnt) {
scanf("%s", snake);
if (strlen(snake) < 2 || snake[0] != '>') {
printf("NA\n");
} else if (snake[1] == '\'') {
cnt2 = 0;
i = 2;
while (snake[i] == '=') {
... |
p00139 Snakes | In a world, a mysterious snake made of only letters lives. Two types of snakes are currently identified, type A and type B, but there may be other types as well.
For class A, after ">'" is followed by one or more "=", "#" comes, and after the same number of "=" as before, "~" (half-width tilde) finish.
Class B ends w... | {
"input": [
"3\n>'======#======~\n>^Q=Q=Q=Q=Q=Q=Q=Q=Q=~~\n>'===#====~"
],
"output": [
"A\nB\nNA"
]
} | {
"input": [],
"output": []
} | IN-CORRECT | cpp | #include <bits/stdc++.h>
using namespace std;
string repeat(int n, string s) {
string res = "";
for (int i = 0; i < n; ++i) res += s;
return res;
}
int main() {
int N;
cin >> N;
for (int i = 0; i < N; ++i) {
string snake;
cin >> snake;
int len = snake.size();
string A = ">'" + repeat((len - ... |
p00139 Snakes | In a world, a mysterious snake made of only letters lives. Two types of snakes are currently identified, type A and type B, but there may be other types as well.
For class A, after ">'" is followed by one or more "=", "#" comes, and after the same number of "=" as before, "~" (half-width tilde) finish.
Class B ends w... | {
"input": [
"3\n>'======#======~\n>^Q=Q=Q=Q=Q=Q=Q=Q=Q=~~\n>'===#====~"
],
"output": [
"A\nB\nNA"
]
} | {
"input": [],
"output": []
} | IN-CORRECT | cpp | #include <bits/stdc++.h>
using namespace std;
bool isa(string s) {
if (s.substr(0, 2) != ">'") return false;
int x = 2;
int c = 0;
while (s[x + c] == '=') {
c++;
}
if (s[x + c] != '#') return false;
x = x + c + 1;
for (int i = 0; i < c; i++) {
if (s[x + i] != '=') return false;
}
x += c;
i... |
p00139 Snakes | In a world, a mysterious snake made of only letters lives. Two types of snakes are currently identified, type A and type B, but there may be other types as well.
For class A, after ">'" is followed by one or more "=", "#" comes, and after the same number of "=" as before, "~" (half-width tilde) finish.
Class B ends w... | {
"input": [
"3\n>'======#======~\n>^Q=Q=Q=Q=Q=Q=Q=Q=Q=~~\n>'===#====~"
],
"output": [
"A\nB\nNA"
]
} | {
"input": [],
"output": []
} | IN-CORRECT | java | import java.util.Scanner;
public class Main
{
public static void main(String arg[])
{
Scanner in=new Scanner(System.in);
int n=in.nextInt();
while(n-->0)
{
char ch[] = in.next().toCharArray();
int counta =0;
int countb =0;
boolean flag=false;
if(ch[0]=='>'&&ch[1]=='\'' &&ch[ch.length-1]=='~')
... |
p00139 Snakes | In a world, a mysterious snake made of only letters lives. Two types of snakes are currently identified, type A and type B, but there may be other types as well.
For class A, after ">'" is followed by one or more "=", "#" comes, and after the same number of "=" as before, "~" (half-width tilde) finish.
Class B ends w... | {
"input": [
"3\n>'======#======~\n>^Q=Q=Q=Q=Q=Q=Q=Q=Q=~~\n>'===#====~"
],
"output": [
"A\nB\nNA"
]
} | {
"input": [],
"output": []
} | IN-CORRECT | cpp | #include <bits/stdc++.h>
using namespace std;
int main(void) {
int n, len, flag = 0, flag2 = 0, cnt1 = 0, cnt2 = 0;
char snake[10000][200];
cin >> n;
for (int i = 0; i < n; i++) {
scanf("%s", snake[i]);
len = strlen(snake[i]);
if (snake[i][0] == '>' && snake[i][1] == '\'') {
for (int j = 2; j ... |
p00139 Snakes | In a world, a mysterious snake made of only letters lives. Two types of snakes are currently identified, type A and type B, but there may be other types as well.
For class A, after ">'" is followed by one or more "=", "#" comes, and after the same number of "=" as before, "~" (half-width tilde) finish.
Class B ends w... | {
"input": [
"3\n>'======#======~\n>^Q=Q=Q=Q=Q=Q=Q=Q=Q=~~\n>'===#====~"
],
"output": [
"A\nB\nNA"
]
} | {
"input": [],
"output": []
} | IN-CORRECT | cpp | #include <bits/stdc++.h>
using namespace std;
bool is_a(string& s) {
if (s[0] != '>' || s[1] != '\'') return false;
int eq_count = 0;
int i;
for (i = 2; s[i] == '='; i++) {
eq_count++;
}
if (s[i++] != '#') return false;
for (; s[i] == '='; i++) {
eq_count--;
}
if (eq_count == 0 && s[i] == '~')... |
p00139 Snakes | In a world, a mysterious snake made of only letters lives. Two types of snakes are currently identified, type A and type B, but there may be other types as well.
For class A, after ">'" is followed by one or more "=", "#" comes, and after the same number of "=" as before, "~" (half-width tilde) finish.
Class B ends w... | {
"input": [
"3\n>'======#======~\n>^Q=Q=Q=Q=Q=Q=Q=Q=Q=~~\n>'===#====~"
],
"output": [
"A\nB\nNA"
]
} | {
"input": [],
"output": []
} | IN-CORRECT | cpp | #include <bits/stdc++.h>
using namespace std;
int main() {
int n;
cin >> n;
for (int i = 0; i < n; i++) {
string s;
cin >> s;
int sz = s.size();
if (s[0] != '>' || sz < 6) {
cout << "NA" << endl;
continue;
}
if (s[1] == '\'') {
int t = sz - 3;
if (t % 2 == 0) {
... |
p00139 Snakes | In a world, a mysterious snake made of only letters lives. Two types of snakes are currently identified, type A and type B, but there may be other types as well.
For class A, after ">'" is followed by one or more "=", "#" comes, and after the same number of "=" as before, "~" (half-width tilde) finish.
Class B ends w... | {
"input": [
"3\n>'======#======~\n>^Q=Q=Q=Q=Q=Q=Q=Q=Q=~~\n>'===#====~"
],
"output": [
"A\nB\nNA"
]
} | {
"input": [],
"output": []
} | IN-CORRECT | UNKNOWN | #include <bits/stdc++.h>
int main(void) {
char w[201];
int a, i, j, k;
scanf("%d", &a);
for (j = 0; j < a; j++) {
gets(w);
if (w[0] != '>') {
printf("NA\n");
continue;
}
if (w[1] == '\'') {
int c;
for (i = 2; w[i] != '#'; i++) {
if (w[i] != '=') {
printf... |
p00139 Snakes | In a world, a mysterious snake made of only letters lives. Two types of snakes are currently identified, type A and type B, but there may be other types as well.
For class A, after ">'" is followed by one or more "=", "#" comes, and after the same number of "=" as before, "~" (half-width tilde) finish.
Class B ends w... | {
"input": [
"3\n>'======#======~\n>^Q=Q=Q=Q=Q=Q=Q=Q=Q=~~\n>'===#====~"
],
"output": [
"A\nB\nNA"
]
} | {
"input": [],
"output": []
} | IN-CORRECT | cpp | #include <bits/stdc++.h>
using namespace std;
const double EPS = 1e-9;
template <class T>
T RoundOff(T a) {
return int(a + .5 - (a < 0));
}
template <class T, class C>
void chmax(T& a, C b) {
if (a < b) a = b;
}
template <class T, class C>
void chmin(T& a, C b) {
if (b < a) a = b;
}
template <class T, class C>
pa... |
p00139 Snakes | In a world, a mysterious snake made of only letters lives. Two types of snakes are currently identified, type A and type B, but there may be other types as well.
For class A, after ">'" is followed by one or more "=", "#" comes, and after the same number of "=" as before, "~" (half-width tilde) finish.
Class B ends w... | {
"input": [
"3\n>'======#======~\n>^Q=Q=Q=Q=Q=Q=Q=Q=Q=~~\n>'===#====~"
],
"output": [
"A\nB\nNA"
]
} | {
"input": [],
"output": []
} | IN-CORRECT | cpp | #include <bits/stdc++.h>
using namespace std;
bool isSnakeA(string snake) {
if (snake[0] != '>' || snake[1] != '\'' || snake[snake.length() - 1] != '~') {
return false;
}
int pre = 0, post = 0;
bool sharpFlag = false;
for (int i = 2; i < (int)snake.length() - 1; i++) {
if (!sharpFlag) {
switch (... |
p00139 Snakes | In a world, a mysterious snake made of only letters lives. Two types of snakes are currently identified, type A and type B, but there may be other types as well.
For class A, after ">'" is followed by one or more "=", "#" comes, and after the same number of "=" as before, "~" (half-width tilde) finish.
Class B ends w... | {
"input": [
"3\n>'======#======~\n>^Q=Q=Q=Q=Q=Q=Q=Q=Q=~~\n>'===#====~"
],
"output": [
"A\nB\nNA"
]
} | {
"input": [],
"output": []
} | IN-CORRECT | cpp | #include <bits/stdc++.h>
using namespace std;
bool isA(const string& s) {
if (s.size() >= 1 && s[0] != '>') return false;
if (s.size() >= 2 && s[1] != '\'') return false;
bool a_flag = true;
bool equal_flag = false;
int cnt = 0;
int j;
for (int i = 1; i < s.size(); i++) {
if (equal_flag == false) {
... |
p00139 Snakes | In a world, a mysterious snake made of only letters lives. Two types of snakes are currently identified, type A and type B, but there may be other types as well.
For class A, after ">'" is followed by one or more "=", "#" comes, and after the same number of "=" as before, "~" (half-width tilde) finish.
Class B ends w... | {
"input": [
"3\n>'======#======~\n>^Q=Q=Q=Q=Q=Q=Q=Q=Q=~~\n>'===#====~"
],
"output": [
"A\nB\nNA"
]
} | {
"input": [],
"output": []
} | IN-CORRECT | UNKNOWN | #include <bits/stdc++.h>
int main(int argc, const char* argv[]) {
char snake[200];
int num;
int i, j, k, l;
scanf("%d", &num);
for (l = 0; l < num + 1; l++) {
int bodyacnt = 0;
int bodybcnt = 0;
int midcnt = 0;
int endcnt = 0;
int nacnt = 0;
for (i = 0; i < 200; i++) {
scanf("%c"... |
p00139 Snakes | In a world, a mysterious snake made of only letters lives. Two types of snakes are currently identified, type A and type B, but there may be other types as well.
For class A, after ">'" is followed by one or more "=", "#" comes, and after the same number of "=" as before, "~" (half-width tilde) finish.
Class B ends w... | {
"input": [
"3\n>'======#======~\n>^Q=Q=Q=Q=Q=Q=Q=Q=Q=~~\n>'===#====~"
],
"output": [
"A\nB\nNA"
]
} | {
"input": [],
"output": []
} | IN-CORRECT | cpp | #include <bits/stdc++.h>
using namespace std;
int main(void) {
string str;
int n;
cin >> n;
while (n--) {
cin >> str;
int ca = 0;
int cntsha = 0;
bool a = true;
if (str.size() % 2 == 0) {
if (str[str.size() / 2] == '#') str[str.size() / 2] = '=';
for (int i = 2; i < str.size() - ... |
p00139 Snakes | In a world, a mysterious snake made of only letters lives. Two types of snakes are currently identified, type A and type B, but there may be other types as well.
For class A, after ">'" is followed by one or more "=", "#" comes, and after the same number of "=" as before, "~" (half-width tilde) finish.
Class B ends w... | {
"input": [
"3\n>'======#======~\n>^Q=Q=Q=Q=Q=Q=Q=Q=Q=~~\n>'===#====~"
],
"output": [
"A\nB\nNA"
]
} | {
"input": [],
"output": []
} | IN-CORRECT | cpp | #include <bits/stdc++.h>
using namespace std;
int main() {
int n;
cin >> n;
while (n--) {
string s;
cin >> s;
int f = 0;
if (s.substr(0, 2) == ">'") {
int i = 2, j1 = 0, j2 = 0;
for (; i < s.length() && s[i] == '='; i++) j1++;
if (i < s.length() && s[i++] == '#') {
for (;... |
p00139 Snakes | In a world, a mysterious snake made of only letters lives. Two types of snakes are currently identified, type A and type B, but there may be other types as well.
For class A, after ">'" is followed by one or more "=", "#" comes, and after the same number of "=" as before, "~" (half-width tilde) finish.
Class B ends w... | {
"input": [
"3\n>'======#======~\n>^Q=Q=Q=Q=Q=Q=Q=Q=Q=~~\n>'===#====~"
],
"output": [
"A\nB\nNA"
]
} | {
"input": [],
"output": []
} | IN-CORRECT | java | import java.util.Scanner;
public class Main{
public static void main(String[] args){
new Main().run();
}
public void run(){
Scanner scan = new Scanner(System.in);
while(scan.hasNext()){
int n = scan.nextInt();
for(int i = 0;i < n;i++){
String snake = scan.next();
if(snake.substring(0,2).... |
p00139 Snakes | In a world, a mysterious snake made of only letters lives. Two types of snakes are currently identified, type A and type B, but there may be other types as well.
For class A, after ">'" is followed by one or more "=", "#" comes, and after the same number of "=" as before, "~" (half-width tilde) finish.
Class B ends w... | {
"input": [
"3\n>'======#======~\n>^Q=Q=Q=Q=Q=Q=Q=Q=Q=~~\n>'===#====~"
],
"output": [
"A\nB\nNA"
]
} | {
"input": [],
"output": []
} | IN-CORRECT | cpp | #include <bits/stdc++.h>
using namespace std;
int main() {
char buf[210];
int bi, n, eqc, ti;
cin >> n;
for (int i = 0; i < n; i++) {
bi = 0;
cin >> buf;
if (buf[bi++] != '>') {
cout << "NA" << endl;
continue;
}
if (buf[bi] == '\'') {
bi++;
eqc = 0;
while (buf[b... |
p00139 Snakes | In a world, a mysterious snake made of only letters lives. Two types of snakes are currently identified, type A and type B, but there may be other types as well.
For class A, after ">'" is followed by one or more "=", "#" comes, and after the same number of "=" as before, "~" (half-width tilde) finish.
Class B ends w... | {
"input": [
"3\n>'======#======~\n>^Q=Q=Q=Q=Q=Q=Q=Q=Q=~~\n>'===#====~"
],
"output": [
"A\nB\nNA"
]
} | {
"input": [],
"output": []
} | IN-CORRECT | cpp | #include <bits/stdc++.h>
using namespace std;
int main() {
int i, n;
string s;
cin >> n;
while (n--) {
cin >> s;
if (s[0] == '>' && s[1] == '\'' && s.size() % 2 > 5) {
for (i = 2; i < s.size(); i++) {
if (i == s.size() / 2 && s[i] != '#') break;
if (i == s.size() / 2) {
i... |
p00139 Snakes | In a world, a mysterious snake made of only letters lives. Two types of snakes are currently identified, type A and type B, but there may be other types as well.
For class A, after ">'" is followed by one or more "=", "#" comes, and after the same number of "=" as before, "~" (half-width tilde) finish.
Class B ends w... | {
"input": [
"3\n>'======#======~\n>^Q=Q=Q=Q=Q=Q=Q=Q=Q=~~\n>'===#====~"
],
"output": [
"A\nB\nNA"
]
} | {
"input": [],
"output": []
} | IN-CORRECT | cpp | #include <bits/stdc++.h>
using namespace std;
int main() {
int n;
scanf("%d", &n);
for (int i = 0; i < n; i++) {
string s;
cin >> s;
if (s.size() < 4 || s.size() % 2 == 1) {
puts("NA");
continue;
}
if (s[0] == '>' && s[1] == '\'' && s[s.size() - 1] == '~') {
int cnt = 0;
... |
p00139 Snakes | In a world, a mysterious snake made of only letters lives. Two types of snakes are currently identified, type A and type B, but there may be other types as well.
For class A, after ">'" is followed by one or more "=", "#" comes, and after the same number of "=" as before, "~" (half-width tilde) finish.
Class B ends w... | {
"input": [
"3\n>'======#======~\n>^Q=Q=Q=Q=Q=Q=Q=Q=Q=~~\n>'===#====~"
],
"output": [
"A\nB\nNA"
]
} | {
"input": [],
"output": []
} | IN-CORRECT | cpp | #include <bits/stdc++.h>
using namespace std;
const int INF = (1 << 25);
const int dx[] = {1, 0, -1, 0}, dy[] = {0, -1, 0, 1};
int main() {
int n;
int flg = 0;
cin >> n;
while (n--) {
string s;
int cnt = 0;
flg = 0;
cin >> s;
if (s[0] == '>') {
if (s[1] == '\'') {
int equal[2] ... |
p00139 Snakes | In a world, a mysterious snake made of only letters lives. Two types of snakes are currently identified, type A and type B, but there may be other types as well.
For class A, after ">'" is followed by one or more "=", "#" comes, and after the same number of "=" as before, "~" (half-width tilde) finish.
Class B ends w... | {
"input": [
"3\n>'======#======~\n>^Q=Q=Q=Q=Q=Q=Q=Q=Q=~~\n>'===#====~"
],
"output": [
"A\nB\nNA"
]
} | {
"input": [],
"output": []
} | IN-CORRECT | cpp | #include <bits/stdc++.h>
using namespace std;
struct cww {
cww() {
ios::sync_with_stdio(false);
cin.tie(0);
}
} star;
bool check_A(string S) {
auto sz = S.size();
if (S.find(">'=") == 0 && S.find("~") == sz - 1 && sz >= 6) {
S = S.substr(2, sz - 3);
sz = S.size();
if (S.find_first_not_of("#=... |
p00139 Snakes | In a world, a mysterious snake made of only letters lives. Two types of snakes are currently identified, type A and type B, but there may be other types as well.
For class A, after ">'" is followed by one or more "=", "#" comes, and after the same number of "=" as before, "~" (half-width tilde) finish.
Class B ends w... | {
"input": [
"3\n>'======#======~\n>^Q=Q=Q=Q=Q=Q=Q=Q=Q=~~\n>'===#====~"
],
"output": [
"A\nB\nNA"
]
} | {
"input": [],
"output": []
} | IN-CORRECT | cpp | #include <bits/stdc++.h>
const int INF = 10000000;
using namespace std;
int main() {
int n;
string s;
cin >> n;
for (int k = 0; k < (int)(n); k++) {
cin >> s;
if (s.length() < 2) {
cout << "NA" << endl;
goto end;
} else if (s[0] == '>' && s[1] == '\'') {
int num1 = 0, num2 = 0, i;
... |
p00139 Snakes | In a world, a mysterious snake made of only letters lives. Two types of snakes are currently identified, type A and type B, but there may be other types as well.
For class A, after ">'" is followed by one or more "=", "#" comes, and after the same number of "=" as before, "~" (half-width tilde) finish.
Class B ends w... | {
"input": [
"3\n>'======#======~\n>^Q=Q=Q=Q=Q=Q=Q=Q=Q=~~\n>'===#====~"
],
"output": [
"A\nB\nNA"
]
} | {
"input": [],
"output": []
} | IN-CORRECT | java | import java.io.*;
import java.util.*;
public class Main{
public static void main(String[] args){
try{
new Main();
}catch(IOException e){
e.printStackTrace();
}
}
public Main() throws IOException{
BufferedReader in = new BufferedReader(new InputStreamReader(System.in));
List<String> Ans = new Array... |
p00139 Snakes | In a world, a mysterious snake made of only letters lives. Two types of snakes are currently identified, type A and type B, but there may be other types as well.
For class A, after ">'" is followed by one or more "=", "#" comes, and after the same number of "=" as before, "~" (half-width tilde) finish.
Class B ends w... | {
"input": [
"3\n>'======#======~\n>^Q=Q=Q=Q=Q=Q=Q=Q=Q=~~\n>'===#====~"
],
"output": [
"A\nB\nNA"
]
} | {
"input": [],
"output": []
} | IN-CORRECT | UNKNOWN | #include <bits/stdc++.h>
int main(void) {
int max, num;
int total;
int i;
char snake[201];
scanf("%d", &max);
for (num = 0; num < max; num++) {
scanf("%s", snake);
if (strlen(snake) < 2 || snake[0] != '>') printf("NA\n");
if (snake[1] == '\'') {
total = 0;
i = 2;
while (snake[i... |
p00139 Snakes | In a world, a mysterious snake made of only letters lives. Two types of snakes are currently identified, type A and type B, but there may be other types as well.
For class A, after ">'" is followed by one or more "=", "#" comes, and after the same number of "=" as before, "~" (half-width tilde) finish.
Class B ends w... | {
"input": [
"3\n>'======#======~\n>^Q=Q=Q=Q=Q=Q=Q=Q=Q=~~\n>'===#====~"
],
"output": [
"A\nB\nNA"
]
} | {
"input": [],
"output": []
} | IN-CORRECT | python3 | for _ in [0]*int(input()):
s=input()
a='NA'
if s[1]=="'" and s[-1]=='~' and '#' in s:
s=s[2:-1].split('#')
a=[a,'A'][set(s[0])==set(s[1])=={'='} and len(set(s))==1]
elif s[1]=='^' and s[-2:]=='~~':
s=s[2:-2]
a=['NA','B'][len(s)==2*s.count('Q=') and len(s)>0]
print(a) |
p00139 Snakes | In a world, a mysterious snake made of only letters lives. Two types of snakes are currently identified, type A and type B, but there may be other types as well.
For class A, after ">'" is followed by one or more "=", "#" comes, and after the same number of "=" as before, "~" (half-width tilde) finish.
Class B ends w... | {
"input": [
"3\n>'======#======~\n>^Q=Q=Q=Q=Q=Q=Q=Q=Q=~~\n>'===#====~"
],
"output": [
"A\nB\nNA"
]
} | {
"input": [],
"output": []
} | IN-CORRECT | UNKNOWN | #include <bits/stdc++.h>
int A_snake(char snake[]);
int B_snake(char snake[]);
int main(void) {
int quantity, i;
char snake[200] = {0};
scanf("%d", &quantity);
for (i = 0; i < quantity; i++) {
scanf("%s", snake);
if (snake[0] != '>') {
puts("NA");
} else if (snake[1] == '\'') {
if (A_sna... |
p00139 Snakes | In a world, a mysterious snake made of only letters lives. Two types of snakes are currently identified, type A and type B, but there may be other types as well.
For class A, after ">'" is followed by one or more "=", "#" comes, and after the same number of "=" as before, "~" (half-width tilde) finish.
Class B ends w... | {
"input": [
"3\n>'======#======~\n>^Q=Q=Q=Q=Q=Q=Q=Q=Q=~~\n>'===#====~"
],
"output": [
"A\nB\nNA"
]
} | {
"input": [],
"output": []
} | IN-CORRECT | UNKNOWN | char s[101];
A(){
char a[101],b[101],t,t2;
return sscanf(s,">'%[=]#%[=]%c%c",a,b,&t,&t2)==3&&t=='~'&&strlen(a)==strlen(b);
}
Q(char*a){
int i;
for(i=0;a[i];i+=2)
if(a[i]!='Q'||a[i+1]!='=')
return 0;
return i>=2;
}
B(){
char a[101],t,t2;
return sscanf(s,">^%[Q=]~%c%c",a,&t,&t2)==2&&t=='~'&&Q(a);
}
main(){
s... |
p00139 Snakes | In a world, a mysterious snake made of only letters lives. Two types of snakes are currently identified, type A and type B, but there may be other types as well.
For class A, after ">'" is followed by one or more "=", "#" comes, and after the same number of "=" as before, "~" (half-width tilde) finish.
Class B ends w... | {
"input": [
"3\n>'======#======~\n>^Q=Q=Q=Q=Q=Q=Q=Q=Q=~~\n>'===#====~"
],
"output": [
"A\nB\nNA"
]
} | {
"input": [],
"output": []
} | IN-CORRECT | cpp | #include <bits/stdc++.h>
using namespace std;
int main() {
int n;
for (cin >> n; n--;) {
string s;
cin >> s;
string ans = "NA";
if (s.substr(0, 2) == ">'" && s[s.size() - 1] == '~') {
string tmp = s.substr(2, s.size() - 3);
if (tmp.size() % 2 != 0 && tmp[tmp.size() / 2] == '#' &&
... |
p00139 Snakes | In a world, a mysterious snake made of only letters lives. Two types of snakes are currently identified, type A and type B, but there may be other types as well.
For class A, after ">'" is followed by one or more "=", "#" comes, and after the same number of "=" as before, "~" (half-width tilde) finish.
Class B ends w... | {
"input": [
"3\n>'======#======~\n>^Q=Q=Q=Q=Q=Q=Q=Q=Q=~~\n>'===#====~"
],
"output": [
"A\nB\nNA"
]
} | {
"input": [],
"output": []
} | IN-CORRECT | UNKNOWN | char s[102];A(){char a[101],b[101],t,t2;return sscanf(s,">'%[=]#%[=]%c%c",a,b,&t,&t2)==3&&t=='~'&&strlen(a)==strlen(b);}B(){short*q;char*p=s,l=0;if(*(q=p++)=='^>'){for(;*(q=++p)=='=Q';p++)l++;if(l>0&&*(q=p++)=='~~'&&*++p==0)return 1;}return 0;}main(){scanf("%*d\n");for(;~scanf("%[^\n]\n",s);){puts(A()?"A ":B()?"B":"NA"... |
p00139 Snakes | In a world, a mysterious snake made of only letters lives. Two types of snakes are currently identified, type A and type B, but there may be other types as well.
For class A, after ">'" is followed by one or more "=", "#" comes, and after the same number of "=" as before, "~" (half-width tilde) finish.
Class B ends w... | {
"input": [
"3\n>'======#======~\n>^Q=Q=Q=Q=Q=Q=Q=Q=Q=~~\n>'===#====~"
],
"output": [
"A\nB\nNA"
]
} | {
"input": [],
"output": []
} | IN-CORRECT | cpp | #include <bits/stdc++.h>
using namespace std;
int checksnake(string, int);
int main(void) {
int n, len, flag = 0, flag2 = 0, flag3 = 0, cnt1 = 0, cnt2 = 0;
char snake[200];
int type;
cin >> n;
for (int i = 0; i < n; i++) {
scanf("%s", snake);
len = strlen(snake);
type = checksnake(snake, len);
... |
p00139 Snakes | In a world, a mysterious snake made of only letters lives. Two types of snakes are currently identified, type A and type B, but there may be other types as well.
For class A, after ">'" is followed by one or more "=", "#" comes, and after the same number of "=" as before, "~" (half-width tilde) finish.
Class B ends w... | {
"input": [
"3\n>'======#======~\n>^Q=Q=Q=Q=Q=Q=Q=Q=Q=~~\n>'===#====~"
],
"output": [
"A\nB\nNA"
]
} | {
"input": [],
"output": []
} | IN-CORRECT | cpp | #include <bits/stdc++.h>
using namespace std;
static inline int in() {
int x;
scanf("%d", &x);
return x;
}
vector<string> split(const string& s, char delim) {
stringstream ss(s);
string token;
vector<string> res;
while (getline(ss, token, delim)) {
res.push_back(token);
}
return res;
}
int main() ... |
p00139 Snakes | In a world, a mysterious snake made of only letters lives. Two types of snakes are currently identified, type A and type B, but there may be other types as well.
For class A, after ">'" is followed by one or more "=", "#" comes, and after the same number of "=" as before, "~" (half-width tilde) finish.
Class B ends w... | {
"input": [
"3\n>'======#======~\n>^Q=Q=Q=Q=Q=Q=Q=Q=Q=~~\n>'===#====~"
],
"output": [
"A\nB\nNA"
]
} | {
"input": [],
"output": []
} | IN-CORRECT | cpp | #include <bits/stdc++.h>
using namespace std;
int main() {
int n;
cin >> n;
for (int i = 0; i < n; i++) {
string s;
cin >> s;
bool a[4] = {}, b[3] = {};
int cnt = 0;
for (int j = 0; j < s.size(); j++) {
if (s[j] == '>') {
if (!a[1] && s[j + 1] == '\'') a[0] = true;
if (s[... |
p00139 Snakes | In a world, a mysterious snake made of only letters lives. Two types of snakes are currently identified, type A and type B, but there may be other types as well.
For class A, after ">'" is followed by one or more "=", "#" comes, and after the same number of "=" as before, "~" (half-width tilde) finish.
Class B ends w... | {
"input": [
"3\n>'======#======~\n>^Q=Q=Q=Q=Q=Q=Q=Q=Q=~~\n>'===#====~"
],
"output": [
"A\nB\nNA"
]
} | {
"input": [],
"output": []
} | IN-CORRECT | UNKNOWN | #include <bits/stdc++.h>
int A_snake(char snake[]);
int B_snake(char snake[]);
int main(void) {
int quantity, i;
char snake[200] = {0};
scanf("%d", &quantity);
for (i = 0; i < quantity; i++) {
scanf("%s", snake);
if (snake[0] != '>') {
puts("NA");
} else if (snake[1] == '\'') {
if (A_sna... |
p00139 Snakes | In a world, a mysterious snake made of only letters lives. Two types of snakes are currently identified, type A and type B, but there may be other types as well.
For class A, after ">'" is followed by one or more "=", "#" comes, and after the same number of "=" as before, "~" (half-width tilde) finish.
Class B ends w... | {
"input": [
"3\n>'======#======~\n>^Q=Q=Q=Q=Q=Q=Q=Q=Q=~~\n>'===#====~"
],
"output": [
"A\nB\nNA"
]
} | {
"input": [],
"output": []
} | IN-CORRECT | UNKNOWN | #include <bits/stdc++.h>
int main(int argc, const char* argv[]) {
int num;
int i, j, k, l;
scanf("%d", &num);
for (l = 0; l < num + 1; l++) {
char snake[200];
int bodyacnt = 0;
int bodybcnt = 0;
int midcnt = 0;
int endacnt = 0;
int endbcnt = 0;
int nacnt = 0;
for (i = 0; i < 200;... |
p00139 Snakes | In a world, a mysterious snake made of only letters lives. Two types of snakes are currently identified, type A and type B, but there may be other types as well.
For class A, after ">'" is followed by one or more "=", "#" comes, and after the same number of "=" as before, "~" (half-width tilde) finish.
Class B ends w... | {
"input": [
"3\n>'======#======~\n>^Q=Q=Q=Q=Q=Q=Q=Q=Q=~~\n>'===#====~"
],
"output": [
"A\nB\nNA"
]
} | {
"input": [],
"output": []
} | IN-CORRECT | cpp | #include <bits/stdc++.h>
using namespace std;
int checksnake(string, int);
int main(void) {
int n, len;
char snake[200];
int type;
cin >> n;
for (int i = 0; i < n; i++) {
scanf("%s", snake);
len = strlen(snake);
type = checksnake(snake, len);
if (type == 1)
cout << 'A' << endl;
else ... |
p00139 Snakes | In a world, a mysterious snake made of only letters lives. Two types of snakes are currently identified, type A and type B, but there may be other types as well.
For class A, after ">'" is followed by one or more "=", "#" comes, and after the same number of "=" as before, "~" (half-width tilde) finish.
Class B ends w... | {
"input": [
"3\n>'======#======~\n>^Q=Q=Q=Q=Q=Q=Q=Q=Q=~~\n>'===#====~"
],
"output": [
"A\nB\nNA"
]
} | {
"input": [],
"output": []
} | IN-CORRECT | cpp | #include <bits/stdc++.h>
using namespace std;
int main() {
int n;
cin >> n;
for (; n--;) {
string s;
cin >> s;
bool flag = false;
if (s[0] != '>') {
flag = true;
}
bool a_flag = true;
bool b_flag = true;
bool equal_flag = false;
int cnt = 0;
for (int i = 1; i < s.size... |
p00139 Snakes | In a world, a mysterious snake made of only letters lives. Two types of snakes are currently identified, type A and type B, but there may be other types as well.
For class A, after ">'" is followed by one or more "=", "#" comes, and after the same number of "=" as before, "~" (half-width tilde) finish.
Class B ends w... | {
"input": [
"3\n>'======#======~\n>^Q=Q=Q=Q=Q=Q=Q=Q=Q=~~\n>'===#====~"
],
"output": [
"A\nB\nNA"
]
} | {
"input": [],
"output": []
} | IN-CORRECT | java | import java.util.Scanner;
public class Main {
/**
* @param args
*/
int solve(String str)
{
final int HEAD=0;
final int EYE_A=1;
final int EYE_B=2;
final int BODY_A1=3;
final int BODY_A2=4;
final int BODY_B=5;
final int STOMACH_A=6;
final int TAIL_A=7;
final int TAIL_B=8;
int state=-1;... |
p00139 Snakes | In a world, a mysterious snake made of only letters lives. Two types of snakes are currently identified, type A and type B, but there may be other types as well.
For class A, after ">'" is followed by one or more "=", "#" comes, and after the same number of "=" as before, "~" (half-width tilde) finish.
Class B ends w... | {
"input": [
"3\n>'======#======~\n>^Q=Q=Q=Q=Q=Q=Q=Q=Q=~~\n>'===#====~"
],
"output": [
"A\nB\nNA"
]
} | {
"input": [],
"output": []
} | IN-CORRECT | python3 | # -*- coding: utf-8 -*-
import sys
import os
import math
N = int(input())
def is_A(s):
if s[0:2] != ">'":
return False
if s[-1] != '~':
return False
body = s[2:-1]
lst = body.split('#')
if len(lst) != 2:
return False
if lst[0] == lst[1] and len(lst[0]) == lst[0].co... |
p00139 Snakes | In a world, a mysterious snake made of only letters lives. Two types of snakes are currently identified, type A and type B, but there may be other types as well.
For class A, after ">'" is followed by one or more "=", "#" comes, and after the same number of "=" as before, "~" (half-width tilde) finish.
Class B ends w... | {
"input": [
"3\n>'======#======~\n>^Q=Q=Q=Q=Q=Q=Q=Q=Q=~~\n>'===#====~"
],
"output": [
"A\nB\nNA"
]
} | {
"input": [],
"output": []
} | IN-CORRECT | cpp | #include <bits/stdc++.h>
using namespace std;
void a() {
cout << "NA" << endl;
return;
}
int main() {
int n;
cin >> n;
for (int i = 0; i < n; i++) {
string snake;
cin >> snake;
string::size_type aruyon;
if ((aruyon = snake.find(">'")) == 0) {
int equal = 0;
int j;
for (j = 2;... |
p00139 Snakes | In a world, a mysterious snake made of only letters lives. Two types of snakes are currently identified, type A and type B, but there may be other types as well.
For class A, after ">'" is followed by one or more "=", "#" comes, and after the same number of "=" as before, "~" (half-width tilde) finish.
Class B ends w... | {
"input": [
"3\n>'======#======~\n>^Q=Q=Q=Q=Q=Q=Q=Q=Q=~~\n>'===#====~"
],
"output": [
"A\nB\nNA"
]
} | {
"input": [],
"output": []
} | IN-CORRECT | UNKNOWN | #include <bits/stdc++.h>
int main(void) {
int num, i, o, sum;
char line[250];
scanf("%d", &num);
for (i = 0; memset(line, 0, sizeof(line)), i < num; i++) {
scanf("%s", line);
if (line[0] == '>' && line[1] == '\'') {
sum = 0;
o = 2;
while (line[o] != '#' && line[o]) o++, sum++;
if... |
p00139 Snakes | In a world, a mysterious snake made of only letters lives. Two types of snakes are currently identified, type A and type B, but there may be other types as well.
For class A, after ">'" is followed by one or more "=", "#" comes, and after the same number of "=" as before, "~" (half-width tilde) finish.
Class B ends w... | {
"input": [
"3\n>'======#======~\n>^Q=Q=Q=Q=Q=Q=Q=Q=Q=~~\n>'===#====~"
],
"output": [
"A\nB\nNA"
]
} | {
"input": [],
"output": []
} | IN-CORRECT | cpp | #include <bits/stdc++.h>
const double PI = acos(-1);
using namespace std;
int main() {
int n;
cin >> n;
for (int i = 0; i < n; i++) {
string ans;
string s;
cin >> s;
if (s[0] != '>') {
cout << "NA" << endl;
continue;
}
if (s[1] == '^') {
ans = 'B';
int h = 2;
... |
p00139 Snakes | In a world, a mysterious snake made of only letters lives. Two types of snakes are currently identified, type A and type B, but there may be other types as well.
For class A, after ">'" is followed by one or more "=", "#" comes, and after the same number of "=" as before, "~" (half-width tilde) finish.
Class B ends w... | {
"input": [
"3\n>'======#======~\n>^Q=Q=Q=Q=Q=Q=Q=Q=Q=~~\n>'===#====~"
],
"output": [
"A\nB\nNA"
]
} | {
"input": [],
"output": []
} | IN-CORRECT | cpp | #include <bits/stdc++.h>
using namespace std;
int n;
string s;
int main() {
cin >> n;
while (cin >> s) {
if (s.size() < 6 || s[0] != '>') {
cout << "NA" << endl;
break;
}
int cur = 2, l = 0, l2 = 0, f = 0, f2 = 0;
if (s[1] == '\'') {
while (cur < s.size()) {
if (f2) {
... |
p00139 Snakes | In a world, a mysterious snake made of only letters lives. Two types of snakes are currently identified, type A and type B, but there may be other types as well.
For class A, after ">'" is followed by one or more "=", "#" comes, and after the same number of "=" as before, "~" (half-width tilde) finish.
Class B ends w... | {
"input": [
"3\n>'======#======~\n>^Q=Q=Q=Q=Q=Q=Q=Q=Q=~~\n>'===#====~"
],
"output": [
"A\nB\nNA"
]
} | {
"input": [],
"output": []
} | IN-CORRECT | UNKNOWN | #include <bits/stdc++.h>
int main(void) {
int quantity, i, j, idx, count = 0;
char snake[200] = {0};
scanf("%d", &quantity);
for (i = 0; i < quantity; i++) {
scanf("%s", snake);
if (snake[0] != '>') {
puts("NA");
} else if (snake[1] == '\'') {
for (j = 2; j < 199; j++) {
if (snak... |
p00139 Snakes | In a world, a mysterious snake made of only letters lives. Two types of snakes are currently identified, type A and type B, but there may be other types as well.
For class A, after ">'" is followed by one or more "=", "#" comes, and after the same number of "=" as before, "~" (half-width tilde) finish.
Class B ends w... | {
"input": [
"3\n>'======#======~\n>^Q=Q=Q=Q=Q=Q=Q=Q=Q=~~\n>'===#====~"
],
"output": [
"A\nB\nNA"
]
} | {
"input": [],
"output": []
} | IN-CORRECT | cpp | #include <bits/stdc++.h>
using namespace std;
int main() {
int n;
cin >> n;
while (n--) {
string str;
string kp;
string set;
int flag = 0;
int count = 0;
int i = 0;
cin >> str;
for (i = 0; i < 2; i++) kp += str[i]++;
if (kp == ">'") {
while (str[i] != '#') {
if (s... |
p00139 Snakes | In a world, a mysterious snake made of only letters lives. Two types of snakes are currently identified, type A and type B, but there may be other types as well.
For class A, after ">'" is followed by one or more "=", "#" comes, and after the same number of "=" as before, "~" (half-width tilde) finish.
Class B ends w... | {
"input": [
"3\n>'======#======~\n>^Q=Q=Q=Q=Q=Q=Q=Q=Q=~~\n>'===#====~"
],
"output": [
"A\nB\nNA"
]
} | {
"input": [],
"output": []
} | IN-CORRECT | UNKNOWN | import Control.Monad -- replicateM
main = do
n <- readLn
ss <- replicateM n getLine
putStr . unlines . map snakeType $ ss
snakeType s
| isTypeA s = "A"
| isTypeB s = "B"
| otherwise = "NA"
isTypeA s =
s == ">'" ++ eqs ++ "#" ++ eqs ++ "~" && length eqs >= 1
where eqs = takeWhile (== '=') (drop 2 s... |
p00139 Snakes | In a world, a mysterious snake made of only letters lives. Two types of snakes are currently identified, type A and type B, but there may be other types as well.
For class A, after ">'" is followed by one or more "=", "#" comes, and after the same number of "=" as before, "~" (half-width tilde) finish.
Class B ends w... | {
"input": [
"3\n>'======#======~\n>^Q=Q=Q=Q=Q=Q=Q=Q=Q=~~\n>'===#====~"
],
"output": [
"A\nB\nNA"
]
} | {
"input": [],
"output": []
} | IN-CORRECT | cpp | #include <bits/stdc++.h>
using namespace std;
int solve(string &s) {
if (s.length() >= 3 && s.substr(0, 2) == ">'" &&
s[(int)s.length() - 1] == '~') {
int c1 = 0, c2 = 0, t = 0, f = 0;
for (int i = 2; i + 1 < (int)s.length(); ++i) {
if (s[i] != '=' && s[i] != '#') f = 1;
if (s[i] == '#' && t... |
p00139 Snakes | In a world, a mysterious snake made of only letters lives. Two types of snakes are currently identified, type A and type B, but there may be other types as well.
For class A, after ">'" is followed by one or more "=", "#" comes, and after the same number of "=" as before, "~" (half-width tilde) finish.
Class B ends w... | {
"input": [
"3\n>'======#======~\n>^Q=Q=Q=Q=Q=Q=Q=Q=Q=~~\n>'===#====~"
],
"output": [
"A\nB\nNA"
]
} | {
"input": [],
"output": []
} | IN-CORRECT | cpp | #include <bits/stdc++.h>
using namespace std;
int main() {
int n;
cin >> n;
for (int i = 0; i < n; i++) {
bool a = false, b = false;
string str;
cin >> str;
if (str[0] == '>' && str[1] == '\'' && str.size() % 2 == 0) {
a = true;
}
if (str[0] == '>' && str[1] == '^' && str.size() % 2 ... |
p00139 Snakes | In a world, a mysterious snake made of only letters lives. Two types of snakes are currently identified, type A and type B, but there may be other types as well.
For class A, after ">'" is followed by one or more "=", "#" comes, and after the same number of "=" as before, "~" (half-width tilde) finish.
Class B ends w... | {
"input": [
"3\n>'======#======~\n>^Q=Q=Q=Q=Q=Q=Q=Q=Q=~~\n>'===#====~"
],
"output": [
"A\nB\nNA"
]
} | {
"input": [],
"output": []
} | IN-CORRECT | cpp | #include <bits/stdc++.h>
using namespace std;
int main(void) {
int n, len, flag = 0, cnt1 = 0, cnt2 = 0;
char snake[10000][200];
cin >> n;
for (int i = 0; i < n; i++) {
scanf("%s", snake[i]);
len = strlen(snake[i]);
if (snake[i][0] == '>' && snake[i][1] == '\'' && snake[i][2] == '=') {
for (in... |
p00139 Snakes | In a world, a mysterious snake made of only letters lives. Two types of snakes are currently identified, type A and type B, but there may be other types as well.
For class A, after ">'" is followed by one or more "=", "#" comes, and after the same number of "=" as before, "~" (half-width tilde) finish.
Class B ends w... | {
"input": [
"3\n>'======#======~\n>^Q=Q=Q=Q=Q=Q=Q=Q=Q=~~\n>'===#====~"
],
"output": [
"A\nB\nNA"
]
} | {
"input": [],
"output": []
} | IN-CORRECT | UNKNOWN | #include <bits/stdc++.h>
int main(void) {
int quantity, i, j, idx, count = 0;
char snake[200] = {0};
scanf("%d", &quantity);
for (i = 0; i < quantity; i++) {
scanf("%s", snake);
if (snake[0] != '>') {
puts("NA");
} else if (snake[1] == '\'') {
for (j = 2; j < 199; j++) {
if (snak... |
p00139 Snakes | In a world, a mysterious snake made of only letters lives. Two types of snakes are currently identified, type A and type B, but there may be other types as well.
For class A, after ">'" is followed by one or more "=", "#" comes, and after the same number of "=" as before, "~" (half-width tilde) finish.
Class B ends w... | {
"input": [
"3\n>'======#======~\n>^Q=Q=Q=Q=Q=Q=Q=Q=Q=~~\n>'===#====~"
],
"output": [
"A\nB\nNA"
]
} | {
"input": [],
"output": []
} | IN-CORRECT | cpp | #include <bits/stdc++.h>
using namespace std;
int main() {
int n;
cin >> n;
getchar();
for (int i = 0; i < n; i++) {
string snake;
getline(cin, snake);
string ans = "NA";
if (snake[0] == '>' && snake[1] == '\'') {
int shape = 0;
for (int i = 2; i < snake.length(); i++) {
if (... |
p00139 Snakes | In a world, a mysterious snake made of only letters lives. Two types of snakes are currently identified, type A and type B, but there may be other types as well.
For class A, after ">'" is followed by one or more "=", "#" comes, and after the same number of "=" as before, "~" (half-width tilde) finish.
Class B ends w... | {
"input": [
"3\n>'======#======~\n>^Q=Q=Q=Q=Q=Q=Q=Q=Q=~~\n>'===#====~"
],
"output": [
"A\nB\nNA"
]
} | {
"input": [],
"output": []
} | IN-CORRECT | python2 | def snakeJudge(snake):
if snake[:2] == ">'" :
snake = snake[2 : len(snake) - 1]
x1 = snake[0 : snake.index("#")]
x2 = snake[snake.index("#") + 1: len(snake)]
if x1 == x2 : return "A"
if snake[:2] == ">^" :
judge = True
snake = snake[2 : len(snake) - 2]
x1 = snake.count("Q=")
x2 = len(snake)
if x2 /... |
p00139 Snakes | In a world, a mysterious snake made of only letters lives. Two types of snakes are currently identified, type A and type B, but there may be other types as well.
For class A, after ">'" is followed by one or more "=", "#" comes, and after the same number of "=" as before, "~" (half-width tilde) finish.
Class B ends w... | {
"input": [
"3\n>'======#======~\n>^Q=Q=Q=Q=Q=Q=Q=Q=Q=~~\n>'===#====~"
],
"output": [
"A\nB\nNA"
]
} | {
"input": [],
"output": []
} | IN-CORRECT | cpp | #include <iostream>
#include <string>
using namespace std;
int main() {
int n;
string snake;
int idx;
int count;
cin >> n;
getline(cin,snake);
for(int i=0;i<n;i++) {
getline(cin,snake);
//明らかにどちらのヘビでもない
if(snake[0]!='>') {
cout << "NA" << endl;
break;
}
else... |
p00139 Snakes | In a world, a mysterious snake made of only letters lives. Two types of snakes are currently identified, type A and type B, but there may be other types as well.
For class A, after ">'" is followed by one or more "=", "#" comes, and after the same number of "=" as before, "~" (half-width tilde) finish.
Class B ends w... | {
"input": [
"3\n>'======#======~\n>^Q=Q=Q=Q=Q=Q=Q=Q=Q=~~\n>'===#====~"
],
"output": [
"A\nB\nNA"
]
} | {
"input": [],
"output": []
} | IN-CORRECT | cpp | #include <bits/stdc++.h>
using namespace std;
int main() {
int N, j;
cin >> N;
while (N--) {
int runcnt = 0, j;
char S[150] = {0};
cin >> S;
if (S[0] == '>' && S[1] == 39) {
int K = 0;
for (j = 2;; j++) {
if (S[j] == '=') {
runcnt++;
K = 1;
} else if... |
p00139 Snakes | In a world, a mysterious snake made of only letters lives. Two types of snakes are currently identified, type A and type B, but there may be other types as well.
For class A, after ">'" is followed by one or more "=", "#" comes, and after the same number of "=" as before, "~" (half-width tilde) finish.
Class B ends w... | {
"input": [
"3\n>'======#======~\n>^Q=Q=Q=Q=Q=Q=Q=Q=Q=~~\n>'===#====~"
],
"output": [
"A\nB\nNA"
]
} | {
"input": [],
"output": []
} | IN-CORRECT | cpp | #include <bits/stdc++.h>
const double Eps = 1e-6;
using namespace std;
int main() {
char buf[256];
int n;
scanf("%d\n", &n);
while (n--) {
memset(buf, '\0', sizeof(buf));
cin.getline(buf, sizeof(buf));
if (strlen(buf) < 3) {
puts("NA");
continue;
}
const char* p = buf + 2;
if... |
p00139 Snakes | In a world, a mysterious snake made of only letters lives. Two types of snakes are currently identified, type A and type B, but there may be other types as well.
For class A, after ">'" is followed by one or more "=", "#" comes, and after the same number of "=" as before, "~" (half-width tilde) finish.
Class B ends w... | {
"input": [
"3\n>'======#======~\n>^Q=Q=Q=Q=Q=Q=Q=Q=Q=~~\n>'===#====~"
],
"output": [
"A\nB\nNA"
]
} | {
"input": [],
"output": []
} | IN-CORRECT | UNKNOWN | #include <bits/stdc++.h>
int main(void) {
int num, i, o, sum;
char line[202];
scanf("%d", &num);
for (i = 0; i < num; i++) {
scanf("%s", line);
if (line[0] == '>' && line[1] == '\'') {
sum = 0;
o = 2;
while (line[o] != '#' && line[o]) o++, sum++;
if (!line[o]) {
puts("NA"... |
p00139 Snakes | In a world, a mysterious snake made of only letters lives. Two types of snakes are currently identified, type A and type B, but there may be other types as well.
For class A, after ">'" is followed by one or more "=", "#" comes, and after the same number of "=" as before, "~" (half-width tilde) finish.
Class B ends w... | {
"input": [
"3\n>'======#======~\n>^Q=Q=Q=Q=Q=Q=Q=Q=Q=~~\n>'===#====~"
],
"output": [
"A\nB\nNA"
]
} | {
"input": [],
"output": []
} | IN-CORRECT | UNKNOWN | #include <bits/stdc++.h>
int main(int argc, const char* argv[]) {
int num;
int i, j, k, l;
char snake[200];
int bodyacnt = 0;
int bodybcnt = 0;
int midcnt = 0;
int endacnt = 0;
int endbcnt = 0;
int nacnt = 0;
scanf("%d", &num);
for (l = 0; l < num + 1; l++) {
bodyacnt = 0;
bodybcnt = 0;
... |
p00139 Snakes | In a world, a mysterious snake made of only letters lives. Two types of snakes are currently identified, type A and type B, but there may be other types as well.
For class A, after ">'" is followed by one or more "=", "#" comes, and after the same number of "=" as before, "~" (half-width tilde) finish.
Class B ends w... | {
"input": [
"3\n>'======#======~\n>^Q=Q=Q=Q=Q=Q=Q=Q=Q=~~\n>'===#====~"
],
"output": [
"A\nB\nNA"
]
} | {
"input": [],
"output": []
} | IN-CORRECT | cpp | #include <bits/stdc++.h>
using namespace std;
int main() {
int n;
cin >> n;
for (int i = 0; i < n; i++) {
string str;
cin >> str;
if (str.size() <= 4) cout << "NA" << endl;
if (str.substr(0, 2) == ">'" && str[str.size() - 1] == '~' &&
str.size() % 2 == 0) {
string ss = str.substr(2, ... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.