output stringlengths 52 181k | instruction stringlengths 296 182k |
|---|---|
#include <bits/stdc++.h>
class Solve {
private:
std::string inputStr;
int64_t calcAdd(int& s_i)
{
int64_t ret{calcMulti(s_i)};
while (inputStr[s_i] == '+' || inputStr[s_i] == '-')
{
char ope{inputStr[s_i]};
s_i++;
if (ope == '+') ret += calcMulti(s_i);
else ret -= calcMulti(s_i);
}
return ret... | ### Prompt
Generate a CPP solution to the following problem:
Your task is to write a program which reads an expression and evaluates it.
* The expression consists of numerical values, operators and parentheses, and the ends with '='.
* The operators includes +, - , *, / where respectively represents, addition, subtr... |
#include <bits/stdc++.h>
#define REP(i,n) for(int i=0;i<(int)(n);i++)
using namespace std;
pair<int64_t,int> expr(const string &s, int i);
pair<int64_t,int> num(const string &s, int i) {
int64_t v = 0;
while(i < s.size() && ('0' <= s[i] && s[i] <= '9')) {
v *= 10;
v += s[i] - '0';
++i;
}
return m... | ### Prompt
In cpp, your task is to solve the following problem:
Your task is to write a program which reads an expression and evaluates it.
* The expression consists of numerical values, operators and parentheses, and the ends with '='.
* The operators includes +, - , *, / where respectively represents, addition, su... |
/*
<expr> ::= <term> [ ('+'|'-') <term> ]*
<term> ::= <factor> [ ('*'|'/') <factor> ]*
<factor> ::= <number> | '(' <expr> ')'
<number> :== 1つ以上の数字
*/
#include <iostream>
#include <stdio.h>
#include <vector>
#include <string>
#include <algorithm>
using namespace std;
int expr(string& s, int& i);
int term(string& ... | ### Prompt
Generate a Cpp solution to the following problem:
Your task is to write a program which reads an expression and evaluates it.
* The expression consists of numerical values, operators and parentheses, and the ends with '='.
* The operators includes +, - , *, / where respectively represents, addition, subtr... |
#include<iostream>
#include<cassert>
using namespace std;
string s;
size_t cur=0;
int digit()
{
assert(isdigit(s[cur]));
int n=s[cur]-'0';
cur=cur+1;
return n;
};
int number()
{
int n=digit();
while(cur<s.size()&&isdigit(s[cur]))
n=n*10+digit();
return n;
};
double expression();
doub... | ### Prompt
Create a solution in cpp for the following problem:
Your task is to write a program which reads an expression and evaluates it.
* The expression consists of numerical values, operators and parentheses, and the ends with '='.
* The operators includes +, - , *, / where respectively represents, addition, sub... |
#include <cstdio>
#include <cassert>
#include <algorithm>
using namespace std;
char *pt;
int parseAtom();
int parseExpr();
int parseTerm();
int parseAtom() {
if('0' <= *pt && *pt <= '9') {
int x = *pt-'0';
pt++;
while('0' <= *pt && *pt <= '9') {
x = x*10 + *pt-'0';
pt++;
}
return x;
... | ### Prompt
Construct a Cpp code solution to the problem outlined:
Your task is to write a program which reads an expression and evaluates it.
* The expression consists of numerical values, operators and parentheses, and the ends with '='.
* The operators includes +, - , *, / where respectively represents, addition, ... |
#include <iostream>
#include <cctype>
#include <string>
using namespace std;
string S;
int cur = 0;
int digit() {
return S[cur++] - '0';
}
int number() {
int n = digit();
while(cur < S.size() && isdigit(S[cur])) n = n * 10 + digit();
return n;
}
int expression();
int factor() {
if(S[cur] != '(') return n... | ### Prompt
Create a solution in CPP for the following problem:
Your task is to write a program which reads an expression and evaluates it.
* The expression consists of numerical values, operators and parentheses, and the ends with '='.
* The operators includes +, - , *, / where respectively represents, addition, sub... |
#include<iostream>
#include<cctype>
#include<cassert>
using namespace std;
string s;
int cur;
int factor();
char readchar(){
assert(cur <s.size());
char ret =s[cur];
cur += 1;
return ret;
}
char peak(){
assert(cur<s.size());
return s[cur];
}
int digit(){
assert(isdigit(peak()));
int n = readchar() ... | ### Prompt
Your task is to create a Cpp solution to the following problem:
Your task is to write a program which reads an expression and evaluates it.
* The expression consists of numerical values, operators and parentheses, and the ends with '='.
* The operators includes +, - , *, / where respectively represents, a... |
#include <iostream>
#include <string>
#include <cstdlib>
using namespace std;
int p;
int exp(string str);
int term(string str);
int fact(string str);
int exp(string str)
{
int val = term(str);
while(str[p] == '+' || str[p] == '-'){
if(str[p++] == '+'){
val += term(str);
} else {
val -= term(str);
}
}
... | ### Prompt
Your challenge is to write a CPP solution to the following problem:
Your task is to write a program which reads an expression and evaluates it.
* The expression consists of numerical values, operators and parentheses, and the ends with '='.
* The operators includes +, - , *, / where respectively represent... |
#include <cstring>
#include <cctype>
#include <iostream>
#include <cstdio>
using namespace std;
int exp(char* & p);
int num(char* & p) {
int ret = 0;
while (isdigit(*p)) {
ret *= 10;
ret += *p - '0';
p++;
}
return ret;
}
int fac(char* & p) {
int ret = 0;
if (*p == '(')... | ### Prompt
Create a solution in CPP for the following problem:
Your task is to write a program which reads an expression and evaluates it.
* The expression consists of numerical values, operators and parentheses, and the ends with '='.
* The operators includes +, - , *, / where respectively represents, addition, sub... |
#include<string>
#include<iostream>
#include<cctype>
using namespace std;
typedef string::const_iterator State;
int number(State &begin) {
int ans = 0;
bool flag = false;
if (*begin == '-') flag = true, begin++;
while (isdigit(*begin)) ans = ans * 10 + (*begin - '0'), begin++;
if (flag) ans = -ans;
return ... | ### Prompt
Please provide a Cpp coded solution to the problem described below:
Your task is to write a program which reads an expression and evaluates it.
* The expression consists of numerical values, operators and parentheses, and the ends with '='.
* The operators includes +, - , *, / where respectively represent... |
#include<iostream>
#include<string>
using namespace std;
int expression();
int term();
int factor();
string exp;
int p;
int expression(){
int value = term();
while( exp[p] == '+' || exp[p] == '-' ){
if ( exp[p] == '+' ) { p++; value += term(); }
else { p++; value -= term(); }
... | ### Prompt
Your task is to create a cpp solution to the following problem:
Your task is to write a program which reads an expression and evaluates it.
* The expression consists of numerical values, operators and parentheses, and the ends with '='.
* The operators includes +, - , *, / where respectively represents, a... |
#include <iostream>
#include <cctype>
using namespace std;
typedef string::const_iterator State;
int number(State &begin);
int factor(State &begin);
int term(State &begin);
int expression(State &begin);
int main(void){
int N;
cin >> N;
cin.ignore();
for(int i = 0; i < N; i++){
string Expression;
getli... | ### Prompt
Construct a cpp code solution to the problem outlined:
Your task is to write a program which reads an expression and evaluates it.
* The expression consists of numerical values, operators and parentheses, and the ends with '='.
* The operators includes +, - , *, / where respectively represents, addition, ... |
#include <iostream>
#include <string>
#include <cctype>
using namespace std;
int expr(string& s, int& i);
int term(string& s, int& i);
int factor(string& s, int& i);
int number(string& s, int& i);
int expr(string& s, int& i) {
int val = term(s, i);
while(s[i] == '+' || s[i] == '-') {
char op = s[i];
... | ### Prompt
Please provide a CPP coded solution to the problem described below:
Your task is to write a program which reads an expression and evaluates it.
* The expression consists of numerical values, operators and parentheses, and the ends with '='.
* The operators includes +, - , *, / where respectively represent... |
#include <string>
#include<cctype>
#include<cstdio>
using namespace std;
typedef string::const_iterator State;
class ParseError {};
int expression(State &begin);
int number(State &begin){
int ret=0;
while(isdigit(*begin)){
ret*=10;
ret+=*begin-'0';
begin++;
}
return ret;
}
int factor(State &beg... | ### Prompt
Develop a solution in CPP to the problem described below:
Your task is to write a program which reads an expression and evaluates it.
* The expression consists of numerical values, operators and parentheses, and the ends with '='.
* The operators includes +, - , *, / where respectively represents, additio... |
#include<bits/stdc++.h>
using namespace std;
using Int = long long;
//BEGIN CUT HERE
int expression(string,int&);
int term(string,int&);
int factor(string,int&);
int number(string,int&);
bool f;
int expression(string s,int& p){
int res=term(s,p);
while(p<(int)s.size()){
if(s[p]=='+'){
p++;
res+=te... | ### Prompt
Your challenge is to write a Cpp solution to the following problem:
Your task is to write a program which reads an expression and evaluates it.
* The expression consists of numerical values, operators and parentheses, and the ends with '='.
* The operators includes +, - , *, / where respectively represent... |
#include <iostream>
#include <string>
using namespace std;
int p;
string str;
int Term();
int Factor();
int Elem();
int Digit();
int Term() {
int a = Factor();
while (str[p] == '+' || str[p] == '-') {
char c = str[p];
p++; // read [+-]
int b = Factor();
if (c == '+') {
a = a + b;
} else... | ### Prompt
Please provide a cpp coded solution to the problem described below:
Your task is to write a program which reads an expression and evaluates it.
* The expression consists of numerical values, operators and parentheses, and the ends with '='.
* The operators includes +, - , *, / where respectively represent... |
#include <iostream>
#include <string>
using namespace std;
string str;
int p;
int exp();
int factor();
int term();
int factor() {
int num=0;
while('0' <= str[p] && str[p] <= '9') {
num*=10;
num += str[p] - '0';
p++;
}
// cout <<"one"<< num << endl;
if(num != 0) return num;
else if (str[p] =... | ### Prompt
Please create a solution in cpp to the following problem:
Your task is to write a program which reads an expression and evaluates it.
* The expression consists of numerical values, operators and parentheses, and the ends with '='.
* The operators includes +, - , *, / where respectively represents, additio... |
#include <iostream>
#include <algorithm>
#include <cassert>
#include <cctype>
#include <cstdio>
#include <math.h>
#include <map>
#include <queue>
#include <string>
using namespace std;
typedef long long ll;
string S;
size_t cur=0;
int parse();
int digit(){
assert(isdigit(S[cur]));
int n=S[cur]-'0';
cur++... | ### Prompt
Generate a CPP solution to the following problem:
Your task is to write a program which reads an expression and evaluates it.
* The expression consists of numerical values, operators and parentheses, and the ends with '='.
* The operators includes +, - , *, / where respectively represents, addition, subtr... |
#include<iostream>
#include<string>
#include<cassert>
#include<cctype>
#include<stdio.h>
using namespace std;
string S="4*(8+4+3)";
size_t cur=0;
int expression(); //????????£?¨?
//??°????????\???
int digit(){
assert(isdigit(S[cur]));
int n=S[cur++]-'0';
return n;
}
//??°?????\???
int number(){
int n= digit();... | ### Prompt
Construct a Cpp code solution to the problem outlined:
Your task is to write a program which reads an expression and evaluates it.
* The expression consists of numerical values, operators and parentheses, and the ends with '='.
* The operators includes +, - , *, / where respectively represents, addition, ... |
#include<iostream>
#include<vector>
#include<algorithm>
#include<cassert>
using namespace std;
#define INF (1<<24)
bool isNum(char ch){return ('0'<=ch&&ch<='9');}
struct calcStr{
string s;
int pos,len;
void init(){ pos=0;len=s.size();}
int head2Num(){
if(s[pos]=='('){pos++;return getAns();}
boo... | ### Prompt
In CPP, your task is to solve the following problem:
Your task is to write a program which reads an expression and evaluates it.
* The expression consists of numerical values, operators and parentheses, and the ends with '='.
* The operators includes +, - , *, / where respectively represents, addition, su... |
#include <iostream>
#include <vector>
#include <queue>
#include <string>
#include <algorithm>
#include <utility>
#include <cstring>
#include <cassert>
using namespace std;
#define REP(var, count) for(int var=0; var<count; var++)
const char op[] = "()*/+-=N";
string line;
int cur;
char readchar() {
return line[cur... | ### Prompt
Your task is to create a cpp solution to the following problem:
Your task is to write a program which reads an expression and evaluates it.
* The expression consists of numerical values, operators and parentheses, and the ends with '='.
* The operators includes +, - , *, / where respectively represents, a... |
#include <bits/stdc++.h>
using namespace std;
typedef string::const_iterator State;
int number(State &begin);
int factor(State &begin);
int term(State &begin);
int expression(State &begin);
int expression(State &begin) {
int ret = term(begin);
for (;;) {
if (*begin == '+') {
begin++;
ret += term... | ### Prompt
Develop a solution in CPP to the problem described below:
Your task is to write a program which reads an expression and evaluates it.
* The expression consists of numerical values, operators and parentheses, and the ends with '='.
* The operators includes +, - , *, / where respectively represents, additio... |
#include <string>
#include <iostream>
#include <cctype>
using namespace std;
int exp(const string& s, int& p);
int term(const string& s, int& p);
int fact(const string& s, int& p);
int number(const string& s, int& p);
int main()
{
int n;
while (cin >> n) {
for (int i = 0; i < n; ++i) {
string s;
c... | ### Prompt
Please formulate a CPP solution to the following problem:
Your task is to write a program which reads an expression and evaluates it.
* The expression consists of numerical values, operators and parentheses, and the ends with '='.
* The operators includes +, - , *, / where respectively represents, additio... |
#include <cstdio>
#include <iostream>
#include <string>
using namespace std;
string str;
int pos;
int exp(void);
int term(void);
int factor(void);
int main(){
int i,j,n,ans;
cin >> n;
for(i=0;i<n;i++){
cin >> str;
str.erase(str.size()-1);
pos = 0;
ans = exp();
cout << ans << endl;
str.cl... | ### Prompt
Please provide a Cpp coded solution to the problem described below:
Your task is to write a program which reads an expression and evaluates it.
* The expression consists of numerical values, operators and parentheses, and the ends with '='.
* The operators includes +, - , *, / where respectively represent... |
#include<stdio.h>
#include<algorithm>
#include<string>
using namespace std;
char str[200];
pair<int,int>ad(int a);
pair<int,int>mul(int a);
pair<int,int>fact(int a);
pair<int,int>ad(int a){
pair<int,int> res=mul(a);
while(str[res.second]=='+'||str[res.second]=='-'){
pair<int,int>v=mul(res.second+1);
if(str[res.se... | ### Prompt
Your task is to create a Cpp solution to the following problem:
Your task is to write a program which reads an expression and evaluates it.
* The expression consists of numerical values, operators and parentheses, and the ends with '='.
* The operators includes +, - , *, / where respectively represents, a... |
#include <iostream>
#include <cassert>
#include <cctype>
using namespace std;
string S;
size_t cur;
int parse();
int expression();
int digit(){
assert(isdigit(S[cur]));
int n = S[cur] - '0';
cur++;
return n;
}
int number(){
int n = digit();
while(cur < S.size() && isdigit(S[cur])){
n = n * 10 + digi... | ### Prompt
Develop a solution in cpp to the problem described below:
Your task is to write a program which reads an expression and evaluates it.
* The expression consists of numerical values, operators and parentheses, and the ends with '='.
* The operators includes +, - , *, / where respectively represents, additio... |
#include<iostream>
#include<string>
#include<ctype.h>
std::string s;
std::string::iterator it;
int term();
int fact();
// ?¨????
int expr()
{
int p = term();
// + or -
while( *it == '+' || *it == '-' ){
if( *it == '+' ){
it++;
int q = term();
p += q;
... | ### Prompt
Develop a solution in Cpp to the problem described below:
Your task is to write a program which reads an expression and evaluates it.
* The expression consists of numerical values, operators and parentheses, and the ends with '='.
* The operators includes +, - , *, / where respectively represents, additio... |
#include<iostream>
#include<iomanip>
#include<math.h>
#include<algorithm>
#include<string>
#include<vector>
#include<queue>
#include<stack>
#include<set>
#include<map>
#define REP(i, N) for(ll i = 0; i < N; ++i)
#define FOR(i, a, b) for(ll i = a; i < b; ++i)
#define ALL(a) (a).begin(),(a).end()
#define pb push_back
#de... | ### Prompt
Your task is to create a cpp solution to the following problem:
Your task is to write a program which reads an expression and evaluates it.
* The expression consists of numerical values, operators and parentheses, and the ends with '='.
* The operators includes +, - , *, / where respectively represents, a... |
#include <iostream>
#include <cstdio>
#include <cctype>
#include <cassert>
using namespace std;
string S;
size_t cur = 0;
bool isdigit(char a){
if(a =='0' or a=='1' or a=='2' or a=='3' or a=='4' or a=='5' or a=='6' or a=='7' or a=='8' or a=='9'){
return true;
}
else return false;
}
int digit(){
... | ### Prompt
Create a solution in Cpp for the following problem:
Your task is to write a program which reads an expression and evaluates it.
* The expression consists of numerical values, operators and parentheses, and the ends with '='.
* The operators includes +, - , *, / where respectively represents, addition, sub... |
#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)
int expr(string& s, int& i);
int term(string& s, int& i);
int factor(string& s, int& i);
int number(string& s, int& i);
int expr(string& s, int& i) {
int val = term(s, i);
while (s[i] == '+' || s[... | ### Prompt
Your task is to create a cpp solution to the following problem:
Your task is to write a program which reads an expression and evaluates it.
* The expression consists of numerical values, operators and parentheses, and the ends with '='.
* The operators includes +, - , *, / where respectively represents, a... |
#include<iostream>
#include<string>
#include<map>
using namespace std;
#define ans pair<int, int>
string s;
ans equation(int p);
ans factor(int p);
ans term(int p);
int main(){
int n;
cin >>n;
while(n--){
cin >>s;
ans r = equation(0);
cout <<r.first<<endl;
}
return 0;
}
ans equation(int p){
ans ... | ### Prompt
Generate a cpp solution to the following problem:
Your task is to write a program which reads an expression and evaluates it.
* The expression consists of numerical values, operators and parentheses, and the ends with '='.
* The operators includes +, - , *, / where respectively represents, addition, subtr... |
#include<iostream>
#include<string>
#include<cassert>
#include<cctype>
using namespace std;
string s;
int cur=0;
char readchar()
{
assert(cur<s.size());
char ret=s[cur];
cur+=1;
return ret;
}
char peek()
{
assert(cur<s.size());
return s[cur];
}
int digit()
{
assert(isdigit(peek()));
... | ### Prompt
Construct a cpp code solution to the problem outlined:
Your task is to write a program which reads an expression and evaluates it.
* The expression consists of numerical values, operators and parentheses, and the ends with '='.
* The operators includes +, - , *, / where respectively represents, addition, ... |
#include <cctype>
#include <iostream>
#include <string>
typedef std::string::const_iterator State;
using namespace std;
int number(State &begin) {
int ret = 0;
while (isdigit(*begin)) {
ret *= 10;
ret += *begin - '0';
begin++;
}
return ret;
}
int factor(State &begin);
int term(State &begin) {
i... | ### Prompt
Please provide a Cpp coded solution to the problem described below:
Your task is to write a program which reads an expression and evaluates it.
* The expression consists of numerical values, operators and parentheses, and the ends with '='.
* The operators includes +, - , *, / where respectively represent... |
#include <bits/stdc++.h>
using namespace std;
class Calc{
public:
string s;
string::iterator it;
Calc(string s) : s(s) {
it = s.begin();
}
int fact(){
int res = 0;
if(*it == '('){
++it;
res = exp();
++it;
}else{
while(isdigit(*it)){
res *= 10;
re... | ### Prompt
Please provide a CPP coded solution to the problem described below:
Your task is to write a program which reads an expression and evaluates it.
* The expression consists of numerical values, operators and parentheses, and the ends with '='.
* The operators includes +, - , *, / where respectively represent... |
#include<string>
#include<cctype>
#include<stdio.h>
using namespace std;
int ex(char **b);
int te(char **b);
int fu(char **b);
int num(char **b);
int main(){
int n;
char s[1000];
scanf("%d\n",&n);
while(n--){
scanf("%s",s);
char *p = s;
printf("%d\n",ex(&p));
}
}
//和差
int ex(char **b){
int r=te(b);
for(;... | ### Prompt
In CPP, your task is to solve the following problem:
Your task is to write a program which reads an expression and evaluates it.
* The expression consists of numerical values, operators and parentheses, and the ends with '='.
* The operators includes +, - , *, / where respectively represents, addition, su... |
//?????????
//??????00-440415D???Smart_Calculator.cpp
#include <iostream>
#include <string>
#include <cassert>
#include <cctype>
#include <stdio.h>
using namespace std;
string S = "1+2*(3+4)";
size_t cur = 0;
int expression();
int digit(){
assert(isdigit(S[cur]));
int n = S[cur++]-'0';
return n;
}
int number()... | ### Prompt
Construct a Cpp code solution to the problem outlined:
Your task is to write a program which reads an expression and evaluates it.
* The expression consists of numerical values, operators and parentheses, and the ends with '='.
* The operators includes +, - , *, / where respectively represents, addition, ... |
#include <iostream>
#include <cassert>
#include <cctype>
using namespace std;
string S;
int cur;
char readchar()
{
assert(cur<S.size());
char ret=S[cur];
cur++;
return ret;
}
char peek()
{
assert(cur<S.size());
return S[cur];
}
int digit()
{
assert(isdigit(peek()));
int n=readchar()-'0';... | ### Prompt
Construct a CPP code solution to the problem outlined:
Your task is to write a program which reads an expression and evaluates it.
* The expression consists of numerical values, operators and parentheses, and the ends with '='.
* The operators includes +, - , *, / where respectively represents, addition, ... |
#include <iostream>
#include <string>
#include <cctype>
#include <cassert>
using namespace std;
string S;
size_t cur = 0;
int N;
int parse();
char readchar(){
assert(cur < S.size());
return S[cur++];
}
char peek(){
//assert(cur < S.size());
return S[cur];
}
int digit(){
assert(isdigit(peek()));... | ### Prompt
Your task is to create a Cpp solution to the following problem:
Your task is to write a program which reads an expression and evaluates it.
* The expression consists of numerical values, operators and parentheses, and the ends with '='.
* The operators includes +, - , *, / where respectively represents, a... |
#include <iostream>
#include <string>
#include <cstdio>
#include <cctype>
using namespace std;
char s[200];
char *p;
int E();
int F();
int T();
int N();
#ifdef DEBUG
#define dump(s) cerr << s << endl
#else
#define dump(...)
#endif
int E(){
int res = F();
while(*p=='+' || *p=='-'){
if(*p=='+') p++, r... | ### Prompt
Construct a Cpp code solution to the problem outlined:
Your task is to write a program which reads an expression and evaluates it.
* The expression consists of numerical values, operators and parentheses, and the ends with '='.
* The operators includes +, - , *, / where respectively represents, addition, ... |
#include <bits/stdc++.h>
using namespace std;
typedef int Int;
typedef string::const_iterator Iter;
Int eval(const string&);
Int expr(Iter&);
Int term(Iter&);
Int factor(Iter&);
Int number(Iter&);
Int eval(const string &s){
Iter it = s.begin();
return expr(it);
}
Int expr(Iter &it){
Int res = term(it);
while (t... | ### Prompt
Generate a CPP solution to the following problem:
Your task is to write a program which reads an expression and evaluates it.
* The expression consists of numerical values, operators and parentheses, and the ends with '='.
* The operators includes +, - , *, / where respectively represents, addition, subtr... |
#define _USE_MATH_DEFINES
#include<iostream>
#include<cstdio>
#include<algorithm>
#include<climits>
#include<string>
#include<vector>
#include<list>
#include<map>
#include<set>
#include<cmath>
#include<queue>
#include<cstring>
#include<stack>
using namespace std;
int p;
string S;
int num();
int factor();
int term();
... | ### Prompt
Please provide a CPP coded solution to the problem described below:
Your task is to write a program which reads an expression and evaluates it.
* The expression consists of numerical values, operators and parentheses, and the ends with '='.
* The operators includes +, - , *, / where respectively represent... |
#include <iostream>
#include <algorithm>
#include <cstdlib>
using namespace std;
string s;
string::iterator p;
int fact();
int term();
int exp();
int fact() {
int x;
string num;
while(isdigit(*p)) {
num += *p;
++p;
}
if(num.size()) {
x = atoi(num.c_str());
} else {
++p;
x = exp();
... | ### Prompt
Your challenge is to write a cpp solution to the following problem:
Your task is to write a program which reads an expression and evaluates it.
* The expression consists of numerical values, operators and parentheses, and the ends with '='.
* The operators includes +, - , *, / where respectively represent... |
#include <cstdio>
#include <iostream>
#include <algorithm>
#include <string>
using namespace std;
int exp();
int term();
int fact();
string s;
int id;
int main(void){
int n;
cin >> n;
for(int i = 0; i < n; i++){
cin >> s;
id = 0;
cout << exp() << endl;
}
}
int exp(){
int res = term();
while(1... | ### Prompt
Develop a solution in cpp to the problem described below:
Your task is to write a program which reads an expression and evaluates it.
* The expression consists of numerical values, operators and parentheses, and the ends with '='.
* The operators includes +, - , *, / where respectively represents, additio... |
#include<iostream>
#include<string>
#include<cctype>
#define REP(i,n) for(int i=0;i<(n);i++)
using namespace std;
typedef string::const_iterator State;
int ctoi(const char &c)
{
return c - '0';
}
int expression(State &);
int term(State &);
int factor(State &);
int number(State &);
int expression(State &itr)
{
int ... | ### Prompt
Generate a Cpp solution to the following problem:
Your task is to write a program which reads an expression and evaluates it.
* The expression consists of numerical values, operators and parentheses, and the ends with '='.
* The operators includes +, - , *, / where respectively represents, addition, subtr... |
#include<iostream>
#include<sstream>
using namespace std;
bool isnum(string s){
for(int i = 0; i < s.length(); i++)
if('0' > s[i] || s[i] > '9') return false;
return true;
}
int solve(string s){
// cout << s << endl;
// if(s[0] == '-') return -1*solve(s.substr(1));
if(isnum(s)){
stringstream s... | ### Prompt
In CPP, your task is to solve the following problem:
Your task is to write a program which reads an expression and evaluates it.
* The expression consists of numerical values, operators and parentheses, and the ends with '='.
* The operators includes +, - , *, / where respectively represents, addition, su... |
#include <iostream>
#include <string>
#include <queue>
#include <vector>
#include <cctype>
using namespace std;
typedef string::const_iterator State;
int expression(State &begin);
typedef string::const_iterator State;
int expression(State &begin);
int number(State &begin) {
int ret = 0;
for (; isdigit(*begin);) {... | ### Prompt
Please provide a CPP coded solution to the problem described below:
Your task is to write a program which reads an expression and evaluates it.
* The expression consists of numerical values, operators and parentheses, and the ends with '='.
* The operators includes +, - , *, / where respectively represent... |
#include<iostream>
#include<string>
using namespace std;
string S;
size_t cur;
int digit(){
return S[cur++]-'0';
}
int number(){
int n=digit();
while(cur<S.size()&&isdigit(S[cur])){
n=n*10+digit();
}
return n;
}
int expression();
int factor(){
if(isdigit(S[cur]))return number();
cur++;
int n=e... | ### Prompt
Your task is to create a Cpp solution to the following problem:
Your task is to write a program which reads an expression and evaluates it.
* The expression consists of numerical values, operators and parentheses, and the ends with '='.
* The operators includes +, - , *, / where respectively represents, a... |
#include <iostream>
#include <string>
#include <cctype>
using namespace std;
typedef string::const_iterator State;
int expression(State &begin);
int term(State &begin);
int factor(State &begin);
int number(State &begin);
int expression(State &begin){
int ret=term(begin);
while(true){
if(*begin == '+'){
begin++;
... | ### Prompt
In CPP, your task is to solve the following problem:
Your task is to write a program which reads an expression and evaluates it.
* The expression consists of numerical values, operators and parentheses, and the ends with '='.
* The operators includes +, - , *, / where respectively represents, addition, su... |
#include <iostream>
#include <string>
using namespace std;
int n;
string str;
int number(int& i);
int term(int& i);
int expression(int& i);
int factor(int& i);
int number(int& i)
{
int ret = 0;
while ('0' <= str[i] && str[i] <= '9')
{
ret *= 10;
ret += str[i] - '0';
i++;
}
return ret;
}
int term(int& i)
{... | ### Prompt
Please formulate a cpp solution to the following problem:
Your task is to write a program which reads an expression and evaluates it.
* The expression consists of numerical values, operators and parentheses, and the ends with '='.
* The operators includes +, - , *, / where respectively represents, additio... |
#include <iostream>
#include <string>
using namespace std;
string s;
bool isDigit(char c)
{
return (c >= '0' && c <= '9');
}
int parseNumber(string &s, int &pos)
{
int ret = 0;
while(1){
if(isDigit(s[pos])) ret *= 10, ret += s[pos]-'0';
else break;
pos++;
}
return ret;
}
int parseExp(string &s, int &pos);... | ### Prompt
Please provide a Cpp coded solution to the problem described below:
Your task is to write a program which reads an expression and evaluates it.
* The expression consists of numerical values, operators and parentheses, and the ends with '='.
* The operators includes +, - , *, / where respectively represent... |
#include"bits/stdc++.h"
using namespace std;
//define
#define ALL(a) a.begin(),a.end()
#define REP(i,n) for(int i=0;i<n;i++)
#define RREP(i,n) for(int i=n-1;i>=0;i--)
#define debug(x) if(1)cout<<#x<<":"<<x<<endl;
#define DEBUG(x) if(1)cout<<#x<<":"<<x<<endl;
#define ll long long
//typedef
typedef vector<int> vi;
type... | ### Prompt
Develop a solution in cpp to the problem described below:
Your task is to write a program which reads an expression and evaluates it.
* The expression consists of numerical values, operators and parentheses, and the ends with '='.
* The operators includes +, - , *, / where respectively represents, additio... |
#include <iostream>
#include <string>
#include <cctype>
using namespace std;
int cur;
string s;
int digit();
int number();
int factor();
int term();
int expression();
int digit() {
return ( s[cur++] - '0' );
}
int number() {
int n = digit();
while ( isdigit( s[cur] ) )
n = n * 10 + digit();
return n;
}
int f... | ### Prompt
Please formulate a Cpp solution to the following problem:
Your task is to write a program which reads an expression and evaluates it.
* The expression consists of numerical values, operators and parentheses, and the ends with '='.
* The operators includes +, - , *, / where respectively represents, additio... |
#include <iostream>
#include <cctype>
using namespace std;
int expr(string& s,int& i);
int term(string& s,int& i);
int factor(string& s,int& i);
int number(string& s,int& i);
int expr(string& s,int& i){
int val = term(s,i);
while(s[i]=='+' || s[i]=='-'){
char op = s[i];
i++;
int val2 = term(s,i);
... | ### Prompt
Develop a solution in Cpp to the problem described below:
Your task is to write a program which reads an expression and evaluates it.
* The expression consists of numerical values, operators and parentheses, and the ends with '='.
* The operators includes +, - , *, / where respectively represents, additio... |
#include<iostream>
#include<string>
#include<cctype>
using namespace std;
string s;
long id;
long ev1(void);
long num(void){
long v=0;
while(isdigit(s[id])){v=v*10+(s[id]-48);id++;}
return v;
}
long ev3(void){
if(s[id]=='('){
id++;
long v=ev1();
id++;
return v;
}else return num();
}
long ev2(void){
long v=ev3();
while(... | ### Prompt
In cpp, your task is to solve the following problem:
Your task is to write a program which reads an expression and evaluates it.
* The expression consists of numerical values, operators and parentheses, and the ends with '='.
* The operators includes +, - , *, / where respectively represents, addition, su... |
#include<iostream>
#include<queue>
using namespace std;
struct Puzzle { char p[10][10]; };
queue<pair<Puzzle, int>>Q;
queue<pair<int, int> >Q2;
int blute_force(int h, int w, Puzzle x) {
while (!Q.empty())Q.pop();
Q.push(make_pair(x, 0));
while (true) {
Puzzle y = Q.front().first; int V = Q.front().second; Q.pop();... | ### 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;
int dx[] = {1, 0, -1, 0};
int dy[] = {0, 1, 0, -1};
using vc = vector<vector<char>>;
void dfs(vc &c, int y, int x, char oldc, char newc) {
if(y < 0 || y >= c.size() || x < 0 || x >= c[0].size()) return;
if(c[y][x] != oldc) return;
c[y][x] = newc;
for(int i = 0; ... | ### 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<vector>
#include<queue>
#include<set>
#include<tuple>
using namespace std;
enum {STEP, FIELD};
typedef tuple<int, vector<vector<char>>> Node;
int dx[4] = {0, 1, 0, -1};
int dy[4] = {-1, 0, 1, 0};
int w, h;
void flood_fill(vector<vector<char>>& field, int y, int x, char color) {
char f... | ### 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;
const int dy[] = { 0, 1, 0, -1}, dx[] = { 1, 0, -1, 0};
int H, W;
bool isend(const string& str){
bool color;
for(int i = 0; i < 3; i++){
if(count( str.begin(), str.end(), "RGB"[i]) == H * W) return true;
}
return false;
}
int getx( int pos){
return pos % W;
}
... | ### 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 <algorithm>
#include <queue>
#include <cstring>
using namespace std;
typedef long long ll;
const int INF = 1 << 25;
int ans;
int b[10][10];
int W, H;
int dx[4] = { 1, 0, -1, 0 }, dy[4] = { 0, 1, 0, -1 };
bool in(int x, int y) {
return 0 <= x && x < W && 0 <= y && y < H;
}
void copy_boar... | ### 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>
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
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 ... |
// 2017/11/19 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
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<iostream>
#include<cstring>
#include<queue>
#define INF 20
int field_x, field_y;
int res = INF;
bool check(int field[10][10]){
int r = 0, g = 0, b = 0;
for (int i = 0; i < field_y; i++){
for (int j = 0; j < field_x; j++){
field[i][j] == 0 ? r++ : field[i][j] == 1 ? g++ : b++;
}
}
int a = field... | ### 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<cstring>
#include<map>
#include<string>
#include<queue>
#include<algorithm>
#define fr first
#define sc second
using namespace std;
int x, y;
string m;
bool used[16][16];
typedef pair<string, int> Pi;
bool check(string s)
{
for(int i = 1;i < x * y; i++)
if(s[0] != s[i]) return false... | ### 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 grid{
char c[11][11];
int count;
char bf;
/*void operator=(grid& g2){
this->count = g2.count;
this->bf = g2.bf;
for(int i=0;i<x;i++){
for(int j=0;j<y;j++){
this->c[i][j] = g2.c[i][j];
}
}
}*/
};
void DFS(gr... | ### 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 REP(i,x,n) for(int i = x ; i < (int)(n) ; i++)
#define rep(i,n) REP(i,0,n)
static const int dx[]={1,-1,0,0};
static const int dy[]={0,0,1,-1};
static const char color[]={'R','G','B'};
int n,m;
int changeV;
char G[10][10];
bool used[10][10];
struct State{
int ... | ### 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 <algorithm>
#include <string>
#include <vector>
#include <queue>
#include <map>
#include <set>
#include <stack>
#include <cstring>
#include <cmath>
#include <cstdio>
#define FOR(i, a, b) for(int i = (a); i < (b); i++)
#define rep(i, n) for(int i = 0; i < (n); i++)
#define MP make_pair
#de... | ### 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 <vector>
#include <string>
#include <algorithm>
#include <map>
#include <queue>
#include <deque>
#include <complex>
#define FOR(i,a,b) for(int i=(a);i<(b);i++)
#define FORE(i,a,b) for(int i=(a);i<=(b);i++)
#define REP(i,a) FOR(i,0,a)
using namespace std;
typedef complex<int> cl;
const 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<algorithm>
#include<string>
#include<queue>
#define rep(i,a) for( int i = 0; i != (a); ++i )
const std::string RGB = "RGB";
int x, y;
short fld[10][10];
struct State
{
short st[10][10];
int cnt;
State( short fld[10][10], int cnt )
: cnt( cnt )
{
rep( i, y )
rep(... | ### 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 <vector>
#include <string>
#include <map>
#include <algorithm>
using namespace std;
typedef pair<int,int> P;
const int MAX_W = 10;
int w, h, ans;
bool memo[MAX_W][MAX_W];
int dx[4] = {0,0,-1,1};
int dy[4] = {-1,1,0,0};
char C[3] = {'R','G','B'};
int c_to_n[256] = {0};
void debug(vecto... | ### 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>
#include<algorithm>
#include<queue>
#include<map>
using namespace std;
typedef pair<int, int> P;
#define INF (1 << 30)
int nowmax = INF, x, y;
char c;
int come[10][10];
int xs[] = {1, 0, -1, 0}, ys[] = {0, 1, 0, -1};
int dfs(int color[][10], int count = 0){
int res = nowmax;
if(count >= res)r... | ### 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 <algorithm>
#include <queue>
using namespace std;
int xsize, ysize;
char G[10][10];
bool used[10][10];
const char color[] = {'R', 'G', 'B'};
int dx[4] = {1, -1, 0, 0};
int dy[4] = {0, 0, 1, -1};
struct State {
int push;
char grid[10][10];
State(){};
State(int p, char g[][... | ### 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"
#include<unordered_map>
#include<unordered_set>
#pragma warning(disable:4996)
using namespace std;
using ld = long double;
const ld eps = 1e-9;
//// < "d:\d_download\visual studio 2015\projects\programing_contest_c++\debug\a.txt" > "d:\d_download\visual studio 2015\projects\programing_contest_... | ### 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
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;
char fie[11][11];
bool used[11][11];
int X,Y;
inline bool check(){
char c = fie[0][0];
for(int i=0;i<Y;i++)
for(int j=0;j<X;j++)
if( fie[j][i] != c ) return false;
return true;
}
inline void temp(int (*tmp)[11] ){
for(int i=0;i<Y;i++)
for(int j=0;j<X... | ### 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<iostream>
#include<memory.h>
using namespace std ;
int W , H ;
char table[12][12] ;
char C[] = {'R','G','B'} ;
int dx[] = {-1,0,1,0} ;
int dy[] = {0,-1,0,1} ;
int Ans ;
bool Check( char x[][12] ){
char d = x[0][0] ;
for( int i=0 ; i<H ; i++ ){
for( int j=0 ; j<W ; j++ ){
if( d != x[i... | ### 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 <cstdio>
#include <cstdlib>
#include <cstring>
#include <climits>
#include <cmath>
#include <cassert>
#include <iostream>
#include <sstream>
#include <iomanip>
#include <algorithm>
#include <numeric>
#include <complex>
#include <list>
#include <stack>
#include <queue>
#include <set>
#include <map>
#include <bi... | ### 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;
const int dy[]={-1,0,1,0},dx[]={0,-1,0,1};
int h,w;
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);
for(int d=0;d<4;d++){
int ny=y+dy[d],nx=x+dx[d];
if(ny<0||ny>=h... | ### 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>
#include<vector>
using namespace std;
#define inRange(x,a,b) (a <= x && x < b)
int dx[8] = {0,0,1,-1,1,1,-1,-1};
int dy[8] = {1,-1,0,0,1,-1,1,-1};
struct board{
int y, x;
vector<vector<char>> v;
board(int i, int j) : y(i), x(j) {
v.resize(i, vector<char>(j));
... | ### 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 <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
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<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>
using names... | ### 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 <vector>
#include <array>
#include <string>
#include <stack>
#include <queue>
#include <deque>
#include <map>
#include <unordered_map>
#include <set>
#include <unordered_set>
#include <tuple>
#include <bitset>
#include <memory>
#include <cmath>
#include <algorithm>
#include <functional>
#in... | ### 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 <bitset>
#include <vector>
#include <map>
#include <set>
#include <stack>
#include <queue>
#include <cstring>
#include <string>
#include <sstream>
#include <algorithm>
#include <iomanip>
#include <iostream>
#define VARIABLE(x) cerr << #x << "=" << x << endl
#define BINARY(x) cerr << #x << "=" << static_cast<b... | ### 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, int> Pr;
const char* color = "RGB";
const int dx[] = {-1, 0, 1, 0};
const int dy[] = {0, -1, 0, 1};
int h, w;
vector<string> grid;
bool change[10][10];
bool ok(int i, int j)
{
return i >= 0 && i < h && j >= 0 && j < w;
}
bool check(vector<string> grid)... | ### 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 <algorithm>
#include <vector>
#include <string>
#include <memory.h>
#include <queue>
#include <cstdio>
#include <cstdlib>
#include <set>
#include <map>
#include <cctype>
#include <iomanip>
#include <sstream>
#include <cctype>
#include <fstream>
#include <cmath>
using namespace std;
#define... | ### 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>
#include<queue>
using namespace std;
struct grid{
char g[11][11];
int count;
};
void DFS(grid& gr,char f,char c,int x,int y){
if(gr.g[x][y] != f){
return;
}
gr.g[x][y] = c;
DFS(gr,f,c,x+1,y);
DFS(gr,f,c,x-1,y);
DFS(gr,f,c,x,y+1);
DFS(gr,f,c,x,y-1);
}
int main(){
... | ### 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<cstdio>
#include<cstring>
#include<map>
#include<queue>
#include<algorithm>
#include<cassert>
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]=... | ### 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 <sstream>
#include <string>
#include <algorithm>
#include <vector>
#include <stack>
#include <queue>
#include <set>
#include <map>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <cmath>
#include <cassert>
using namespace std;
#define FOR(i,k,n) for(int i=(k); i<(int)n; +... | ### 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 <cstdio>
#include <cmath>
#include <vector>
#include <map>
#include <stack>
#include <queue>
#include <algorithm>
#include <set>
#include <cassert>
#define FOR(i,a,b) for(int i=(a);i<(b);i++)
#define REP(i,j) FOR(i,0,j)
#define mp std::make_pair
typedef long long ll;
typedef unsigned long... | ### 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 <iostream>
#include <sstream>
#include <iomanip>
#include <algorithm>
#include <cmath>
#include <string>
#include <vector>
#include <list>
#include <queue>
#include <stack>
#include <set>
#include <map>
#include <bitset>
#include <numeric>
#include <climits>
#include <cfloat>
using namespace ... | ### 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 <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 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
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 <queue>
#include <utility>
using namespace std;
int main()
{
int x,y;
while(cin>>x>>y&&x)
{
string m;
for(int i=0;i<y;i++)
{
for(int l=0;l<x;l++)
{
string k;cin>>k;
m+=k;
}
}
typedef pair<string,int> psi;
queue<psi> que;que.push(psi(m,0));
while(!que.emp... | ### 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 <vector>
#include <queue>
#include <map>
#include <cstring>
using namespace std;
using Mat = vector<vector<char>>;
constexpr char col[] = {'R', 'G', 'B'};
constexpr int MAX = 10;
constexpr int dx[] = {-1, 0, 1, 0};
constexpr int dy[] = {0, -1, 0, 1};
int W, H;
Mat M;
bool visited[MAX]... | ### 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<vector>
#include<algorithm>
#include<string>
using namespace std;
int h,w,lim;
int dx[4]={1,-1,0,0};
int dy[4]={0,0,1,-1};
char g[11][11];
string s="RGB";
void rev(int x,int y,vector<int>&p,char ch){
char tmp=g[y][x];
g[y][x]=ch;
p.push_back(y*w+x);
for(int i=0;i<4;i++){
int ... | ### 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 <cstdio>
#include <cstring>
#include <cstdlib>
#include <cmath>
#include <vector>
#include <string>
#include <map>
#include <set>
#include <queue>
#include <stack>
#include <algorithm>
using namespace std;
#define rep(i,j) REP((i), 0, (j))
#define REP(i,j,k) for(int i=(j);(i)<(k);++i)
#de... | ### 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<sstream>
#include<vector>
#include<algorithm>
#include<set>
#include<map>
#include<queue>
#include<complex>
#include<cstdio>
#include<cstdlib>
#include<cstring>
#include<cassert>
using namespace std;
#define rep(i,n) for(int i=0;i<(int)n;i++)
#define each(i,c) for(__typeof(c.begin()) i=c.be... | ### 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 <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
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<stdio.h>
#include<algorithm>
#include<queue>
using namespace std;
int dx[]={1,0,0,-1};
int dy[]={0,1,-1,0};
struct wolf{
int m[10][10];
wolf(){for(int i=0;i<10;i++)for(int j=0;j<10;j++)m[i][j]=0;}
};
int st[10][10];
char str[2];
int a,b;
int ret;
void solve(int t,wolf w){
//printf("%d\n",t);
//fflush(stdou... | ### 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 <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
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... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.