2014-09-01から1日間の記事一覧

0067 - The Number of Island

#include <iostream> #include <string> using namespace std; void dfs(string data[], int i, int j) { data[i][j]='0'; if (j<12-1 && data[i][j+1]=='1') dfs(data,i,j+1); if (i<12-1 && data[i+1][j]=='1') dfs(data,i+1,j); if (0</string></iostream>

0066 - Tic Tac Toe

#include <iostream> #include <string> using namespace std; void Slove(string data) { char result='d'; for (int i=0; i<3; ++i) { if ( data[i]==data[i+3] && data[i]==data[i+2*3] ) result=data[i]; if (result=='o' || result=='x') break; } for (int j=0; j<3; ++j</string></iostream>…