output stringlengths 52 181k | instruction stringlengths 296 182k |
|---|---|
#include<iostream>
#include<algorithm>
#include<map>
#include<stack>
using namespace std;
#define INF 100000000
typedef pair<string,int> P;
int x,y;
string f;
char c, alph[] = {'R','G','B'};
int ans;
int r,g,b;
map<string,int> memo;
int dy[] = {-1,0,1,0}, dx[] = {0,1,0,-1};
bool vis[10][10];
void color(string &s,int... | ### Prompt
Your challenge is to write a cpp solution to the following problem:
The tablet interface technology, which can be operated by touching the screen with a finger, has also been applied in the field of games, and various types of games with new operability have been created. The game currently being developed... |
#include <cstdio>
#include <cstring>
#include <cstdlib>
#include <cmath>
#include <complex>
#include <string>
#include <sstream>
#include <algorithm>
#include <vector>
#include <queue>
#include <stack>
#include <functional>
#include <iostream>
#include <map>
#include <set>
using namespace std;
typedef pair<int,int> P;
... | ### Prompt
Please formulate a Cpp solution to the following problem:
The tablet interface technology, which can be operated by touching the screen with a finger, has also been applied in the field of games, and various types of games with new operability have been created. The game currently being developed by AZ is ... |
#include <stdio.h>
#include <queue>
using namespace std;
int tx[4] = {0,0,1,-1},ty[4] = {1,-1,0,0};
int x,y;
class gamen{
public:
char map[12][12];
int howcnt;
int i,j;
gamen(){
howcnt = 0;
for(i = 0; i <= x+1; i++){
map[0][i] = 'L';
map[y+1][i] = 'L';
}
for(i = 0; i <= y+1; i++){
map[i][0] = 'L... | ### Prompt
Your challenge is to write a CPP solution to the following problem:
The tablet interface technology, which can be operated by touching the screen with a finger, has also been applied in the field of games, and various types of games with new operability have been created. The game currently being developed... |
#include <iostream>
#include <vector>
#include <queue>
#include <string>
using namespace std;
int x, y;
void solve(int i, int j, vector<int>& v, int ch, int nx) {
int dxy[] ={0, 1, 0, -1, 0};
for(int k = 0; k < 4; k++) {
if(i+dxy[k] >= 0 && i+dxy[k] < y && j+dxy[k+1] >= 0 && j+dxy[k+1] < x) {
if(((v[i+dxy[k]] ... | ### Prompt
Please provide a Cpp coded solution to the problem described below:
The tablet interface technology, which can be operated by touching the screen with a finger, has also been applied in the field of games, and various types of games with new operability have been created. The game currently being developed... |
#include<iostream>
#include<cstring>
using namespace std;
#define INF (1<<29)
#define rep(i,n) for(int i=0;i<(n);++i)
int w,h;
int ans;
int dx[4]={1,0,-1,0};
int dy[4]={0,1,0,-1};
bool visit[10][10];
inline bool check(int y,int x){
return 0<=y&&y<h&&0<=x&&x<w;
}
int neighbor(int y,int x,char color,char panel[10][10... | ### Prompt
Please provide a Cpp coded solution to the problem described below:
The tablet interface technology, which can be operated by touching the screen with a finger, has also been applied in the field of games, and various types of games with new operability have been created. The game currently being developed... |
#include <iostream>
#include <iomanip>
#include <sstream>
#include <cstdio>
#include <string>
#include <vector>
#include <algorithm>
#include <complex>
#include <cstring>
#include <cstdlib>
#include <cmath>
#include <cassert>
#include <climits>
#include <queue>
#include <set>
#include <map>
#include <valarray>
#include... | ### Prompt
Please provide a cpp coded solution to the problem described below:
The tablet interface technology, which can be operated by touching the screen with a finger, has also been applied in the field of games, and various types of games with new operability have been created. The game currently being developed... |
#include <iostream>
#include <stdio.h>
#include <sstream>
#include <string>
#include <vector>
#include <map>
#include <queue>
#include <algorithm>
#include <set>
#include <math.h>
#include <utility>
#include <stack>
#include <string.h>
#include <complex>
using namespace std;
const int INF = 1<<29;
const double EPS = 1e... | ### Prompt
Please formulate a CPP solution to the following problem:
The tablet interface technology, which can be operated by touching the screen with a finger, has also been applied in the field of games, and various types of games with new operability have been created. The game currently being developed by AZ is ... |
#include<iostream>
#include<queue>
using namespace std;
int x,y;
struct grid{
char g[11][11];
int count;
};
void DFS(grid& gr,char firstcell,char changecolor,int posx,int posy){
if(posx < 0 || posx >= x || posy < 0 || posy >= y || gr.g[posx][posy] != firstcell){
return;
}
gr.g[posx][posy] = changeco... | ### Prompt
Please provide a CPP coded solution to the problem described below:
The tablet interface technology, which can be operated by touching the screen with a finger, has also been applied in the field of games, and various types of games with new operability have been created. The game currently being developed... |
#include <iostream>
#include <string>
#include <vector>
#include <cstring>
#include <climits>
#include <algorithm>
#include <map>
using namespace std;
const int dx[4] = {1, -1, 0, 0};
const int dy[4] = {0, 0, 1, -1};
int X, Y;
int bd[10][10];
inline bool valid(int x, int y) {
return 0 <= x && x < X && 0 <= y && y <... | ### Prompt
Develop a solution in Cpp to the problem described below:
The tablet interface technology, which can be operated by touching the screen with a finger, has also been applied in the field of games, and various types of games with new operability have been created. The game currently being developed by AZ is ... |
#include <bits/stdc++.h>
using namespace std;
int w, h;
int dx[] = {0, 0, -1, 1};
int dy[] = {-1, 1, 0, 0};
char rgb[] = "RGB";
struct Grid {
int cnt;
string stat;
};
bool check(string s) {
int p = 1;
while(s[p] == s[p - 1] && p < s.size()) ++p;
return p == s.size();
}
void rep(string &stat, ch... | ### Prompt
Your challenge is to write a cpp solution to the following problem:
The tablet interface technology, which can be operated by touching the screen with a finger, has also been applied in the field of games, and various types of games with new operability have been created. The game currently being developed... |
#include<iostream>
#include<queue>
#include<vector>
#define INF 1000
using namespace std;
typedef pair<int,int> P;
int H,W;
int mindep; //最小手数
char MAP[12][12]; //可変マップデータ( 外側番兵 )
char has[4] = "RGB";
//領域の面積を戻り値とする
int BFS( char color ){
queue<P> que;
P now;
char map11 = MAP[1][1];
int i;
int dx[4] = {0... | ### Prompt
Develop a solution in Cpp to the problem described below:
The tablet interface technology, which can be operated by touching the screen with a finger, has also been applied in the field of games, and various types of games with new operability have been created. The game currently being developed by AZ is ... |
#include<iostream>
#include<algorithm>
#include<map>
#include<queue>
#include<cassert>
using namespace std;
#define MAX 20
class State{
public:
char T[MAX][MAX], w, h, cost;
State(){}
State(int w, int h):w(w), h(h){ cost = 0;}
bool operator < ( const State &s ) const{
for ( int i = 0; i < h; i++ ){
... | ### Prompt
Please create a solution in cpp to the following problem:
The tablet interface technology, which can be operated by touching the screen with a finger, has also been applied in the field of games, and various types of games with new operability have been created. The game currently being developed by AZ is ... |
#include <bits/stdc++.h>
using namespace std;
using ll = long long int;
using P = pair<int, int>;
using P3 = pair<int,P>;
using PP = pair<P, P>;
constexpr int INF = 1<<29;
constexpr ll MOD = ll(1e9)+7;
constexpr int di[] = {0,1,0,-1};
constexpr int dj[] = {1,0,-1,0};
int h, w, ans;
void solve(vector<vector<int> > &a... | ### Prompt
In CPP, your task is to solve the following problem:
The tablet interface technology, which can be operated by touching the screen with a finger, has also been applied in the field of games, and various types of games with new operability have been created. The game currently being developed by AZ is one o... |
#include <bits/stdc++.h>
using namespace std;
#define rep(i,x,y) for(int i=(x);i<(y);++i)
#define debug(x) #x << "=" << (x)
#ifdef DEBUG
#define _GLIBCXX_DEBUG
#define dump(x) std::cerr << debug(x) << " (L:" << __LINE__ << ")" << std::endl
#else
#define dump(x)
#endif
typedef long long int ll;
typedef pair<int,int> ... | ### Prompt
Please formulate a Cpp solution to the following problem:
The tablet interface technology, which can be operated by touching the screen with a finger, has also been applied in the field of games, and various types of games with new operability have been created. The game currently being developed by AZ is ... |
#include<iostream>
#include<queue>
using namespace std;
struct grid{
char g[12][12];
int cnt;
};
void paint(grid &gr,char C,char c,int x,int y){
if(gr.g[y][x] != C){
return;
}
gr.g[y][x] = c;
paint(gr,C,c,x+1,y);
paint(gr,C,c,x-1,y);
paint(gr,C,c,x,y+1);
paint(gr,C,c,x,y-1);
}
bool check(... | ### Prompt
Your task is to create a Cpp solution to the following problem:
The tablet interface technology, which can be operated by touching the screen with a finger, has also been applied in the field of games, and various types of games with new operability have been created. The game currently being developed by ... |
#include <cstdlib>
#include <iostream>
#include <queue>
#include <vector>
using namespace std;
int w, h;
constexpr int dx[] = {1, -1, 0, 0};
constexpr int dy[] = {0, 0, 1, -1};
inline bool out(int x, int y) {
return x < 0 || y < 0 || x >= w || y >= h;
}
int count_panel(const vector<vector<int>> &field) {
int res =... | ### Prompt
Please formulate a cpp solution to the following problem:
The tablet interface technology, which can be operated by touching the screen with a finger, has also been applied in the field of games, and various types of games with new operability have been created. The game currently being developed by AZ is ... |
#include <iostream>
#include <cstdio>
#include <string>
#include <cstring>
#include <deque>
#include <list>
#include <queue>
#include <stack>
#include <vector>
#include <utility>
#include <algorithm>
#include <map>
#include <set>
#include <complex>
#include <cmath>
#include <limits>
#include <cfloat>
#include <climits>... | ### Prompt
Your challenge is to write a cpp solution to the following problem:
The tablet interface technology, which can be operated by touching the screen with a finger, has also been applied in the field of games, and various types of games with new operability have been created. The game currently being developed... |
#include <stdio.h>
#include <cmath>
#include <algorithm>
#include <cfloat>
#include <stack>
#include <queue>
#include <vector>
#include <string>
#include <iostream>
typedef long long int ll;
typedef unsigned long long int ull;
#define BIG_NUM 2000000000
#define MOD 1000000007
#define EPS 0.000000001
using namespace std... | ### Prompt
In Cpp, your task is to solve the following problem:
The tablet interface technology, which can be operated by touching the screen with a finger, has also been applied in the field of games, and various types of games with new operability have been created. The game currently being developed by AZ is one o... |
#include<iostream>
#include<cstdio>
#include<cstring>
#include<map>
#include<queue>
#include<algorithm>
using namespace std;
typedef pair<int,int> P;
class state{
public:
char f[11][11],c,l;
state(){}
state(int c,int l):c(c),l(l){};
};
char in[11][11];
state ne;
bool used[11][11];
const int dx[4]={0,0,1,-1};
const ... | ### Prompt
Create a solution in Cpp for the following problem:
The tablet interface technology, which can be operated by touching the screen with a finger, has also been applied in the field of games, and various types of games with new operability have been created. The game currently being developed by AZ is one of... |
#include <iostream>
using namespace std;
int x,y,an,fc,dx[4]={1,0,-1,0},dy[4]={0,-1,0,1};
void fill(int (*d)[10],int c,int cr,int fx,int fy) {
int i;
for (i=0;i<4;i++) {
if (fx+dx[i]>=0 && fx+dx[i]<x && fy+dy[i]>=0 && fy+dy[i]<y) {
if (d[fy+dy[i]][fx+dx[i]]==c) {
fc++; d[fy+dy[i]][fx+dx[i]]=cr; fill... | ### Prompt
Your challenge is to write a cpp solution to the following problem:
The tablet interface technology, which can be operated by touching the screen with a finger, has also been applied in the field of games, and various types of games with new operability have been created. The game currently being developed... |
#include <bits/stdc++.h>
using namespace std;
int x,y;
struct sc{
char cs[11][11];
};
void DFS(sc& v,char base,char c,int xp,int yp){
if(xp < 0 || yp < 0 || xp >= x || yp >= y || v.cs[xp][yp]!=base){
return;
}
v.cs[xp][yp] = c;
DFS(v,base,c,xp+1,yp);
DFS(v,base,c,xp,yp+1);
DFS... | ### Prompt
In cpp, your task is to solve the following problem:
The tablet interface technology, which can be operated by touching the screen with a finger, has also been applied in the field of games, and various types of games with new operability have been created. The game currently being developed by AZ is one o... |
#include<bits/stdc++.h>
#define rep(i,n)for(int i=0;i<(n);i++)
using namespace std;
struct st {
char f[10][11]; int cnt;
};
int w, h, dx[]{ 1,-1,0,0 }, dy[]{ 0,0,1,-1 };
char dir[] = "RGB";
bool ok(st&s) {
char c = s.f[0][0];
rep(i, h)rep(j, w) {
if (s.f[i][j] != c)return false;
}
return true;
}
void dfs(st&s, ... | ### Prompt
Create a solution in cpp for the following problem:
The tablet interface technology, which can be operated by touching the screen with a finger, has also been applied in the field of games, and various types of games with new operability have been created. The game currently being developed by AZ is one of... |
// 2014/09/11 Tazoe
#include <iostream>
#include <queue>
#include <string>
#include <map>
using namespace std;
struct State{
string G;
int n;
};
bool is_over(string G)
{
bool flg = true;
for(int i=1; i<G.size(); i++){
if(G[i]!=G[0]){
flg = false;
break;
}
}
return flg;
}
void DFS(char g[12][12], c... | ### Prompt
Your challenge is to write a cpp solution to the following problem:
The tablet interface technology, which can be operated by touching the screen with a finger, has also been applied in the field of games, and various types of games with new operability have been created. The game currently being developed... |
#include<cstdio>
#include<cstdlib>
#include<ctime>
#include<cmath>
#include<cstring>
#include<cctype>
#include<complex>
#include<iostream>
#include<sstream>
#include<algorithm>
#include<functional>
#include<vector>
#include<string>
#include<stack>
#include<queue>
#include<map>
#include<set>
#include<bitset>
#include<nu... | ### Prompt
In CPP, your task is to solve the following problem:
The tablet interface technology, which can be operated by touching the screen with a finger, has also been applied in the field of games, and various types of games with new operability have been created. The game currently being developed by AZ is one o... |
#include <iostream>
#include <queue>
using namespace std;
int w, h;
int dx[] = { 0, 1, 0, -1 };
int dy[] = { -1, 0, 1, 0 };
struct Pazzle {
char glid[10][10];
};
void draw(char glid[][10], int x, int y, char base, char color, int *count) {
glid[y][x] = color;
for (int i = 0; i < 4; i++) {
int np... | ### Prompt
Generate a CPP solution to the following problem:
The tablet interface technology, which can be operated by touching the screen with a finger, has also been applied in the field of games, and various types of games with new operability have been created. The game currently being developed by AZ is one of t... |
#include<algorithm>
#include<functional>
#include<cmath>
#include<cstdio>
#include<cstdlib>
#include<cstring>
#include<string>
#include<sstream>
#include<iostream>
#include<iomanip>
#include<vector>
#include<list>
#include<stack>
#include<queue>
#include<map>
#include<set>
#include<bitset>
#include<climits>
#define al... | ### Prompt
In CPP, your task is to solve the following problem:
The tablet interface technology, which can be operated by touching the screen with a finger, has also been applied in the field of games, and various types of games with new operability have been created. The game currently being developed by AZ is one o... |
#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... | ### Prompt
Construct a Cpp code solution to the problem outlined:
The tablet interface technology, which can be operated by touching the screen with a finger, has also been applied in the field of games, and various types of games with new operability have been created. The game currently being developed by AZ is one... |
#include <algorithm>
#include <cctype>
#include <climits>
#include <cmath>
#include <complex>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <functional>
#include <map>
#include <numeric>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <string>
#include <vector>
using nam... | ### Prompt
Please create a solution in CPP to the following problem:
The tablet interface technology, which can be operated by touching the screen with a finger, has also been applied in the field of games, and various types of games with new operability have been created. The game currently being developed by AZ is ... |
# include "bits/stdc++.h"
using namespace std;
using LL = long long;
using ULL = unsigned long long;
const double PI = acos(-1);
template<class T>constexpr T INF() { return ::std::numeric_limits<T>::max(); }
template<class T>constexpr T HINF() { return INF<T>() / 2; }
template <typename T_char>T_char TL(T_char cX) { re... | ### Prompt
Please formulate a cpp solution to the following problem:
The tablet interface technology, which can be operated by touching the screen with a finger, has also been applied in the field of games, and various types of games with new operability have been created. The game currently being developed by AZ is ... |
#include<iostream>
#include<queue>
using namespace std;
int x,y;
struct grid{
char g[11][11];
int count;
};
void DFS(grid& gr,char firstcell,char changecolor,int posx,int posy){
//if(posx < 0 || posx >= x || posy < 0 || posy >= y || gr.g[posx][posy] != firstcell){
if(gr.g[posx][posy] != firstcell){
ret... | ### Prompt
Please create a solution in Cpp to the following problem:
The tablet interface technology, which can be operated by touching the screen with a finger, has also been applied in the field of games, and various types of games with new operability have been created. The game currently being developed by AZ is ... |
// 2014/09/12 Tazoe
#include <iostream>
#include <queue>
#include <string>
#include <map>
using namespace std;
struct state{
string G;
int N;
};
bool is_over(string G)
{
bool flg = true;
for(int i=1; i<G.size(); i++){
if(G[i]!=G[0]){
flg = false;
break;
}
}
return flg;
}
void DFS(char g[12][12], c... | ### Prompt
Develop a solution in cpp to the problem described below:
The tablet interface technology, which can be operated by touching the screen with a finger, has also been applied in the field of games, and various types of games with new operability have been created. The game currently being developed by AZ is ... |
#include<iostream>
#include<queue>
using namespace std;
struct grid{
char g[12][12];
int cost;
};
void paint(grid& gr,char l_u_cell,char changecolor,int p_x,int p_y){
if(gr.g[p_y][p_x]!=l_u_cell){
return ;
}
gr.g[p_y][p_x]=changecolor;
paint(gr,l_u_cell,changecolor,p_x+1,p_y);
paint(gr,l_u_cell,chan... | ### Prompt
In Cpp, your task is to solve the following problem:
The tablet interface technology, which can be operated by touching the screen with a finger, has also been applied in the field of games, and various types of games with new operability have been created. The game currently being developed by AZ is one o... |
#define _USE_MATH_DEFINES
#define INF 0x3f3f3f3f
#include <cstdio>
#include <iostream>
#include <sstream>
#include <cmath>
#include <cstdlib>
#include <algorithm>
#include <queue>
#include <stack>
#include <limits>
#include <map>
#include <string>
#include <cstring>
#include <set>
#include <deque>
#include <bitset>
#in... | ### Prompt
Please create a solution in cpp to the following problem:
The tablet interface technology, which can be operated by touching the screen with a finger, has also been applied in the field of games, and various types of games with new operability have been created. The game currently being developed by AZ is ... |
#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... | ### Prompt
Please provide a CPP coded solution to the problem described below:
The tablet interface technology, which can be operated by touching the screen with a finger, has also been applied in the field of games, and various types of games with new operability have been created. The game currently being developed... |
#include<iostream>
#include<queue>
using namespace std;
struct grid{
char g[12][12];
int cnt;
};
void fill(grid &gr,char C,char c,int x,int y){
if(gr.g[y][x] != C){
return;
}
gr.g[y][x] = c;
fill(gr,C,c,x+1,y);
fill(gr,C,c,x-1,y);
fill(gr,C,c,x,y+1);
fill(gr,C,c,x,y-1);
}
bool check(grid &gr,ch... | ### Prompt
In CPP, your task is to solve the following problem:
The tablet interface technology, which can be operated by touching the screen with a finger, has also been applied in the field of games, and various types of games with new operability have been created. The game currently being developed by AZ is one o... |
#include <bits/stdc++.h>
using namespace std;
string co="RGB";
int W,H;
typedef struct{
int cnt,area;
char f[12][12];
}F;
int chk(F tmp){
for(int i=1;i<=H;i++){
for(int j=1;j<=W;j++){
if(tmp.f[1][1]!=tmp.f[j][i])return 0;
}
}
return 1;
}
F dt,df,dc;
int dx[4]={1,0,-1,0};
int dy[4]={0,1,0,-1};
typedef pair... | ### Prompt
In cpp, your task is to solve the following problem:
The tablet interface technology, which can be operated by touching the screen with a finger, has also been applied in the field of games, and various types of games with new operability have been created. The game currently being developed by AZ is one o... |
#include<bits/stdc++.h>
using namespace std;
const int dx[]={-1,0,1,0};
const int dy[]={0,-1,0,1};
int H,W;
int fld[10][10];
int lim;
void change(int y,int x,int c,int f){
fld[y][x]=c;
for(int d=0;d<4;d++){
int ny=y+dy[d],nx=x+dx[d];
if(ny<0||ny>=H||nx<0||nx>=W||fld[ny][nx]!=f)continue;
... | ### Prompt
Construct a CPP code solution to the problem outlined:
The tablet interface technology, which can be operated by touching the screen with a finger, has also been applied in the field of games, and various types of games with new operability have been created. The game currently being developed by AZ is one... |
#include<iostream>
#include<queue>
using namespace std;
struct grid{
char g[12][12];
int turn;
};
void fill(grid &gr,char cell,char color,int fx,int fy){
if(gr.g[fy][fx] != cell){
return;
}
gr.g[fy][fx] = color;
fill(gr,cell,color,fx+1,fy);
fill(gr,cell,color,fx-1,fy);
fill(gr,cell,color,fx,fy+1);... | ### Prompt
Please create a solution in Cpp to the following problem:
The tablet interface technology, which can be operated by touching the screen with a finger, has also been applied in the field of games, and various types of games with new operability have been created. The game currently being developed by AZ is ... |
#include <iostream>
#include <algorithm>
#include <utility>
#include <queue>
#include <cstring>
using namespace std;
typedef pair<int, int> P;
struct State {
int turn;
char board[10][10];
};
int main() {
while(true) {
int X, Y;
cin >> X >> Y;
if(X == 0 && Y == 0) break;
char board[10][10];
... | ### Prompt
Please formulate a cpp solution to the following problem:
The tablet interface technology, which can be operated by touching the screen with a finger, has also been applied in the field of games, and various types of games with new operability have been created. The game currently being developed by AZ is ... |
#include <iostream>
#include <queue>
#include <cstring>
#include <climits>
using namespace std;
typedef pair<int,int> P;
int w, h, ans;
int t[12][12];
bool closed[12][12];
int dx[] = {1, -1, 0, 0};
int dy[] = {0, 0, 1, -1};
bool judge(int array[12][12]){
for(int i = 0; i < h; i++){
for(int j = 0; j < w; j++){... | ### Prompt
Develop a solution in CPP to the problem described below:
The tablet interface technology, which can be operated by touching the screen with a finger, has also been applied in the field of games, and various types of games with new operability have been created. The game currently being developed by AZ is ... |
#include<iostream>
#include<sstream>
#include<string>
#include<queue>
#include<utility>
using namespace std;
typedef pair<string, int> P;
int W, H, N, dx[] = {1, -1, 0, 0}, dy[] = {0, 0, 1, -1};
string rgb = "RGB";
bool check(const string& s)
{
char c = s[0];
for(int i = 0; i < W * H; i++)
if(s[i] != c)
... | ### Prompt
Your task is to create a cpp solution to the following problem:
The tablet interface technology, which can be operated by touching the screen with a finger, has also been applied in the field of games, and various types of games with new operability have been created. The game currently being developed by ... |
#include<iostream>
#include<cstring>
using namespace std;
#define INF (1<<29)
#define rep(i,n) for(int i=0;i<(n);++i)
int w,h;
int ans;
int dx[4]={1,0,-1,0};
int dy[4]={0,1,0,-1};
bool visit[10][10];
inline bool check(int y,int x){
return 0<=y&&y<h&&0<=x&&x<w;
}
int neighbor(int y,int x,char color,char panel[10][10... | ### Prompt
In CPP, your task is to solve the following problem:
The tablet interface technology, which can be operated by touching the screen with a finger, has also been applied in the field of games, and various types of games with new operability have been created. The game currently being developed by AZ is one o... |
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <queue>
#include <iterator>
#include <map>
#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 dx[4] = {1,0,-1,0};
int dy[4] = {0,1,0,-1};
struct Field
{
vector<vector<char> > f... | ### Prompt
Develop a solution in CPP to the problem described below:
The tablet interface technology, which can be operated by touching the screen with a finger, has also been applied in the field of games, and various types of games with new operability have been created. The game currently being developed by AZ is ... |
#include<bits/stdc++.h>
using namespace std;
#define rep(i,n) for(int i=0;i<(int)(n);i++)
const int dy[]={-1,0,1,0},dx[]={0,-1,0,1};
int w,h;
char fld[20][20];
int lim;
void paint(int y,int x,char c,vector<int>&V){
char tmp=fld[y][x];
fld[y][x]=c;
V.push_back(y*w+x);
rep(d,4){
int ny=y+dy[d],n... | ### Prompt
Please create a solution in CPP to the following problem:
The tablet interface technology, which can be operated by touching the screen with a finger, has also been applied in the field of games, and various types of games with new operability have been created. The game currently being developed by AZ is ... |
#include <cstdio>
#include <cstdint>
#include <vector>
#include <algorithm>
#include <string>
#include <utility>
#include <tuple>
#include <queue>
constexpr size_t m1 = -1;
constexpr size_t di[] = {m1, 0, 1, 0};
constexpr size_t dj[] = {0, m1, 0, 1};
using ban = std::vector<std::string>;
using zahyo = std::pair<size_... | ### Prompt
Create a solution in CPP for the following problem:
The tablet interface technology, which can be operated by touching the screen with a finger, has also been applied in the field of games, and various types of games with new operability have been created. The game currently being developed by AZ is one of... |
#include<bits/stdc++.h>
using namespace std;
const int dx[]={-1,0,1,0};
const int dy[]={0,-1,0,1};
int H,W;
int fld[10][10];
int lim;
bool change(int y,int x,int c,int f){
fld[y][x]=c;
int cnt=1;
for(int d=0;d<4;d++){
int ny=y+dy[d],nx=x+dx[d];
if(ny<0||ny>=H||nx<0||nx>=W||fld[ny][nx]!=f)c... | ### Prompt
Generate a CPP solution to the following problem:
The tablet interface technology, which can be operated by touching the screen with a finger, has also been applied in the field of games, and various types of games with new operability have been created. The game currently being developed by AZ is one of t... |
#include<bits/stdc++.h>
using namespace std;
int X, Y, Ans;
int Dx[] = { 1,0,-1,0 };
int Dy[] = { 0,1,0,-1 };
bool Used[10][10];
void show(int s[10][10]) {
char ch;
for (int i = 0; i < Y; i++) {
for (int j = 0; j < X; j++) {
if (s[i][j] == 0) {
ch = 'R';
}
else if (s[i][j] == 1) {
ch = 'G';
... | ### Prompt
Generate a cpp solution to the following problem:
The tablet interface technology, which can be operated by touching the screen with a finger, has also been applied in the field of games, and various types of games with new operability have been created. The game currently being developed by AZ is one of t... |
#include<bits/stdc++.h>
using namespace std;
typedef struct{
int maps[11][11];
int c;
}DAT;
typedef pair<int,int>P;
DAT tmp;
int x,y;
int dy[4] = {1,0,-1,0};
int dx[4] = {0,1,0,-1};
string str;
int solve(DAT);
int change_color(DAT,int);
int main(){
char moji;
while(cin >> x >> y,x|y){
DAT a;
... | ### Prompt
Generate a Cpp solution to the following problem:
The tablet interface technology, which can be operated by touching the screen with a finger, has also been applied in the field of games, and various types of games with new operability have been created. The game currently being developed by AZ is one of t... |
//15
#include<iostream>
#include<algorithm>
#include<queue>
#include<vector>
using namespace std;
int x,y;
struct S{
int t;
vector<char> g;
};
void ff(vector<char> &g,int xx,int yy,char c,char sc){
if(xx<0||x<=xx||yy<0||y<=yy||sc!=g[yy*x+xx])return;
g[yy*x+xx]=c;
for(int i=0;i<4;i++){
int d[]={0,1,0,-... | ### Prompt
Create a solution in CPP for the following problem:
The tablet interface technology, which can be operated by touching the screen with a finger, has also been applied in the field of games, and various types of games with new operability have been created. The game currently being developed by AZ is one of... |
#include <stdio.h>
#include <assert.h>
#include <vector>
#include <queue>
#include <utility>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define mp make_pair
int n, m;
char f[16][16];
int g[32][16][16];
bool completed(int (*g)[16]) {
rep (i, n) rep (j, m) if (g[i][j] != g[0][0]) retu... | ### Prompt
Develop a solution in cpp to the problem described below:
The tablet interface technology, which can be operated by touching the screen with a finger, has also been applied in the field of games, and various types of games with new operability have been created. The game currently being developed by AZ is ... |
#include <queue>
#include <string>
#include <vector>
#include <iostream>
#include <cstring>
#include <map>
#define REP(i,a,b) for(int i=(a);i<(b);++i)
#define rep(i,n) REP(i,0,n)
using namespace std;
int n, m;
int dr[] = { -1, 0, 1, 0 }, dc[] = { 0, 1, 0, -1 };
int used[12][12];
bool done(const vector<string>& v)
{
... | ### Prompt
Please formulate a CPP solution to the following problem:
The tablet interface technology, which can be operated by touching the screen with a finger, has also been applied in the field of games, and various types of games with new operability have been created. The game currently being developed by AZ is ... |
#include<iostream>
#include<queue>
using namespace std;
class state {
public:
int c[12][12];
int time;
};
int dx[4] = {0, 1, 0, -1};
int dy[4] = {1, 0, -1, 0};
int X, Y;
void DFS(state& copy,int x,int y,int oldcolor,int newcolor) {
if (copy.c[x][y] != oldcolor)
return;
else{
copy.c[x][y] = newcolor;
}
for (in... | ### Prompt
Construct a cpp code solution to the problem outlined:
The tablet interface technology, which can be operated by touching the screen with a finger, has also been applied in the field of games, and various types of games with new operability have been created. The game currently being developed by AZ is one... |
#include<iostream>
#include<queue>
#include<vector>
using namespace std;
#define rep(i,n) for(int i=0;i<n;i++)
int w, h;
void fill( vector<char> &f, char c, char ch, int x, int y ){
f[y*w+x] = ch;
if( x>0 && f[y*w+(x-1)]==c ) fill( f, c, ch, x-1, y );
if( x+1<w && f[y*w+(x+1)]==c ) fill( f, c, ch, x+1, y );
if... | ### Prompt
Your task is to create a CPP solution to the following problem:
The tablet interface technology, which can be operated by touching the screen with a finger, has also been applied in the field of games, and various types of games with new operability have been created. The game currently being developed by ... |
#include <iostream>
#include <stdio.h>
#include <sstream>
#include <string>
#include <vector>
#include <map>
#include <queue>
#include <algorithm>
#include <set>
#include <math.h>
#include <utility>
#include <stack>
#include <string.h>
#include <complex>
using namespace std;
const int INF = 1<<29;
const double EPS = 1e... | ### Prompt
Please formulate a cpp solution to the following problem:
The tablet interface technology, which can be operated by touching the screen with a finger, has also been applied in the field of games, and various types of games with new operability have been created. The game currently being developed by AZ is ... |
#include <bits/stdc++.h>
using namespace std;
int x,y;
void DFS(array<array<char,11>,11>& v,char base,char c,int xp,int yp){
if(xp < 0 || yp < 0 || xp >= x || yp >= y || v[xp][yp]!=base){
return;
}
v[xp][yp] = c;
DFS(v,base,c,xp+1,yp);
DFS(v,base,c,xp,yp+1);
DFS(v,base,c,xp-1,yp);
... | ### Prompt
Please provide a CPP coded solution to the problem described below:
The tablet interface technology, which can be operated by touching the screen with a finger, has also been applied in the field of games, and various types of games with new operability have been created. The game currently being developed... |
#include <bits/stdc++.h>
using namespace std;
typedef pair<int, string> P;
const char rgb[] = "RGB";
const int dx[] = {-1, 0, 1, 0}, dy[] = {0, -1, 0, 1};
int x, y;
bool check(string& s)
{
char start = s[0];
for (char c : s){
if (c != start) return false;
}
return true;
}
void change(string... | ### Prompt
Create a solution in CPP for the following problem:
The tablet interface technology, which can be operated by touching the screen with a finger, has also been applied in the field of games, and various types of games with new operability have been created. The game currently being developed by AZ is one of... |
#include<queue>
#include<cstdio>
#define rep(i,n) for(int i=0;i<(n);i++)
using namespace std;
const int dx[]={1,0,-1,0},dy[]={0,-1,0,1};
int h,w;
char B[10][10];
int ub;
bool dfs(int t){
bool end=true;
rep(i,h) rep(j,w) if(B[i][j]!=B[0][0]) { end=false; break; }
if(end) return true;
if(t==ub) return false;
... | ### Prompt
Please provide a cpp coded solution to the problem described below:
The tablet interface technology, which can be operated by touching the screen with a finger, has also been applied in the field of games, and various types of games with new operability have been created. The game currently being developed... |
#include<iostream>
#include<queue>
using namespace std;
int x,y;
struct grid{
char g[11][11];
int count;
};
void DFS(grid& gr,char firstcell,char changecolor,int posx,int posy){
//if(posx < 0 || posx >= x || posy < 0 || posy >= y || gr.g[posx][posy] != firstcell){
if(gr.g[posx][posy] != firstcell){
ret... | ### Prompt
Your task is to create a Cpp solution to the following problem:
The tablet interface technology, which can be operated by touching the screen with a finger, has also been applied in the field of games, and various types of games with new operability have been created. The game currently being developed by ... |
#include <queue>
#include <vector>
#include <iostream>
#include <algorithm>
using namespace std;
int H, W; char c;
int main() {
ios::sync_with_stdio(false);
while (cin >> W >> H, H | W) {
vector<vector<int> > a(H, vector<int>(W));
for (int i = 0; i < H; i++) {
for (int j = 0; j < W; j++) {
cin >> c;
if... | ### Prompt
Please create a solution in Cpp to the following problem:
The tablet interface technology, which can be operated by touching the screen with a finger, has also been applied in the field of games, and various types of games with new operability have been created. The game currently being developed by AZ is ... |
#include<bits/stdc++.h>
using namespace std;
int main(){
int n,m;
cin >> n;
while(n != 0){
char a[n+1],b[n+1];
for(int i = 0;i < n;i++) cin >> a[i] >> b[i];
cin >> m;
char ans[m+1];
for(int i = 0;i < m;i++){
cin >> ans[i];
for(int j = 0;j < n;j++){
if(ans[i] == a[j]... | ### Prompt
Please provide a CPP coded solution to the problem described below:
Create a program that converts data based on the given conversion table.
The characters used in the data are letters or numbers, and the letters are case sensitive. There is no regularity in the order of the characters that appear in the ... |
#include <iostream>
#include <string>
#define rep(i, a, b) for(int i = a; i < b; i ++)
using namespace std;
int main() {
int n, m;
char A[100], B[100], C;
while(cin >> n, n) {
rep(i, 0, 100) {
A[i] = 0;
B[i] = 0;
}
rep(i, 0, n) {
cin >> A[i] >> B[i];
}
cin >> m;
rep(i, 0, m) {
cin >> C;... | ### Prompt
Your task is to create a cpp solution to the following problem:
Create a program that converts data based on the given conversion table.
The characters used in the data are letters or numbers, and the letters are case sensitive. There is no regularity in the order of the characters that appear in the conv... |
#include <iostream>
#include <map>
#include <string>
using namespace std;
int main() {
int n, m;
while (cin >> n, n) {
char a, b;
string str;
map<char, char> to;
for (int i = 0; i < n; ++i) {
cin >> a >> b;
to[a] = b;
}
cin >> m;
for (int i = 0; i < m; ++i) {
cin >> a;
if (to[a]) a = to[a]... | ### Prompt
Your challenge is to write a CPP solution to the following problem:
Create a program that converts data based on the given conversion table.
The characters used in the data are letters or numbers, and the letters are case sensitive. There is no regularity in the order of the characters that appear in the ... |
#import<iostream>
using namespace std;
int main(){
int n, m;
char a, b;
while(cin>>n, n){
int d[256] = {};
for(int i=0;i<n;i++){
cin >> a >> b;
d[a] = b-a;
}
for(cin>>n;n--;putchar(a+d[a]))
cin>>a;
puts("");
}
} | ### Prompt
Please formulate a Cpp solution to the following problem:
Create a program that converts data based on the given conversion table.
The characters used in the data are letters or numbers, and the letters are case sensitive. There is no regularity in the order of the characters that appear in the conversion... |
#include <iostream>
using namespace std;
int main(){
while(1){
int n,m;
cin>>n;
if(n==0) break;
char map[n][2];
for(int i=0;i<n;i++){
cin>>map[i][0]>>map[i][1];
}
cin>>m;
char result[m+1];
for(int i=0;i<m;i++){
cin>>result[i];
for(int j=0;j<n;j++){
if(result[i]==map[j][0]){
result... | ### Prompt
Please provide a Cpp coded solution to the problem described below:
Create a program that converts data based on the given conversion table.
The characters used in the data are letters or numbers, and the letters are case sensitive. There is no regularity in the order of the characters that appear in the ... |
#include <cstdio>
#include <map>
using namespace std;
int main() {
int n;
while (scanf("%d", &n), n) {
map<char, char> table;
for (int i = 0; i < n; ++i) {
char from, to; scanf(" %c %c", &from, &to);
table[from] = to;
}
int m; scanf("%d", &m);
for (int i = 0; i < m; ++i){
char... | ### Prompt
Generate a CPP solution to the following problem:
Create a program that converts data based on the given conversion table.
The characters used in the data are letters or numbers, and the letters are case sensitive. There is no regularity in the order of the characters that appear in the conversion table.
... |
#include<iostream>
using namespace std;
char T[25000][2];
char S;
int main(){
int n,m;
while(true){
cin>>n;
if(n==0){
break;
}
for(int i=0;i<n;i++){
cin>>T[i][0]>>T[i][1];
}
cin>>m;
for(int i=0;i<m;i++){
cin>>S;
for(int j=0;j<n;j++){
if(T[j][0]==S){
cout<<T[j][1];
goto Exit;
}
}
cout<<S;
Exit:;
}
cout<<endl;
}
} | ### Prompt
Please formulate a Cpp solution to the following problem:
Create a program that converts data based on the given conversion table.
The characters used in the data are letters or numbers, and the letters are case sensitive. There is no regularity in the order of the characters that appear in the conversion... |
#include <cstdio>
int main() {
int n;
while (scanf("%d", &n) != EOF && n) {
char C[200];
for (auto i=0; i<200; i++) {
C[i] = (char)i;
}
for (auto i=0; i<n; i++) {
char a, b;
scanf(" %c %c", &a, &b);
C[(int)a] = b;
}
int m;
scanf("%d", &m);
for (auto j=0; j<m;... | ### Prompt
Construct a cpp code solution to the problem outlined:
Create a program that converts data based on the given conversion table.
The characters used in the data are letters or numbers, and the letters are case sensitive. There is no regularity in the order of the characters that appear in the conversion ta... |
#include<bits/stdc++.h>
using namespace std;
int main(){
int a;
while(cin>>a,a){
map<string,string>s;
for(int b=0;b<a;b++){
string c,k;
cin>>c>>k;
s.insert(pair<string,string>(c,k));
}
int d;
cin>>d;
string r="";
for(int e=0;e<d;e++){
string t;
cin>>t;
if(s[t].empty()==true)s[t]=t;;
r+=s[t];
}
cout<<r... | ### Prompt
Please create a solution in cpp to the following problem:
Create a program that converts data based on the given conversion table.
The characters used in the data are letters or numbers, and the letters are case sensitive. There is no regularity in the order of the characters that appear in the conversion... |
#include<iostream>
using namespace std;
int main() {
int n, m;
char data[100][2], str[100000];
while (cin >> n && n) {
for (int i = 0; i < n; ++i) cin >> data[i][0] >> data[i][1];
cin >> m;
for (int i = 0; i < m; ++i) {
cin >> str[i];
for (int j = 0; j < n; ++j) {
if (str[i] == data[j][0]) {
str... | ### Prompt
Construct a CPP code solution to the problem outlined:
Create a program that converts data based on the given conversion table.
The characters used in the data are letters or numbers, and the letters are case sensitive. There is no regularity in the order of the characters that appear in the conversion ta... |
#include <iostream>
#include <map>
using namespace std;
int main()
{
int n,m;
char c;
pair<char,char> data[10000];
while(true){
cin>>n;
if(!n)break;
for(int i=0;i<n;i++)cin>>data[i].first>>data[i].second;
cin>>m;
for(int i=0;i<m;i++){
cin>>c;
for(int j=0;j<n;j++)if(data[j].first==c){c=data[j].sec... | ### Prompt
Construct a Cpp code solution to the problem outlined:
Create a program that converts data based on the given conversion table.
The characters used in the data are letters or numbers, and the letters are case sensitive. There is no regularity in the order of the characters that appear in the conversion ta... |
#include <iostream>
#include <string>
using namespace std;
int main(void){
int n, m;
cin >> n;
while(n){
char henkan[100][2];
for(int i = 0; i < n; i++)
cin >> henkan[i][0] >> henkan[i][1];
cin >> m;
char data;
string moji;
for(int i = 0; i < m; i++){
cin >> data;
for(int j = 0; j < n; j++){
... | ### Prompt
Please formulate a cpp solution to the following problem:
Create a program that converts data based on the given conversion table.
The characters used in the data are letters or numbers, and the letters are case sensitive. There is no regularity in the order of the characters that appear in the conversion... |
#include<iostream>
#include<map>
using namespace std;
int main(){
int n;
map<char,char>mp;
while(cin >> n,n){
for(int i=0;i<n;i++){
char a, b;
cin >> a >> b;
mp[a] = b;
}
int m;
cin >> m;
for(int i=0;i<m;i++){
char a;
cin >> a;
if(mp.find(a)!=mp.end()) cout ... | ### Prompt
Your challenge is to write a CPP solution to the following problem:
Create a program that converts data based on the given conversion table.
The characters used in the data are letters or numbers, and the letters are case sensitive. There is no regularity in the order of the characters that appear in the ... |
#include<iostream>
#include<map>
#include<string>
#include<cstdio>
using namespace std;
int main(){
long int n;
string x,y,z;
while(cin >> n, n){
long int m;
map < string,string > a;
for(int i=0;i<n;i++){
cin >> x >> y;
a[x] = y;
}
cin >> m;
for(int i=0;i<m;i++){
ci... | ### Prompt
In cpp, your task is to solve the following problem:
Create a program that converts data based on the given conversion table.
The characters used in the data are letters or numbers, and the letters are case sensitive. There is no regularity in the order of the characters that appear in the conversion tabl... |
#include <iostream>
#include <vector>
using namespace std;
int main(){
int a,b,i,j;
while(1){
cin>>a;
if(a==0) break;
vector<char>from(a);
vector<char>to(a);
for(i=0;i<a;i++){
cin>>from[i]>>to[i];
}
cin>>b;
vector<char>v(b);
for(i=0;i<b;i++){
cin>>v[i];
for(j=0;j<a;j++){
if(v[i]=... | ### Prompt
Your task is to create a Cpp solution to the following problem:
Create a program that converts data based on the given conversion table.
The characters used in the data are letters or numbers, and the letters are case sensitive. There is no regularity in the order of the characters that appear in the conv... |
#include<stdio.h>
int main(void)
{
int i,j,n,m;
char s[100],t[100];
char a;
scanf("%d",&n);
while (n!=0) {
for (i=0;i<n;i++) {
scanf(" %c %c",&s[i],&t[i]);
}
scanf("%d",&m);
for (i=0;i<m;i++) {
scanf(" %c",&a);
for (j=0;j<n;j++) {
if(a == s[j]) {
a=t[j];
break;
}
}
printf(... | ### Prompt
Develop a solution in cpp to the problem described below:
Create a program that converts data based on the given conversion table.
The characters used in the data are letters or numbers, and the letters are case sensitive. There is no regularity in the order of the characters that appear in the conversion... |
#include <iostream>
using namespace std;
char conv[128];
void make() {
for(int i = 0; i < 128; ++i) conv[i] = i;
}
int main() {
int n, m;
while((cin >> n) && n) {
make();
for(int i = 0; i < n; ++i) {
char a, b;
cin >> a >> b;
conv[a] = b;
}
cin >> m;
for(int i = 0; i < m; ... | ### Prompt
Please provide a CPP coded solution to the problem described below:
Create a program that converts data based on the given conversion table.
The characters used in the data are letters or numbers, and the letters are case sensitive. There is no regularity in the order of the characters that appear in the ... |
#include<bits/stdc++.h>
using namespace std;
int N;
void solve(){
map<char,char>M;
while(N--){
char from,to;
scanf(" %c %c",&from,&to);
M[from]=to;
}
int K;
scanf("%d",&K);
while(K--){
char c;
scanf(" %c",&c);
if(M.find(c)!=M.end())printf("%c",M... | ### Prompt
Create a solution in cpp for the following problem:
Create a program that converts data based on the given conversion table.
The characters used in the data are letters or numbers, and the letters are case sensitive. There is no regularity in the order of the characters that appear in the conversion table... |
#include<stdio.h>
#include<string.h>
int n,m;
int i,j;
char a,b,c;
char list[1000];
int main(){
while(1){
scanf("%d",&n);
if(n==0)return 0;
for(i=0;i<1000;i++)list[i]=i;
for(i=0;i<n;i++){
scanf(" %c %c",&a,&b);
list[a]=b;
}
scanf("%d",&m);
for(i=0;i<m;i++){
scanf(" %c",&c);
printf("%c",list[... | ### Prompt
Construct a CPP code solution to the problem outlined:
Create a program that converts data based on the given conversion table.
The characters used in the data are letters or numbers, and the letters are case sensitive. There is no regularity in the order of the characters that appear in the conversion ta... |
#include <iostream>
#include <string>
using namespace std;
int main()
{
int n;
char t[100], a[100];
while (cin >> n, n){
for (int i = 0; i < n; i++){
cin >> t[i] >> a[i];
}
int m;
string s;
cin >> m;
for (int i = 0; i < m; i++){
char c;
cin >> c;
for (int j = 0; j < n; j++){
if... | ### Prompt
Your challenge is to write a Cpp solution to the following problem:
Create a program that converts data based on the given conversion table.
The characters used in the data are letters or numbers, and the letters are case sensitive. There is no regularity in the order of the characters that appear in the ... |
#include<stdio.h>
#include<map>
int main()
{
int n;
char s[8];
while(scanf("%d",&n),n)
{
std::map<char,char>m;
fgets(s,8,stdin);
while(n--) fgets(s,8,stdin),m[s[0]]=s[2];
scanf("%d",&n);
while(n--) scanf("%s",s),putchar(m.find(s[0])==m.end()?s[0]:m[s[0]]);
puts("");
}
return 0;
} | ### Prompt
In CPP, your task is to solve the following problem:
Create a program that converts data based on the given conversion table.
The characters used in the data are letters or numbers, and the letters are case sensitive. There is no regularity in the order of the characters that appear in the conversion tabl... |
#include<stdio.h>
int main(){
int c[256];
int a;
while(1){
scanf("%d",&a);
if(a==0)return 0;
for(int i=0;i<256;i++)c[i]=i;
getchar();
getchar();
for(int i=0;i<a;i++){
char b,d;
b=getchar();
getchar();
d=getchar();
getchar();
getchar();
c[b]=d;
}
int e;
scanf("%d",&e);
getcha... | ### Prompt
Generate a CPP solution to the following problem:
Create a program that converts data based on the given conversion table.
The characters used in the data are letters or numbers, and the letters are case sensitive. There is no regularity in the order of the characters that appear in the conversion table.
... |
#include <stdio.h>
int main(void) {
char table[100000][2];
long int n,m,i,c;
char buf;
while(scanf("%ld",&n)){
if(n == 0)break;
for(i = 0; n > i; i++){
getchar();
scanf("%c",&table[i][0]);
getchar();
scanf("%c",&table[i][1]);
}
scanf("%ld",&m);
for(i = 0; m > i; i++){
getchar();
scanf("... | ### Prompt
In cpp, your task is to solve the following problem:
Create a program that converts data based on the given conversion table.
The characters used in the data are letters or numbers, and the letters are case sensitive. There is no regularity in the order of the characters that appear in the conversion tabl... |
#include <iostream>
#include <cstring>
using namespace std;
int main()
{
int n,m;
int henkan[256];
while(cin>>n,n){
memset(henkan,0,sizeof(henkan));
while(n--){
char a,b; cin>>a>>b;
henkan[(int)a] = b;
}
cin>>m;
while(m--){
char a; cin>>a;
printf("%c",henkan[(int)a]?:a);
}
puts("");
}
ret... | ### Prompt
In Cpp, your task is to solve the following problem:
Create a program that converts data based on the given conversion table.
The characters used in the data are letters or numbers, and the letters are case sensitive. There is no regularity in the order of the characters that appear in the conversion tabl... |
#include <cstdio>
#include <cstring>
int n, m; char e[261], f, g;
int main() {
while(scanf("%d\n", &n), n) {
for(int i = 0; i < 256; i++) e[i] = i;
for(int i = 0; i < n; i++) scanf("%c %c\n", &f, &g), e[f] = g;
scanf("%d\n", &m);
for(int i = 0; i < m; i++) scanf("%c\n", &f), printf("%c", e[f]);
printf("\n");... | ### Prompt
Generate a Cpp solution to the following problem:
Create a program that converts data based on the given conversion table.
The characters used in the data are letters or numbers, and the letters are case sensitive. There is no regularity in the order of the characters that appear in the conversion table.
... |
#include <bits/stdc++.h>
using namespace std;
int n, q;
int main() {
while(cin >> n, n) {
map<char, char> conversion;
for(int i = 0; i < 128; i++) conversion[i] = i;
string c, d;
while(n--) cin >> c >> d, conversion[c[0]] = d[0];
cin >> q;
while(q--) cin >> c, cout <<... | ### Prompt
Please provide a Cpp coded solution to the problem described below:
Create a program that converts data based on the given conversion table.
The characters used in the data are letters or numbers, and the letters are case sensitive. There is no regularity in the order of the characters that appear in the ... |
#include <iostream>
#include <algorithm>
#include <cassert>
#include <cctype>
#include <cstdio>
#include <math.h>
#include <map>
#include <queue>
#include <string>
using namespace std;
int n,m;
char a,b;
int main(){
while(cin>>n){
if(n==0)return 0;
map<char,char> table;
for(int i=0;i<n;i++){
cin>>a>>b;
t... | ### Prompt
In cpp, your task is to solve the following problem:
Create a program that converts data based on the given conversion table.
The characters used in the data are letters or numbers, and the letters are case sensitive. There is no regularity in the order of the characters that appear in the conversion tabl... |
#include<iostream>
using namespace std;
int main(){
int time;
char word;
while(cin>>time&&time!=0){
char henkan[128]={0};
char hena,henb;
for(int i=0;i<time;++i){
cin>>hena>>henb;
henkan[hena]=henb;
}
cin>>time;
for(int i=0;i<time;++i){
cin>>word;
if(henkan[word]!=0){
cout<<(char)henkan[w... | ### Prompt
Please create a solution in Cpp to the following problem:
Create a program that converts data based on the given conversion table.
The characters used in the data are letters or numbers, and the letters are case sensitive. There is no regularity in the order of the characters that appear in the conversion... |
#include<iostream>
using namespace std;
int main(){
while(1){
char d;
char ans[101000];
char f[1010000],g[101000];
int n;
cin>>n;
if(n==0)break;
for(int i=0;i<n;i++){
cin>>d;
f[i]=d;
cin>>d;
g[i]=d;
}
int s;
cin>>s;
for(int i=0;i<s;i++){
cin>>d;
ans[i]=d;
for(int j=0;j<n;j++)... | ### Prompt
Develop a solution in cpp to the problem described below:
Create a program that converts data based on the given conversion table.
The characters used in the data are letters or numbers, and the letters are case sensitive. There is no regularity in the order of the characters that appear in the conversion... |
#include<bits/stdc++.h>
using namespace std;
int main(){
int n;
map<char,char> s;
while(1){
cin>>n;
if(n==0) break;
s.clear();
for(int i=0;i<n;i++){
char a,b;
cin>>a>>b;
s[a]=b;
}
int m;
cin>>m;
for(int i=0;i<m;i++){
char a;
cin>>a;
if(s.count(a)... | ### Prompt
Your task is to create a CPP solution to the following problem:
Create a program that converts data based on the given conversion table.
The characters used in the data are letters or numbers, and the letters are case sensitive. There is no regularity in the order of the characters that appear in the conv... |
#include <iostream>
using namespace std;
int main(){
int n;
cin >> n;
do{
char a[256],b[256];
for(int i=0; i<n; i++){
cin >> a[i] >> b[i];
}
int num;
char s;
cin >> num;
for(int i=0; i<num; i++){
cin >> s;
for(int j=0; j<n; j++){
if(s==a[j]){
s=b[j];
break;
}
}
cout <... | ### Prompt
Generate a CPP solution to the following problem:
Create a program that converts data based on the given conversion table.
The characters used in the data are letters or numbers, and the letters are case sensitive. There is no regularity in the order of the characters that appear in the conversion table.
... |
#include<bits/stdc++.h>
using namespace std;
int main(){
map<char,char>maps;
int n,m;
char a,b;
while(1){
for(int i=0;i<26;i++){
maps['A'+i]='A'+i;
maps['a'+i]='a'+i;
}
for(int i=0;i<10;i++){
maps['0'+i]='0'+i;
}
cin>>n;
if(!n)break;
while(n--){
cin>>a>>b;
maps[a]=b;
}
cin... | ### Prompt
In cpp, your task is to solve the following problem:
Create a program that converts data based on the given conversion table.
The characters used in the data are letters or numbers, and the letters are case sensitive. There is no regularity in the order of the characters that appear in the conversion tabl... |
#include <iostream>
#include <algorithm>
using namespace std;
int main(){
int n;
while(cin >> n, n){
char t[128];
fill(t, t + 128, -1);
for(int i = 0; i < n; i++){
char a, b;
cin >> a >> b;
t[a] = b;
}
int m;
cin >> m;
for(int i = 0; i < m; i++){
char ch;
... | ### Prompt
Create a solution in CPP for the following problem:
Create a program that converts data based on the given conversion table.
The characters used in the data are letters or numbers, and the letters are case sensitive. There is no regularity in the order of the characters that appear in the conversion table... |
#include<iostream>
#include<string>
using namespace std;
int main(){
int n,m;
while(cin >> n&&n!=0){
char conv[n][2];
for(int i=0;i<n;i++){
cin >> conv[i][0] >> conv[i][1];
}
cin >> m;
char inp[m];
for(int i=0;i<m;i++){
cin >> inp[i];
for(int j=0;j<n;j++){
if(inp... | ### Prompt
Generate a cpp solution to the following problem:
Create a program that converts data based on the given conversion table.
The characters used in the data are letters or numbers, and the letters are case sensitive. There is no regularity in the order of the characters that appear in the conversion table.
... |
#include<iostream>
#include<map>
using namespace std;
int main(){
int n;
char a,b;
map<char,char> list;
map<char,char>::iterator it;
while(1){
cin>>n;
if(n==0)break;
for(int i=0;i<n;i++){
cin>>a>>b;
list.insert(pair<char,char>(a,b));
}
cin>>n;
for(int i=0;i<n;i++){
cin>>a;
it=list.find(a);... | ### Prompt
Construct a Cpp code solution to the problem outlined:
Create a program that converts data based on the given conversion table.
The characters used in the data are letters or numbers, and the letters are case sensitive. There is no regularity in the order of the characters that appear in the conversion ta... |
#include<iostream>
using namespace std;
int main(){
int i,j;
int n,m;
cin>>n;
while(n!=0){
char t[n][2];
for(i=0;i<n;i++)
cin>>t[i][0]>>t[i][1];
cin>>m;
char ans[m+1];
for(i=0;i<m;i++){
cin>>ans[i];
for(j=0;j<n;j++){
if(t[j][0]==ans[i]){
ans[i]=t[j][1];
brea... | ### Prompt
Your task is to create a Cpp solution to the following problem:
Create a program that converts data based on the given conversion table.
The characters used in the data are letters or numbers, and the letters are case sensitive. There is no regularity in the order of the characters that appear in the conv... |
#include <bits/stdc++.h>
using namespace std;
int N;
char m;
void solve(){
int M;
map<char, char> changer;
char f, t;
for (int i = 0; i < N; i++){
cin >> f;
cin >> t;
changer[f] = t;
}
cin >> M;
for (int i = 0; i < M; i++){
cin >> m;
if (changer.find(m) != changer.end()) cout << cha... | ### Prompt
Your challenge is to write a Cpp solution to the following problem:
Create a program that converts data based on the given conversion table.
The characters used in the data are letters or numbers, and the letters are case sensitive. There is no regularity in the order of the characters that appear in the ... |
#include <iostream>
using namespace std;
int main() {
int n,i;
char c[75]={};
char d[75]={};
char a,b;
for(int i=0; i<75 ;i++){
d[ i ]='0'+i;
}
while( true ){
cin >> n;
if( n == 0 ){
return 0;
}
for(int i=0; i<75 ;i++){
c[ i ]=d[i];
}
for( int i=0;i<n;i++){
cin >> a >> b;
c[a - '0' ... | ### Prompt
Please provide a CPP coded solution to the problem described below:
Create a program that converts data based on the given conversion table.
The characters used in the data are letters or numbers, and the letters are case sensitive. There is no regularity in the order of the characters that appear in the ... |
#include <cstdio>
int main(){
char d[3],key[3],val[3],table[256];
int n,m,i;
scanf("%d",&n);
while(n>0){
for(i=0;i<256;i++) table[i]=i;
for(i=0;i<n;i++){
scanf("%s %s",key,val);
table[key[0]]=val[0];
};
scanf("%d",&m);
for(i=0;i<m;i++){
scanf("%s",d);
printf("%c",tab... | ### Prompt
Please formulate a cpp solution to the following problem:
Create a program that converts data based on the given conversion table.
The characters used in the data are letters or numbers, and the letters are case sensitive. There is no regularity in the order of the characters that appear in the conversion... |
#include <iostream>
#include <string>
using namespace std;
int main() {
int n,m,i,j,t[128]={};
char a,b;
string s;
while(cin>>n,n){
s="";
for(i=0;i<128;++i)t[i]=i;
for(i=0;i<n;++i){
cin>>a>>b;
t[a]=b;
}
cin>>m;
for(i=0;i<m;++i){
cin>>a;
s+=(char)t[a];
}
cout<<s<<endl;
}
} | ### Prompt
Create a solution in Cpp for the following problem:
Create a program that converts data based on the given conversion table.
The characters used in the data are letters or numbers, and the letters are case sensitive. There is no regularity in the order of the characters that appear in the conversion table... |
#include <cstdio>
#include <algorithm>
using namespace std;
int n, m;
char cv[256], ch, ch2;
int main(){
while(scanf("%d\n", &n), n != 0) {
fill(cv, cv + 256, 0);
for (int i = 0; i < n; i++) {
scanf("%c %c\n", &ch, &ch2);
cv[ch] = ch2;
}
scanf("%d\n", &m);
for (int i = 0; i < m; i++) {
scanf("%c\... | ### Prompt
Please formulate a CPP solution to the following problem:
Create a program that converts data based on the given conversion table.
The characters used in the data are letters or numbers, and the letters are case sensitive. There is no regularity in the order of the characters that appear in the conversion... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.