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 | 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 main(void) {
int num, i, o, sum;
char line[202];
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>
bool checkA(char st[1001]) {
int len = strlen(st);
if (st[len - 1] != '~') return false;
if (len % 2 == 1) return false;
st[len / 2 - 1] = '=';
for (int i = 0; i < len - 1; i++) {
if (st[i] != '=') return false;
}
return true;
}
bool checkB(char st[1001]) {
if (st[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 | cpp | #include <bits/stdc++.h>
using namespace std;
bool isA(const string &str) {
int n = str.size();
int m = 0;
int pos = 2;
if (n == 0 || n == 1) return false;
if (str[0] != '>') return false;
if (str[1] != '\'') return false;
while (pos < n && str[pos] == '=') {
m++;
pos++;
}
if (pos == n) return... |
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;
cin >> n;
for (int i = 0; i < n; i++) {
string str;
cin >> str;
if (str.size() < 2)
cout << "NA" << endl;
else if (str[0] == '>' && str[1] == '\'') {
int j = 2;
int l[2] = {0, 0};
int ck = 0;
bool 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 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 | 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 | 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) && s.size() >= 6)
cout << "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;
bool A(string body) {
if (int a = body.find("#") != -1 && body.size() % 2 == 0 &&
body.substr(body.size() - 1, 1) == "~") {
for (int i = 0; i < a; i++) {
if (body.substr(i, 1) == body.substr(body.size() - 2 - i, 1) &&
body.substr(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 <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 | 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(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 | java | import java.util.Scanner;
public class Main
{
public static void main(String arg[])
{
Scanner sc = new Scanner(System.in);
int n= sc.nextInt();
while(n-->0)
{
String str = sc.nextLine();
char ch[] = str.toCharArray();
int counta =0;
int countb =0;
try{
if(ch[0]=='>'&&ch[1]=='\'' &&ch[ch.le... |
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 snakeA(s):
if s[:2]==">'" and s[-1]=="~":
t=s[2:-1].split("#")
if t[0]==t[-1]:
return True
return False
def snakeB(s):
if s[:2]==">^" and s[-2:]=="~~":
t=s[2:-2]
if set(t.split("Q="))==set(['']):
return True
return False
for i in range(input(... |
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;
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 | UNKNOWN | #include <stdio.h>
#include <math.h>
int main(){
int n,i,t,l,gou=0,syucnt[10000]={0};
char input[300];
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 | cpp | #include <bits/stdc++.h>
using namespace std;
int main() {
int n, f, i, m;
string s;
cin >> n;
while (n-- > 0) {
cin >> s;
f = 0;
if (s[0] == '>' && s[1] == '\'') {
m = s.find('#');
if (m != string::npos) {
for (i = 1; s[m - i] == s[m + i];) i++;
if (i > 1 && m - 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() {
int n;
while (cin >> n, n) {
for (int x = 0; x < n; ++x) {
string line;
cin >> line;
string sol = "NA";
if (line.find('#') != string::npos) {
bool flag = false;
string a = "";
string b = "";
for (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;
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] == '\'') {
S = S.substr(2, S.size() - 3);
if (S.find_first_not_of("#=", 0) != string... |
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 | UNKNOWN | #include <bits/stdc++.h>
int main(void) {
char str[201];
int i, j, n, cnt1, cnt2, last, 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 (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 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 | using System;
namespace AOJ.Volume1
{
public class Snakes
{
public static bool CheckA(string input)
{
// 先頭は「>'」
if (input.Substring(0, 2) != ">'") { return false; }
// 末尾は「~」
if (input.Substring(input.Length - 1, 1) != "~") { return 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 | java | import java.util.Scanner;
public class Main {
public static void main(String[] args){
Scanner sc = new Scanner(System.in);
int n = Integer.parseInt(sc.nextLine());
for(int i = 0; i < n; i++){
char[] str = sc.nextLine().toCharArray();
boolean is_na = false;
boolean is_a = false;
if(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 <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(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[1] == '\'') {
for (j = 2; j < 199; j++) {
if (snake[j] == '=')
count++;
else if (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;
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;
string solve(string s) {
if (s.substr(0, 2) == ">'") {
int eq = 0;
for (int i = 2; i < s.size(); i++) {
if (s[i] != '=')
break;
else {
eq++;
}
}
if (eq == 0) return "NA";
if (s[(2 + eq - 1) + 1] != '#') return "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;
cin >> n;
while (n--) {
string s;
cin >> s;
if (s == ">'" + string((s.size() - 4) / 2, '=') + '#' +
string((s.size() - 4) / 2, '=') + '~') {
cout << 'A' << endl;
} else {
int r = (s.size() - 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 | 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 += ">";
B += ">";
} else if (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() {
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 | 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 <iostream>
#include <string>
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{
fi(s[1] != ''')return "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(void) {
int max, data;
int num;
int cut_i;
char hebi[] = "特に意味のない文章";
scanf("%d", &max);
for (data = 0; data < max; data++) {
scanf("%s", hebi);
if (strlen(hebi) < 2 || hebi[0] != '>') {
puts("NA");
continue;
}
if (hebi[1] == '\'') {
num = ... |
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 | UNKNOWN | char s[101],a[50],b[50],t,t2;
Q(){
int i;
for(i=0;a[i];i+=2)
if(a[i]!='Q'||a[i+1]!='=')
return 0;
return i>=2;
}
main(){
scanf("%*d\n");
for(;~scanf("%[^\n]\n",s);){
if(sscanf(s,">'%[=]#%[=]%c%c",a,b,&t,&t2)==3&&t=='~'&&strlen(a)==strlen(b))
puts("A");
else if(sscanf(s,">^%[Q=]~%c%c",a,&t,&t2)==2&&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;
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 | #include <bits/stdc++.h>
char s[201];
int A(int p, int st, int c) {
if (st == 2 && c == 0 && s[p] == 0)
return 1;
else if (st == 1 && s[p] == '~')
return A(p + 1, st + 1, c);
else if (st == 1 && s[p] == '=')
return A(p + 1, st, c - 1);
else if (st == 0 && s[p] == '#')
return A(p + 1, st + 1, 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 | UNKNOWN | #include <bits/stdc++.h>
int main() {
int n, i, j;
char s[100001];
scanf("%d", &n);
while (n--) {
scanf("%s", s);
if (s[0] != '>') {
printf("NA");
continue;
}
if (s[1] == '\'') {
for (i = 2; s[i] == '='; i++)
;
for (j = 1; s[i - j] == '=' && s[i + j] == '='; 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 | 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);}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);){if(A())puts("A");else if(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 Judge(string &s) {
if (s[0] != '>') return -1;
if (s.size() < 2) return -1;
if (s[1] == '\'') {
if (s[s.size() - 1] != '~') return -1;
int len = ((int)s.size()) - 3;
if (len % 2 == 0) return -1;
for (int i = 0; i < ((len - 1) / 2); 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 | cpp | #include <bits/stdc++.h>
using namespace std;
int Judge(string &s) {
if (s[0] != '>') return -1;
if (s.size() < 2) return -1;
if (s[1] == '\'') {
if (s[s.size() - 1] != '~') return -1;
int len = ((int)s.size()) - 3;
if (len < 3 || len % 2 == 0) return -1;
for (int i = 0; i < ((len - 1) / 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 s;
cin >> s;
bool f = s[0] == '>';
int l = s.size();
f &= l > 5;
if (s[1] == '\'') {
int x = 0;
int i;
for (i = 2; i < l; i++) {
if (s[i] == '=')
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 | STDOUT.sync = true
n = gets.to_i
n.times do
str = gets.chomp!
size = (str.size - 4) / 2
stra = ">'"
strb = ">^"
size.times do
stra += '='
strb += 'Q='
end
stra += '#'
size.times do
stra += '='
end
stra += "~"
strb += '~~'
if (str == stra)... |
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 placeholders;
using LL = long long;
using ULL = unsigned long long;
using VI = vector<int>;
using VVI = vector<vector<int> >;
using VS = vector<string>;
using ISS = istringstream;
using OSS = ostringstream;
using PII = pair<int, int>;
using VPII = vector<pai... |
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 (snake[i++] != '#') {
return (0);
}
while (snake[i] == '=') {
i++;
num--;
}
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 | 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++) {
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) {
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() {
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) {
while (idx < str.size() && str[idx] != '#') {
cnt++;
idx++;
}
id... |
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) {
while (str[idx] != '#') {
cnt++;
idx++;
}
idx++;
while (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;
bool check_A(string str) {
if (str.size() < 6 || str.size() % 2 == 1) {
return false;
}
if (str.substr(0, 2) != ">'") {
return false;
}
int count = 0;
for (int i = 2; i < (str.size() - 4) / 2 + 2; i++) {
if (str[i] != '=') {
return 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 | 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 <string>
#include <iostream>
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 j = cnt + 3; ... |
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;
const double eps = 1e-10;
const double pi = acos(-1.0);
const double inf = (int)1e8;
int main() {
int n;
cin >> n;
for (int q = (0); q < unsigned long long(n); ++q) {
string s;
cin >> s;
bool p = true;
if (s.substr(0, 2) == ">'") {
s = s.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 | 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 S;
int n;
string solve(string T) {
int chain = 0, ok = 0;
if (T.size() >= 3) {
if (T[T.size() - 1] == '~') {
if (T.substr(0, 2) == ">'" && T.size() >= 6) {
for (int i = 2; i < T.size() - 1; i++) {
if (T[i] == '#') {
ok++;
... |
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, 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 + "=";
... |
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() {
bool b;
int n, i, j, t, c[2];
char s[201];
cin >> n;
for (i = 0; i < n; i++) {
b = true;
cin >> s;
if (s[0] == '>') {
if (s[1] == '\'') {
for (j = 2, t = c[0] = c[1] = 0; j < strlen(s) - 1; j++) {
if (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 | 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 | cpp | #include <bits/stdc++.h>
using namespace std;
int main() {
int n, size;
string s, a, b;
for (cin >> n; n > 0; n--) {
cin >> s;
size = s.size();
a = ">'";
b = ">^";
for (int i = 0; i < size / 2 - 2; i++) {
a = a + "=";
b = b + "Q=";
}
a += "#";
for (int i = 0; i < 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;
string head = s.substr(0, 2);
bool ok = true;
if (head == ">'") {
int c = 0;
for (int i = (2); i < (s.size()); ++i) {
if (s[i] != '=') break;
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;
bool isA(string s) {
int cnt1 = 0;
for (int i = 2; i < s.size(); ++i) {
if (s[i] == '=') {
++cnt1;
} else if (s[i] == '#') {
break;
} else {
return false;
}
}
int cnt2 = 0;
for (int i = cnt1 + 3; i < s.size(); ++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 | 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 | 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('#')
if len(segments) != ... |
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
s = gets.chomp
if s =~ /^>(?:.*)(=+)#\1~$/
puts ?A
elsif s =~ /^>(?:.*)(Q=)+(?:.*)~$/
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 | 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
if(isA && s(s.length-1)=='~') "A" else "NA"
} else if (s(1) == '^') { // maybeB
var isB = true
for(i<-2 until s.length-2 by... |
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 | python3 | class Ex(Exception):
pass
n=int(input())
for i in range(n):
try:
snk=input()
l=len(snk)
head=snk[:2]
body=snk[2:l-1]
tail=snk[l-1]
if tail!='~' or snk[0]!='>':
print("NA")
continue
spl_a=body.split('#')
if len(spl_a)==2 and ... |
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>
void Atype();
void Btype();
void wrong();
int A, B;
char b[200];
int main() {
int n, i;
char a;
scanf("%d", &n);
for (i = 0; i < n; i++) {
A = 0;
B = 0;
scanf("%s", b);
if (b[0] != '>')
wrong();
else {
if (b[1] == '\'')
Atype();
else if (b[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() {
int i, j, n, f;
char s[210];
scanf("%d", &n);
while (n--) {
scanf("%s", s);
if (s[0] == '>' && s[1] == '\'') {
i = 2;
f = 0;
while (1) {
if (s[i] == '#') break;
if (s[i] == '=')
f++;
else {
f = 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, 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() {
int n, c, h, i;
char s[201];
scanf("%d", &n);
while (n--) {
scanf("%s", s);
if (s[c = 0] != '>' || s[h = 1] != '\'' && s[1] != '^') {
printf("NA\n");
continue;
}
for (i = 2; s[i]; i++) {
if (s[1] == '\'') {
if (s[i] == '=') c += h;
... |
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 = 1e-8;
int main(void) {
int n;
cin >> n;
while (n--) {
string snake;
cin >> snake;
if (snake[0] == '>' && snake[1] == '\'' && snake[snake.size() - 1] == '~') {
int count = 0;
int end;
for (int i = 2; i < snake.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;
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();
if (len % 2 == 1) {
cout <... |
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) {
int mark = 0;
int cnt = 0;
for (int i = 2; i < s.size(); i++) {
if (mark == 0 && s[i] == '=') {
mark = 1;
cnt++;
} else if (mark == 1 && 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 | UNKNOWN | #include <bits/stdc++.h>
int main(void) {
int max, data;
int num;
int cut_i;
char hebi[] = " ";
scanf("%d", &max);
for (data = 0; data < max; data++) {
scanf("%s", hebi);
if (strlen(hebi) < 2 || hebi[0] != '>') {
puts("NA");
continue;
}
if (hebi[1] == '\'') {
num = 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 | 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 | UNKNOWN | #include <bits/stdc++.h>
int main(void) {
char snake[200];
int n, cnt1 = 0, cnt2 = 0, i, j = 0;
scanf("%d", &n);
for (i = 0; i < n; i++) {
scanf("%s", snake);
while (1) {
if (snake[j] == '>') {
j++;
if (snake[j] == '\'') {
j++;
while (1) {
if (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 | cpp | #include <bits/stdc++.h>
using namespace std;
static const double eps = 10e-9;
bool isA(string str) {
if (str.substr(0, 2) != ">'") return false;
string rear = str.substr(2, str.size() - 2);
int eq = count(rear.begin(), rear.end(), '=');
int shrp = count(rear.begin(), rear.end(), '#');
int til = count(rear.be... |
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 | cpp | #include <bits/stdc++.h>
using namespace std;
int main() {
int n;
cin >> n;
while (n--) {
string s;
cin >> s;
string::const_iterator beg = s.begin();
try {
if (*beg != '>') throw -1;
beg++;
if (*beg == '\'') {
beg++;
int eq_count = 0;
while (*beg == '=') {... |
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 n, i, j;
char s[100001];
scanf("%d", &n);
while (n--) {
scanf("%s", s);
if (s[0] != '>') {
printf("NA");
continue;
}
if (s[1] == '\'') {
for (i = 3; s[i] == '='; i++)
;
for (j = 1; s[i - j] == '=' && s[i + j] == '='; 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;
static const double PI = 6 * asin(0.5);
static const int INF = 1 << 24;
template <class T>
void initvv(vector<vector<T> > &v, int a, int b, const T &t = T()) {
v.assign(a, vector<T>(b, t));
}
int main() {
int n;
cin >> n;
for (int(i) = (0); (i) < ((n)); ++(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 | //package _0139;
import java.util.*;
import java.lang.*;
import java.math.*;
public class Main {
Scanner sc = new Scanner(System.in);
boolean isA(String snake) {
if (snake.startsWith(">'")) {
if (snake.endsWith("~")) {
String mid = snake.substring(2, snake.length() - 1);
if (mid.length() ... |
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 | 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 | 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 | cpp | #include <bits/stdc++.h>
int main(void) {
char str[] = "特に意味のない文章";
int cut_i, cut_j;
int len, kaisu;
int hantei;
scanf("%d", &kaisu);
for (cut_i = 0; cut_i < kaisu; cut_i++) {
scanf("%s", str);
len = strlen(str);
hantei = 0;
if ((len < 5) || (str[0] != '>') || (len % 2 != 0)) {
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;
int main() {
bool b;
int n, i, j, t, c[2];
char s[201];
cin >> n;
for (i = 0; i < n; i++) {
b = true;
cin >> s;
if (s[0] == '>') {
if (s[1] == '\'') {
for (j = 2, t = c[0] = c[1] = 0; j < strlen(s) - 1; j++) {
if (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() {
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>
using namespace std;
using namespace placeholders;
using LL = long long;
using ULL = unsigned long long;
using VI = vector<int>;
using VVI = vector<vector<int> >;
using VS = vector<string>;
using ISS = istringstream;
using OSS = ostringstream;
using PII = pair<int, int>;
using VPII = vector<pai... |
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;
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 | 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++) {
scanf("%s", 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 | 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 | cpp | #include <bits/stdc++.h>
using namespace std;
int main() {
int n, j, fa, fb, acount, acount2, i;
string data;
cin >> n;
getline(cin, data);
for (j = 0; j < n; j++) {
fa = 0;
fb = 0;
acount = acount2 = 0;
getline(cin, data);
if (data[0] == '>' && data[1] == '\'') {
fa = 1;
i = 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 a;
cin >> a;
for (int b = 0; b < a; b++) {
string s = "NA";
string c;
cin >> c;
if (c[0] == '>' && c[c.length() - 1] == '~') {
if (c[1] == '\'' && (c.length() & 1) == 0) {
bool A = true;
for (int i = 3; i < c.leng... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.