prompt string | response string |
|---|---|
Problem: 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... | #include <iostream>
using namespace std;
int main(){
string s[3];
while(cin >> s[0], s[0] != "0"){
for(int i = 1 ; i < 3 ; i++){
cin >> s[i];
}
bool end = false;
for(int i = 0 ; i < 3 ; i++){
char ch = s[i][0];
bool ok = true;
for(int j = 1 ; j < 3 ; j++){
if(s[i][j] ... |
Problem: 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... | #include<iostream>
#include<string>
using namespace std;
int main(){
int i, j;
string c[3];
char win;
while(1){
for(i=0; i<3; ++i){
cin >> c[i];
if(c[0] == "0") break;
}
if(c[0] == "0") break;
win = '0';
for(i=0; i<3; i++){
if(c[i][0] == c[i][1] && c[i][0] == c[i][2] &... |
Problem: 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... | #include <bits/stdc++.h>
#define rep(i,a,n) for(int i=a;i<n;i++)
#define repb(i,a,b) for(int i=a;i>=b;i--)
#define all(a) a.begin(),a.end()
#define o(a) cout<<a<<endl
#define int long long
#define fi first
#define se second
using namespace std;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef pair<int,int> pii;
... |
Problem: 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... | #include <iostream>
using namespace std;
bool judge(char a[3][3], char c)
{
if(a[0][0] == c && a[0][1] == c && a[0][2] == c ||
a[1][0] == c && a[1][1] == c && a[1][2] == c ||
a[2][0] == c && a[2][1] == c && a[2][2] == c ||
a[0][0] == c && a[1][0] == c && a[2][0] == c ||
a[0][1] == c && a[1][1] == c &... |
Problem: 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... | #include<iostream>
#include<algorithm>
#include<vector>
#include<queue>
using namespace std;
int main(){
string s[3];
while(cin>>s[0]&&s[0]!="0"){
cin>>s[1]>>s[2];
bool ak=false,bk=false;
for(int i=0;i<3;i++){
bool ak1=true,ak2=true;
bool bk1=true,bk2=true;
for(int j=0;j<3;j++){
if(s... |
Problem: 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... | // #define _CRT_SECURE_NO_WARNINGS
#define _USE_MATH_DEFINES
#include <iostream>
#include <cstdio>
#include <algorithm>
#include <string>
#include <vector>
#include <map>
#include <set>
#include <stack>
#include <cmath>
#include <cstdlib>
#include <functional>
#include <locale>
#include <cctype>
#include <sstream>
usin... |
Problem: 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... | #include <iostream>
using namespace std;
char field[3][3];
void check() {
for (int i = 0; i < 3; ++i) {
if (field[i][0] != '+' && field[i][0] == field[i][1]) {
if (field[i][1] == field[i][2]) {
cout << field[i][2] << endl; return;
}
}
}
for (int i = 0; i < 3; ++i) {
if (field[0][i] != '+' && field[0... |
Problem: 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... | #include<iostream>
using namespace std;
char mat[3][3];
char judge(){
for(int i = 0; i < 3; i++){
if(mat[i][0] != '+' && mat[i][0] == mat[i][1] && mat[i][1] == mat[i][2]) return mat[i][2];
if(mat[0][i] != '+' && mat[0][i] == mat[1][i] && mat[1][i] == mat[2][i]) return mat[2][i];
}
if(mat[1... |
Problem: 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... | #include <iostream>
using namespace std;
int main(void){
char t[10];
string s,s1,s2,s3;
while(getline(cin,s1)){
if(s1=="0") break;
getline(cin,s2);
getline(cin,s3);
s=s1+s2+s3;
for(int i=0;i<9;++i) t[i]=s[i];
bool o[10],x[10];
int i;
for(i=0;i<9;++i){
o[i]=(t[i]=='b')?true:false;
x[i]=(t[i]=='... |
Problem: 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... | def f(a):
for x in 'bw':
if a[0::4].count(x)==3 or a[2:7:2].count(x)==3:return x
for i in range(3):
if a[i*3:i*3+3].count(x)==3 or a[i::3].count(x)==3:return x
return 'NA'
while 1:
a=input()
if a =='0':break
print(f(a+input()+input())) |
Problem: 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... | #include<iostream>
#include<string>
using namespace std;
int main() {
string a;
while (cin >> a&&a != "0") {
char b[3][3];
for (int i = 0; i < 3; i++)
b[0][i] = a[i];
for (int i = 1; i < 3; i++) {
cin >> a;
for (int j = 0; j < 3; j++)
b[i][j] = a[j];
}
string e;
for (int i = 0; i < 3; i++) {... |
Problem: 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... | #include <stdio.h>
#pragma warning(disable : 4996)
char c[10]; const char d[3] = "bw";
int main() {
while (~scanf("%c", &c[0])) {
if (c[0] == '0') break;
for (int i = 1; i < 9; i++) {
if (i % 3 == 0) getchar();
scanf("%c", &c[i]);
}
bool ok = false;
for (int i = 0; i < 2; i++) {
bool flag = false;
... |
Problem: 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... | #include <iostream>
using namespace std;
int checkYoko( char stage[4][4], int i )
{
if( stage[i][0] == stage[i][1] && stage[i][1] == stage[i][2] ) {
if( stage[i][0] == 'b' ) return 1;
else if( stage[i][0] == 'w' ) return 2;
else return 0;
}
return 0;
}
int checkTate( char stage[4][4], int i )
{
if( stage[... |
Problem: 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... | #include <functional>
#include <algorithm>
#include <iostream>
#include <numeric>
#include <iomanip>
#include <utility>
#include <cstdlib>
#include <sstream>
#include <bitset>
#include <vector>
#include <cstdio>
#include <ctime>
#include <queue>
#include <deque>
#include <cmath>
#include <stack>
#include <list>
#includ... |
Problem: 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... | #include<cstdio>
#include<cstdlib>
#include<cstring>
#include<cmath>
#include<cassert>
#include<iostream>
#include<sstream>
#include<string>
#include<vector>
#include<queue>
#include<set>
#include<map>
#include<utility>
#include<numeric>
#include<algorithm>
#include<bitset>
#include<complex>
using namespace std;
type... |
Problem: 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... | #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";
char c;
for(int i=0;i<3;i++){
c = m[i][0];
if(2*c - m[i][1] - m[i][2] == 0 && c - '+')w = c;
c = m[0][i];
if(2*c - m[1][i] - m[2][i] == 0 && c - '+')w = c;
... |
Problem: 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... | b,w = ["b"]*3,["w"]*3
t = range(3)
while 1:
try:
bw = [list(raw_input()) for i in t]
ans = "NA"
for i in range(3):
if b == bw[i] or b == [bw[j][i] for j in t]: ans = "b"
if w == bw[i] or w == [bw[j][i] for j in t]: ans = "w"
if b == [bw[i][i] for i in t] or b == [bw[i][2-i] for i in t]: ans = "b"
if w ... |
Problem: 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... | #include <iostream>
#include <string>
using namespace std;
int main()
{
string s[3];
while (cin >> s[0], s[0] != "0")
{
cin >> s[1] >> s[2];
if (s[0][0] == s[0][1] && s[0][1] == s[0][2] && s[0][0] != '+')
{
cout << s[0][0] << endl;
}
else if (s[1][0] == s[1][1] && s[1][1] == s[1][2] && s[1][0] != '... |
Problem: 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... | def f(a):
for x in ['b','w']:
if a[0::4].count(x)==3 or a[2:7:2].count(x)==3:return x
for i in range(3):
if a[i*3:i*3+3].count(x)==3 or a[i::3].count(x)==3:return x
return 'NA'
while 1:
a=input()
if a=='0':break
a+=input()+input()
print(f(list(a))) |
Problem: 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... | //Name: Black-and-White
//Level: 1
//Category: 実装
//Note:
/**
* 縦、横、斜めそれぞれについて、同じ文字が1列に並んでいるか、並んでいればどの文字かを判定する。
*/
#include <iostream>
#include <string>
#include <array>
using namespace std;
array<string,3> field;
char check_inner(int r, int c, int dr, int dc) {
if(field[r][c] == field[r+dr][c+dc] && field[r][... |
Problem: 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... | import java.util.*;
public class Main {
/**
* @param args
*/
public static void main(String[] args) throws java.io.IOException {
// TODO 自動生成されたメソッド・スタブ
Scanner sc = new Scanner(System.in);
char bor[][] = new char[3][3];
while (true){
if(sc.hasNextInt())break;
for (int i = 0; i < 3; i++) {
bo... |
Problem: 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... | #include<cstdio>
#include<algorithm>
using namespace std;
int f(int a,int b,int c)
{
if(a==b&&b==c&&a-'+')return a;
return 0;
}
int main()
{
char s[10];
int i,c;
while(c=0,scanf("%s",s),s[0]-'0')
{
scanf("%s%s",&s[3],&s[6]);
for(i=0;i<3;++i)c=max(max(c,f(s[i*3],s[i*3+1],s[i*3+2])),f(s[i],s[i+3],s[i+6]));
c=... |
Problem: 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... | #include<iostream>
#include<string>
using namespace std;
char s[3][3];
int judgeB(){
for(int i = 0; i < 3; i++){
if(s[i][0] == 'b' && s[i][1] == 'b' && s[i][2] == 'b') return 1;
}
for(int i = 0; i < 3; i++){
if(s[0][i] == 'b' && s[1][i] == 'b' && s[2][i] == 'b') return 1;
}
if(s[0][0] == 'b' && s[1... |
Problem: 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... | #include <cstdio>
#include <iostream>
#include <string>
using namespace std;
int a[3][3];
void bw(string str,int n){
for(int i=0;i<3;i++){
if(str[i] == 'b') a[n][i] = 1;
else if(str[i] == 'w') a[n][i] = 2;
else if(str[i] == '+') a[n][i] = 0;
}
}
int main(){
int i,j,tate1,tate2,yoko1,yoko2,na1,na2,na... |
Problem: 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... | #include <bits/stdc++.h>
#define FOR(i,a,b) for(int i=(a);i<(b);i++)
#define RFOR(i,a,b) for(int i=(b) - 1;i>=(a);i--)
#define REP(i,n) for(int i=0;i<(n);i++)
#define RREP(i,n) for(int i=n-1;i>=0;i--)
#define PB push_back
#define INF INT_MAX/3
#define ALL(a) (a).begin(),(a).end()
#define CLR(a) memset(a,0,sizeof(a))
... |
Problem: 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... | #include<iostream>
#include<math.h>
#include<vector>
#include<algorithm>
#include<cstdio>
#include <string>
#include <complex>
#include <functional>
using namespace std;
typedef pair<int,int> P;
string r[3];
void solve(){
for(int i=0;i<3;i++){
if(r[i][0]==r[i][1]
&&r[i][1]==r[i][2]
... |
Problem: 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... | #include <iostream>
#include <string>
using namespace std;
int main()
{
string s,t;
while(cin >> s, s!="0")
{
for(int i=0; i<2; i++)
{
cin >> t;
s+=t;
}
int b=0, w=0;
for(int i=0; i<9; i++)
{
if(s[i] == 'b') b++;
if(s[i] == 'w') w++;
}
bool bw=false, ww=false;
for(int i=0; i<9; i+=3)
... |
Problem: 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... | #define _USE_MATH_DEFINES
#define INF 10000000
#include <iostream>
#include <sstream>
#include <cmath>
#include <algorithm>
#include <queue>
#include <stack>
#include <limits>
#include <map>
#include <string>
#include <cstring>
#include <set>
#include <deque>
#include <bitset>
using namespace std;
typedef long long l... |
Problem: 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... | #include <bits/stdc++.h>
using namespace std;
#define FOR(i,a,b) for(int i=(a);i<(b);i++)
#define REP(i,n) FOR(i,0,n)
#define ALL(v) (v).begin(),(v).end()
#define fi first
#define se second
template<typename A, typename B> inline bool chmax(A &a, B b) { if (a<b) { a=b; return 1; } return 0; }
template<typename A, ty... |
Problem: 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... | #include <iostream>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <cmath>
#include <climits>
#include <string>
#include <vector>
#include <algorithm>
#include <map>
#include <set>
#include <queue>
#include <stack>
#include <list>
#include <bitset>
using namespace std;
typedef vector<int> vi;
typedef... |
Problem: 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... | #include<iostream>
#include<string>
using namespace std;
int main() {
string s1, s2, s3;
while (cin >> s1){
if (s1 == "0")return 0;
cin >> s2 >> s3;
if (s1[0] != '+') {
if (s1[0] == s1[1] && s1[0] == s1[2]) { cout << s1[0]; goto heaven; }
else if (s1[0] == s2[1] && s1[0] == s3[2]) { cout << s1[0]; goto he... |
Problem: 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... | #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++){
char c = m[i][0];
if(2 * c - m[i][1] - m[i][2] == 0 && c - '+')w = c;
c = m[0][i];
if(2 * c - m[1][i] - m[2][i] == 0 && c - '+')w = c;
... |
Problem: 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... | #include <iostream>
#include <string>
using namespace std;
int main(){
string s1,s2,s3,mas;
bool judge;
while(1){
cin >> s1;
if(s1 == "0") break;
cin >> s2 >> s3;
mas = s1 + s2 + s3;
judge = false;
for(int i=0;i<9;i+=3){
if(mas.substr(i,3) == "bbb... |
Problem: 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... | import java.util.Scanner;
public class Main {
public static void main(String[] args){
Scanner sc = new Scanner(System.in);
while(true){
int[][] board = new int[3][3];
for(int i = 0; i < 3; i++){
char[] strs = sc.nextLine().toCharArray();
if(strs[0] == '0'){
return;
}
... |
Problem: 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... | #include<iostream>
using namespace std;
bool judge( char a, char b, char c )
{
if( a == b && b == c && a != '+' )
return true;
return false;
}
int main()
{
char c[3][3];
while( cin >> c[0][0] )
{
if( c[0][0] == '0' )
break;
cin >> c[0][1] >> c[0][2];
... |
Problem: 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... | def f(a):
for x in ['b','w']:
if a[0::4].count(x)==3 or a[2:7:2].count(x)==3:return x
for i in range(3):
if a[i*3:i*3+3].count(x)==3 or a[i::3].count(x)==3:return x
return 'NA'
while 1:
a=list(input())
if len(a)==1:break
a+=list(input())+list(input())
print(f(a)) |
Problem: 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... | #include <iostream>
#include <string>
#include <vector>
using namespace std;
int main() {
vector<string> bd(3);
while (cin >> bd[0], bd[0] != "0") {
for (int i=1; i<3; ++i) cin >> bd[i];
string res = "NA";
for (int k=0; k<3; ++k) {
if (bd[0][k] != '+' && bd[0][k] == bd[1][k]... |
Problem: 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... | #include<cstdio>
#include<cstdlib>
#include<cmath>
#include<cstring>
#include<cctype>
#include<iostream>
#include<algorithm>
#include<vector>
#include<string>
#include<stack>
#include<queue>
#include<map>
using namespace std;
const int dx[] = {1,0,-1,0},dy[] = {0,1,0,-1};
#define INF 999999
#define rep(i,j) for(int i=... |
Problem: 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... | #include <iostream>
#include <string>
using namespace std;
int main()
{
string s[3];
while (cin >> s[0], s[0] != "0"){
cin >> s[1] >> s[2];
bool c = true;
for (int i = 0; i < 3; i++){
if (s[i] == "www"){
cout << "w" << endl;
c = false;
break;
}
else if (s[i] == "bbb"){
cout << "b"... |
Problem: 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... | #include <iostream>
using namespace std;
int main(){
char s[3][3];
while(true){
cin >> s[0][0];
if(s[0][0]=='0') break;
for(int i = 0 ; i < 3 ; i++){
for(int j = 0 ; j < 3 ; j++){
if(!i&&!j) continue;
else cin >> s[i][j];
}
... |
Problem: 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... | #include <iostream>
using namespace std;
int main() {
char hyou[3][3];
while (cin >> hyou[0][0]) {
if (hyou[0][0] == '0') {
break;
}
for (int i = 0; i < 3; i++) {
for (int j = 0; j < 3; j++) {
if (i != 0 || j != 0) {
cin >> hyou[i][j];
}
}
}
bool hantei = true;
for (int i = 0; i <... |
Problem: 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... | #include <iostream>
#include <string>
using namespace std;
int main() {
for(string s1, s2, s3; cin >> s1, s1 != "0"; ) {
cin >> s2 >> s3;
string s = s1 + s2 + s3;
string bit[] = {
"111000000",
"000111000",
"000000111",
"100100100",
... |
Problem: 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... | #include <bits/stdc++.h>
using namespace std;
using ll = long long;
using pii = pair<int, int>;
int main() {
cin.tie(0);
ios_base::sync_with_stdio(false);
cout << fixed << setprecision(10);
string s[3];
while (cin >> s[0], s[0] != "0") {
cin >> s[1] >> s[2];
string ans = "NA";
for (int i = 0; ... |
Problem: 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... | import java.util.Scanner;
public class Main{
public static void main(String[] args){
new Main().run();
}
public void run(){
Scanner scan = new Scanner(System.in);
int[][] dx = {{0,1,2},{0,3,6},{0,4,8},{1,4,7},{3,4,5},{6,7,8},{2,4,6},{2,5,8}};
int fl = 0;
int t = 0;
while(sca... |
Problem: 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... | #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 <deque>
#include <complex>
#include <stack>
#... |
Problem: 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... | import java.util.Scanner;
//Black-and-White
public class Main{
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
while(true){
String s = sc.next();
if(s.equals("0"))break;
char[][] m = new char[3][3];
m[0] = s.toCharArray();
for(int i=1;i<3;i++)m[i]=sc.next().toCharArra... |
Problem: 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... | #include <iostream>
#include <string>
#include <vector>
using namespace std;
string solve( vector< string >& map )
{
char row, col, rd, ld, comp;
rd = map[ 0 ][ 0 ];
ld = map[ 0 ][ 2 ];
for( int i = 0; i < 3; ++i ){
row = map[ 0 ][ i ];
col = map[ i ][ 0 ];
for( int j = 0; j < 3; ++j ){
if( row != map[ j ... |
Problem: 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... |
import java.awt.geom.Point2D;
import java.io.*;
import java.math.BigInteger;
import java.util.ArrayDeque;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collections;
import java.util.Comparator;
import java.util.Deque;
import java.util.HashMap;
import java.util.HashSet;
import java.util.List;
im... |
Problem: 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... | #include <iostream>
using namespace std;
int main() {
string str[3];
while(1) {
for(int i=0;i<3;i++) {
getline(cin,str[i]);
if(cin.eof()) return 0;
// cout << str[i] << endl;
}
bool r = false;
for(int i=0;i<3;i++) { //yoko
if(str[i][0] == str[i][1] && str[i][1] == str... |
Problem: 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... | #include <iostream>
#include <fstream>
#include <algorithm>
#include <cassert>
#include <cctype>
#include <complex>
#include <cstdio>
#include <map>
#include <math.h>
#include <queue>
#include <set>
#include <stack>
#include <string>
#include <vector>
using namespace std;
#define rep(i,n) for(int i=0;i<n;i++)
int l[]... |
Problem: 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... | // 0183
#include <iostream>
#include <string>
using namespace std;
bool check(char bw[3][3], char x){
for(int i=0;i<3;i++)
if((bw[i][0] == x) && (bw[i][1] == x) && (bw[i][2] == x))
return true;
else if((bw[0][i] == x) && (bw[1][i] == x) && (bw[2][i] == x))
return true;
if((bw[0][0] == x) && (bw[1][1] == ... |
Problem: 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... | import java.util.Scanner;
public class Main {
/**
* @param args
*/
static String[] field = new String[3];
public static void main(String[] args) {
Scanner cin = new Scanner(System.in);
label:while(true){
field = new String[3];
field[0]=cin.next();
if(field[0].equals("0")){
break;
}
field... |
Problem: 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... | #include<iostream>
#include<algorithm>
#include<vector>
#include<stack>
#include<map>
#include<set>
#include<queue>
#include<cstdio>
#include<climits>
#include<cmath>
#include<cstring>
#include<string>
#include<sstream>
#include<numeric>
#include<cassert>
#define f first
#define s second
#define mp make_pair
#define ... |
Problem: 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... | #include <bits/stdc++.h>
using namespace std;
int main(void){
std::deque<char> deq1;
std::deque<char> deq2;
std::deque<char> deq3;
string s;
while(cin>>s) {
if (s=="0") {
break;
} else {
for (int i=0;i<3;i++) {
deq1.emplace_back(s.at(i));
... |
Problem: 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... | #include <iostream>
#include <iomanip>
#include <vector>
#include <string>
#include <stack>
#include <queue>
#include <deque>
#include <set>
#include <map>
#include <algorithm>
#include <sstream>
#include <cstdlib>
#include <cstring>
#include <functional>
#include <numeric>
#include <cmath>
#include <climits>
#include ... |
Problem: 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... |
#define _CRT_SECURE_NO_WARNINGS
#define _USE_MATH_DEFINES
#include <cfloat>
#include <climits>
#include <cmath>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <ctime>
#include <iostream>
#include <memory>
#include <string>
#include <algorithm>
#include <complex>
#include <list>
#include <map>
#inclu... |
Problem: 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... | #include <iostream>
#include <cstdio>
using namespace std;
int main(){
int i,j;
char g[3][3];
char win;
while(1){
for(i=0;i<3;i++){
for(j=0;j<3;j++){
cin >> g[i][j];
if(g[0][0]=='0') return 0;
if(g[i][j]=='+') g[i][j]=(j+1)*(i+1);
}
}
for(i=0;i<3;i++){
if(g[i][0]==g... |
Problem: 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... | #include <iostream>
using namespace std;
int main()
{
char field[3][3];
while(true){
for(int i=0;i<3;i++){
for(int j=0;j<3;j++){
cin >> field[i][j];
if(field[i][j] == '0')
return 0;
}
}
bool flag = false;
for(int i=0;i<3;i++){
if(field[i][1] == field[i][0] && field[i][1] == field[i][2] ... |
Problem: 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... | #include<iostream>
using namespace std;
int main(){
while(true){
string s[3];
cin >> s[0];
if(s[0] == "0")break;
cin >> s[1];
cin >> s[2];
if(s[0][0] == s[0][1] && s[0][1] == s[0][2] && s[0][0] != '+'){
cout << s[0][0] << endl;
continue;
}
if(s[0][0] == s[1][0] && s[1][... |
Problem: 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... | import java.util.Scanner;
public class Main {
static char[][] f;
public static void main(String[] args) {
Scanner stdIn = new Scanner(System.in);
while(true){
f = new char[3][3];
for(int i=0;i<3;i++){
char[] input = stdIn.nextLine().toCharArray();
if(input[0]=='0') return;
f[i] = new char[3];
... |
Problem: 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... | import java.util.*;
import java.io.*;
public class Main {
static void solve (FastScanner in, PrintWriter out, Methods ms) {
while (true) {
char[][] map = new char[3][3];
String s = in.next();
if (s.equals("0")) return;
map[0] = s.toCharArray();
map[1] = in.next().toCharArray();
map[2] = in.n... |
Problem: 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... | #include<iostream>
using namespace std;
int main(){
char board[3][4];
int i;
char w;
while(true){
w='0';
for(i=0;i<3;i++){
cin>>board[i];
if(board[i][0] == '0' && board[i][1] == '\0'){
break;
}
}
if(i<3) break;
for(i=0;i<3;i++){
if(board[i][0]==board[i][1] && board[i][0]==board[i][2] && b... |
Problem: 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... | def f(a):
for x in ['b','w']:
if a[0::4].count(x)==3 or a[2:7:2].count(x)==3:return x
for i in range(3):
if a[i*3:i*3+3].count(x)==3 or a[i::3].count(x)==3:return x
return 'NA'
while 1:
a=input()
if a=='0':break
print(f(a+input()+input())) |
Problem: 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... | #include <iostream>
#include <fstream>
#include <sstream>
#include <iomanip>
#include <complex>
#include <string>
#include <vector>
#include <list>
#include <deque>
#include <stack>
#include <queue>
#include <set>
#include <map>
#include <bitset>
#include <functional>
#include <utility>
#include <algorithm>
#include <n... |
Problem: 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... | #include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#define REP(i,k,n) for(int i=k;i<n;i++)
#define rep(i,n) for(int i=0;i<n;i++)
using namespace std;
int main()
{
string s;
while(cin >> s)
{
if(s == "0") break;
vector<string> v;
v.push_back(s);
rep(i,2)
{
string temp;
... |
Problem: 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... | /* {{{ Shinobu kawaii */
/*
______ __ _ __
.' ____ \ [ | (_) [ |
| (___ \_| | |--. __ _ .--. .--. | |.--. __ _
_.____`. | .-. | [ | [ `.-. |/ .'`\ \| '/'`\ \[ | | |
| \____) | | | | | | | | | | || \__. || \__/ | | ... |
Problem: 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... | //38
#include<iostream>
using namespace std;
int main(){
for(;;){
char g[3][3];
for(int i=0;i<3;i++){
for(int j=0;j<3;j++){
cin>>g[i][j];
if(g[i][j]=='0')return 0;
}
}
for(int i=0;i<3;i++){
if(g[i][0]!='+'&&g[i][0]==g[i][1]&&g[i][0]==g[i][2]){
cout<<g[i][0]<<endl;
goto next;
... |
Problem: 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... | #include <iostream>
#include <algorithm>
#include <map>
#include <set>
#include <queue>
#include <stack>
#include <numeric>
#include <bitset>
#include <cmath>
static const int MOD = 1000000007;
using ll = long long;
using u32 = unsigned;
using u64 = unsigned long long;
using namespace std;
template<class T> constexpr... |
Problem: 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... | #include <iostream>
#include <cstdio>
#include <vector>
#include <algorithm>
#include <complex>
#include <cstring>
#include <cstdlib>
#include <string>
#include <cmath>
#include <queue>
using namespace std;
#define REP(i,n) for(int i=0;i<(int)n;++i)
#define FOR(i,c) for(__typeof((c).begin())i=(c).begin();i!=(c).end();... |
Problem: 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... |
import java.util.Scanner;
public class Main {
public static void main(String[] args) {
new Main().run();
}
private void run() {
Scanner scanner = new Scanner(System.in);
while (true) {
String line1 = scanner.next();
if (line1.equals("0"))
break;
char[][] map = new char[3][3];
map[0] = line1.... |
Problem: 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... | #include<iostream>
using namespace std;
int main(void){
for(;;){
char a[3][3];
int f=0,z=0;
for (int i=0;i<3;i++){
cin>>a[i];
if(a[i][0]=='0'){
z++;
break;
}
}
if(z!=0)break;
for(int i=0;i<1;i++){
for(int j=0;j<3;j++){
... |
Problem: 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... | #include <iostream>
#include <vector>
#include <string>
using namespace std;
int main( void )
{
while ( 1 )
{
vector <string> M(3);
bool not_found;
cin >> M[0];
if ( M[0] == "0" ) break;
cin >> M[1] >> M[2];
not_found = true;
for ( int i = 0; not_found && i < 3; i++ )
{
if ( M[i][0] == M[i][1] &&... |
Problem: 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... | #include<iostream>
#include<string>
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[1][2]){cout<<s[1][0]<<endl;continue;}
if(s[2][0]!='+'... |
Problem: 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... | #include <stdio.h>
#define NON 0
#define BLK 1
#define WHT -1
#define SIZE 3
int isGameSet(int iField[SIZE][SIZE]);
int main(void){
int board[SIZE][SIZE];
char buf[4];
while(1){
for (int y=0; y<SIZE; y++){
scanf("%s", buf);
if (buf[0]=='0') return 0;
for (... |
Problem: 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... | #include<iostream>
using namespace std;
string a[3];
char tate(){
for(int i=0;i<3;i++){
if(a[0][i]==a[1][i]&&a[0][i]==a[2][i]&&a[0][i]!='+'){
return a[0][i];
}
}
return '+';
}
char yoko(){
for(int i=0;i<3;i++){
if(a[i][0]==a[i][1]&&a[i][0]==a[i][2]&&a[i][0]!='+'){
return a[i][0];
}
}
return '+';
... |
Problem: 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... | #include <iostream>
#include <algorithm>
#include <vector>
using namespace std;
int board[3][3];
int main(){
char c;
while(cin >> c){
if(c == '0'){
return 0;
}
//テ、ツスツソテァツ板ィテ」ツδ愿」ツδシテ」ツδ嘉」ツつ?テ」ツ?ァテ・ツ按敕ヲツ慊淌・ツ個?
for(int i=0;i<3;i++){
for(int j=0;j<3;j++){
board[i][j] = 0;
}
}
for(int... |
Problem: 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... | all_b = "bbb"
all_w = "www"
while True:
r1 = input()
if r1 == "0":
break
r2 = input()
r3 = input()
cands = [r1, r2, r3]
for i in range(3):
col = r1[i] + r2[i] + r3[i]
cands.append(col)
cands.append(r1[0] + r2[1] + r3[2])
cands.append(r1[2] + r2[1] + r3[0])
for cand in cands:
if cand ==... |
Problem: 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... | //AOJ 0183
#include <iostream>
#include <string>
using namespace std;
int main(){
string s[3];
char w;
while (1) {
w = 'q';
for (auto& i : s) {
cin>>i;
if(i == "0") return 0;
}
bool end = false;
for (int i = 0; i < 3; i++) {
char c = s[i][0];
bool flag = true;
for (int j = 0; j < 3; j++)
... |
Problem: 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... | #include <iostream>
#include <string>
using namespace std;
string m[3];
string solve(){
for(int i=0 ; i < 3 ; i++ ){
if( m[i] == "bbb" )
return "b";
if( m[i] == "www" )
return "w";
if( m[0][i] == 'b' && m[1][i] == 'b' && m[2][i] == 'b' )
return "b";
if( m[0][i] == 'w' && m[1][i] == 'w' && m[2][i] ==... |
Problem: 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... | #include <iostream>
void dwrite(int i){
std::cout << i << std::endl;
}
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][... |
Problem: 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... | #include<iostream>
#include<cstdio>
#include<algorithm>
using namespace std;
const int dy[8] = {-1,-1,0,1,1,1,0,-1}, dx[8] = {0,1,1,1,0,-1,-1,-1};
int main(){
char fld[3][3];
while(true){
for(int i=0;i<3;i++){
for(int j=0;j<3;j++){
cin>>fld[i][j];
if(fld[i][j]=='0') return 0;
}
}
for(int i=0;i<3... |
Problem: 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... | #include<iostream>
#include<string>
using namespace std;
char T[3][3];
string blackwhite() {
for (int i = 0; i < 3; i++) {
if (T[i][0] == T[i][1] && T[i][1] == T[i][2]) {
if (T[i][0] == 'b') { return "b"; }
if (T[i][0] == 'w') { return "w"; }
}
}
for (int i = 0; i < 3; i++) {
if (T[0][i] == T[1][i] && ... |
Problem: 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... | #include <iostream>
#include <vector>
#include <algorithm>
using namespace std;
#define rep(i,n) for(int i=0;i<n;i++)
int di[][3] = {
{0,1,2},{3,4,5},{6,7,8},
{0,3,6},{1,4,7},{2,5,8},
{0,4,8},{2,4,6}
};
int main(){
string t;
while(cin >> t , t != "0"){
string ans = "NA";
string s; s += t;
rep(i,2)cin >> t ,... |
Problem: 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... | #include<iostream>
#include<string>
using namespace std;
int main() {
char b[5][5];
while (cin >> b[0] ) {
if (b[0][0] == '0')break;
cin >> b[1] >> b[2];
string x;
if (b[0][0] == b[0][1] && b[0][1] == b[0][2] && b[0][0] != '+') { x = b[0][0]; }
else if (b[1][0] == b[1][1] && b[1][1] == b[1][2] && b[1][0] ... |
Problem: 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... | #include <bits/stdc++.h>
using namespace std;
int main()
{
char c;
while (cin >> c, c != '0') {
char b[3][3]; b[0][0] = c;
for (int i = 1; i < 9; i++) {
cin >> b[i/3][i%3];
}
auto win = [&](char c) -> bool {
for (int i = 0; i < 3; i++) {
... |
Problem: 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... | import java.util.regex.*;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&&Pattern.compile(String.format(".*%1$s.{%2$s}%1$s.{%2$s}%1$s.*",y,i),Pattern.DOTALL).match... |
Problem: 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... | #include<bits/stdc++.h>
#define rep(i,n)for(int i=0;i<n;i++)
using namespace std;
typedef pair<int, int>P;
char a[3][3];
int main() {
while (cin >> a[0][0], a[0][0] != 48) {
rep(i, 3)rep(j, 3)if (i || j)cin >> a[i][j];
rep(i, 3) {
if (a[i][0] == a[i][1] && a[i][1] == a[i][2] && a[i][0] != '+') {
cout << a[... |
Problem: 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... | #include <iostream>
using namespace std;
int main() {
char c[3][4],a;
int i;
while(cin >> c[0]) {
if (c[0][0]=='0') break;
cin >> c[1] >> c[2];
a='+';
if (((c[0][0]==c[1][1] && c[1][1]==c[2][2]) || (c[0][2]==c[1][1] && c[1][1]==c[2][0])) && c[1][1]!='+') a=c[1][1];
else {
for (i=0;i<3;i++) {
if (c... |
Problem: 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... | // 2011/08/24 Tazoe
#include <iostream>
using namespace std;
int main()
{
while(true){
char brd[3][3];
for(int i=0; i<3; i++){
for(int j=0; j<3; j++){
cin >> brd[i][j];
if(brd[i][j]=='0') // ¶
return 0;
}
}
if(brd[0][0]!='+'&&brd[0][0]==brd[0][1]&&brd[0][1]==brd[0][2])
cout << brd[0... |
Problem: 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... | #include <iostream>
#include <cstdio>
#include <algorithm>
#include <cmath>
#include <vector>
using namespace std;
int main()
{
string a[3];
char ans;
while(true){
cin >> a[0];
if(a[0][0] == '0'){
break;
}
cin >> a[1] >> a[2];
ans = '0';
for(int i = 0; i < 3; i++)... |
Problem: 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... | #include <iostream>
using namespace std;
char t[4][4];
char judge(void){
for(int i=0;i<3;i++){
int j;
for(j=1;j<3;j++){
if(t[i][j-1] != t[i][j]) break;
}
if(j == 3 && t[i][0] != '+'){
return t[i][0];
}
}
for(int j=0;j<3;j++){
int i;
for(i=1;i<3;i++){
if(t[i-1][j] != t[i][j]) break;
}
if(... |
Problem: 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... | #include <iostream>
using namespace std;
int main() {
while (true) {
char field[3][4];
for (int i = 0; i < 3; i++) {
cin >> field[i];
}
if (field[0][0] == '0') {
break;
}
if (field[1][1] != '+' &&
((field[1][1] == field[0][0] && fi... |
Problem: 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... | #include <iostream>
#include <string>
using namespace std;
char solve(char board[9]) {
//テァツクツヲ
for (int i = 0; i < 3; i++)
if (board[i] != '+' && board[i] == board[i + 3] && board[i] == board[i + 3 * 2])
return board[i];
//テヲツィツェ
for (int i = 0; i < 9; i += 3)
if (board[i] != '+' && board[i] == board[i ... |
Problem: 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... | #include <iostream>
#include <string>
#include <cstdio>
#include <cstring>
using namespace std;
int main(){
char ban[9];
int hoge[9];
int tmp[8][3]={{0,1,2},{3,4,5},{6,7,8},{0,3,6},{1,4,7},{2,5,8},{0,4,8},{2,4,6}};
while(true){
int hatena = -1;
cin >> ban[0];
if(ban[0]=='0') break;
for(int i=1;i... |
Problem: 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... | #include<iostream>
#include<cmath>
#include<vector>
#include<string>
typedef unsigned long long ull;
#define rep(i,a) for(int i=0;i<a;i++)
#define loop(i,a,b) for(int i=a;i<b;i++)
using namespace std;
const double eps = 1e-10;
const double pi = acos(-1);
const double inf = (int)1e8;
int main(void){
char maze[3][3];
... |
Problem: 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... | #include <bits/stdc++.h>
using namespace std;
#define FOR(i, s, n) for(int i = s; i < (int)n; ++i)
#define per(i, n) for(int i = n; i >= 0; i--)
#define ROF(i, s, n) for(int i = s; i >= (int)n; i--)
#define FORIT(i, A) for (auto i : A)
#define PRINT(x) cout << (x) << "\n"
#define ALL(a) (a).begin(),(a).end()
#define RA... |
Problem: 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... |
import java.util.Scanner;
public class Main {
char [][] data;
private char check(int x, int y){
char ans = data[y][x];
//tate
if(ans == data[y+1][x] && ans == data[y-1][x]){
return ans;
}
//yoko
if(ans == data[y][x+1] && ans == data[y][x-1]){
return ans;
}
//naname
if(ans == data[y-1][x-1]... |
Problem: 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... | #include <iostream>
#define rep(i,n) for(int i=0;i<(int)(n);i++)
using namespace std;
typedef pair<string, int> P;
/** Problem0183 : Black-and-White **/
int main()
{
string board;
while (cin>>board, board!="0") {
string s; cin>>s;
board+=s;
cin >>s; board+=s;
for (int i=0; i<3; i++) {
if (board[i*3] != '... |
Problem: 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... | #include <bits/stdc++.h>
using namespace std;
string MapData[3];
void judge() {
for (int i = 0; i < 3; i++) {
//judgeByRow
if (MapData[i][0] != '+' && MapData[i][0] == MapData[i][1] && MapData[i][1] == MapData[i][2]) {
cout << MapData[i][0] << endl;
return;
}
//judgeByCol
if (MapData[0][i] != '+' ... |
Problem: 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... | #include <iostream>
#include <string>
#define BLACK 'b'
#define WHITE 'w'
#define SPACE '+'
using namespace std;
char isWin(string data[3]) {
char temp;
temp = data[0][0];
if(temp != SPACE && data[1][1] == temp && data[2][2] == temp) return temp;
temp = data[2][0];
if(temp != SPACE && data[1][1] == temp &... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.