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 a = 0, b = 0;
bool f;
if (s[0] == '>') {
if (s[1] == '^') {
f = false;
for (int i = 0; i < s.size() - 1; i++) {
if (s[i] == 'Q' && s[i + 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, 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 | 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 | cpp | #include <bits/stdc++.h>
using namespace std;
bool A(string s) {
if (s[0] != '>' || s[1] != '\'' || s[s.size() - 1] != '~') return false;
if (s.size() % 2 == 1) return false;
if (s[s.size() / 2] != '#') return false;
s[s.size() / 2] = '=';
for (int i = 2; i < s.size() - 1; i++) {
if (s[i] != '=') return f... |
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>
bool checkA(char *p) {
int eqCnt = 0;
if (*p++ != '>') return false;
if (*p++ != '\'') return false;
while (*p++ == '=') eqCnt++;
p--;
if (*p++ != '#') return false;
while (*p++ == '=') eqCnt--;
p--;
if (eqCnt != 0) return false;
if (*p++ != '~') return false;
if (*p != '\... |
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 n[486848] = {};
int main() {
string str, x = " ";
int N;
cin >> N;
for (int i = 0; i < N; i++) {
cin >> str;
for (int j = 0; j < 2; j++) x[j] = str[j];
if (x == ">'" && str[str.size() - 1] == '~') {
bool f = true;
int C = 0;
int m... |
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;
scanf("%d", &n);
while (n-- > 0) {
char snake[256] = {0};
int i;
char *kind;
int equal = 0;
int tilda = 0;
int sharp = 0;
scanf("%s", snake);
if (strncmp(">'", snake, 2) == 0)
kind = "A";
else if (strncmp(">^", snake, 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() {
int n, i, j;
string str;
cin >> n;
for (i = 0; i < n; i++) {
cin >> str;
if (str[0] == '>') {
if (str[1] == '\'') {
int num = 0;
for (j = 2; j < str.size(); j++) {
if (str[j] == '=')
num++;
e... |
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 void Main(string[] args)
{
StringBuilder sb = new StringBuilder();
int n = int.Parse(Console.ReadLine());
while (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;
string s;
for (int i = 0; i < n; ++i) {
cin >> s;
int m = s.size();
string res;
if (s.size() < 6 || s.size() % 2 == 1) {
res = "NA";
} else if (s.substr(0, 2) == ">'" && s[m - 1] == '~') {
res = "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 | for _ in [0]*int(input()):
s=input()
if s[1]=='\'':
a=s[2:-1].split('#')
print(['NA','A'][set(a[0])==set(a[1])=={'='} and len(set(a))==1])
else:
s=s[2:-2]
print(['NA','B'][len(s)==2*s.count('Q=')]) |
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 ++ "~"
where eqs = takeWhile (== '=') (drop 2 s)
isTypeB s =
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, a, c, f;
string str = "\0";
cin >> n;
for (int i = 0; i < n; ++i) {
cin >> str;
c = f = 0;
a = 2;
if (str[0] == '>') {
if (str[1] == '\'') {
while (str[a] == '=') {
++a;
++c;
}
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 str;
int N;
cin >> N;
for (int i = 0; i < N; i++) {
cin >> str;
string x = " ";
for (int j = 0; j < 2; j++) x[j] = str[j];
if (str[0] == '>') {
if (str[1] == '\'' && str[str.size() - 1] == '~') {
bool f = true;
... |
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 judgeSnakeType(string s) {
if (s.find(">'") == 0 && s.find("~") == s.size() - 1) {
s.erase(s.size() - 1, 1);
s.erase(0, 2);
int cnt = 0;
while (s.size() > 0 && s[0] == '=') {
if (s[0] == '=') {
s.erase(0, 1);
cnt++;
}
... |
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) {
Scanner sc = new Scanner(System.in);
int n = sc.nextInt();
while (n-- > 0) {
String snake = sc.next();
if (snake.indexOf('#') > 0 && snake.charAt(0) == '>' && snake.charAt(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() {
int n;
cin >> n;
for (int hoge = 0; hoge < n; hoge++) {
string s;
cin >> s;
int state = 0;
if (s.size() <= 5) {
cout << "NA" << endl;
continue;
}
if (s[0] == '>' && s[1] == '\'')
state = 1;
else if (s[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 | char s[102],a[101],b[101],t,t2;A(){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 | UNKNOWN | chkA ('>':'\'':s) = chkA_1 s
chkA s = False
chkA_1 ('=':s) =
let n = 1 + (length . takeWhile (== '=')) s
in
chkA_2 n $ dropWhile (== '=') s
chkA_1 s = False
chkA_2 n ('#':s) = chkA_3 n s
chkA_2 n s = False
chkA_3 n ('=':s) =
let m = 1 + (length . takeWhile (== '=')) s
in
if n == m
then chkA_4 $... |
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);
cout << tmp << endl;
if (tmp.size() % 2 != 0 && tmp[tmp.si... |
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 hoge = 0; hoge < n; hoge++) {
string s;
cin >> s;
int state = 0;
if (s[0] == '>' && s[1] == '\'')
state = 1;
else if (s[0] == '>' && s[1] == '^')
state = 2;
int cal = 0, cnt = 0;
bool myboo... |
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;
int main() {
int n;
cin >> n;
while (n--) {
string s;
cin >> s;
if (s[0] == '>') {
if (s[1] == '\'') {
int sum = 0;
for (int i = 0; i < s.size(); i++)
if (s[i] == '=') sum++;
if (s.size() % 2 == 0 && s[s.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 | #include <bits/stdc++.h>
int A_snake(char snake[]);
int B_snake(char snake[]);
int main(void) {
int quantity, i;
char snake[201] = {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 | python3 | for _ in [0]*int(input()):
s=input()
if s[:2]==">'" and s[-1]=='~' and '#' in s:
s=s[2:-1].split('#')
print(['NA','A'][set(s[0])==set(s[1])=={'='} and len(set(s))==1])
elif s[:2]=='>^' and s[-2:]=='~~':
s=s[2:-2]
print(['NA','B'][len(s)==2*s.count('Q=') and len(s)>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;
inline int toInt(string s) {
int v;
istringstream sin(s);
sin >> v;
return v;
}
template <class T>
inline string toString(T x) {
ostringstream sout;
sout << x;
return sout.str();
}
const double EPS = 1e-12;
const double PI = acos(-1.0);
int main() {
int 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, a, c, f;
string str = "\0";
cin >> n;
for (int i = 0; i < n; ++i) {
cin >> str;
c = f = 0;
a = 2;
if (str[0] == '>') {
if (str[1] == '\'') {
while (str[a] == '=') {
++a;
++c;
}
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;
bool isOutOfStr(int ind, string str) { return ind >= str.length(); }
int main(void) {
int n;
cin >> n;
while (n--) {
string str;
cin >> str;
if (!isOutOfStr(1, str) && str[0] == '>' && str[1] == '\'') {
int sharp_cnt = 0;
int ind;
ind = 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() {
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;
string res = species[2];
for (i = 0; i < n; ++i) {
g... |
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 solv(string s) {
int ss = s.size();
if (s[0] != '>' || s[ss - 1] != '~') return "NA";
if (s[ss - 2] == '~') {
if (s[1] != '^') return "NA";
for (int i = 0; i < ss - 2; i++) {
if (s[i] == 'Q' && s[i + 1] == '=') return "B";
}
} 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>
using namespace std;
int main() {
int n;
cin >> n;
for (int z = 0; z < n; z++) {
string a;
cin >> a;
string b = a.substr(0, 2), c = a.substr(a.length() - 2, 2);
if (b == ">'") {
if (c[1] == '~') {
int d[2] = {0, 0}, e = 0;
bool f = false;
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 | cpp | #include <bits/stdc++.h>
using namespace std;
int main() {
int in;
cin >> in;
for (int i = 0; i < in; i++) {
int status = 0;
string snake;
cin >> snake;
if (snake[0] != '>') {
cout << "NA" << endl;
continue;
}
if (snake[1] == '^') {
for (int j = 2; j < snake.size() - 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 | UNKNOWN | chkA ('>':'\'':s) = chkA_1 s
chkA s = False
chkA_1 ('=':s) = chkA_2 n $ dropWhile (== '=') s
where
n = 1 + (length . takeWhile (== '=')) s
chkA_1 s = False
chkA_2 n ('#':s) = chkA_3 n s
chkA_2 n s = False
chkA_3 n ('=':s) = if n == m
... |
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() {
char data[110];
int a, b, i, n, c, j, len, temp;
scanf("%d", &n);
for (i = 0; i < n; i++) {
a = b = 0;
if (scanf("%s", data) == EOF) break;
;
len = strlen(data);
if (len >= 6 && len % 2 == 0) {
if (data[0] == '>' && data[1] == '\'' && data[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 | 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
"NA"
} else if (s(1) == '^') { // maybeB
var isB = true
for(i<-2 until s.length-2 by 2) {
if(s(i)!='Q' || s(i+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 <stdio.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;
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 | cpp | #include <bits/stdc++.h>
using namespace std;
string judgeSnakeType(string s) {
if (s.find(">'") == 0 && s.find("~") == s.size() - 1) {
s.erase(s.size() - 1, 1);
s.erase(0, 2);
int cnt = 0;
while (s.size() > 0 && s[0] == '=') {
if (s[0] == '=') {
s.erase(0, 1);
cnt++;
}
... |
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(char snake[]) {
int i, num;
if (snake[0] != '>' || snake[1] != '\'') {
return (0);
}
i = 2;
num = 0;
while (snake[i] == '=') {
i++;
num++;
}
if (num == 0) {
return (0);
}
if (snake[i++] != '#') {
return (0);
}
while (snake[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 | cpp | #include <bits/stdc++.h>
using namespace std;
bool kind_a(string str) {
if (str[0] != '>' || str[1] != '\'' || str[str.size() - 1] != '~') {
return false;
}
string su = str.substr(2, str.size() - 3);
for (int i = 0; i < su.size(); ++i) {
int j = su.size() - 1 - i;
if (i >= j) break;
if (su[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 | cpp | #include <bits/stdc++.h>
using namespace std;
template <class T>
void debug(T a) {
for (auto i : a) cout << i << endl;
}
int dx[4] = {0, -1, 1, 0}, dy[4] = {1, 0, 0, -1};
int main() {
int n;
cin >> n;
for (int i = 0; i < n; i++) {
string a;
cin >> a;
bool ok = true;
string ans;
if (a[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 n;
string s;
int check() {
if (s.size() < 6) return 0;
if (s[0] != '>') return 0;
if (s[1] == '\'') {
int cnt = 0, cntp = 0;
for (int i = 2; i < s.size() - 1; i++) {
if (s[i] != '=') break;
cnt++;
cntp++;
}
if (s[2 + cnt] != '#') ... |
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[210] = {0};
scanf("%d", &quantity);
for (i = 0; i < quantity; i++) {
snake[i] = getchar();
if (snake[0] != '>') {
puts("NA");
} else if (snake[1] == '\'') {
if (A_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;
struct cww {
cww() {
ios::sync_with_stdio(false);
cin.tie(0);
}
} star;
int check(string S) {
if (S[0] != '>' || S[S.size() - 1] != '~') {
return 0;
}
if (S[1] == '\'') {
if (S.substr(2, S.size() - 3).find_first_not_of("#=", 0) != string::npos)
... |
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--) {
bool judge = false;
string s;
cin >> s;
if (s[0] == '>') {
if (s[1] == '\'' && s[s.size() - 1] == '~') {
if (s[s.size() / 2] == '#' && !(s.size() & 1))
cout << "A" << endl;
els... |
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;
cin.getline(buf, sizeof(buf));
sscanf(buf, "%d", &n);
while (n--) {
memset(buf, '\0', sizeof(buf));
cin.getline(buf, sizeof(buf));
if (strlen(buf) < 3) {
puts("NA");
continue;
... |
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 | UNKNOWN | gets.to_i.times do
case line=gets.chomp
when line=~/>'=+#=+~~/o
puts :A
when line=~/>^(:?Q=)+~~/o
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 in;
int isA() {
if (in[0] != '>') return 0;
if (in[1] != '\'') return 0;
if (!(in[in.length() - 1] == '~' && in[in.length() - 2] == '=')) return 0;
int data[2] = {0, 0};
int status = 0;
for (int i = 2; i < in.length() - 1; i++) {
if (in[i] == '#') sta... |
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;
string in;
int isA() {
if (in[0] != '>') return 0;
if (in[1] != '\'') return 0;
if (!(in[in.length() - 1] == '~' && in[in.length() - 2] == '=')) return 0;
int data[2] = {0, 0};
int status = 0;
for (int i = 2; i < in.length() - 1; i++) {
if (in[i] == '#') sta... |
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;
bool check() {
if (s.size() < 6) return 0;
if (s[0] != '>') return 0;
if (s[1] != '\'') {
int cnt = 0;
for (int i = 2; i < s.size() - 1; i++) {
if (s[i] != '=') break;
cnt++;
}
if (s[2 + cnt] != '#') return 0;
for (int ... |
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 | char s[101],a[101],b[101],t,t2;A(){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 main() {
int n;
string s;
cin >> n;
for (int i = 0; i < n; i++) {
cin >> s;
if (s.substr(0, 2) == ">\'") {
if (s[s.length() - 1] != '~')
cout << "NA" << endl;
else {
int cnt = 0, pos = 2;
bool flag = true;
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 | UNKNOWN | #include <bits/stdc++.h>
int checkA(char str[]) {
int i;
int cnt = 0;
if (str[strlen(str) - 1] != '~') return 0;
for (i = 2; i < strlen(str); i++) {
if (str[i] == '=')
cnt++;
else if (str[i] == '#')
break;
else
return 0;
}
i++;
while (i < strlen(str)) {
if (i == strlen(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 | UNKNOWN | #include <stdio.h>
#include <math.h>
int main(){
int syucnt[1000]={0},n,i,t,l,gou=0;
char input[10000];
scanf("%d",&n);
for(i=0;i<n;i++){
scanf("%s",input);
l = strlen(input);
if(input[l-1]=='~'&&input[l-2]=='~'&&input[0]=='>'&&input[1]=='^'){//B種の調べ
for(t=2;t<=l-4;t=t+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 i, n, state, cc;
char snake[20000];
int main() {
for (scanf("%d", &n); n > 0; n--) {
scanf("%s", snake);
if (strncmp(snake, ">'", 2) == 0 && snake[strlen(snake) - 1] == '~' &&
strlen(snake) % 2 == 0) {
for (i = 2; i < strlen(snake) - 1; i++) {
if (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;
int main() {
int N;
cin >> N;
while (N--) {
string str;
cin >> str;
bool Aflag, Bflag;
Aflag = Bflag = true;
if (str.length() < 2) {
cout << "NA" << endl;
continue;
}
if (str.substr(0, 2) == ">'")
Bflag = false;
else 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;
string s;
cin >> n;
for (int u = 0; u < n; u++) {
cin >> s;
bool a = true, b = true;
if (s[0] != '>' || s.size() % 2 != 0) a = false, b = false;
if (s[1] != '\'' || s[s.size() - 1] != '~') a = false;
if (s[1] != '^' || s[s.siz... |
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 in;
cin >> in;
for (int i = 0; i < in; i++) {
int status = 0;
string snake;
cin >> snake;
if (snake[0] != '>') {
cout << "NA" << endl;
continue;
}
if (snake[1] == '^') {
for (int j = 2; j < snake.size() - 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>
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 | cpp | #include <bits/stdc++.h>
using namespace std;
inline int toInt(string s) {
int v;
istringstream sin(s);
sin >> v;
return v;
}
template <class T>
inline string toString(T x) {
ostringstream sout;
sout << x;
return sout.str();
}
template <class T>
inline T sqr(T x) {
return x * x;
}
const double EPS = 1e-... |
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[300] = {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() {
char s[201] = {0};
int i, n, j, c, h = 0;
scanf("%d", &n);
for (i = 0; i < n; i++) {
h = 0;
scanf("%s", s);
if (s[0] == '>') {
if (s[1] == '\'') {
c = 0;
for (j = 2; s[j] == '='; j++) c++;
if (s[j++] == '#') {
for (; s[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;
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 | python3 | # Aizu Problem 00139: Snakes
#
import sys, math, os, copy
# read input:
PYDEV = os.environ.get('PYDEV')
if PYDEV=="True":
sys.stdin = open("sample-input.txt", "rt")
def is_A_snake(snake):
if snake[1] != "'":
return False
snake = snake[2:-1]
segments = snake.split('#')
L = len(segments[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++) {
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 | UNKNOWN | #include <bits/stdc++.h>
int A_snake(char snake[]);
int B_snake(char snake[]);
int main(void) {
int quantity, i;
char snake[210] = {0};
scanf("%d", &quantity);
for (i = 0; i < quantity; i++) {
snake[i] = getchar();
if (snake[i] == EOF) break;
if (snake[0] != '>') {
puts("NA");
} else 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;
bool isSnakeA(string snake) {
if (snake.substr(0, 2) != ">'" || snake[snake.length() - 1] != '~') {
return false;
}
snake.erase(snake.begin(), snake.begin() + 2);
snake.erase(snake.end() - 1, snake.end());
size_t pos = snake.find('#');
if (pos == string::npo... |
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 const double eps = 10e-9;
bool isA(string str) {
if (str[0] != '>') return false;
if (str[1] != '\'') return false;
int hist[] = {0, 0};
for (int i = 2, j = 0; i < str.size() - 1; i++) {
if (str[i] == '=') {
hist[j]++;
} else if (str[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, 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 | python3 | # -*- coding: utf-8 -*-
import sys
import os
N = int(input())
def is_A(s):
if s[0:2] != ">'":
return False
if s[-1] != '~':
return False
body = s[2:-1]
if len(body) % 2 == 0:
return False
# body = '==#=='
center_index = len(body) // 2
if body[center_index] != '... |
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;
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, ... |
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() {
string str;
int n;
cin >> n;
while (n--) {
cin >> str;
int idx = 2;
int cnt = 0;
bool flg = true;
if (str[0] == '>' && str[1] == 39) {
bool used = false;
while (idx < str.size() && str[idx] == '=') {
used = true;
... |
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 str;
int n;
cin >> n;
while (n--) {
cin >> str;
int idx = 2;
int cnt = 0;
bool flg = true;
if (str[0] == '>' && str[1] == 39) {
bool used = false;
while (idx < str.size() && str[idx] == '=') {
used = true;
... |
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[201] = {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 check_a(char *snake) {
int n;
if (snake[strlen(snake) - 1] != '~') {
return (0);
}
snake[strlen(snake) - 1] = '\0';
if (*snake != '=') {
return (0);
}
n = 0;
while (*snake != '#') {
if (*snake != '=') {
return (0);
}
n++;
snake++;
}
snake++;... |
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 | chkA ('>':'\'':s) = chkA_1 s
chkA s = False
chkA_1 ('=':s) =
let n = 1 + (length . takeWhile (== '=')) s
in
chkA_2 n $ dropWhile (== '=') s
chkA_1 s = False
chkA_2 n ('#':s) = chkA_3 n s
chkA_2 n s = False
chkA_3 n ('=':s) =
let m = 1 + (length . takeWhile (== '=')) s
in
if n == m
then chkA_4 $... |
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 hoge = 0; hoge < n; hoge++) {
string s;
cin >> s;
int state = 0;
if (s[0] == '>' && s[1] == '\'')
state = 1;
else if (s[0] == '>' && s[1] == '^')
state = 2;
int cal = 0, cnt = 0;
bool myboo... |
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 | 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) {
if (S.find_first_not_of("#=", 2) != sz - 1) {
return 0;
}
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 | 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.index... |
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 | cpp | #include <bits/stdc++.h>
using namespace std;
string s;
int main() {
int n, t, now;
cin >> n;
while (n--) {
cin >> s;
if (s.size() >= 6 && s.substr(0, 3) == ">'=") {
t = 0;
while (s[3 + (t++)] == '=')
;
if (s[3 + t - 1] != '#')
cout << "NA" << endl;
else if (4 + 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 | def is_a?(s)
l = s.size
n = (l-4)/2
return false if l.odd?
return true if s.last == '~' && s[2,n] == s[-(n+1),n] && s[2,n].all?{|x| x=='='} && s[2+n] == '#'
return false
end
def is_b?(s)
l = s.size
return false unless s[-2,2].all?{|x| x=='~'}
s[2..-3].each_slice(2) do |q,e|
return false if q != 'Q'... |
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
N = int(input())
def is_A(s):
if s[0:2] != ">'":
return False
if s[-1] != '~':
return False
body = s[2:-1]
if len(body) % 2 == 0:
return False
# body = '==#=='
center_index = len(body) // 2
if body[center_index] != '... |
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 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;
using namespace std;
int main() {
int n;
while (cin >> n, n) {
for (int x = 0; x < n; ++x) {
string line;
cin >> line;
string sol = "NA";
int j = line.find('#');
if (line.find('#') != string::npos) {
bool flag = false;
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;
string s;
cin >> n;
for (int i = 0; i < (n); i++) {
cin >> s;
string ans;
if (s[0] == '>' && s[s.size() - 1] == '~') {
if (s[1] == '\'') {
ans = "A";
for (int i = 2; i < s.size() - 1; i++) {
if (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 n;
cin >> n;
for (int i = 0; i < n; i++) {
bool a = false, b = false;
string str;
cin >> str;
if (str[0] == '>' && str[1] == '\'') {
a = true;
}
if (str[0] == '>' && str[1] == '^') {
b = true;
}
if (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 | cpp | #include <bits/stdc++.h>
using namespace std;
int main(void) {
string s;
int n;
cin >> n;
while (n--) {
cin >> s;
if (s[0] == '>') {
if (s[1] == '\'') {
int cnt1 = 0;
int i;
for (i = 2; s[i] == '='; i++) {
cnt1++;
}
if (s[i] != '#') {
cou... |
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 == 0) {
for (i = 2; i < s.size(); i++) {
if (i == s.size() / 2 && s[i] != '#') break;
if (i == s.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;
void solve() {
int n;
cin >> n;
while (n--) {
string snake;
cin >> snake;
if (snake.size() < 4) {
cout << "NA" << endl;
} else if (snake[0] == '>' && snake[1] == '\'' &&
snake[snake.size() - 1] == '~') {
bool first = true;
... |
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() {
char s[201];
int n;
fscanf(stdin,
"%"
"d",
&n);
while (n--) {
fscanf(stdin,
"%"
"s",
&s);
int i, f = 0;
if (s[1] == '\'') {
int l, r;
l = r = 0;
for (i = 2; s[i] == '=' && s[i] != '\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>
const double Eps = 1e-6;
using namespace std;
int main() {
char buf[256];
int n;
cin.getline(buf, sizeof(buf));
sscanf(buf, "%d", &n);
while (n--) {
memset(buf, '\0', sizeof(buf));
cin.getline(buf, sizeof(buf));
if (strlen(buf) < 3) {
puts("NA");
continue;
... |
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.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
public class Main {
private static BufferedReader br = null;
static {
br = new BufferedReader(new InputStreamReader(System.in));
}
/**
* @param args
*/
public static void main(String[] args) {
// TODO Auto-ge... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.