Search is not available for this dataset
name stringlengths 2 112 | description stringlengths 29 13k | source int64 1 7 | difficulty int64 0 25 | solution stringlengths 7 983k | language stringclasses 4
values |
|---|---|---|---|---|---|
p00183 Black-and-White | Consider a tic-tac-toe on a 3x3 board. Tic-tac-toe is a two-player battle game. Decide the first attack and the second attack, one hits Kuroishi and one hits Shiraishi. The winner is the person who puts stones one by one on the board alternately and arranges three of his own stones first in either the vertical, horizon... | 7 | 0 | #include <iostream>
int main()
{
char board[3][3];
while (true) {
std::cin >> board[0][0];
if (board[0][0] == '0') break;
std::cin >> board[0][1] >> board[0][2];
std::cin >> board[1][0] >> board[1][1] >> board[1][2];
std::cin >> board[2][0] >> board[2][1] >> board[2][2];
char c;
bool isNA = true;
// ... | CPP |
p00183 Black-and-White | Consider a tic-tac-toe on a 3x3 board. Tic-tac-toe is a two-player battle game. Decide the first attack and the second attack, one hits Kuroishi and one hits Shiraishi. The winner is the person who puts stones one by one on the board alternately and arranges three of his own stones first in either the vertical, horizon... | 7 | 0 | #include <cstdio>
#include <cstdlib>
#include <cmath>
#include <climits>
#include <cfloat>
#include <map>
#include <utility>
#include <set>
#include <iostream>
#include <memory>
#include <string>
#include <vector>
#include <algorithm>
#include <functional>
#include <sstream>
#include <complex>
#include <stack>
#include... | CPP |
p00183 Black-and-White | Consider a tic-tac-toe on a 3x3 board. Tic-tac-toe is a two-player battle game. Decide the first attack and the second attack, one hits Kuroishi and one hits Shiraishi. The winner is the person who puts stones one by one on the board alternately and arranges three of his own stones first in either the vertical, horizon... | 7 | 0 | #include <stdio.h>
#include<math.h>
#include <algorithm>
using namespace std;
int main(){
char table[3][4];
bool FLG;
while(true){
scanf("%s",table[0]);
if(table[0][0] == '0')break;
scanf("%s",table[1]);
scanf("%s",table[2]);
FLG = false;
//?¨???¨????????????
for(int i=0; i < 3; i++){
if((table... | CPP |
p00183 Black-and-White | Consider a tic-tac-toe on a 3x3 board. Tic-tac-toe is a two-player battle game. Decide the first attack and the second attack, one hits Kuroishi and one hits Shiraishi. The winner is the person who puts stones one by one on the board alternately and arranges three of his own stones first in either the vertical, horizon... | 7 | 0 | #include<iostream>
#include<vector>
#include<string>
using namespace std;
int main()
{
while (1) {
string a;
cin >> a;
if (a == "0")break;
string b, c;
cin >> b >> c;
a += b + c;
if (a[4] != '+' && (a[0] == a[4] && a[4] == a[8] || a[1] == a[4] && a[4] == a[7] || a[2] == a[4] && a[4] == a[6] || a[3] == a... | CPP |
p00183 Black-and-White | Consider a tic-tac-toe on a 3x3 board. Tic-tac-toe is a two-player battle game. Decide the first attack and the second attack, one hits Kuroishi and one hits Shiraishi. The winner is the person who puts stones one by one on the board alternately and arranges three of his own stones first in either the vertical, horizon... | 7 | 0 | #include <iostream>
#include <algorithm>
#include <cmath>
using namespace std;
int main() {
char grid[3][3];
while(1) {
for(int i=0; i<3; i++) {
for(int j=0; j<3; j++) {
cin >> grid[i][j];
if(grid[i][j] == '0') return 0;
}
}
for(int i=0; i<3; i++) {
bool b = 1... | CPP |
p00183 Black-and-White | Consider a tic-tac-toe on a 3x3 board. Tic-tac-toe is a two-player battle game. Decide the first attack and the second attack, one hits Kuroishi and one hits Shiraishi. The winner is the person who puts stones one by one on the board alternately and arranges three of his own stones first in either the vertical, horizon... | 7 | 0 | def f1(c, l):
for i in range(3):
if c*3 == l[i]:
return 1
return 0
def f2(c, l):
for i in range(0, 7, 3):
s = set(h[i:i+3])
if c in s and len(s) == 1:
return 1
return 0
def f3(c, l):
if c*3 == l[0]+l[4]+l[8]:
return 1
if c*3 == l[2]+l[4]+... | PYTHON3 |
p00183 Black-and-White | Consider a tic-tac-toe on a 3x3 board. Tic-tac-toe is a two-player battle game. Decide the first attack and the second attack, one hits Kuroishi and one hits Shiraishi. The winner is the person who puts stones one by one on the board alternately and arranges three of his own stones first in either the vertical, horizon... | 7 | 0 | while True:
L = input()
if L == "0":
break
table = [["+" for i in range(3)] for j in range(3)]
for i in range(3):
table[0][i] = L[i]
L = input()
for i in range(3):
table[1][i] = L[i]
L = input()
for i in range(3):
table[2][i] = L[i]
ans = "NA"
... | PYTHON3 |
p00183 Black-and-White | Consider a tic-tac-toe on a 3x3 board. Tic-tac-toe is a two-player battle game. Decide the first attack and the second attack, one hits Kuroishi and one hits Shiraishi. The winner is the person who puts stones one by one on the board alternately and arranges three of his own stones first in either the vertical, horizon... | 7 | 0 | #include <iostream>
#include <vector>
#include <string>
#include <algorithm>
using namespace std;
char b[3][3];
bool check(char c) {
for (int i = 0; i < 3; i++) {
if (b[i][0] == c && b[i][0] == b[i][1] && b[i][0] == b[i][2]) return true;
if (b[0][i] == c && b[0][i] == b[1][i] && b[0][i] == b[2][i]) return true;
... | CPP |
p00183 Black-and-White | Consider a tic-tac-toe on a 3x3 board. Tic-tac-toe is a two-player battle game. Decide the first attack and the second attack, one hits Kuroishi and one hits Shiraishi. The winner is the person who puts stones one by one on the board alternately and arranges three of his own stones first in either the vertical, horizon... | 7 | 0 | def b_or_w(b_1, b_2, b_3):
b, w = 'bbb', 'www'
board = [b_1, b_2, b_3]
for i in range(3):
col = b_1[i] + b_2[i] + b_3[i]
board.append(col)
board.append(b_1[0] + b_2[1] + b_3[2])
board.append(b_1[2] + b_2[1] + b_3[0])
for bod in board:
if bod == b:
return 'b'
... | PYTHON3 |
p00183 Black-and-White | Consider a tic-tac-toe on a 3x3 board. Tic-tac-toe is a two-player battle game. Decide the first attack and the second attack, one hits Kuroishi and one hits Shiraishi. The winner is the person who puts stones one by one on the board alternately and arranges three of his own stones first in either the vertical, horizon... | 7 | 0 | #include <iostream>
using namespace std;
void solve()
{
char field[3][3];
while(cin >> field[0][0])
{
if(field[0][0] == '0')
{
break;
}
cin >> field[0][1] >> field[0][2];
for(int i = 1; i < 3; ++i)
{
for(int j = 0; j < 3; ++j)
{
cin >> field[i][j];
}
}
bool flag = false;
for(int ... | CPP |
p00183 Black-and-White | Consider a tic-tac-toe on a 3x3 board. Tic-tac-toe is a two-player battle game. Decide the first attack and the second attack, one hits Kuroishi and one hits Shiraishi. The winner is the person who puts stones one by one on the board alternately and arranges three of his own stones first in either the vertical, horizon... | 7 | 0 | #include<iostream>
using namespace std;
char field[3][4];
char solve(){
for(int i=0; i<3; i++){
if(field[i][0] == field[i][1] && field[i][1] == field[i][2] && (field[i][0] == 'w' || field[i][0] == 'b'))
return field[i][0];
}
for(int k=0; k<3; k++){
if(field[0][k] == field[1][k] && field[1][k] == field[2][k]... | CPP |
p00183 Black-and-White | Consider a tic-tac-toe on a 3x3 board. Tic-tac-toe is a two-player battle game. Decide the first attack and the second attack, one hits Kuroishi and one hits Shiraishi. The winner is the person who puts stones one by one on the board alternately and arranges three of his own stones first in either the vertical, horizon... | 7 | 0 | #include <iostream>
#include <vector>
#include <string>
using namespace std;
int main() {
while(1) {
vector<string> v;
for(int i = 0; i < 3; i++) {
string str;
cin >> str;
if(str == "0")
goto EXIT;
v.push_back(str);
}
for(int i = 0; i < 2; i++) {
bool tate, yoko;
bool naname0, naname1;
... | CPP |
p00183 Black-and-White | Consider a tic-tac-toe on a 3x3 board. Tic-tac-toe is a two-player battle game. Decide the first attack and the second attack, one hits Kuroishi and one hits Shiraishi. The winner is the person who puts stones one by one on the board alternately and arranges three of his own stones first in either the vertical, horizon... | 7 | 0 |
#include<iostream>
using namespace std;
int main()
{
int i;
string s[3],ans;
while(cin>>s[0]>>s[1]>>s[2],s[0]!="0"){
ans="NA";
for(i=0;i<3;i++){
if(s[i][0]!='+' && s[i][0]==s[i][1] && s[i][0]==s[i][2])ans=s[i][0];
if(s[0][i]!='+' && s[0][i]==s[1][i] && s[0][i]==s[2][i])ans=s[0][i];
}
... | CPP |
p00183 Black-and-White | Consider a tic-tac-toe on a 3x3 board. Tic-tac-toe is a two-player battle game. Decide the first attack and the second attack, one hits Kuroishi and one hits Shiraishi. The winner is the person who puts stones one by one on the board alternately and arranges three of his own stones first in either the vertical, horizon... | 7 | 0 | #include <bits/stdc++.h>
using namespace std;
int main() {
const static char c[2] = {'b','w'};
while(1) {
vector<string> s(3);
for(int i = 0; i < 3; ++i) {
cin >> s[i];
if(s[i] == "0") return 0;
}
for(int i = 0; i < 2; ++i) {
if(s[0][0] == c[i] && s[1][1] == c[i] && s[2][2] == c[i... | CPP |
p00183 Black-and-White | Consider a tic-tac-toe on a 3x3 board. Tic-tac-toe is a two-player battle game. Decide the first attack and the second attack, one hits Kuroishi and one hits Shiraishi. The winner is the person who puts stones one by one on the board alternately and arranges three of his own stones first in either the vertical, horizon... | 7 | 0 | import sys
def win(c, line):
for i in range(0, 9, 3):
if all(p == c for p in line[i:i + 3:1]):
return True
for i in range(3):
if all(p == c for p in line[i:i + 9:3]):
return True
if all(p == c for p in line[0::4]): return True
if all(p == c for p in line[2:8:2]): return True
return False;
while True:
li... | PYTHON |
p00183 Black-and-White | Consider a tic-tac-toe on a 3x3 board. Tic-tac-toe is a two-player battle game. Decide the first attack and the second attack, one hits Kuroishi and one hits Shiraishi. The winner is the person who puts stones one by one on the board alternately and arranges three of his own stones first in either the vertical, horizon... | 7 | 0 | #include<iostream>
using namespace std;
string t[3];
void solve(){
for(int i=0;i<3;i++){
if(t[i][0]==t[i][1]&&t[i][1]==t[i][2]&&t[i][0]!='+'){cout<<t[i][0]<<endl;return;}
if(t[0][i]==t[1][i]&&t[1][i]==t[2][i]&&t[0][i]!='+'){cout<<t[0][i]<<endl;return;}
}
if(t[0][0]==t[1][1]&&t[1][1]==t[2][2]&&t[1][1... | CPP |
p00183 Black-and-White | Consider a tic-tac-toe on a 3x3 board. Tic-tac-toe is a two-player battle game. Decide the first attack and the second attack, one hits Kuroishi and one hits Shiraishi. The winner is the person who puts stones one by one on the board alternately and arranges three of his own stones first in either the vertical, horizon... | 7 | 0 | #include <cstdio>
#include <cstdlib>
#include <cstring>
#include <cmath>
#include <ctime>
#include <cassert>
#include <iostream>
#include <cctype>
#include <sstream>
#include <string>
#include <list>
#include <vector>
#include <queue>
#include <set>
#include <stack>
#include <map>
#include <utility>
#include <numeric>
... | CPP |
p00183 Black-and-White | Consider a tic-tac-toe on a 3x3 board. Tic-tac-toe is a two-player battle game. Decide the first attack and the second attack, one hits Kuroishi and one hits Shiraishi. The winner is the person who puts stones one by one on the board alternately and arranges three of his own stones first in either the vertical, horizon... | 7 | 0 | #include <iostream>
#include <complex>
#include <sstream>
#include <string>
#include <algorithm>
#include <deque>
#include <list>
#include <map>
#include <numeric>
#include <queue>
#include <vector>
#include <set>
#include <limits>
#include <cstdio>
#include <cctype>
#include <cmath>
#include <cstring>
#include <cstdli... | CPP |
p00183 Black-and-White | Consider a tic-tac-toe on a 3x3 board. Tic-tac-toe is a two-player battle game. Decide the first attack and the second attack, one hits Kuroishi and one hits Shiraishi. The winner is the person who puts stones one by one on the board alternately and arranges three of his own stones first in either the vertical, horizon... | 7 | 0 | #include <iostream>
#include <string>
using namespace std;
int v[] = {7,56,73,84,146,273,292,448};
int main() {
char c;
while (cin >> c, c != '0') {
int b = c=='b';
int w = c=='w';
for (int i=1; i<9; ++i) {
cin >> c;
b = b*2+(c=='b');
w = w*2+(c=='w');
}
string res = "NA";
for (int i=0; i<8; ++... | CPP |
p00183 Black-and-White | Consider a tic-tac-toe on a 3x3 board. Tic-tac-toe is a two-player battle game. Decide the first attack and the second attack, one hits Kuroishi and one hits Shiraishi. The winner is the person who puts stones one by one on the board alternately and arranges three of his own stones first in either the vertical, horizon... | 7 | 0 | #include<iostream>
#include<cstdio>
#include<algorithm>
#include<string>
using namespace std;
int main(){
while(1){
char ban[10][10] = {{0}};
char field[10][10] = {{0}};
cin >> field[0];
if(field[0][0] == '0') break;
cin >> field[1];
cin >> field[2];
for(int i... | CPP |
p00183 Black-and-White | Consider a tic-tac-toe on a 3x3 board. Tic-tac-toe is a two-player battle game. Decide the first attack and the second attack, one hits Kuroishi and one hits Shiraishi. The winner is the person who puts stones one by one on the board alternately and arranges three of his own stones first in either the vertical, horizon... | 7 | 0 | #include<bits/stdc++.h>
using namespace std;
string s1, s2, s3;
int main() {
while (cin >> s1, s1 != "0") {
cin >> s2 >> s3;
if (s1[0] != '+' && s1[0] == s1[1] && s1[1] == s1[2])cout << s1[0] << endl;
else if (s2[0] != '+' && s2[0] == s2[1] && s2[1] == s2[2])cout << s2[0] << endl;
else if (s3[0] != '+' && s3[0... | CPP |
p00183 Black-and-White | Consider a tic-tac-toe on a 3x3 board. Tic-tac-toe is a two-player battle game. Decide the first attack and the second attack, one hits Kuroishi and one hits Shiraishi. The winner is the person who puts stones one by one on the board alternately and arranges three of his own stones first in either the vertical, horizon... | 7 | 0 | #include<iostream>
#include<cstdio>
using namespace std;
#define rep(i,n) for(i=0;i<n;i++)
int main() {
while(1){
int i;
char a[5][5]={};
bool ans=false;
cin>>a[0];
if(a[0][0]=='0')break;
cin>>a[1];
cin>>a[2];
rep(i,3)
if(a[i][0]==a[i][1] && a[i][1]==a[i][2] && a[i][0]!='+'){
... | CPP |
p00183 Black-and-White | Consider a tic-tac-toe on a 3x3 board. Tic-tac-toe is a two-player battle game. Decide the first attack and the second attack, one hits Kuroishi and one hits Shiraishi. The winner is the person who puts stones one by one on the board alternately and arranges three of his own stones first in either the vertical, horizon... | 7 | 0 | #include "bits/stdc++.h"
using namespace std;
typedef vector<int> vi;
typedef pair<int,int> pii;
typedef long long ll;
#define rep(i,n) for(ll i=0;i<(ll)(n);i++)
#define all(a) (a).begin(),(a).end()
#define pb push_back
char solve(string data[3]){
rep(i,3){
if( data[i][0]==data[i][1] && data[i][1]==data[i][2] &... | CPP |
p00183 Black-and-White | Consider a tic-tac-toe on a 3x3 board. Tic-tac-toe is a two-player battle game. Decide the first attack and the second attack, one hits Kuroishi and one hits Shiraishi. The winner is the person who puts stones one by one on the board alternately and arranges three of his own stones first in either the vertical, horizon... | 7 | 0 | #include<iostream>
#include<utility>
#include<queue>
#include<functional>
#include<algorithm>
#include<cstring>
#include<vector>
#include<climits>
#include<map>
using namespace std;
#define FOR(i,n) for(int i=0;i<(int)n;i++)
#define FORI(i,k,n) for(int i=k;i<(int)n;i++)
#define ALL(x) (x).begin(),(x).end()
#define INF ... | CPP |
p00183 Black-and-White | Consider a tic-tac-toe on a 3x3 board. Tic-tac-toe is a two-player battle game. Decide the first attack and the second attack, one hits Kuroishi and one hits Shiraishi. The winner is the person who puts stones one by one on the board alternately and arranges three of his own stones first in either the vertical, horizon... | 7 | 0 | #include <iostream>
using namespace std;
bool win_check(char c, char d, char e)
{
if ( c == 'b' && d == 'b' && e == 'b' )
{
cout << 'b' << endl;
return true;
}
else if ( c == 'w' && d == 'w' && e == 'w' )
{
cout << 'w' << endl;
return true;
}
return false;
}
int main()
{
while (true)
... | CPP |
p00183 Black-and-White | Consider a tic-tac-toe on a 3x3 board. Tic-tac-toe is a two-player battle game. Decide the first attack and the second attack, one hits Kuroishi and one hits Shiraishi. The winner is the person who puts stones one by one on the board alternately and arranges three of his own stones first in either the vertical, horizon... | 7 | 0 | #include<stdio.h>
char dat[3][4];
int main(){
while(1){
scanf("%s",dat[0]);
if(dat[0][0]=='0')return 0;
scanf("%s%s",dat[1],dat[2]);
bool b=false;
bool w=false;
if(dat[0][0]=='w'&&dat[0][1]=='w'&&dat[0][2]=='w')w=true;
if(dat[1][0]=='w'&&dat[1][1]=='w'&&dat[1][2]=='w')w=true;
if(dat[2][0]=='w'&&dat[2][... | CPP |
p00183 Black-and-White | Consider a tic-tac-toe on a 3x3 board. Tic-tac-toe is a two-player battle game. Decide the first attack and the second attack, one hits Kuroishi and one hits Shiraishi. The winner is the person who puts stones one by one on the board alternately and arranges three of his own stones first in either the vertical, horizon... | 7 | 0 | import java.util.Scanner;
public class Main {
public static void main(String args[]) {
Scanner sc = new Scanner(System.in);
int a[][];
while (true) {
String s = sc.next();
if (s.equals("0")) {
break;
}
a = new int[3][3];
for (int i = 0; i < 3; i++) {
a[0][i] = s.charAt(i);
}
for (i... | JAVA |
p00183 Black-and-White | Consider a tic-tac-toe on a 3x3 board. Tic-tac-toe is a two-player battle game. Decide the first attack and the second attack, one hits Kuroishi and one hits Shiraishi. The winner is the person who puts stones one by one on the board alternately and arranges three of his own stones first in either the vertical, horizon... | 7 | 0 | #include <iostream>
#include <string>
using namespace std;
int main() {
string line;
int a[3][3];
int winner;
cin >> line;
while (1) {
if (line == "0") {
break;
}
for (int i=0; i<3; i++) {
for (int j=0; j<3; j++) {
char c = line[j];
if (c == 'b') {
a[i][j] = ... | CPP |
p00183 Black-and-White | Consider a tic-tac-toe on a 3x3 board. Tic-tac-toe is a two-player battle game. Decide the first attack and the second attack, one hits Kuroishi and one hits Shiraishi. The winner is the person who puts stones one by one on the board alternately and arranges three of his own stones first in either the vertical, horizon... | 7 | 0 | #include<iostream>
#include<cstdio>
using namespace std;
int main()
{
for(;;){
char ban[3][3];
char result = 'N';
for(int i = 0; i < 3; i++){
for(int j = 0; j < 3; j++){
cin >> ban[i][j];
if(ban[i][j] == '0'){
goto FIN;
}
}
}
for(int i = 0; i < 3; i++){
if(ban[i][0] == ban... | CPP |
p00183 Black-and-White | Consider a tic-tac-toe on a 3x3 board. Tic-tac-toe is a two-player battle game. Decide the first attack and the second attack, one hits Kuroishi and one hits Shiraishi. The winner is the person who puts stones one by one on the board alternately and arranges three of his own stones first in either the vertical, horizon... | 7 | 0 | #include<iostream>
using namespace std;
int main(){
string b[3];
string ans;
for(;;){
cin >> b[0];
if(b[0] == "0")break;
cin >> b[1] >> b[2];
ans = "NA";
for(int i=0;i<3;i++){
if(b[0][i] == b[1][i] && b[1][i] == b[2][i]){
if(b[0][i] == 'b')ans = "b";
if(b[0][i] == 'w')ans = "w";
... | CPP |
p00183 Black-and-White | Consider a tic-tac-toe on a 3x3 board. Tic-tac-toe is a two-player battle game. Decide the first attack and the second attack, one hits Kuroishi and one hits Shiraishi. The winner is the person who puts stones one by one on the board alternately and arranges three of his own stones first in either the vertical, horizon... | 7 | 0 | while True:
s=raw_input()
if s=="0":break
s+="".join([raw_input() for i in range(2)])
L=[(i,i+1,i+2) for i in range(0,9,3)]+[(i,i+3,i+6) for i in range(3)]+[(0,4\
,8),(2,4,6)]
for i,j,k in L:
if s[i]==s[j]==s[k]!="+":
print "b" if s[i]=="b" else "w"
break
else:
... | PYTHON |
p00183 Black-and-White | Consider a tic-tac-toe on a 3x3 board. Tic-tac-toe is a two-player battle game. Decide the first attack and the second attack, one hits Kuroishi and one hits Shiraishi. The winner is the person who puts stones one by one on the board alternately and arranges three of his own stones first in either the vertical, horizon... | 7 | 0 | #include <map>
#include <set>
#include <list>
#include <cmath>
#include <queue>
#include <stack>
#include <cstdio>
#include <string>
#include <vector>
#include <complex>
#include <cstdlib>
#include <cstring>
#include <numeric>
#include <sstream>
#include <iostream>
#include <algorithm>
#include <functional>
#define mp... | CPP |
p00183 Black-and-White | Consider a tic-tac-toe on a 3x3 board. Tic-tac-toe is a two-player battle game. Decide the first attack and the second attack, one hits Kuroishi and one hits Shiraishi. The winner is the person who puts stones one by one on the board alternately and arranges three of his own stones first in either the vertical, horizon... | 7 | 0 | import java.util.*;
import java.util.regex.*;
import static java.lang.Math.*;
import static java.lang.System.out;
// AOJ
public class Main {
final Scanner sc=new Scanner(System.in);
final int[] vx={0,1,0,-1}, vy={-1,0,1,0};
static class Point{
int x, y;
Point(int x, int y){ this.x=x; this.y=y;}
Point(){ this.... | JAVA |
p00183 Black-and-White | Consider a tic-tac-toe on a 3x3 board. Tic-tac-toe is a two-player battle game. Decide the first attack and the second attack, one hits Kuroishi and one hits Shiraishi. The winner is the person who puts stones one by one on the board alternately and arranges three of his own stones first in either the vertical, horizon... | 7 | 0 | #include <iostream>
#include <cstdio>
using namespace std;
int main(){
char grid[3][3];
while(cin >> grid[0][0]){
if(grid[0][0] == '0')break;
for(int i = 0 ; i < 3 ; i++ ){
for(int j = 0 ; j < 3 ; j++ ){
if(i == 0 && j == 0)continue;
cin >> grid[j][i];
}
}
char c[2] = {'b','w'},ans = ... | CPP |
p00183 Black-and-White | Consider a tic-tac-toe on a 3x3 board. Tic-tac-toe is a two-player battle game. Decide the first attack and the second attack, one hits Kuroishi and one hits Shiraishi. The winner is the person who puts stones one by one on the board alternately and arranges three of his own stones first in either the vertical, horizon... | 7 | 0 | import java.util.*;
public class Main {
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
while(true){
String[] s = new String[3];
s[0] = sc.next();
if(s[0].compareTo("0")==0)break;
s[1] = sc.next();
s[2] = sc.next();
int[][] map = new int[3][3];
for(int i... | JAVA |
p00183 Black-and-White | Consider a tic-tac-toe on a 3x3 board. Tic-tac-toe is a two-player battle game. Decide the first attack and the second attack, one hits Kuroishi and one hits Shiraishi. The winner is the person who puts stones one by one on the board alternately and arranges three of his own stones first in either the vertical, horizon... | 7 | 0 | #include <iostream>
using namespace std;
int main(void){
string board1,board2,board3;
while(cin>>board1>>board2>>board3){
if(board1[0]!='+' and board1[0]==board1[1] and board1[1]==board1[2]){
cout<<board1[0]<<endl;
continue;
}
if(board2[0]!='+' and board2[0]==board2[1] and board2[1]==board2... | CPP |
p00183 Black-and-White | Consider a tic-tac-toe on a 3x3 board. Tic-tac-toe is a two-player battle game. Decide the first attack and the second attack, one hits Kuroishi and one hits Shiraishi. The winner is the person who puts stones one by one on the board alternately and arranges three of his own stones first in either the vertical, horizon... | 7 | 0 | #include <algorithm>
#include <cctype>
#include <climits>
#include <cmath>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <functional>
#include <map>
#include <numeric>
#include <queue>
#include <set>
#include <sstream>
#include <string>
#include <vector>
using namespace std;
#define reps(i,f,n) for... | CPP |
p00183 Black-and-White | Consider a tic-tac-toe on a 3x3 board. Tic-tac-toe is a two-player battle game. Decide the first attack and the second attack, one hits Kuroishi and one hits Shiraishi. The winner is the person who puts stones one by one on the board alternately and arranges three of his own stones first in either the vertical, horizon... | 7 | 0 | #include<iostream>
#include<string>
#include<algorithm>
#include<map>
#include<set>
#include<utility>
#include<vector>
#include<cmath>
#include<cstdio>
#define loop(i,a,b) for(int i=a;i<b;i++)
#define rep(i,a) loop(i,0,a)
#define pb push_back
#define mp make_pair
#define it ::iterator
#define all(in) in.begin(),in.end... | CPP |
p00183 Black-and-White | Consider a tic-tac-toe on a 3x3 board. Tic-tac-toe is a two-player battle game. Decide the first attack and the second attack, one hits Kuroishi and one hits Shiraishi. The winner is the person who puts stones one by one on the board alternately and arranges three of his own stones first in either the vertical, horizon... | 7 | 0 | #include<bits/stdc++.h>
using namespace std;
char c[3]={'r','g','b'};
int main(){
string s[3];
while(cin>>s[0],s[0][0]!='0'){
cin>>s[1]>>s[2];
if(s[0][0]=='b'&&s[0][1]=='b'&&s[0][2]=='b')goto B;
if(s[1][0]=='b'&&s[1][1]=='b'&&s[1][2]=='b')goto B;
if(s[2][0]=='b'&&s[2][1]=='b'&&s[2][2]=='b')goto B;
... | CPP |
p00183 Black-and-White | Consider a tic-tac-toe on a 3x3 board. Tic-tac-toe is a two-player battle game. Decide the first attack and the second attack, one hits Kuroishi and one hits Shiraishi. The winner is the person who puts stones one by one on the board alternately and arranges three of his own stones first in either the vertical, horizon... | 7 | 0 | #include<iostream>
#include<cstdio>
#include<string>
using namespace std;
int main(void){
string str[3];
while(1){
cin >> str[0];
if(str[0]=="0")break;
cin >> str[1];
cin >> str[2];
if(str[0]=="bbb" || str[1]=="bbb" || str[2]=="bbb")cout << "b" << endl;
else if(str[0][0]=='b' && str[1][0]=='b' && str[2][... | CPP |
p00183 Black-and-White | Consider a tic-tac-toe on a 3x3 board. Tic-tac-toe is a two-player battle game. Decide the first attack and the second attack, one hits Kuroishi and one hits Shiraishi. The winner is the person who puts stones one by one on the board alternately and arranges three of his own stones first in either the vertical, horizon... | 7 | 0 | #define _CRT_SECURE_NO_WARNINGS
#include "bits/stdc++.h"
using namespace std;
#define rep(i, n) for(int i=0; i<(n); ++i)
#define FOR(i, m, n) for(int i=(m); i<(n); ++i)
#define sz(x) ((int)(x).size())
#define all(x) (x).begin(),(x).end()
#define mp make_pair
#define pb push_back
#define Cout(x) cout << (x) << endl
#def... | CPP |
p00183 Black-and-White | Consider a tic-tac-toe on a 3x3 board. Tic-tac-toe is a two-player battle game. Decide the first attack and the second attack, one hits Kuroishi and one hits Shiraishi. The winner is the person who puts stones one by one on the board alternately and arranges three of his own stones first in either the vertical, horizon... | 7 | 0 | #include<iostream>
#include<string>
#include<vector>
using namespace std;
vector<string> ans;
int rep(char c){
int sum,k;
for(int i=0;i<3;i++){
sum=0;k=0;
for(int j=0;j<3;j++){
if(ans[i][j]==c)
sum++;
if(ans[j][i]==c)
k++;
}
if(sum==3||k==3)
return 1;
}
if(ans[0][0]==c&&ans[1][1]==c&&ans[2]... | CPP |
p00183 Black-and-White | Consider a tic-tac-toe on a 3x3 board. Tic-tac-toe is a two-player battle game. Decide the first attack and the second attack, one hits Kuroishi and one hits Shiraishi. The winner is the person who puts stones one by one on the board alternately and arranges three of his own stones first in either the vertical, horizon... | 7 | 0 | def f(line):
if line == ['b','b','b']:
print 'b'
return True
elif line == ['w', 'w', 'w']:
print 'w'
return True
while True:
L = []
line = raw_input()
if line == '0': break
L.append(list(line))
for i in range(2):
L.append(list(raw_input()))
flag =... | PYTHON |
p00183 Black-and-White | Consider a tic-tac-toe on a 3x3 board. Tic-tac-toe is a two-player battle game. Decide the first attack and the second attack, one hits Kuroishi and one hits Shiraishi. The winner is the person who puts stones one by one on the board alternately and arranges three of his own stones first in either the vertical, horizon... | 7 | 0 | #include<iostream>
#include<string>
#include<algorithm>
#include<vector>
#include<map>
#include<cstring>
using namespace std;
#define rep(i,n) for(int i=0;i<n;i++)
#define REP(n) rep(i,n)
#define all(n) n.begin(),n.end()
string s[3];
int main()
{
while(cin >> s[0])
{
if(s[0] == "0" ) break;
c... | CPP |
p00183 Black-and-White | Consider a tic-tac-toe on a 3x3 board. Tic-tac-toe is a two-player battle game. Decide the first attack and the second attack, one hits Kuroishi and one hits Shiraishi. The winner is the person who puts stones one by one on the board alternately and arranges three of his own stones first in either the vertical, horizon... | 7 | 0 | #include <iostream>
using namespace std;
int main(void)
{
char table[3][3];
while(1) {
cin >> table[0];
if(table[0][0] == '0') break;
for(int i = 1 ; i < 3 ; i++) {
cin >> table[i];
}
if(table[0][0] == 'b' && table[0][1] == 'b' && table[0][2] == 'b') cout << 'b' << endl;
else if(... | CPP |
p00183 Black-and-White | Consider a tic-tac-toe on a 3x3 board. Tic-tac-toe is a two-player battle game. Decide the first attack and the second attack, one hits Kuroishi and one hits Shiraishi. The winner is the person who puts stones one by one on the board alternately and arranges three of his own stones first in either the vertical, horizon... | 7 | 0 | #include <iostream>
using namespace std;
int main(int argc, char **)
{
int f;
char a[3][4];
while(scanf("%s", a[0])!=EOF){
if(a[0][0] == '0'){
break;
}
f = 0;
scanf("%s", a[1]);
scanf("%s", a[2]);
for(int i = 0; i < 3; i++){
if(a[0][i] == a[1][i] && a[0][i] == a[2][i] && (a[0][i] == 'w' || a[0]... | CPP |
p00183 Black-and-White | Consider a tic-tac-toe on a 3x3 board. Tic-tac-toe is a two-player battle game. Decide the first attack and the second attack, one hits Kuroishi and one hits Shiraishi. The winner is the person who puts stones one by one on the board alternately and arranges three of his own stones first in either the vertical, horizon... | 7 | 0 | #include<iostream>
#include<cstdio>
using namespace std;
int main()
{
for(;;){
char ban[3][3];
char result = 'N';
for(int i = 0; i < 3; i++){
for(int j = 0; j < 3; j++){
cin >> ban[i][j];
if(ban[i][j] == '0'){
goto FIN;
}
}
}
for(int i = 0; i < 3; i++){
if(ban[i][0] == ban... | CPP |
p00183 Black-and-White | Consider a tic-tac-toe on a 3x3 board. Tic-tac-toe is a two-player battle game. Decide the first attack and the second attack, one hits Kuroishi and one hits Shiraishi. The winner is the person who puts stones one by one on the board alternately and arranges three of his own stones first in either the vertical, horizon... | 7 | 0 | #include<iostream>
#include<string>
using namespace std;
int mask[8]={0444,0222,0111,0700,070,07,0124,0421};
int create_mask(char c,char board[9]){
int res=0;
for(int i=0;i<9;i++){
if(c==board[i])res |= 1<<i;
}
return res;
}
int main(){
char board[9];
int b,w;
string win;
while(cin>>board[0], board[0]!='0'){... | CPP |
p00183 Black-and-White | Consider a tic-tac-toe on a 3x3 board. Tic-tac-toe is a two-player battle game. Decide the first attack and the second attack, one hits Kuroishi and one hits Shiraishi. The winner is the person who puts stones one by one on the board alternately and arranges three of his own stones first in either the vertical, horizon... | 7 | 0 | while 1:
board = []
n = list(input())
if n[0] == "0":
break
board.append(n)
for _ in range(2):
n = list(input())
board.append(n)
ans = "NA"
for i in range(3):
if board[i][0] == board[i][1] == board[i][2] and board[i][0] != "+":
ans = board[i][0]
... | PYTHON3 |
p00183 Black-and-White | Consider a tic-tac-toe on a 3x3 board. Tic-tac-toe is a two-player battle game. Decide the first attack and the second attack, one hits Kuroishi and one hits Shiraishi. The winner is the person who puts stones one by one on the board alternately and arranges three of his own stones first in either the vertical, horizon... | 7 | 0 | #include <cstdio>
#include <cstdlib>
#include <cmath>
#include <cstring>
#include <map>
#include <utility>
#include <set>
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <sstream>
#include <complex>
#include <stack>
#include <queue>
using namespace std;
typedef long long LL;
typed... | CPP |
p00183 Black-and-White | Consider a tic-tac-toe on a 3x3 board. Tic-tac-toe is a two-player battle game. Decide the first attack and the second attack, one hits Kuroishi and one hits Shiraishi. The winner is the person who puts stones one by one on the board alternately and arranges three of his own stones first in either the vertical, horizon... | 7 | 0 | #include <iostream>
#include <string>
using namespace std;
#define rep2(x,from,to) for(int x=(from);x<(to);++(x))
#define rep(x,to) rep2(x,0,to)
char same(char c[3][3]) {
char ret = '+';
rep(i,3) {
if(c[i][0] == c[i][1] && c[i][1] == c[i][2] && c[i][0] != '+') ret = c[i][0];
}
rep(i,3) {
if(c[0][i] == c[1][i] &... | CPP |
p00183 Black-and-White | Consider a tic-tac-toe on a 3x3 board. Tic-tac-toe is a two-player battle game. Decide the first attack and the second attack, one hits Kuroishi and one hits Shiraishi. The winner is the person who puts stones one by one on the board alternately and arranges three of his own stones first in either the vertical, horizon... | 7 | 0 | import java.util.*;
class Main {
public static void main(String args[]) {
Scanner sc = new Scanner(System.in);
while (true) {
String[] S = new String[3];
S[0] = sc.next();
if (S[0].equals("0")) {
... | JAVA |
p00183 Black-and-White | Consider a tic-tac-toe on a 3x3 board. Tic-tac-toe is a two-player battle game. Decide the first attack and the second attack, one hits Kuroishi and one hits Shiraishi. The winner is the person who puts stones one by one on the board alternately and arranges three of his own stones first in either the vertical, horizon... | 7 | 0 | #include<bits/stdc++.h>
using namespace std;
typedef long long int lld;
int main(){
string str[3];
string dif[] = {"bbb","www"};
while(cin >> str[0] , str[0] != "0"){
cin >> str[1];
cin >> str[2];
bool flg = false;;
for(int i=0;i<3;i++){
for(int j=0;j<2;j++){
if(str[i] == dif[j]){
cout ... | CPP |
p00183 Black-and-White | Consider a tic-tac-toe on a 3x3 board. Tic-tac-toe is a two-player battle game. Decide the first attack and the second attack, one hits Kuroishi and one hits Shiraishi. The winner is the person who puts stones one by one on the board alternately and arranges three of his own stones first in either the vertical, horizon... | 7 | 0 | #include<iostream>
using namespace std;
int main(void) {
while (1) {
char c;
int goban[3][3] = { 0 }, result = 0, judge = 0;
for (int i = 0; i < 3; i++) {
for (int j = 0; j < 3; j++) {
cin >> c;
if (c == '0') return 0;
if (c == 'b')goban[i][j] = 1;
else if (c == 'w')goban[i][j] = -1;
else ... | CPP |
p00183 Black-and-White | Consider a tic-tac-toe on a 3x3 board. Tic-tac-toe is a two-player battle game. Decide the first attack and the second attack, one hits Kuroishi and one hits Shiraishi. The winner is the person who puts stones one by one on the board alternately and arranges three of his own stones first in either the vertical, horizon... | 7 | 0 | while True:
input_data1 = input()
if input_data1 == "0":
break
input_data2 = input()
input_data3 = input()
output = "NA"
if input_data1[0] != "+" and input_data1[0] == input_data1[1] == input_data1[2]:
output = input_data1[0]
elif input_data2[0] != "+" and input_data2[0]... | PYTHON3 |
p00183 Black-and-White | Consider a tic-tac-toe on a 3x3 board. Tic-tac-toe is a two-player battle game. Decide the first attack and the second attack, one hits Kuroishi and one hits Shiraishi. The winner is the person who puts stones one by one on the board alternately and arranges three of his own stones first in either the vertical, horizon... | 7 | 0 | #include <iostream>
#include <string>
using namespace std;
int main(){
string field[3];
while(1){
bool b = false,w = false;
cin >> field[0];
if(field[0] == "0") break;
cin >> field[1] >> field[2];
for(int i = 0;i < 3;i++){
if(field[i] == "bbb") b = true;
else if(field[i] == "www") w = true;
}
for... | CPP |
p00183 Black-and-White | Consider a tic-tac-toe on a 3x3 board. Tic-tac-toe is a two-player battle game. Decide the first attack and the second attack, one hits Kuroishi and one hits Shiraishi. The winner is the person who puts stones one by one on the board alternately and arranges three of his own stones first in either the vertical, horizon... | 7 | 0 | #include <bits/stdc++.h>
using namespace std;
#define TEMP_T template<typename T>
TEMP_T void sort(T& v){ sort(v.begin(), v.end()); }
TEMP_T void revs(T& v){ reverse(v.begin(), v.end()); }
TEMP_T void uniq(T& v){ sort(v); v.erase(unique(v.begin(), v.end()), v.end()); }
TEMP_T T cums(T& v){ T r(v.size()); partial_s... | CPP |
p00183 Black-and-White | Consider a tic-tac-toe on a 3x3 board. Tic-tac-toe is a two-player battle game. Decide the first attack and the second attack, one hits Kuroishi and one hits Shiraishi. The winner is the person who puts stones one by one on the board alternately and arranges three of his own stones first in either the vertical, horizon... | 7 | 0 | #include <cassert>// c
#include <ctime>
#include <iostream>// io
#include <iomanip>
#include <fstream>
#include <sstream>
#include <vector>// container
#include <map>
#include <set>
#include <queue>
#include <bitset>
#include <stack>
#include <algorithm>// other
#include <utility>
#include <complex>
#include <numeric>
... | CPP |
p00183 Black-and-White | Consider a tic-tac-toe on a 3x3 board. Tic-tac-toe is a two-player battle game. Decide the first attack and the second attack, one hits Kuroishi and one hits Shiraishi. The winner is the person who puts stones one by one on the board alternately and arranges three of his own stones first in either the vertical, horizon... | 7 | 0 | #include <iostream>
#include <vector>
#include <algorithm>
#include <string>
using namespace std;
int main(){
string str;
while(cin>>str&&str!="0"){
vector<string> field;
field.push_back(str);
for(int i = 0; i < 2; i++){
cin>>str;
field.push_back(str);
}
bool fin=false;
// æ±
for(int i = 0; i... | CPP |
p00183 Black-and-White | Consider a tic-tac-toe on a 3x3 board. Tic-tac-toe is a two-player battle game. Decide the first attack and the second attack, one hits Kuroishi and one hits Shiraishi. The winner is the person who puts stones one by one on the board alternately and arranges three of his own stones first in either the vertical, horizon... | 7 | 0 | while True:
try:
f = [list(raw_input()) for _ in xrange(3)]
except EOFError:
break
g = map(lambda x:"".join(x),
f+zip(*f)+[(f[0][0],f[1][1],f[2][2])]+[(f[2][0],f[1][1],f[0][2])])
print "b" if "b"*3 in g else "w" if "w"*3 in g else "NA" | PYTHON |
p00183 Black-and-White | Consider a tic-tac-toe on a 3x3 board. Tic-tac-toe is a two-player battle game. Decide the first attack and the second attack, one hits Kuroishi and one hits Shiraishi. The winner is the person who puts stones one by one on the board alternately and arranges three of his own stones first in either the vertical, horizon... | 7 | 0 | #include<stdio.h>
#include<iostream>
#include<string>
#include<algorithm>
#include <vector>
#include<math.h>
using namespace std;
int main(){
string p,q,r;
while(1){
cin>>p;if(p=="0")break;
cin>>q>>r;
char ch[4][4]={};
for(int i=0;i<3;i++)
{
ch[0][i]=p[i];
ch[1][i]=q[i];
ch[2][i]=r[i];
}
char w... | CPP |
p00183 Black-and-White | Consider a tic-tac-toe on a 3x3 board. Tic-tac-toe is a two-player battle game. Decide the first attack and the second attack, one hits Kuroishi and one hits Shiraishi. The winner is the person who puts stones one by one on the board alternately and arranges three of his own stones first in either the vertical, horizon... | 7 | 0 | #include <iostream>
int main(){
std::string m[3];
while(std::cin >> m[0], m[0][0] != '0'){
for(int i=1;i<3;i++)std::cin >> m[i];
std::string w = "NA";
for(int i=0;i<3;i++){
if(!(m[i][0] + m[i][1] - m[i][2] * 2))
if(m[i][0] != '+')w = m[i][0];
if(!(m[0][i] + m[1][i] - m[2][i] * 2))
if(m[0][i] != '+... | CPP |
p00183 Black-and-White | Consider a tic-tac-toe on a 3x3 board. Tic-tac-toe is a two-player battle game. Decide the first attack and the second attack, one hits Kuroishi and one hits Shiraishi. The winner is the person who puts stones one by one on the board alternately and arranges three of his own stones first in either the vertical, horizon... | 7 | 0 | while True:
try:
f = [list(raw_input()) for _ in xrange(3)]
except EOFError:
break
g = map(lambda x:"".join(x),
f+zip(*f)+zip(*[(f[i][i],f[2-i][i]) for i in xrange(3)]))
print "b" if "b"*3 in g else "w" if "w"*3 in g else "NA" | PYTHON |
p00183 Black-and-White | Consider a tic-tac-toe on a 3x3 board. Tic-tac-toe is a two-player battle game. Decide the first attack and the second attack, one hits Kuroishi and one hits Shiraishi. The winner is the person who puts stones one by one on the board alternately and arranges three of his own stones first in either the vertical, horizon... | 7 | 0 | #include <bits/stdc++.h>
using namespace std;
int main() {
string s[3];
while (cin >> s[0]) {
if (s[0] == "0")
break;
cin >> s[1] >> s[2];
if (s[0][0] != '+' && s[0][0] == s[0][1] && s[0][1] == s[0][2]) {
cout << s[0][0] << endl;
continue;
}
if (s[1][0] != '+' && s[1][0] == s[1][1] && s[1][1] == s[... | CPP |
p00183 Black-and-White | Consider a tic-tac-toe on a 3x3 board. Tic-tac-toe is a two-player battle game. Decide the first attack and the second attack, one hits Kuroishi and one hits Shiraishi. The winner is the person who puts stones one by one on the board alternately and arranges three of his own stones first in either the vertical, horizon... | 7 | 0 | # -*- coding: utf-8 -*-
"""
http://judge.u-aizu.ac.jp/onlinejudge/description.jsp?id=0183
"""
import sys
from sys import stdin
input = stdin.readline
def solve(board):
colors = ['b', 'w']
for c in colors:
for y in range(3):
if board[y].count(c) == 3:
return c
for x... | PYTHON3 |
p00183 Black-and-White | Consider a tic-tac-toe on a 3x3 board. Tic-tac-toe is a two-player battle game. Decide the first attack and the second attack, one hits Kuroishi and one hits Shiraishi. The winner is the person who puts stones one by one on the board alternately and arranges three of his own stones first in either the vertical, horizon... | 7 | 0 | #include <string>
#include <iostream>
#include <vector>
using namespace std;
#define rep(i,b) for(int i=0; i<int(b); i++)
using namespace std;
void solve(vector<string> const& s){
if(s[0][0]==s[0][1] && s[0][1]==s[0][2] && s[0][0] != '+'){
cout << s[0][0] << endl;
}
else if(s[0][0]==s[1][0] && s[1... | CPP |
p00183 Black-and-White | Consider a tic-tac-toe on a 3x3 board. Tic-tac-toe is a two-player battle game. Decide the first attack and the second attack, one hits Kuroishi and one hits Shiraishi. The winner is the person who puts stones one by one on the board alternately and arranges three of his own stones first in either the vertical, horizon... | 7 | 0 | #include<iostream>
using namespace std;
int main(){
char b[3][3];
int x,y;
int check;
int boolean = 1;
while(boolean){
x = 0;
y = 0;
check = 1;
for(int i = 0; i < 3; i++){
cin >> b[i];
if(b[0][0] == '0'){
boolean = 0;
check = 0;
break;
}
}
for(int i = 0; i <= 2; i++){
if(b[... | CPP |
p00183 Black-and-White | Consider a tic-tac-toe on a 3x3 board. Tic-tac-toe is a two-player battle game. Decide the first attack and the second attack, one hits Kuroishi and one hits Shiraishi. The winner is the person who puts stones one by one on the board alternately and arranges three of his own stones first in either the vertical, horizon... | 7 | 0 | #include <iostream>
int main(){
std::string m[3], w;
while(std::cin >> m[0], m[0][0] != '0'){
for(int i=1;i<3;i++)std::cin >> m[i];
w = "NA";
for(int i=0;i<3;i++){
if(m[i][0] + m[i][1] - m[i][2] * 2 == 0 && m[i][0] - '+')w = m[i][0];
if(m[0][i] + m[1][i] - m[2][i] * 2 == 0 && m[0][i] - '+')w = m[0][i];
... | CPP |
p00183 Black-and-White | Consider a tic-tac-toe on a 3x3 board. Tic-tac-toe is a two-player battle game. Decide the first attack and the second attack, one hits Kuroishi and one hits Shiraishi. The winner is the person who puts stones one by one on the board alternately and arranges three of his own stones first in either the vertical, horizon... | 7 | 0 | class Main{public static void main(String[]z)throws Exception{String r;for(byte[]x=new byte[12];System.in.read(x)>11;System.out.println(r)){r="NA";for(String y:"b w".split(" "))for(int i=0;i<5;++i)if(i!=1&&new String(x).replaceAll("\n"," ").matches(String.format(".*%1$s.{%2$s}%1$s.{%2$s}%1$s.*",y, i)))r=y;}}} | JAVA |
p00183 Black-and-White | Consider a tic-tac-toe on a 3x3 board. Tic-tac-toe is a two-player battle game. Decide the first attack and the second attack, one hits Kuroishi and one hits Shiraishi. The winner is the person who puts stones one by one on the board alternately and arranges three of his own stones first in either the vertical, horizon... | 7 | 0 | #include<iostream>
using namespace std;
int main()
{
string map[3];
for(;cin>>map[0],map[0]!="0";)
{
cin>>map[1];
cin>>map[2];
string ans="NA";
for(int i=0;i<3;i++)
{
if(map[i][0]!='+' && map[i][0]==map[i][1]&&map[i][1]==map[i][2])
ans=map[i][0];
if(map[0][i]!='+' && map[0][... | CPP |
p00183 Black-and-White | Consider a tic-tac-toe on a 3x3 board. Tic-tac-toe is a two-player battle game. Decide the first attack and the second attack, one hits Kuroishi and one hits Shiraishi. The winner is the person who puts stones one by one on the board alternately and arranges three of his own stones first in either the vertical, horizon... | 7 | 0 | #include <iostream>
#include <string>
#include <algorithm>
using namespace std;
int main(void){
string str[3];
while(cin >> str[0]){
if(str[0] == "0") break;
int r=-1;
cin >> str[1] >> str[2];
for(int i=0;i<3;i++){
if(str[i][0] == str[i][1] && str[i][1] == str[i][2]){
if(str[i][0] != '+'){
str[i... | CPP |
p00183 Black-and-White | Consider a tic-tac-toe on a 3x3 board. Tic-tac-toe is a two-player battle game. Decide the first attack and the second attack, one hits Kuroishi and one hits Shiraishi. The winner is the person who puts stones one by one on the board alternately and arranges three of his own stones first in either the vertical, horizon... | 7 | 0 | #include<iostream>
#include<string>
using namespace std;
int main(){
string b[3],s;
while(1){
cin>>b[0];
s="";
if(b[0]=="0")
break;
cin>>b[1];
cin>>b[2];
int flag=0;
for(int i=0;i<3;i++){
if(b[0].at(i)==b[1].at(i)&&b[2].at(i)==b[1].at(i)&&b[0].at(i)!='+') s=b[0].at(i);
... | CPP |
p00183 Black-and-White | Consider a tic-tac-toe on a 3x3 board. Tic-tac-toe is a two-player battle game. Decide the first attack and the second attack, one hits Kuroishi and one hits Shiraishi. The winner is the person who puts stones one by one on the board alternately and arranges three of his own stones first in either the vertical, horizon... | 7 | 0 | #include <iostream>
#include <string>
#include <vector>
using namespace std;
bool solve(const vector<string>& board, char c)
{
if (board[0][0] == c && board[0][1] == c && board[0][2] == c ||
board[1][0] == c && board[1][1] == c && board[1][2] == c ||
board[2][0] == c && board[2][1] == c && board[2][2] ==... | CPP |
p00183 Black-and-White | Consider a tic-tac-toe on a 3x3 board. Tic-tac-toe is a two-player battle game. Decide the first attack and the second attack, one hits Kuroishi and one hits Shiraishi. The winner is the person who puts stones one by one on the board alternately and arranges three of his own stones first in either the vertical, horizon... | 7 | 0 | import java.util.*;
import java.lang.*;
import java.math.*;
import java.io.*;
import static java.lang.Math.*;
import static java.util.Arrays.*;
public class Main{
Scanner sc=new Scanner(System.in);
int INF=1<<28;
double EPS=1e-9;
int[][] a;
int n;
void run(){
n=3;
for(;;){
a=new int[n][n];
for(int... | JAVA |
p00183 Black-and-White | Consider a tic-tac-toe on a 3x3 board. Tic-tac-toe is a two-player battle game. Decide the first attack and the second attack, one hits Kuroishi and one hits Shiraishi. The winner is the person who puts stones one by one on the board alternately and arranges three of his own stones first in either the vertical, horizon... | 7 | 0 | #include <iostream>
#include <string>
#include <sstream>
#include <algorithm>
#include <vector>
#include <utility>
#include <stack>
#include <queue>
#include <map>
#include <set>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <cmath>
using namespace std;
#define rep(i,n) for(int i=0; i<(n); i++)
#de... | CPP |
p00183 Black-and-White | Consider a tic-tac-toe on a 3x3 board. Tic-tac-toe is a two-player battle game. Decide the first attack and the second attack, one hits Kuroishi and one hits Shiraishi. The winner is the person who puts stones one by one on the board alternately and arranges three of his own stones first in either the vertical, horizon... | 7 | 0 | #define _USE_MATH_DEFINES
#include "bits/stdc++.h"
using namespace std;
//#define int long long
#define DBG 1
#define dump(o) if(DBG){cerr<<#o<<" "<<o<<endl;}
#define dumpc(o) if(DBG){cerr<<#o; for(auto &e:(o))cerr<<" "<<e;cerr<<endl;}
#define rep(i,a,b) for(int i=(a);i<(b);i++)
#define rrep(i,a,b) for(int i=(b)-1;i>=... | CPP |
p00183 Black-and-White | Consider a tic-tac-toe on a 3x3 board. Tic-tac-toe is a two-player battle game. Decide the first attack and the second attack, one hits Kuroishi and one hits Shiraishi. The winner is the person who puts stones one by one on the board alternately and arranges three of his own stones first in either the vertical, horizon... | 7 | 0 | #include <cstdio>
#include <cstring>
#include <algorithm>
#include <string>
#include <cmath>
#include <stack>
#include <vector>
#include <map>
#include <set>
#include <queue>
#include <list>
#include <iostream>
#include <sstream>
#include <climits>
#include <cfloat>
#include <complex>
using namespace std;
int main()
... | CPP |
p00183 Black-and-White | Consider a tic-tac-toe on a 3x3 board. Tic-tac-toe is a two-player battle game. Decide the first attack and the second attack, one hits Kuroishi and one hits Shiraishi. The winner is the person who puts stones one by one on the board alternately and arranges three of his own stones first in either the vertical, horizon... | 7 | 0 | #include<iostream>
using namespace std;
int main(){
int cnt_b, cnt_w;
char c[3][3];
while(cin >> c[0][0]){
if(c[0][0] == '0') break;
for(int i=0; i<3; i++){
for(int j=0; j<3; j++){
if(i != 0 || j != 0){
cin >> c[i][j];
}
}
}
if(c[0][0] == c[1][1] && c[1][1] == c[2][2] ||
c[... | CPP |
p00183 Black-and-White | Consider a tic-tac-toe on a 3x3 board. Tic-tac-toe is a two-player battle game. Decide the first attack and the second attack, one hits Kuroishi and one hits Shiraishi. The winner is the person who puts stones one by one on the board alternately and arranges three of his own stones first in either the vertical, horizon... | 7 | 0 | import java.util.Scanner;
public class Main {
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
while(true) {
String[] s = new String[3];
s[0] = sc.next();
if (s[0].equals("0")) {
break;
}
for(int i=1;i<3;i++) {
s[i] = sc.next();
}
char[][] map = new char[... | JAVA |
p00183 Black-and-White | Consider a tic-tac-toe on a 3x3 board. Tic-tac-toe is a two-player battle game. Decide the first attack and the second attack, one hits Kuroishi and one hits Shiraishi. The winner is the person who puts stones one by one on the board alternately and arranges three of his own stones first in either the vertical, horizon... | 7 | 0 | import java.util.*;
public class Main {
static Scanner sc = new Scanner(System.in);
static char[][] board = new char[3][3];
static boolean read() {
String line = sc.next();
if(line.equals("0")) return false;
board[0][0] = line.charAt(0); board[0][1] = line.charAt(1); board[0][2] = line.charAt(2);
for(int ... | JAVA |
p00183 Black-and-White | Consider a tic-tac-toe on a 3x3 board. Tic-tac-toe is a two-player battle game. Decide the first attack and the second attack, one hits Kuroishi and one hits Shiraishi. The winner is the person who puts stones one by one on the board alternately and arranges three of his own stones first in either the vertical, horizon... | 7 | 0 | #include<iostream>
#include<iomanip>
#include<algorithm>
#include<array>
#include<bitset>
#include<cassert>
#include<cctype>
#include<cmath>
#include<cstdio>
#include<cstring>
#include<functional>
#include<limits>
#include<list>
#include<map>
#include<numeric>
#include<set>
#include<stack>
#include<string>
#include<sst... | CPP |
p00183 Black-and-White | Consider a tic-tac-toe on a 3x3 board. Tic-tac-toe is a two-player battle game. Decide the first attack and the second attack, one hits Kuroishi and one hits Shiraishi. The winner is the person who puts stones one by one on the board alternately and arranges three of his own stones first in either the vertical, horizon... | 7 | 0 | #include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <cmath>
#include <cstdio>
#include <functional>
#include <numeric>
#include <stack>
#include <queue>
#include <map>
#include <set>
#include <utility>
#include <sstream>
#include <complex>
using namespace std;
#define FOR(i,a,b) for(... | CPP |
p00183 Black-and-White | Consider a tic-tac-toe on a 3x3 board. Tic-tac-toe is a two-player battle game. Decide the first attack and the second attack, one hits Kuroishi and one hits Shiraishi. The winner is the person who puts stones one by one on the board alternately and arranges three of his own stones first in either the vertical, horizon... | 7 | 0 | #include <iostream>
using namespace std;
int main(){
string m[3];
while(std::cin >> m[0], m[0][0] != '0'){
for(int i=1;i<3;i++)std::cin >> m[i];
string w = "NA";
for(int i=0;i<3;i++){
if(m[i][0] == m[i][1] && m[i][0] == m[i][2])
if(m[i][0] != '+')w = m[i][0];
if(m[0][i] == m[1][i] && m[0][i] == m[2][i... | CPP |
p00183 Black-and-White | Consider a tic-tac-toe on a 3x3 board. Tic-tac-toe is a two-player battle game. Decide the first attack and the second attack, one hits Kuroishi and one hits Shiraishi. The winner is the person who puts stones one by one on the board alternately and arranges three of his own stones first in either the vertical, horizon... | 7 | 0 |
import static java.util.Arrays.deepToString;
import java.util.Scanner;
public class Main {
public static void main(String[] args) {
new Main().run();
}
void tr(Object... os) {
System.err.println(deepToString(os));
}
Scanner sc = new Scanner(System.in);
public void run() {
for (;sc.hasNext();) {
char[... | JAVA |
p00183 Black-and-White | Consider a tic-tac-toe on a 3x3 board. Tic-tac-toe is a two-player battle game. Decide the first attack and the second attack, one hits Kuroishi and one hits Shiraishi. The winner is the person who puts stones one by one on the board alternately and arranges three of his own stones first in either the vertical, horizon... | 7 | 0 | #include <cstdio>
#include <cstdlib>
#include <cstring>
#include <cmath>
#include <ctime>
#include <iostream>
#include <algorithm>
#include <sstream>
#include <string>
#include <vector>
#include <queue>
#include <stack>
#include <map>
#include <set>
#include <utility>
using namespace std;
#define rep(i,n) for(int (i)=... | CPP |
p00183 Black-and-White | Consider a tic-tac-toe on a 3x3 board. Tic-tac-toe is a two-player battle game. Decide the first attack and the second attack, one hits Kuroishi and one hits Shiraishi. The winner is the person who puts stones one by one on the board alternately and arranges three of his own stones first in either the vertical, horizon... | 7 | 0 | #include<cstdio>
#include<algorithm>
#include<vector>
using namespace std;
int main(){
char f[3][4];
while(scanf("%s",f[0]),f[0][0]!='0'){
for(int i=1;i<3;i++)scanf("%s",f[i]);
char ans=0;
for(int i=0;i<3;i++){
if(f[0][i]==f[1][i]&&f[1][i]==f[2][i]&&f[2][i]!='+')ans=f[0][i];
... | CPP |
p00183 Black-and-White | Consider a tic-tac-toe on a 3x3 board. Tic-tac-toe is a two-player battle game. Decide the first attack and the second attack, one hits Kuroishi and one hits Shiraishi. The winner is the person who puts stones one by one on the board alternately and arranges three of his own stones first in either the vertical, horizon... | 7 | 0 | #include<iostream>
using namespace std;
string s[3];
int main()
{
while(cin>>s[0],s[0]!="0")
{
cin>>s[1]>>s[2];
char ans='-';
for(int i=0;i<3;i++)
{
if(s[i][0]=='+')continue;
if(s[i][0]==s[i][1]&&s[i][0]==s[i][2])
{
ans=s[i][0];break;
}
}
for(int i=0;i<3;i++)
{
if(s[0][i]=='+')continu... | CPP |
p00183 Black-and-White | Consider a tic-tac-toe on a 3x3 board. Tic-tac-toe is a two-player battle game. Decide the first attack and the second attack, one hits Kuroishi and one hits Shiraishi. The winner is the person who puts stones one by one on the board alternately and arranges three of his own stones first in either the vertical, horizon... | 7 | 0 | #include <bits/stdc++.h>
using namespace std;
int main(){
char field[3][3];
while(cin >> field[0], field[0][0] != '0'){
char win = ' ';
for(int i=1; i < 3; i++){
cin >> field[i];
}
if(field[0][0] == field[1][1] && field[1][1] == field[2][2] && field[0][0] != '+')win... | CPP |
p00183 Black-and-White | Consider a tic-tac-toe on a 3x3 board. Tic-tac-toe is a two-player battle game. Decide the first attack and the second attack, one hits Kuroishi and one hits Shiraishi. The winner is the person who puts stones one by one on the board alternately and arranges three of his own stones first in either the vertical, horizon... | 7 | 0 | #include <iostream>
using namespace std;
char b[3][3];
bool check(char c) {
for (int i = 0; i < 3; i++) {
if (b[i][0] == c && b[i][1] == c && b[i][2] == c) return true;
if (b[0][i] == c && b[1][i] == c && b[2][i] == c) return true;
}
if (b[0][0] == c && b[1][1] == c && b[2][2] == c) return true;
if (b[0][2] =... | CPP |
p00183 Black-and-White | Consider a tic-tac-toe on a 3x3 board. Tic-tac-toe is a two-player battle game. Decide the first attack and the second attack, one hits Kuroishi and one hits Shiraishi. The winner is the person who puts stones one by one on the board alternately and arranges three of his own stones first in either the vertical, horizon... | 7 | 0 | #include<iostream>
#define loop(i,a,b) for(int i=a;i<b;i++)
#define rep(i,a) loop(i,0,a)
using namespace std;
int main(){
int dt[3][3];
char c;
while(1){
bool cnt=true;
bool br=false;
rep(i,3){
rep(j,3){
cin>>c;
if(c=='0'){
br=true;
break;
}
if(c=='b')dt[i][j]=2;
else if(c=='w')dt[i]... | CPP |
p00183 Black-and-White | Consider a tic-tac-toe on a 3x3 board. Tic-tac-toe is a two-player battle game. Decide the first attack and the second attack, one hits Kuroishi and one hits Shiraishi. The winner is the person who puts stones one by one on the board alternately and arranges three of his own stones first in either the vertical, horizon... | 7 | 0 | #include <bits/stdc++.h>
using namespace std;
int main()
{
string b[3];
while (cin >> b[0], b[0] != "0"){
int f = 0;
cin >> b[1] >> b[2];
for (int i = 0; i < 3; i++){
if (b[i] == "bbb"){
f = 1;
break;
}
else if (b[i] == "www"){
f = 2;
break;
}
... | CPP |
p00183 Black-and-White | Consider a tic-tac-toe on a 3x3 board. Tic-tac-toe is a two-player battle game. Decide the first attack and the second attack, one hits Kuroishi and one hits Shiraishi. The winner is the person who puts stones one by one on the board alternately and arranges three of his own stones first in either the vertical, horizon... | 7 | 0 | #include "bits/stdc++.h"
#include<unordered_map>
#include<unordered_set>
#pragma warning(disable:4996)
using namespace std;
using ld = long double;
const ld eps = 1e-9;
//// < "d:\d_download\visual studio 2015\projects\programing_contest_c++\debug\a.txt" > "d:\d_download\visual studio 2015\projects\programing_contest_... | CPP |
p00183 Black-and-White | Consider a tic-tac-toe on a 3x3 board. Tic-tac-toe is a two-player battle game. Decide the first attack and the second attack, one hits Kuroishi and one hits Shiraishi. The winner is the person who puts stones one by one on the board alternately and arranges three of his own stones first in either the vertical, horizon... | 7 | 0 | #include <iostream>
#include <vector>
#include <string>
using namespace std;
int main() {
vector<string> field(3);
string s;
while (cin >> s, s != "0") {
field[0] = s;
cin >> field[1];
cin >> field[2];
string res = "NA";
for (int i = 0; i < 3; i++) {
if... | CPP |
p00183 Black-and-White | Consider a tic-tac-toe on a 3x3 board. Tic-tac-toe is a two-player battle game. Decide the first attack and the second attack, one hits Kuroishi and one hits Shiraishi. The winner is the person who puts stones one by one on the board alternately and arranges three of his own stones first in either the vertical, horizon... | 7 | 0 | // 2011/03/01 Tazoe
#include <iostream>
#include <string>
using namespace std;
int main()
{
while(true){
string brd[3];
cin >> brd[0];
if(brd[0]=="0")
break;
cin >> brd[1];
cin >> brd[2];
if(brd[0][0]!='+'&&brd[0][0]==brd[0][1]&&brd[0][1]==brd[0][2])
cout << brd[0][0] << endl;
else if(brd[1][0]... | CPP |
p00183 Black-and-White | Consider a tic-tac-toe on a 3x3 board. Tic-tac-toe is a two-player battle game. Decide the first attack and the second attack, one hits Kuroishi and one hits Shiraishi. The winner is the person who puts stones one by one on the board alternately and arranges three of his own stones first in either the vertical, horizon... | 7 | 0 | #include <iostream>
using namespace std;
int main(){
char m[9];
while(1){
for(int i=0;i<9;i++){
cin >> m[i];
if(m[i]=='0')return 0;
}
string win = "NA";
for(int i=0;i<3;i++){
if(m[i*3]!='+' && m[i*3]==m[i*3+1] && m[i*3+1]==m[i*3+2])
win = m[i*3];
if(m[ i ]!='+' && m[ i ]==m[ i+3 ] && m[ i+3 ... | CPP |
p00183 Black-and-White | Consider a tic-tac-toe on a 3x3 board. Tic-tac-toe is a two-player battle game. Decide the first attack and the second attack, one hits Kuroishi and one hits Shiraishi. The winner is the person who puts stones one by one on the board alternately and arranges three of his own stones first in either the vertical, horizon... | 7 | 0 | #include<iostream>
using namespace std;
bool iswinner(char b[3][4],char c)
{
int cnt=0;
for(int i=0;i<3;i++){
cnt=0;
for(int j=0;j<3;j++) if(b[i][j]==c) cnt++;
if(cnt==3) return true;
cnt=0;
for(int j=0;j<3;j++) if(b[j][i]==c) cnt++;
if(cnt==3) return true;
}
cnt=0;
for(int i=0;i<3;i++) if(b[i][i]=... | CPP |
p00183 Black-and-White | Consider a tic-tac-toe on a 3x3 board. Tic-tac-toe is a two-player battle game. Decide the first attack and the second attack, one hits Kuroishi and one hits Shiraishi. The winner is the person who puts stones one by one on the board alternately and arranges three of his own stones first in either the vertical, horizon... | 7 | 0 | #include <iostream>
#include <sstream>
#include <iomanip>
#include <algorithm>
#include <cmath>
#include <string>
#include <vector>
#include <list>
#include <queue>
#include <stack>
#include <set>
#include <map>
#include <bitset>
#include <numeric>
#include <climits>
#include <cfloat>
using namespace std;
int main()
{... | CPP |
p00183 Black-and-White | Consider a tic-tac-toe on a 3x3 board. Tic-tac-toe is a two-player battle game. Decide the first attack and the second attack, one hits Kuroishi and one hits Shiraishi. The winner is the person who puts stones one by one on the board alternately and arranges three of his own stones first in either the vertical, horizon... | 7 | 0 | #include <iostream>
#include <string>
using namespace std;
int main() {
string buf;
int board[3][3];
while(getline(cin,buf)) {
if(buf[0]=='0') break;
for(int i=0;i<3;i++) {
switch(buf[i]) {
case '+':
board[0][i]=0;
break;
case 'b':
board[0][i]=1;
break;
case 'w'... | CPP |
p00183 Black-and-White | Consider a tic-tac-toe on a 3x3 board. Tic-tac-toe is a two-player battle game. Decide the first attack and the second attack, one hits Kuroishi and one hits Shiraishi. The winner is the person who puts stones one by one on the board alternately and arranges three of his own stones first in either the vertical, horizon... | 7 | 0 | #define _USE_MATH_DEFINES
#include <iostream>
#include <complex>
#include <algorithm>
#include <vector>
#include <stack>
#include <string>
#include <queue>
#include <cmath>
#include <math.h>
#include <numeric>
#include <list>
#include <sstream>
#include <fstream>
#include <iomanip>
#include <climits>
#include <set>
#in... | CPP |
p00183 Black-and-White | Consider a tic-tac-toe on a 3x3 board. Tic-tac-toe is a two-player battle game. Decide the first attack and the second attack, one hits Kuroishi and one hits Shiraishi. The winner is the person who puts stones one by one on the board alternately and arranges three of his own stones first in either the vertical, horizon... | 7 | 0 | #include<iostream>
#include<string>
#include<cstdio>
#include<algorithm>
#include<stack>
#include<queue>
#include<vector>
#include<cmath>
#include<utility>
#include<set>
#include<complex>
#include<map>
#define vi vector<int>
#define vvi vector<vector<int> >
#define ll long long int
#define vl vector<ll>
#define vvl vec... | CPP |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.