output stringlengths 52 181k | instruction stringlengths 296 182k |
|---|---|
#include <iostream>
#include <sstream>
#include <cstdio>
#include <cstdlib>
#include <cmath>
#include <ctime>
#include <cstring>
#include <string>
#include <vector>
#include <stack>
#include <queue>
#include <deque>
#include <map>
#include <set>
#include <bitset>
#include <numeric>
#include <utility>
#include <iomanip>... | ### Prompt
Please provide a Cpp coded solution to the problem described below:
Problem statement
There are two integers $ A $ and $ B $. The process of finding $ A --B $ by writing in decimal is shown below.
1. Express $ A $ and $ B $ in decimal. Subscripts are $ 0,1,2, ..., n-1 $ in order from the bottom, $ A = A_... |
#include <iostream>
using namespace std;
int solve(const int *a, const int *b, int s)
{
int c[10] = {0};
int borrow = 0;
for (int i = 0; i < 10; i++) {
if (a[i] - borrow >= b[i]) {
c[i] = a[i] - borrow - b[i];
borrow = 0;
} else {
c[i] = a[i] - borrow + 10 - b[i];
if (s & (1<<i)) ... | ### Prompt
Please provide a CPP coded solution to the problem described below:
Problem statement
There are two integers $ A $ and $ B $. The process of finding $ A --B $ by writing in decimal is shown below.
1. Express $ A $ and $ B $ in decimal. Subscripts are $ 0,1,2, ..., n-1 $ in order from the bottom, $ A = A_... |
#include <bits/stdc++.h>
using namespace std;
int a[11] = {0}, b[11] = {0};
int K;
int solve(int idx, int k, int brw)
{
if(k < 0) return -(1 << 25);
if(idx == 0) return 0;
int sa = a[idx] - b[idx];
int ret = -(1 << 25);
if(brw == 1) sa--;
if(sa < 0){
if(k > 0) ret = solve(idx-1, k-1, 0) + (sa+10) * p... | ### Prompt
In cpp, your task is to solve the following problem:
Problem statement
There are two integers $ A $ and $ B $. The process of finding $ A --B $ by writing in decimal is shown below.
1. Express $ A $ and $ B $ in decimal. Subscripts are $ 0,1,2, ..., n-1 $ in order from the bottom, $ A = A_ {n-1} A_ {n-2}... |
#include<iostream>
#include<algorithm>
#include<cstring>
#define N 99999
using namespace std;
int main(){
int A[N],B[N],C_0[N],C_1[N],K;
string a,b;
cin >> a >> b >> K;
memset(A,0,sizeof(A));
memset(B,0,sizeof(B));
memset(C_0,0,sizeof(C_0));
memset(C_1,0,sizeof(C_1));
int hh=0;
for(int i=a.length(... | ### Prompt
Construct a CPP code solution to the problem outlined:
Problem statement
There are two integers $ A $ and $ B $. The process of finding $ A --B $ by writing in decimal is shown below.
1. Express $ A $ and $ B $ in decimal. Subscripts are $ 0,1,2, ..., n-1 $ in order from the bottom, $ A = A_ {n-1} A_ {n-... |
#include<stdio.h>
#include<algorithm>
using namespace std;
int ret;
int A[11];
int B[11];
int C[11];
int n;
void solve(int a,int b,int c){
if(a==n){
int tmp=0;
for(int i=10;i>=0;i--){
tmp*=10;tmp+=C[i];
}
ret=max(ret,tmp);
return;
}
int t=A[a]-B[a]-b;
if(t<0){
C[a]=t+10;
if(c)solve(a+1,0,c-1);
... | ### Prompt
In CPP, your task is to solve the following problem:
Problem statement
There are two integers $ A $ and $ B $. The process of finding $ A --B $ by writing in decimal is shown below.
1. Express $ A $ and $ B $ in decimal. Subscripts are $ 0,1,2, ..., n-1 $ in order from the bottom, $ A = A_ {n-1} A_ {n-2}... |
#include <stdio.h>
#include <cmath>
#include <algorithm>
#include <cfloat>
#include <stack>
#include <queue>
#include <vector>
typedef long long int ll;
#define BIG_NUM 2000000000
#define MOD 1000000007
#define EPS 0.000001
using namespace std;
int main(){
int K,A[11],B[11],C[11],ans,tmp_digit,POW[10] = {1,10,100,10... | ### Prompt
Please create a solution in Cpp to the following problem:
Problem statement
There are two integers $ A $ and $ B $. The process of finding $ A --B $ by writing in decimal is shown below.
1. Express $ A $ and $ B $ in decimal. Subscripts are $ 0,1,2, ..., n-1 $ in order from the bottom, $ A = A_ {n-1} A_ ... |
#include<bits/stdc++.h>
#define LL long long
#define REP(i,n) for(int i=0;i<(n);++i)
#define lp(i,n) for(int i=0;i<(n);i++)
#define REPA(i,n) for(int i=1;i<(n);++i)
#define PII pair<int,int>
#define PLI pair<long long, int>
#define PLL pair<long long, long long>
#define MOD ((int)1e9 + 7)
#define INF ((int)2e9)
#define... | ### Prompt
Generate a cpp solution to the following problem:
Problem statement
There are two integers $ A $ and $ B $. The process of finding $ A --B $ by writing in decimal is shown below.
1. Express $ A $ and $ B $ in decimal. Subscripts are $ 0,1,2, ..., n-1 $ in order from the bottom, $ A = A_ {n-1} A_ {n-2} ..... |
#include <iostream>
#include <string>
#include <algorithm>
using namespace std;
int dp[11][10][2]; // dp[i][j][k]: i桁まで計算、j回忘れた、直前borrowならk=1
int main() {
int a;
int b;
int k;
cin >> a >> b >> k;
for(int i = 0; i < 11; i++) {
for(int j = 0; j < 10; j++) {
dp[i][j][0] = dp[i][j][1] = -1;
}
}
dp[0][0][0]... | ### Prompt
Construct a CPP code solution to the problem outlined:
Problem statement
There are two integers $ A $ and $ B $. The process of finding $ A --B $ by writing in decimal is shown below.
1. Express $ A $ and $ B $ in decimal. Subscripts are $ 0,1,2, ..., n-1 $ in order from the bottom, $ A = A_ {n-1} A_ {n-... |
#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
Create a solution in CPP for the following problem:
Problem statement
There are two integers $ A $ and $ B $. The process of finding $ A --B $ by writing in decimal is shown below.
1. Express $ A $ and $ B $ in decimal. Subscripts are $ 0,1,2, ..., n-1 $ in order from the bottom, $ A = A_ {n-1} A_ {n-2} ... |
#include <set>
#include <cstring>
#include <cstdio>
#include <algorithm>
#define REP(i,n) for(int i=0; i<(int)(n); i++)
#define MEQ(a,b) a = max((a), (b))
inline int getInt(){ int s; scanf("%d", &s); return s; }
using namespace std;
int memo[10][10][2];
int a[20];
int b[20];
int p[10];
int main(){
int aa = getIn... | ### Prompt
Create a solution in Cpp for the following problem:
Problem statement
There are two integers $ A $ and $ B $. The process of finding $ A --B $ by writing in decimal is shown below.
1. Express $ A $ and $ B $ in decimal. Subscripts are $ 0,1,2, ..., n-1 $ in order from the bottom, $ A = A_ {n-1} A_ {n-2} ... |
#include<bits/stdc++.h>
using namespace std;
string a,b;
int k,n,ans;
int num[10];
void dfs(int x,int borrow,int cntk){
if(x==n){
if(cntk<=k){
int t=0;
for(int i=n-1;i>=0;i--)t=t*10+num[i];
ans=max(ans,t);
}
}else{
int A=a[x]-'0',B=b[x]-'0';
if(A-borrow>=B){
num[x]=A-borrow-... | ### Prompt
Your task is to create a cpp solution to the following problem:
Problem statement
There are two integers $ A $ and $ B $. The process of finding $ A --B $ by writing in decimal is shown below.
1. Express $ A $ and $ B $ in decimal. Subscripts are $ 0,1,2, ..., n-1 $ in order from the bottom, $ A = A_ {n-... |
#include<bits/stdc++.h>
#define rep(i,n)for(int i=0;i<(n);i++)
using namespace std;
string a,b;int k;
int Max=0;
string c;
void dfs(int i,int p,int t){
if(i==a.size()){
string q=c;reverse(q.begin(),q.end());
Max=max(Max,stoi(q));
return;
}
if(a[i]-p>=b[i]){
c+=to_string(a[i]-p-b[i]);
dfs(i+1,0,t);c.pop_ba... | ### Prompt
Your challenge is to write a CPP solution to the following problem:
Problem statement
There are two integers $ A $ and $ B $. The process of finding $ A --B $ by writing in decimal is shown below.
1. Express $ A $ and $ B $ in decimal. Subscripts are $ 0,1,2, ..., n-1 $ in order from the bottom, $ A = A_... |
#include<bits/stdc++.h>
using namespace std;
#define int long long
signed main(){
int a,b,K;
cin>>a>>b>>K;
vector<int> A,B;
int atmp=a,btmp=b,sz=0;
while(atmp){
A.push_back(atmp%10);
B.push_back(btmp%10);
atmp/=10;
btmp/=10;
sz++;
}
int dp[15][2][15];
fill_n(**dp,15*2*15,-1);
dp[0... | ### Prompt
Construct a CPP code solution to the problem outlined:
Problem statement
There are two integers $ A $ and $ B $. The process of finding $ A --B $ by writing in decimal is shown below.
1. Express $ A $ and $ B $ in decimal. Subscripts are $ 0,1,2, ..., n-1 $ in order from the bottom, $ A = A_ {n-1} A_ {n-... |
#include <iostream>
#include <algorithm>
#include <string>
using namespace std;
string ANS="0000000000";
void cal(string A,string B,int C,int D){
if(A.size()==D+1){
string st="";
for(int i=0;i<A.size();i++)st+=(A[i]-B[i]+'0');
reverse(st.begin(),st.end());
if(ANS<st)ANS=st;
}
else{
if(A[D]>=B[D]){
cal(... | ### Prompt
Create a solution in Cpp for the following problem:
Problem statement
There are two integers $ A $ and $ B $. The process of finding $ A --B $ by writing in decimal is shown below.
1. Express $ A $ and $ B $ in decimal. Subscripts are $ 0,1,2, ..., n-1 $ in order from the bottom, $ A = A_ {n-1} A_ {n-2} ... |
#include <cstdio>
#include <iostream>
#include <vector>
#include <list>
#include <cmath>
#include <fstream>
#include <algorithm>
#include <string>
#include <queue>
#include <set>
#include <map>
#include <complex>
#include <iterator>
#include <cstdlib>
#include <cstring>
#include <sstream>
#include <stack>
using namesp... | ### Prompt
Develop a solution in CPP to the problem described below:
Problem statement
There are two integers $ A $ and $ B $. The process of finding $ A --B $ by writing in decimal is shown below.
1. Express $ A $ and $ B $ in decimal. Subscripts are $ 0,1,2, ..., n-1 $ in order from the bottom, $ A = A_ {n-1} A_ ... |
//Name: A-B Problem
//Level: 2
//Category: 動的計画法,DP
//Note:
/**
* dp[n][k][b] = n桁目以降で、あとk回まで繰り下がりを忘れていい時に作れる最大値(ただしn桁目におけるborrowの値はb)
* として、メモ化再帰の形で書く。
*
* オーダーは O(K log A)。
*/
#include <iostream>
#include <string>
#include <array>
#include <algorithm>
using namespace std;
template <typename T>
struct Maybe {/... | ### Prompt
In CPP, your task is to solve the following problem:
Problem statement
There are two integers $ A $ and $ B $. The process of finding $ A --B $ by writing in decimal is shown below.
1. Express $ A $ and $ B $ in decimal. Subscripts are $ 0,1,2, ..., n-1 $ in order from the bottom, $ A = A_ {n-1} A_ {n-2}... |
#include <iostream>
#include <vector>
using namespace std;
int borrow, a, b, k, ans, A[10], B[10], C[10], as, bs;
void solve(int p, int cnt){
if(p == as){
int tmp = 0;
for(int i=0, r=1;i<as;i++,r*=10) tmp += C[i] * r;
ans = max(ans, tmp);
return;
}
if(A[p] - borrow >= B[p]){
C[p] = A[p] - b... | ### Prompt
Create a solution in cpp for the following problem:
Problem statement
There are two integers $ A $ and $ B $. The process of finding $ A --B $ by writing in decimal is shown below.
1. Express $ A $ and $ B $ in decimal. Subscripts are $ 0,1,2, ..., n-1 $ in order from the bottom, $ A = A_ {n-1} A_ {n-2} ... |
#include <iostream>
#include <algorithm>
#include <string>
using namespace std;
string A, B;
int K, N;
int ten[11];
bool flag[11];
int rec(int p, int k) {
if(p == N) {
int res = 0;
for(int i = 0, borrow = 0; i < N; ++i) {
int a, b;
a = A[i]-'0', b = B[i]-'0';
if(a-borrow >= b) {
res += te... | ### Prompt
Your challenge is to write a CPP solution to the following problem:
Problem statement
There are two integers $ A $ and $ B $. The process of finding $ A --B $ by writing in decimal is shown below.
1. Express $ A $ and $ B $ in decimal. Subscripts are $ 0,1,2, ..., n-1 $ in order from the bottom, $ A = A_... |
#include <iostream>
#include <vector>
#include <algorithm>
#include <string>
#include <cstring>
#include <cstdlib>
#include <cstdio>
#include <cmath>
#include <queue>
#include <stack>
#include <map>
#include <set>
#include <bitset>
#define rep(i, n) for(int i = 0; i < (n); i++)
#define FOR(i, a, b) for(int i = (a); ... | ### Prompt
Your task is to create a cpp solution to the following problem:
Problem statement
There are two integers $ A $ and $ B $. The process of finding $ A --B $ by writing in decimal is shown below.
1. Express $ A $ and $ B $ in decimal. Subscripts are $ 0,1,2, ..., n-1 $ in order from the bottom, $ A = A_ {n-... |
#include <iostream>
#include <algorithm>
#include <cstring>
#include <cmath>
#define ll long long
using namespace std;
int digitAt(int arg, int d){
int ret;
ret = arg % (int)pow(10, d+1);
ret /= (int)pow(10, d);
return ret;
}
int bitcount(int arg){
int ret=0;
while(arg > 0){
if(arg ... | ### Prompt
Generate a CPP solution to the following problem:
Problem statement
There are two integers $ A $ and $ B $. The process of finding $ A --B $ by writing in decimal is shown below.
1. Express $ A $ and $ B $ in decimal. Subscripts are $ 0,1,2, ..., n-1 $ in order from the bottom, $ A = A_ {n-1} A_ {n-2} ..... |
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <cmath>
#include <climits>
#include <cfloat>
#include <ctime>
#include <cassert>
#include <map>
#include <utility>
#include <set>
#include <iostream>
#include <memory>
#include <string>
#include <vector>
#include <algorithm>
#include <functional>
#include... | ### Prompt
Create a solution in cpp for the following problem:
Problem statement
There are two integers $ A $ and $ B $. The process of finding $ A --B $ by writing in decimal is shown below.
1. Express $ A $ and $ B $ in decimal. Subscripts are $ 0,1,2, ..., n-1 $ in order from the bottom, $ A = A_ {n-1} A_ {n-2} ... |
/*
* 2350.cc: A-B Problem
*/
#include<cstdio>
#include<cstdlib>
#include<cstring>
#include<cmath>
#include<iostream>
#include<string>
#include<vector>
#include<map>
#include<set>
#include<stack>
#include<list>
#include<queue>
#include<deque>
#include<algorithm>
#include<numeric>
#include<utility>
#include<complex>
#... | ### Prompt
Create a solution in Cpp for the following problem:
Problem statement
There are two integers $ A $ and $ B $. The process of finding $ A --B $ by writing in decimal is shown below.
1. Express $ A $ and $ B $ in decimal. Subscripts are $ 0,1,2, ..., n-1 $ in order from the bottom, $ A = A_ {n-1} A_ {n-2} ... |
#include<algorithm>
#include<cstdio>
#include<cstring>
using namespace std;
char a[11],b[11];
int c[10][2][10],lna,lnb;
int fn(int p,int q,int r){
if(p==lna)
return 0;
if(c[p][q][r])
return c[p][q][r];
if(a[lna-p-1]-q<(lnb-p-1<0?'0':b[lnb-p-1]))
return c[p][q][r]=a[lna-p-1]-'0'-q-(lnb-p-1<0?0:b[lnb-p-... | ### Prompt
Construct a cpp code solution to the problem outlined:
Problem statement
There are two integers $ A $ and $ B $. The process of finding $ A --B $ by writing in decimal is shown below.
1. Express $ A $ and $ B $ in decimal. Subscripts are $ 0,1,2, ..., n-1 $ in order from the bottom, $ A = A_ {n-1} A_ {n-... |
#include<iostream>
using namespace std;
#define rep(i, n) for (int i = 0; i < int(n); ++i)
int solve(string a, string b, int k) {
if (a.size() == 0u) return 0;
if (a[a.size() - 1] >= b[b.size() - 1]) {
return solve(a.substr(0, a.size() - 1), b.substr(0, b.size() - 1), k) * 10 + a[a.size() - 1] - b[b.size() -... | ### Prompt
Develop a solution in CPP to the problem described below:
Problem statement
There are two integers $ A $ and $ B $. The process of finding $ A --B $ by writing in decimal is shown below.
1. Express $ A $ and $ B $ in decimal. Subscripts are $ 0,1,2, ..., n-1 $ in order from the bottom, $ A = A_ {n-1} A_ ... |
#include <iostream>
#include <vector>
#include <cstring>
#define rep(i,n) for(int i = 0; i < n; i++)
using namespace std;
typedef vector<int> vi;
int va[12];
int vb[12];
int dp[12][12][2];
int solve(int i, int k, int borrow){
if(i == 12) return 0;
int& d = dp[i][k][borrow];
if(d != -1) ret... | ### Prompt
Develop a solution in cpp to the problem described below:
Problem statement
There are two integers $ A $ and $ B $. The process of finding $ A --B $ by writing in decimal is shown below.
1. Express $ A $ and $ B $ in decimal. Subscripts are $ 0,1,2, ..., n-1 $ in order from the bottom, $ A = A_ {n-1} A_ ... |
#include<iostream>
using namespace std;
int mx;
int nm[11],ans;
void dfs(int a,int b,int brw,int k,int x){
int ai,bi;
if(a==0){
int pnt=0;
for(int i=x-1;i>=0;i--) pnt=pnt*10+nm[i];
ans=max(ans,pnt);
return;
}
ai=a%10,bi=b%10;
a/=10,b/=10;
if(brw==0){
if(ai-brw>=bi) nm[x]=ai-brw-bi... | ### Prompt
In Cpp, your task is to solve the following problem:
Problem statement
There are two integers $ A $ and $ B $. The process of finding $ A --B $ by writing in decimal is shown below.
1. Express $ A $ and $ B $ in decimal. Subscripts are $ 0,1,2, ..., n-1 $ in order from the bottom, $ A = A_ {n-1} A_ {n-2}... |
#include <iostream>
#include <vector>
#include <string>
#include <algorithm>
using namespace std;
int K;
int solve(const vector<int>& A, const vector<int>& B, vector<int> C, int i, int k, int borrow)
{
int ret = 0;
if (i >= C.size()) {
reverse(C.begin(), C.end());
for (i = 0; i < 10; ++i) {
ret *= 1... | ### Prompt
Please provide a cpp coded solution to the problem described below:
Problem statement
There are two integers $ A $ and $ B $. The process of finding $ A --B $ by writing in decimal is shown below.
1. Express $ A $ and $ B $ in decimal. Subscripts are $ 0,1,2, ..., n-1 $ in order from the bottom, $ A = A_... |
#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 provide a Cpp coded solution to the problem described below:
Problem statement
There are two integers $ A $ and $ B $. The process of finding $ A --B $ by writing in decimal is shown below.
1. Express $ A $ and $ B $ in decimal. Subscripts are $ 0,1,2, ..., n-1 $ in order from the bottom, $ A = A_... |
#include<iostream>
#include<cstring>
#include<cstdio>
using namespace std;
#define REP(i,b,n) for(int i=b;i<n;i++)
#define rep(i,n) REP(i,0,n)
/*
計算量はたかだか2^9
*/
int ans;
void solve(int now,int val,int base,int *a,int *b,int borrow,int k){
if (k < 0)return;
if (now == -1){
ans = max(ans,val);
return;
... | ### Prompt
Please formulate a Cpp solution to the following problem:
Problem statement
There are two integers $ A $ and $ B $. The process of finding $ A --B $ by writing in decimal is shown below.
1. Express $ A $ and $ B $ in decimal. Subscripts are $ 0,1,2, ..., n-1 $ in order from the bottom, $ A = A_ {n-1} A_ ... |
#include <iostream>
#include <string>
#include <algorithm>
using namespace std;
int main(){
int a, b, k;
cin >> a >> b >> k;
int answer = a - b;
for(int i = 0; i < (1 << 10); ++i){
int p = a, q = b, borrow = 0, result = 0;
if(__builtin_popcount(i) > k){ continue; }
for(int j = 0, d = 1; p || q; ++j, d *= 10... | ### Prompt
Please create a solution in cpp to the following problem:
Problem statement
There are two integers $ A $ and $ B $. The process of finding $ A --B $ by writing in decimal is shown below.
1. Express $ A $ and $ B $ in decimal. Subscripts are $ 0,1,2, ..., n-1 $ in order from the bottom, $ A = A_ {n-1} A_ ... |
#include <stdio.h>
#include <string.h>
#include <algorithm>
#include <iostream>
#include <math.h>
#include <assert.h>
#include <vector>
#include <queue>
#include <string>
#include <map>
#include <set>
using namespace std;
typedef long long ll;
typedef unsigned int uint;
typedef unsigned long long ull;
static const dou... | ### Prompt
Create a solution in cpp for the following problem:
Problem statement
There are two integers $ A $ and $ B $. The process of finding $ A --B $ by writing in decimal is shown below.
1. Express $ A $ and $ B $ in decimal. Subscripts are $ 0,1,2, ..., n-1 $ in order from the bottom, $ A = A_ {n-1} A_ {n-2} ... |
#define _USE_MATH_DEFINES
#include <iostream>
#include <sstream>
#include <cmath>
#include <algorithm>
#include <queue>
#include <stack>
#include <limits>
#include <map>
#include <string>
#include <cstring>
#include <set>
#include <deque>
#include <bitset>
using namespace std;
typedef long long ll;
typedef pair<int,i... | ### Prompt
Construct a CPP code solution to the problem outlined:
Problem statement
There are two integers $ A $ and $ B $. The process of finding $ A --B $ by writing in decimal is shown below.
1. Express $ A $ and $ B $ in decimal. Subscripts are $ 0,1,2, ..., n-1 $ in order from the bottom, $ A = A_ {n-1} A_ {n-... |
#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
Develop a solution in CPP to the problem described below:
Problem statement
There are two integers $ A $ and $ B $. The process of finding $ A --B $ by writing in decimal is shown below.
1. Express $ A $ and $ B $ in decimal. Subscripts are $ 0,1,2, ..., n-1 $ in order from the bottom, $ A = A_ {n-1} A_ ... |
#include<iostream>
#include<vector>
#include<cassert>
#include<cmath>
using namespace std;
long long A,B,K;
long long calc(const string& s){
long long a = A, b = B, c = 0, borrow = 0;
int base = 1;
int N = (int)log10(A)+1;
for(int i = 0; i < N; i++){
long long tmpA = a%10;
long long tmpB = b%10;
... | ### Prompt
Develop a solution in cpp to the problem described below:
Problem statement
There are two integers $ A $ and $ B $. The process of finding $ A --B $ by writing in decimal is shown below.
1. Express $ A $ and $ B $ in decimal. Subscripts are $ 0,1,2, ..., n-1 $ in order from the bottom, $ A = A_ {n-1} A_ ... |
#include <iostream>
#include <vector>
#include <string>
#include <algorithm>
using namespace std;
void solve(const string& A, const string& B, string C, vector<int> borrow, int i, int k, int n, int& ans){
if( i == n ){
int res = 0;
reverse(C.begin(),C.end());
for(int i=0 ; i < C.size() ; i++ ){
res = res * 1... | ### Prompt
Please formulate a Cpp solution to the following problem:
Problem statement
There are two integers $ A $ and $ B $. The process of finding $ A --B $ by writing in decimal is shown below.
1. Express $ A $ and $ B $ in decimal. Subscripts are $ 0,1,2, ..., n-1 $ in order from the bottom, $ A = A_ {n-1} A_ ... |
#include <iostream>
#include <string>
#include <algorithm>
#include <functional>
#include <vector>
#include <utility>
#include <cstring>
#include <iomanip>
#include <numeric>
#include <limits>
#include <cmath>
#include <cassert>
using namespace std;
using ll = long long;
const int INF = 1<<30;
const int MOD = (int)1e9 ... | ### Prompt
Please provide a Cpp coded solution to the problem described below:
Problem statement
There are two integers $ A $ and $ B $. The process of finding $ A --B $ by writing in decimal is shown below.
1. Express $ A $ and $ B $ in decimal. Subscripts are $ 0,1,2, ..., n-1 $ in order from the bottom, $ A = A_... |
#include<iostream>
#include<vector>
#include<algorithm>
#define pb push_back
using namespace std;
int A,B,K;
vector<int> a,b;
int rec(int p,int t,int B,vector<int> c){
if(p==a.size()){
int res = 0;
int k = 1;
for(int i=0;i<(int)c.size();i++){
res += k*c[i];
k *= 10;
}
return res;
}... | ### Prompt
Please formulate a cpp solution to the following problem:
Problem statement
There are two integers $ A $ and $ B $. The process of finding $ A --B $ by writing in decimal is shown below.
1. Express $ A $ and $ B $ in decimal. Subscripts are $ 0,1,2, ..., n-1 $ in order from the bottom, $ A = A_ {n-1} A_ ... |
#include<cstdio>
#include<cstring>
#include<algorithm>
#define rep(i,n) for(int i=0;i<(n);i++)
using namespace std;
int len;
char a[16],b[16],c[16];
int dfs(int i,int k,int borrow){
int res=0;
rep(_,2){
if(i==len){
if(borrow==0){
reverse(c,c+len);
res=max(res,atoi(c));
reverse(c,c+len);
}
}
... | ### Prompt
Develop a solution in CPP to the problem described below:
Problem statement
There are two integers $ A $ and $ B $. The process of finding $ A --B $ by writing in decimal is shown below.
1. Express $ A $ and $ B $ in decimal. Subscripts are $ 0,1,2, ..., n-1 $ in order from the bottom, $ A = A_ {n-1} A_ ... |
//37
#include<iostream>
#include<string>
#include<cstdlib>
using namespace std;
int main(){
string a,b;
int k;
cin>>a>>b>>k;
b=string(a.size()-b.size(),'0')+b;
string r;
for(int i=0;i<1<<a.size();i++){
int bt=0,ic=i;
while(ic){
bt++;
ic=ic&ic-1;
}
if(bt<=k){
int c=0;
... | ### Prompt
Create a solution in CPP for the following problem:
Problem statement
There are two integers $ A $ and $ B $. The process of finding $ A --B $ by writing in decimal is shown below.
1. Express $ A $ and $ B $ in decimal. Subscripts are $ 0,1,2, ..., n-1 $ in order from the bottom, $ A = A_ {n-1} A_ {n-2} ... |
//include
//------------------------------------------
#include <bits/stdc++.h> // only for GCC
using namespace std;
//typedef
//------------------------------------------
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<string> vs;
typedef vector<bool> vb;
typedef vector<vb> vvb;
typedef pair<int, int>... | ### Prompt
Construct a Cpp code solution to the problem outlined:
Problem Statement
Mr. Takatsuki, who is planning to participate in the Aizu training camp, has a poor house and does not have much money. Therefore, he is trying to save money by using the Seishun 18 Ticket. With only one 18 ticket, you can ride a loc... |
#include <iostream>
#include <algorithm>
#include <string>
#include <cstring>
#include <vector>
using namespace std;
int conv(string s){
return atoi(s.substr(0, 2).c_str()) * 60 + atoi(s.substr(3).c_str());
}
int main(){
int n, t;
cin >> n >> t;
vector<pair<string, int> > ans;
string pre;
for(int i=0;i<n;i++){... | ### Prompt
Create a solution in cpp for the following problem:
Problem Statement
Mr. Takatsuki, who is planning to participate in the Aizu training camp, has a poor house and does not have much money. Therefore, he is trying to save money by using the Seishun 18 Ticket. With only one 18 ticket, you can ride a local ... |
#include<bits/stdc++.h>
#define range(i,a,b) for(int i = (a); i < (b); i++)
#define rep(i,b) range(i,0,b)
#define pb(a) push_back(a)
#define all(a) (a).begin(), (a).end()
#define debug(x) cout << "debug " << x << endl;
#define INF (1 << 31 - 1)
using namespace std;
typedef struct{
string name;
int time;
}s;
i... | ### Prompt
In CPP, your task is to solve the following problem:
Problem Statement
Mr. Takatsuki, who is planning to participate in the Aizu training camp, has a poor house and does not have much money. Therefore, he is trying to save money by using the Seishun 18 Ticket. With only one 18 ticket, you can ride a local... |
#include<bits/stdc++.h>
using namespace std;
int a(char x){ return x-'0'; }
int cal(string s){
int h = a(s[0])*10 + a(s[1]), m = a(s[3])*10 + a(s[4]);
return h*60+m;
}
int main(){
int n,t;
cin >> n >> t;
vector<string> ansn;
vector<int> anst;
int bt = -1;
for(int i=0;i<n;i++){
string st, sn, et,... | ### Prompt
Your challenge is to write a CPP solution to the following problem:
Problem Statement
Mr. Takatsuki, who is planning to participate in the Aizu training camp, has a poor house and does not have much money. Therefore, he is trying to save money by using the Seishun 18 Ticket. With only one 18 ticket, you c... |
#include <bits/stdc++.h>
#define r(i,a,n) for(int i=a;i<n;i++)
using namespace std;
int main(){
int n,t,cc=0,aa[11514];
string sss[11514],pp;
cin>>n>>t;
if(n)cin>>pp>>pp;
r(i,0,n-1){
int a,b,c,d;
string s,ss;
scanf("%d:%d",&a,&b);
cin>>s;
scanf("%d:%d",&c,&d);
cin>>ss;
if(((c*60+d)-(a*60+b))>=t){
... | ### Prompt
Construct a CPP code solution to the problem outlined:
Problem Statement
Mr. Takatsuki, who is planning to participate in the Aizu training camp, has a poor house and does not have much money. Therefore, he is trying to save money by using the Seishun 18 Ticket. With only one 18 ticket, you can ride a loc... |
#include <iostream>
#include <sstream>
#include <string>
#include <vector>
#include <map>
using namespace std;
int main(){
int n,t,tim1,sec1,tim2,sec2,tot1,tot2;
string s,na1,na2;
char trash;
stringstream ss;
vector <pair<string,int> > ans;
cin >> n >> t;
cin.ignore();
getline(cin,s); s... | ### Prompt
Please create a solution in CPP to the following problem:
Problem Statement
Mr. Takatsuki, who is planning to participate in the Aizu training camp, has a poor house and does not have much money. Therefore, he is trying to save money by using the Seishun 18 Ticket. With only one 18 ticket, you can ride a ... |
#include <iostream>
#include <cstdio>
#include <cstring>
#include <cstdlib>
#include <cmath>
#include <vector>
#include <string>
#include <map>
#include <queue>
#include <stack>
#include <algorithm>
#define rep(i,j) REP((i), 0, (j))
#define REP(i,j,k) for(int i=(j);(i)<(k);++i)
#define between(a,x,b) ((a)<=(x)&&(x)<=(... | ### Prompt
Create a solution in Cpp for the following problem:
Problem Statement
Mr. Takatsuki, who is planning to participate in the Aizu training camp, has a poor house and does not have much money. Therefore, he is trying to save money by using the Seishun 18 Ticket. With only one 18 ticket, you can ride a local ... |
#include <iostream>
#include <vector>
#include <map>
using namespace std;
typedef pair<string, int> P;
int main(){
int n, t;
vector<P> v;
cin >> n >> t;
int h1, m1, h2, m2;
char c; string str;
cin >> h1 >> c >> m1 >> str;
if( n == 1 ) {
cout << 0 << endl;
return 0;
}
for(int i=0; i<n; ... | ### Prompt
Construct a Cpp code solution to the problem outlined:
Problem Statement
Mr. Takatsuki, who is planning to participate in the Aizu training camp, has a poor house and does not have much money. Therefore, he is trying to save money by using the Seishun 18 Ticket. With only one 18 ticket, you can ride a loc... |
#include<iostream>
#include<vector>
using namespace std;
int main()
{
int n,t;
cin>>n>>t;
int at;
vector<int> ii;
vector<string> ss;
for(int i=0;i<n;i++)
{
int st_t1,st_t2,ar_t1,ar_t2;
string st_n,ar_n;
char br;
cin>>st_t1>>br>>st_t2>>st_n>>ar_t1>>br>>ar_t2>>ar_n;
if(i>0 &... | ### Prompt
Please create a solution in CPP to the following problem:
Problem Statement
Mr. Takatsuki, who is planning to participate in the Aizu training camp, has a poor house and does not have much money. Therefore, he is trying to save money by using the Seishun 18 Ticket. With only one 18 ticket, you can ride a ... |
#include <bits/stdc++.h>
using namespace std;
#define rep(i,n) for(int i=0;i<(n);i++)
int N,T;
vector<pair<string,int> > ans;
inline int conv(int hh,int mm) {
return hh*60+mm;
}
int main() {
cin>>N>>T;
int hh1,mm1,hh2,mm2;
string st_name,ar_name;
scanf("%d:%d",&hh1,&mm1);
cin>>st_name;
rep... | ### Prompt
Generate a CPP solution to the following problem:
Problem Statement
Mr. Takatsuki, who is planning to participate in the Aizu training camp, has a poor house and does not have much money. Therefore, he is trying to save money by using the Seishun 18 Ticket. With only one 18 ticket, you can ride a local tr... |
#include <cstdio>
#include <iostream>
#include <string>
#include <map>
#include <vector>
using namespace std;
typedef pair<string,int> psi;
vector<psi> stay;
int main(void){
int n,t;
cin >> n >> t;
int prev=-1;
for(int i=0;i<n;++i){
string st,sn,at,an;
cin >> st >> sn >> at >> an;
int sh=10*(st[0]-'0')+(s... | ### Prompt
Your task is to create a CPP solution to the following problem:
Problem Statement
Mr. Takatsuki, who is planning to participate in the Aizu training camp, has a poor house and does not have much money. Therefore, he is trying to save money by using the Seishun 18 Ticket. With only one 18 ticket, you can r... |
#include<vector>
#include<map>
#include<climits>
#include<set>
#include<queue>
#include<algorithm>
#include<functional>
#include<numeric>
#include<utility>
#include<sstream>
#include<iostream>
#include<iomanip>
#include<cstdio>
#include<cmath>
#include<cstdlib>
#include<cctype>
#include<string>
#include<bitset>
#includ... | ### Prompt
Your task is to create a cpp solution to the following problem:
Problem Statement
Mr. Takatsuki, who is planning to participate in the Aizu training camp, has a poor house and does not have much money. Therefore, he is trying to save money by using the Seishun 18 Ticket. With only one 18 ticket, you can r... |
#include<bits/stdc++.h>
using namespace std;
int toMin(string s){
return stoi(s.substr(0,2)) * 60 + stoi(s.substr(3,2));
}
int main(){
int N,T;
cin >> N >> T;
vector<pair<string,int>> ans;
string st_time,st_name,ar_time,ar_name;
cin >> st_time >> st_name;
for(int i = 0;i < N-1;i++){
... | ### Prompt
Generate a Cpp solution to the following problem:
Problem Statement
Mr. Takatsuki, who is planning to participate in the Aizu training camp, has a poor house and does not have much money. Therefore, he is trying to save money by using the Seishun 18 Ticket. With only one 18 ticket, you can ride a local tr... |
#include <cstdlib>
#include <iostream>
#include <vector>
using namespace std;
inline int input_time() {
int h, m;
char semicolon;
cin >> h >> semicolon >> m;
return h * 60 + m;
}
inline string input_name() {
string name;
cin >> name;
return name;
}
inline void input_null() {
string null;
cin >> null;
}
int... | ### Prompt
Create a solution in Cpp for the following problem:
Problem Statement
Mr. Takatsuki, who is planning to participate in the Aizu training camp, has a poor house and does not have much money. Therefore, he is trying to save money by using the Seishun 18 Ticket. With only one 18 ticket, you can ride a local ... |
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <cmath>
#include <cstdio>
#include <functional>
#include <numeric>
#include <stack>
#include <queue>
#include <map>
#include <set>
#include <utility>
#include <sstream>
#include <complex>
#include <fstream>
using namespace std;
#def... | ### Prompt
Develop a solution in CPP to the problem described below:
Problem Statement
Mr. Takatsuki, who is planning to participate in the Aizu training camp, has a poor house and does not have much money. Therefore, he is trying to save money by using the Seishun 18 Ticket. With only one 18 ticket, you can ride a ... |
#include<iostream>
#include<string>
#include<vector>
#include<algorithm>
#define Pair pair<int, string>
using namespace std;
int convert_minutes(const string& s){
int h = (s[0]-'0')*10 + (s[1]-'0');
int m = (s[3]-'0')*10 + (s[4]-'0');
return 60*h + m;
}
int main(){
int N, T, t, t_;
string t1, t2, s1, s2;
... | ### Prompt
Please formulate a cpp solution to the following problem:
Problem Statement
Mr. Takatsuki, who is planning to participate in the Aizu training camp, has a poor house and does not have much money. Therefore, he is trying to save money by using the Seishun 18 Ticket. With only one 18 ticket, you can ride a ... |
#include <iostream>
#include <string>
#include <sstream>
#include <algorithm>
#include <vector>
#include <utility>
#include <functional>
#include <stack>
#include <queue>
#include <map>
#include <set>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <cmath>
#include <deque>
#include <ctime>
using name... | ### Prompt
Generate a CPP solution to the following problem:
Problem Statement
Mr. Takatsuki, who is planning to participate in the Aizu training camp, has a poor house and does not have much money. Therefore, he is trying to save money by using the Seishun 18 Ticket. With only one 18 ticket, you can ride a local tr... |
#define _USE_MATH_DEFINES
#define INF 0x3f3f3f3f
#include <iostream>
#include <cstdio>
#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>
#i... | ### Prompt
Construct a cpp code solution to the problem outlined:
Problem Statement
Mr. Takatsuki, who is planning to participate in the Aizu training camp, has a poor house and does not have much money. Therefore, he is trying to save money by using the Seishun 18 Ticket. With only one 18 ticket, you can ride a loc... |
#define _USE_MATH_DEFINES
#include<stdio.h>
#include<string>
#include<iostream>
#include<cctype>
#include<cstdio>
#include<vector>
#include<stack>
#include <algorithm>
#include<math.h>
#include<set>
#include<map>
#include<iomanip>
using namespace std;
int main(){
int n,t;
cin>>n>>t;
pair<string,int>y[15];
int ... | ### Prompt
Your task is to create a CPP solution to the following problem:
Problem Statement
Mr. Takatsuki, who is planning to participate in the Aizu training camp, has a poor house and does not have much money. Therefore, he is trying to save money by using the Seishun 18 Ticket. With only one 18 ticket, you can r... |
#include <iostream>
#include <string>
#include <vector>
#include <sstream>
using namespace std;
const int INF = 1000000000;
int get_time(const string &s){
stringstream ss(s);
int h, m;
ss >> h;
ss.ignore();
ss >> m;
return h * 60 + m;
}
int main(){
ios_base::sync_with_stdio(false);
int n, t;
cin >> n >> t;
... | ### Prompt
Please create a solution in cpp to the following problem:
Problem Statement
Mr. Takatsuki, who is planning to participate in the Aizu training camp, has a poor house and does not have much money. Therefore, he is trying to save money by using the Seishun 18 Ticket. With only one 18 ticket, you can ride a ... |
#include <iostream>
#include <cstdlib>
#include <string>
#include <vector>
using namespace std;
struct Status {
int t; // [minute]
string name;
};
int getTime( string s ) {
int m = ( s[ 0 ] - '0' ) * 600 + ( s[ 1 ] - '0' ) * 60;
m += ( ( s[ 3 ] - '0' ) * 10 + s[ 4 ] - '0' );
return m;
}
int main () {
int... | ### Prompt
Construct a cpp code solution to the problem outlined:
Problem Statement
Mr. Takatsuki, who is planning to participate in the Aizu training camp, has a poor house and does not have much money. Therefore, he is trying to save money by using the Seishun 18 Ticket. With only one 18 ticket, you can ride a loc... |
#include<bits/stdc++.h>
using namespace std;
int main(){
int n,t;
scanf("%d%d",&n,&t);
vector<string> name;
vector<int> stay;
int prv = 0;
for(int i=0;i<n;i++){
int h1,m1,h2,m2;
string name1, name2;
scanf("%d:%d",&h1,&m1);
m1 += h1*60;
cin >> name1;
scanf("%d:%d",&h2,&m2);
m2 ... | ### Prompt
In Cpp, your task is to solve the following problem:
Problem Statement
Mr. Takatsuki, who is planning to participate in the Aizu training camp, has a poor house and does not have much money. Therefore, he is trying to save money by using the Seishun 18 Ticket. With only one 18 ticket, you can ride a local... |
#include <iostream>
#include <vector>
#include <algorithm>
#include <utility>
#include <map>
#include <queue>
#include <stack>
#include <string>
#include <sstream>
#include <cstring>
#include <cstdlib>
using namespace std;
#define ALL(c) c.begin(),c.end()
#define RALL(c) c.rbegin(),c.rend()
#define REP(type,i,n) for(... | ### Prompt
Your challenge is to write a cpp solution to the following problem:
Problem Statement
Mr. Takatsuki, who is planning to participate in the Aizu training camp, has a poor house and does not have much money. Therefore, he is trying to save money by using the Seishun 18 Ticket. With only one 18 ticket, you c... |
#include <stdio.h>
#include <cmath>
#include <algorithm>
#include <stack>
#include <queue>
#include <vector>
typedef long long int ll;
#define BIG_NUM 2000000000
#define MOD 1000000007
#define EPS 0.000001
using namespace std;
struct Info{
int time;
char name[51];
};
int calc(char time[6]){
return 60*(10*(time[0]-... | ### Prompt
Generate a cpp solution to the following problem:
Problem Statement
Mr. Takatsuki, who is planning to participate in the Aizu training camp, has a poor house and does not have much money. Therefore, he is trying to save money by using the Seishun 18 Ticket. With only one 18 ticket, you can ride a local tr... |
#include <iostream>
#include <vector>
#include <string>
#include <cstdio>
#include <utility>
using namespace std;
int main(){
int N, T; cin >> N >> T;
int tmp_ar_time_h = -1, tmp_ar_time_m = -1;
vector<pair<string, int> > ans;
for (int i = 0; i < N; i++) {
int st_time_h, st_time_m;
int ar_time_h, ar_time_m;... | ### Prompt
Please formulate a Cpp solution to the following problem:
Problem Statement
Mr. Takatsuki, who is planning to participate in the Aizu training camp, has a poor house and does not have much money. Therefore, he is trying to save money by using the Seishun 18 Ticket. With only one 18 ticket, you can ride a ... |
#include <iostream>
#include <vector>
#include <algorithm>
using namespace std;
struct Station {
string name;
int time;
Station() {}
Station(string name, int time) : name(name), time(time) {}
};
int main()
{
int N, T;
char a[55], b[55];
int h1, d1, h2, d2;
string s;
vector<Station... | ### Prompt
Generate a cpp solution to the following problem:
Problem Statement
Mr. Takatsuki, who is planning to participate in the Aizu training camp, has a poor house and does not have much money. Therefore, he is trying to save money by using the Seishun 18 Ticket. With only one 18 ticket, you can ride a local tr... |
#include <iostream>
#include <iomanip>
#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>... | ### Prompt
Your task is to create a CPP solution to the following problem:
Problem Statement
Mr. Takatsuki, who is planning to participate in the Aizu training camp, has a poor house and does not have much money. Therefore, he is trying to save money by using the Seishun 18 Ticket. With only one 18 ticket, you can r... |
#include<iostream>
#include<vector>
#include<utility>
#define loop(i,a,b) for(int i=a;i<b;i++)
#define rep(i,a) loop(i,0,a)
using namespace std;
int tm(string s){
long long res=((s[0]-'0')*10+(s[1]-'0'))*60+(s[3]-'0')*10+(s[4]-'0');
return res;
}
int main(){
long long n,t;
cin>>n>>t;
string st[n];
string ar[n];... | ### Prompt
Generate a CPP solution to the following problem:
Problem Statement
Mr. Takatsuki, who is planning to participate in the Aizu training camp, has a poor house and does not have much money. Therefore, he is trying to save money by using the Seishun 18 Ticket. With only one 18 ticket, you can ride a local tr... |
#include<iostream>
#include<algorithm>
#include<string>
#define loop(i,a,b) for(int i=a;i<b;i++)
#define rep(i,a) loop(i,0,a)
using namespace std;
int main(){
int n,t;
cin>>n>>t;
string name1,name2;
string canstop[20];
int stoptime[20];
char c;
int h,m,ah,am;
int cnt=0;
cin>>h>>c>>m>>name1;
rep(i,n-1){
ci... | ### Prompt
Generate a CPP solution to the following problem:
Problem Statement
Mr. Takatsuki, who is planning to participate in the Aizu training camp, has a poor house and does not have much money. Therefore, he is trying to save money by using the Seishun 18 Ticket. With only one 18 ticket, you can ride a local tr... |
#include <iostream>
#include <cstdio>
using namespace std;
#define MAX 11
int main(){
int n,t;
int a[MAX],b[MAX],c[MAX],d[MAX];
char s[MAX][100],tmp[MAX][100];
char hoge[MAX][100];
scanf("%d %d",&n,&t);
for(int i=0; i<n; i++){
scanf("%d:%d %s %d:%d %s",&a[i],&b[i],s[i],&c[i],&d[i],tmp[i]);
}
int... | ### Prompt
Please create a solution in cpp to the following problem:
Problem Statement
Mr. Takatsuki, who is planning to participate in the Aizu training camp, has a poor house and does not have much money. Therefore, he is trying to save money by using the Seishun 18 Ticket. With only one 18 ticket, you can ride a ... |
#include <bits/stdc++.h>
using namespace std;
int main(){
int n,m;
cin>>n>>m;
vector <string> ans;
vector <int> num;
int pre=1e9;
for(int i=0;i<n;i++){
string a,b;
int h1,m1,h2,m2;
scanf("%d:%d",&h1,&m1);
cin>>a;
scanf("%d:%d",&h2,&m2);
cin>>b;
int res=h1*60+m1-(pre);
if(r... | ### Prompt
Please create a solution in CPP to the following problem:
Problem Statement
Mr. Takatsuki, who is planning to participate in the Aizu training camp, has a poor house and does not have much money. Therefore, he is trying to save money by using the Seishun 18 Ticket. With only one 18 ticket, you can ride a ... |
#include<iostream>
#include<algorithm>
#include<cstdio>
#include<cmath>
#include<math.h>
#include<string>
#include<string.h>
#include<stack>
#include<queue>
#include<vector>
#include<utility>
#include<set>
#include<map>
#include<stdlib.h>
#include<iomanip>
using namespace std;
#define ll long long
#define ld long do... | ### Prompt
Please provide a cpp coded solution to the problem described below:
Problem Statement
Mr. Takatsuki, who is planning to participate in the Aizu training camp, has a poor house and does not have much money. Therefore, he is trying to save money by using the Seishun 18 Ticket. With only one 18 ticket, you c... |
#include<iostream>
#include<vector>
#include<algorithm>
#include<string>
using namespace std;
typedef pair<string,int> P;
int main(void){
int n,t;
cin >> n >> t;
char ch;
vector<string>a(n),b(n);
vector<int>ha(n),hb(n),ma(n),mb(n);
for(int i=0;i<n;i++){
cin >> ha[i] >> ch >> ma[i] >> a[i];
cin... | ### Prompt
Generate a CPP solution to the following problem:
Problem Statement
Mr. Takatsuki, who is planning to participate in the Aizu training camp, has a poor house and does not have much money. Therefore, he is trying to save money by using the Seishun 18 Ticket. With only one 18 ticket, you can ride a local tr... |
#include <cstdio>
#include <iostream>
#include <string>
using namespace std;
int main(){
int n, t, m=0;
int st[10], ar[10];
string ans[10];
int anst[10];
scanf(" %d %d", &n, &t);
for(int i=0; i<n; ++i){
int a, b, c, d;
string p, q;
scanf(" %d:%d", &a, &b);
cin >> p;
scanf(" %d:%d", &c, &d);
cin ... | ### Prompt
Create a solution in cpp for the following problem:
Problem Statement
Mr. Takatsuki, who is planning to participate in the Aizu training camp, has a poor house and does not have much money. Therefore, he is trying to save money by using the Seishun 18 Ticket. With only one 18 ticket, you can ride a local ... |
#include <iostream>
#include <string>
#include <vector>
using namespace std;
class Time
{
public:
Time(int hour, int min);
public:
// return min
int operator-(const Time& right) const;
private:
int m_hour;
int m_min;
};
inline Time::Time(int hour, int min) :
m_hour(hour), m_min(min)
{
}... | ### Prompt
Your task is to create a CPP solution to the following problem:
Problem Statement
Mr. Takatsuki, who is planning to participate in the Aizu training camp, has a poor house and does not have much money. Therefore, he is trying to save money by using the Seishun 18 Ticket. With only one 18 ticket, you can r... |
// clang-format off
#include <bits/stdc++.h>
#define int long long
#define main signed main()
#define loop(i, a, n) for (int i = (a); i < (n); i++)
#define rep(i, n) loop(i, 0, n)
#define forever for (;;)
#define all(v) (v).begin(), (v).end()
#define rall(v) (v).rbegin(), (v).rend()
#define prec(n) fixed << setprecisio... | ### Prompt
Your challenge is to write a cpp solution to the following problem:
Problem Statement
Mr. Takatsuki, who is planning to participate in the Aizu training camp, has a poor house and does not have much money. Therefore, he is trying to save money by using the Seishun 18 Ticket. With only one 18 ticket, you c... |
#include <iostream>
#include <sstream>
#include <vector>
#include <string>
#include <map>
#include <set>
#include <algorithm>
#include <stack>
#include <queue>
#include <deque>
#include <cstdio>
#include <cstring>
#include <cstdlib>
#include <cmath>
#include <cassert>
#define REP(i,n) for(int i=0; i<(int)(n); ++i)
usi... | ### Prompt
Generate a cpp solution to the following problem:
Problem Statement
Mr. Takatsuki, who is planning to participate in the Aizu training camp, has a poor house and does not have much money. Therefore, he is trying to save money by using the Seishun 18 Ticket. With only one 18 ticket, you can ride a local tr... |
#include <iostream>
#include <vector>
#include <string>
using namespace std;
#define loop(i,a,b) for(int i=(a); i<(int)(b); i++)
#define rep(i,b) loop(i,0,b)
int h,m;
char c;
string sta;
int main(){
int n,t;cin>>n>>t;
cin>>h>>c>>m;
cin>>sta;
vector<int> ans_t;
vector<string> ans_sta;
rep(i,... | ### Prompt
Your challenge is to write a CPP solution to the following problem:
Problem Statement
Mr. Takatsuki, who is planning to participate in the Aizu training camp, has a poor house and does not have much money. Therefore, he is trying to save money by using the Seishun 18 Ticket. With only one 18 ticket, you c... |
#include<bits/stdc++.h>
using namespace std;
int main(){
vector<string>tt;
vector<int>t;
int a,b;
cin>>a>>b;
string c,d;
cin>>c>>d;
for(int e=0;e<a-1;e++){
string f,g;
cin>>f>>g;
int i=(f[0]-48)*600+(f[1]-48)*60+(f[3]-48)*10+(f[4]-48);
cin>>f>>g;
int j=(f[0]-48)*600+(f[1]-48)*60+(f[3]-48)*10+(f[4]-48);
if(j-i>=b... | ### Prompt
Your task is to create a Cpp solution to the following problem:
Problem Statement
Mr. Takatsuki, who is planning to participate in the Aizu training camp, has a poor house and does not have much money. Therefore, he is trying to save money by using the Seishun 18 Ticket. With only one 18 ticket, you can r... |
#include <cstdio>
#include <iostream>
#include <sstream>
#include <fstream>
#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 <cfloa... | ### Prompt
Generate a Cpp solution to the following problem:
Problem Statement
Mr. Takatsuki, who is planning to participate in the Aizu training camp, has a poor house and does not have much money. Therefore, he is trying to save money by using the Seishun 18 Ticket. With only one 18 ticket, you can ride a local tr... |
#include <cstdio>
#include <iostream>
#include <algorithm>
#include <vector>
#include <queue>
#include <functional>
#include <string>
#include <utility>
using namespace std;
using ll = long long int;
using P = pair<string, int>;
char st_name[10][51], ar_name[10][51];
int st_time[10], ar_time[10];
int main() {
int N, ... | ### Prompt
Your challenge is to write a CPP solution to the following problem:
Problem Statement
Mr. Takatsuki, who is planning to participate in the Aizu training camp, has a poor house and does not have much money. Therefore, he is trying to save money by using the Seishun 18 Ticket. With only one 18 ticket, you c... |
#include<iostream>
#include<vector>
#include<string>
#include<cstdio>
#include<algorithm>
#include<map>
using namespace std;
typedef pair<int,string> P;
int main(){
int n,t,h1,m1,h2,m2;
char s1[51],s2[51];
scanf("%d %d",&n,&t);
vector<P> p;
string o,o2;
cin >> o >> o2;
for(int i=0;i<n-1;i++){
scanf("%... | ### Prompt
Construct a CPP code solution to the problem outlined:
Problem Statement
Mr. Takatsuki, who is planning to participate in the Aizu training camp, has a poor house and does not have much money. Therefore, he is trying to save money by using the Seishun 18 Ticket. With only one 18 ticket, you can ride a loc... |
#include <cstdio>
#include <iostream>
#include <string>
#include <vector>
using namespace std;
int N, T;
int main() {
scanf("%d%d", &N, &T);
vector<pair<string, int>> result;
char st_name[52], ar_name[52];
int st_hh, st_mm, ar_hh, ar_mm;
scanf("%02d:%02d %s %02d:%02d %s", &st_hh, &st_mm, st_name, &ar_hh, &ar_m... | ### Prompt
Generate a cpp solution to the following problem:
Problem Statement
Mr. Takatsuki, who is planning to participate in the Aizu training camp, has a poor house and does not have much money. Therefore, he is trying to save money by using the Seishun 18 Ticket. With only one 18 ticket, you can ride a local tr... |
#include <iostream>
#include <cstdio>
#include <vector>
#include <string>
using namespace std;
typedef pair<int, int> P;
class Data
{
public:
string station;
P start;
P arrival;
};
class Ans
{
public:
string station;
int time;
Ans(string station, int time) : station(station), time(time){}
};
void solve()
{
int... | ### Prompt
Create a solution in CPP for the following problem:
Problem Statement
Mr. Takatsuki, who is planning to participate in the Aizu training camp, has a poor house and does not have much money. Therefore, he is trying to save money by using the Seishun 18 Ticket. With only one 18 ticket, you can ride a local ... |
#include<iostream>
using namespace std;
int main(){
int n,t,h,m,f=0,ansr[1000];
int ansh=0,ansm=0,anst;
int afh,afm;
char p;
string str[1000],ans[1000],s;
cin>>n>>t;
cin>>h>>p>>m>>str[0];
for(int i=1;i<n;i++){
cin>>h>>p>>m>>str[i]>>afh>>p>>afm>>s;
ansh=afh-h,ansm=afm-m;
anst=ansh*60+ansm... | ### Prompt
Construct a Cpp code solution to the problem outlined:
Problem Statement
Mr. Takatsuki, who is planning to participate in the Aizu training camp, has a poor house and does not have much money. Therefore, he is trying to save money by using the Seishun 18 Ticket. With only one 18 ticket, you can ride a loc... |
#include <functional>
#include <algorithm>
#include <iostream>
#include <numeric>
#include <iomanip>
#include <utility>
#include <cstdlib>
#include <sstream>
#include <bitset>
#include <vector>
#include <cstdio>
#include <ctime>
#include <queue>
#include <deque>
#include <cmath>
#include <stack>
#include <list>
#includ... | ### Prompt
Create a solution in CPP for the following problem:
Problem Statement
Mr. Takatsuki, who is planning to participate in the Aizu training camp, has a poor house and does not have much money. Therefore, he is trying to save money by using the Seishun 18 Ticket. With only one 18 ticket, you can ride a local ... |
#include<iostream>
using namespace std;
int stot(string s){
int h=0,m=0;
h = (s[0]-'0')*10 + s[1]-'0';
m = (s[3]-'0')*10 + s[4]-'0';
return h*60 + m;
}
int main(){
int n,t;
string d[10],a[10];
string name[11];
cin >> n >> t;
for(int i=0;i<n;i++){
cin >> d[i] >> name[i] >> a[i] >> name[i+1];
}... | ### Prompt
Construct a CPP code solution to the problem outlined:
Problem Statement
Mr. Takatsuki, who is planning to participate in the Aizu training camp, has a poor house and does not have much money. Therefore, he is trying to save money by using the Seishun 18 Ticket. With only one 18 ticket, you can ride a loc... |
#include <iostream>
#include <vector>
using namespace std;
int toMin(string s){
int h = (s[0] - '0') * 10 + (s[1] - '0');
int m = (s[3] - '0') * 10 + (s[4] - '0');
return h * 60 + m;
}
int n, m;
int f_tm[12], t_tm[12];
string f_nm[12], t_nm[12];
int main(){
while(cin >> n >> m){
string s;
for(int i ... | ### Prompt
Develop a solution in cpp to the problem described below:
Problem Statement
Mr. Takatsuki, who is planning to participate in the Aizu training camp, has a poor house and does not have much money. Therefore, he is trying to save money by using the Seishun 18 Ticket. With only one 18 ticket, you can ride a ... |
#include <bits/stdc++.h>
using namespace std;
#define all(c) (c).begin(),(c).end()
#define rep(i,n) for(int i=0;i<(int)(n);i++)
#define rrep(i,n) for(int i=(int)(n)-1;i>=0;i--)
#define REP(i,m,n) for(int i=(int)(m);i<(int)(n);i++)
#define iter(c) __typeof((c).begin())
#define tr(it,c) for(iter(c) it=(c).begin();it!=(c)... | ### Prompt
Please formulate a Cpp solution to the following problem:
Problem Statement
Mr. Takatsuki, who is planning to participate in the Aizu training camp, has a poor house and does not have much money. Therefore, he is trying to save money by using the Seishun 18 Ticket. With only one 18 ticket, you can ride a ... |
#include <string>
#include <iostream>
using namespace std;
int n, t, x1[15], x2[15]; string s1[15], s2[15], z;
int main() {
cin >> n >> t;
for (int i = 0; i < n; i++) {
cin >> z >> s1[i];
x1[i] = stoi(z.substr(0, 2)) * 60 + stoi(z.substr(3, 2));
cin >> z >> s2[i];
x2[i] = stoi(z.substr(0, 2)) * 60 + stoi(z.su... | ### Prompt
Please formulate a Cpp solution to the following problem:
Problem Statement
Mr. Takatsuki, who is planning to participate in the Aizu training camp, has a poor house and does not have much money. Therefore, he is trying to save money by using the Seishun 18 Ticket. With only one 18 ticket, you can ride a ... |
#include<iostream>
#include<cstdio>
#include<string>
#include<cstring>
#include<vector>
#include<set>
#include<list>
#include<queue>
#include<cmath>
#include<functional>
#include<algorithm>
#define INF (1<<29)
#define EPS 1e-10
#define rep(i,n) for(int i=0;i<(n);i++)
using namespace std;
int tominutes(string &s){
i... | ### Prompt
Develop a solution in Cpp to the problem described below:
Problem Statement
Mr. Takatsuki, who is planning to participate in the Aizu training camp, has a poor house and does not have much money. Therefore, he is trying to save money by using the Seishun 18 Ticket. With only one 18 ticket, you can ride a ... |
#include<bits/stdc++.h>
#define REP(i,s,n) for(int i=s;i<n;i++)
#define rep(i,n) REP(i,0,n)
using namespace std;
int toTime(string s) {
int h,m;
stringstream ss;
s[2] = ' ';
ss << s;
ss >> h;
ss >> m;
return h * 60 + m;
}
string input[200][4];
int main(){
int n,T;
cin >> n >> T;
typedef pair<st... | ### Prompt
Generate a cpp solution to the following problem:
Problem Statement
Mr. Takatsuki, who is planning to participate in the Aizu training camp, has a poor house and does not have much money. Therefore, he is trying to save money by using the Seishun 18 Ticket. With only one 18 ticket, you can ride a local tr... |
#include<stdio.h>
#include<string.h>
int main(){
int a,b;
scanf("%d %d",&a,&b);
int i,c,d,f,g,j=0;
char e[51]={0};
char k[51][180]={0};
int l[180]={0};
scanf("%d:%d %s",&c,&d,e);
for(i=0;i<a-1;i++){
scanf("%d:%d %s %d:%d %s",&c,&d,e,&f,&g,e);
c*=60;
f*=60;
if(f+g-c-d>=b){
j++;
... | ### Prompt
Develop a solution in cpp to the problem described below:
Problem Statement
Mr. Takatsuki, who is planning to participate in the Aizu training camp, has a poor house and does not have much money. Therefore, he is trying to save money by using the Seishun 18 Ticket. With only one 18 ticket, you can ride a ... |
//============================================================================
// Name : aoj2515.cpp
// Author : afterCmidday
// Version :
// Copyright : Your copyright notice
// Description : Hello World in C++, Ansi-style
//============================================================================... | ### Prompt
In cpp, your task is to solve the following problem:
Problem Statement
Mr. Takatsuki, who is planning to participate in the Aizu training camp, has a poor house and does not have much money. Therefore, he is trying to save money by using the Seishun 18 Ticket. With only one 18 ticket, you can ride a local... |
#include <iostream>
#include <cstdio>
#include <vector>
#include <algorithm>
using namespace std;
int readtime(string time){
int h,m;
sscanf(time.c_str(),"%02d:%02d",&h,&m);
return h*60+m;
}
int main(){
int n,t;cin>>n>>t;
vector<pair<string,int> > ans;
string st,sn,at,an;
for(int i=0;i<n;++i){
string old_at... | ### Prompt
Develop a solution in CPP to the problem described below:
Problem Statement
Mr. Takatsuki, who is planning to participate in the Aizu training camp, has a poor house and does not have much money. Therefore, he is trying to save money by using the Seishun 18 Ticket. With only one 18 ticket, you can ride a ... |
#include<iostream>
#include<sstream>
using namespace std;
int main(){
int N,T;
cin>>N>>T;
int c=0;
stringstream ss;
int l=99999;
while(N--){
int h1,m1,h2,m2;
char s1[51],s2[51];
char d1,d2;
cin>>h1>>d1>>m1>>s1>>h2>>d2>>m2>>s2;
int i=h1*60+m1-l;
if(i>=T){
c++;
ss<<s1<<' ... | ### Prompt
Generate a cpp solution to the following problem:
Problem Statement
Mr. Takatsuki, who is planning to participate in the Aizu training camp, has a poor house and does not have much money. Therefore, he is trying to save money by using the Seishun 18 Ticket. With only one 18 ticket, you can ride a local tr... |
#include<bits/stdc++.h>
#define rep(i,n)for(int i=0;i<n;i++)
using namespace std;
int main() {
int n, t; scanf("%d%d", &n, &t);
int tim;
vector<pair<string, int>>ans;
rep(i, n) {
int h1, m1, h2, m2; string s1, s2;
scanf("%d:%d", &h1, &m1); cin >> s1;
scanf("%d:%d", &h2, &m2); cin >> s2;
int tim1 = h1 * 60 ... | ### Prompt
Please create a solution in cpp to the following problem:
Problem Statement
Mr. Takatsuki, who is planning to participate in the Aizu training camp, has a poor house and does not have much money. Therefore, he is trying to save money by using the Seishun 18 Ticket. With only one 18 ticket, you can ride a ... |
#include<bits/stdc++.h>
using namespace std;
int main(){
int n, t;
cin >> n >> t;
string s[2][n];
int time[2][n];
for(int j = 0; j < n; j++){
for(int i = 0;i < 2; i++){
int a, b;
scanf("%d:%d", &a, &b);
time[i][j] = 60*a + b;
cin >> s[i][j];
}
}
int ans = 0;
vector<int> id... | ### Prompt
In cpp, your task is to solve the following problem:
Problem Statement
Mr. Takatsuki, who is planning to participate in the Aizu training camp, has a poor house and does not have much money. Therefore, he is trying to save money by using the Seishun 18 Ticket. With only one 18 ticket, you can ride a local... |
#include<iostream>
#include<vector>
using namespace std;
int calc(int h1,int m1,int h2,int m2){
return 60*(h2-h1)+(m2-m1);
}
int main(){
int n;
cin>>n;
int t;
cin>>t;
int sh[n],sm[n],eh[n],em[n];
string s[n+1];
for(int i=0;i<n;i++){
scanf(" %d:%d",&sh[i],&sm[i]);
cin>>s... | ### Prompt
Develop a solution in CPP to the problem described below:
Problem Statement
Mr. Takatsuki, who is planning to participate in the Aizu training camp, has a poor house and does not have much money. Therefore, he is trying to save money by using the Seishun 18 Ticket. With only one 18 ticket, you can ride a ... |
#include<iostream>
#include<cstdio>
#include<cstdlib>
#include<utility>
#include<vector>
using namespace std;
int timeAbs(string t1,string t2);
int main(){
vector<pair<string,int> > vec;
int ans=0;
int n,t;
cin>>n>>t;
string st_time[n],st_name[n],ar_time[n],ar_name[n];
for(int i=0;i<n;i++)
cin>>st_... | ### Prompt
Please create a solution in CPP to the following problem:
Problem Statement
Mr. Takatsuki, who is planning to participate in the Aizu training camp, has a poor house and does not have much money. Therefore, he is trying to save money by using the Seishun 18 Ticket. With only one 18 ticket, you can ride a ... |
#include<stdio.h>
#include<algorithm>
using namespace std;
char str[20][60];
int ans[20];
int t[20];
int main(){
int a,b;scanf("%d%d",&a,&b);
int last=0;
int ret=0;
for(int i=0;i<a;i++){
int p,q,r,s;
scanf("%d:%d%s%d:%d%s",&p,&q,str[i],&r,&s,str[i+1]);
p=p*60+q;
r=r*60+s;
if(i){
if(p-last>=b){
t[re... | ### Prompt
Generate a Cpp solution to the following problem:
Problem Statement
Mr. Takatsuki, who is planning to participate in the Aizu training camp, has a poor house and does not have much money. Therefore, he is trying to save money by using the Seishun 18 Ticket. With only one 18 ticket, you can ride a local tr... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.