output
stringlengths
52
181k
instruction
stringlengths
296
182k
#include <iostream> #include <algorithm> #include <cmath> #include <vector> #include <complex> #include <queue> #include <deque> #include <set> #include <map> #include <unordered_set> #include <unordered_map> #include <iomanip> #include <assert.h> #include <array> #include <cstdio> #include <cstring> #include <random> ...
### Prompt Construct a Cpp code solution to the problem outlined: Your master went to the town for a day. You could have a relaxed day without hearing his scolding. But he ordered you to make donuts dough by the evening. Loving donuts so much, he can't live without eating tens of donuts everyday. What a chore for suc...
#include<iostream> #include<vector> #include<string> #include<algorithm> #include<map> #include<set> #include<utility> #include<cmath> #include<cstring> #include<queue> #include<cstdio> #include<sstream> #include<iomanip> #define loop(i,a,b) for(int i=a;i<b;i++) #define rep(i,a) loop(i,0,a) #define pb push_back #defi...
### Prompt Your task is to create a CPP solution to the following problem: Your master went to the town for a day. You could have a relaxed day without hearing his scolding. But he ordered you to make donuts dough by the evening. Loving donuts so much, he can't live without eating tens of donuts everyday. What a chor...
#include <bits/stdc++.h> using namespace std; int main() { int N, M; while(cin >> N >> M, N || M) { vector<string> v(N); for(auto &i : v) cin >> i; string res = ""; const int dx[] = {1, 1, 1, -1, -1, -1, 0, 0}; const int dy[] = {-1, 0, 1, -1, 0, 1, -1, 1}; set<s...
### Prompt Your challenge is to write a Cpp solution to the following problem: Your master went to the town for a day. You could have a relaxed day without hearing his scolding. But he ordered you to make donuts dough by the evening. Loving donuts so much, he can't live without eating tens of donuts everyday. What a ...
#include <iostream> #include <map> #include <algorithm> #include <cstring> using namespace std; int h, w; char t[50][50]; bool used[50][50]; map<string,int> cnt; int dx[] = {-1, 0, 1, -1, 1, -1, 0, 1}; int dy[] = {-1, -1, -1, 0, 0, 1, 1, 1}; void solve(int sx, int sy){ for(int i = 0; i < 8; i++){ int x = sx; ...
### Prompt Please create a solution in Cpp to the following problem: Your master went to the town for a day. You could have a relaxed day without hearing his scolding. But he ordered you to make donuts dough by the evening. Loving donuts so much, he can't live without eating tens of donuts everyday. What a chore for ...
#include <iostream> #include <vector> #include <algorithm> #include <string> #include <sstream> #include <cstring> #include <cstdio> #include <cstdlib> #include <cmath> #include <queue> #include <stack> #include <map> #include <set> #include <numeric> #include <cctype> // BEGIN CUT HERE #ifdef _MSC_VER #include <agent...
### Prompt Please provide a cpp coded solution to the problem described below: Your master went to the town for a day. You could have a relaxed day without hearing his scolding. But he ordered you to make donuts dough by the evening. Loving donuts so much, he can't live without eating tens of donuts everyday. What a ...
#include <cstdio> #include <string> #include <algorithm> #include <set> #include <vector> using namespace std; #define REP(i,x)for(int i=0;i<x;i++) string res; int H,W,dx,dy,min_len; char s[200]; char MAP[11][22]; bool visit[20][20]; vector<string> ss; void dfs(int x,int y,int k){ if(visit[y][x]){ ss.push_back(s...
### Prompt Please create a solution in Cpp to the following problem: Your master went to the town for a day. You could have a relaxed day without hearing his scolding. But he ordered you to make donuts dough by the evening. Loving donuts so much, he can't live without eating tens of donuts everyday. What a chore for ...
#include <map> #include <vector> #include <iostream> #include <cstring> using namespace std; int m[29][29]; int main(){ string s,t; int h,w,i,j,x,y,X,Y; for(;cin>>h>>w,h;cout<<s<<endl){ vector<string>v; for(i=0;i<h;i++)cin>>s,v.push_back(s); s="0"; map<string,int>M; for(i=0;i<h;i++)for(j=0;j<w;j++)for(x=-1...
### Prompt Create a solution in Cpp for the following problem: Your master went to the town for a day. You could have a relaxed day without hearing his scolding. But he ordered you to make donuts dough by the evening. Loving donuts so much, he can't live without eating tens of donuts everyday. What a chore for such a...
#include <bits/stdc++.h> using namespace std; constexpr int di8[] = {0, 1, 1, 1, 0, -1, -1, -1}; constexpr int dj8[] = {1, 1, 0, -1, -1, -1, 0, 1}; int solve(){ int h, w; cin >> h >> w; if(h == 0) return 1; vector<string> s(h); for(int i=0;i<h;i++){ cin >> s[i]; } map<string,int> c...
### Prompt Construct a CPP code solution to the problem outlined: Your master went to the town for a day. You could have a relaxed day without hearing his scolding. But he ordered you to make donuts dough by the evening. Loving donuts so much, he can't live without eating tens of donuts everyday. What a chore for suc...
#include <iostream> #include <map> #include <string> using namespace std; int main(){ //?????¶????????§?§£????????¨????????? int H, W; while(cin >> H >> W, H||W){ string pattern[H]; for(int i = 0; i < H; ++i){ cin >> pattern[i]; } int ng = H*W + 1, ok = 2; int dx[] = {1,0,-1,0,1,1,-1,-1}...
### Prompt Create a solution in CPP for the following problem: Your master went to the town for a day. You could have a relaxed day without hearing his scolding. But he ordered you to make donuts dough by the evening. Loving donuts so much, he can't live without eating tens of donuts everyday. What a chore for such a...
#include<bits/stdc++.h> using namespace std; int W, H; string donuts[10]; int dx[8] = {-1, -1, -1, 0, 0, 1, 1, 1}; int dy[8] = {-1, 0, 1, -1,1, -1,0, 1}; string ansstr; set<string> strs; int flgs[100][100]; void dfs(int x, int y, int d, string cur){ x = (x + W) % W; y = (y + H) % H; if(flgs[y][x]) return; str...
### Prompt Construct a Cpp code solution to the problem outlined: Your master went to the town for a day. You could have a relaxed day without hearing his scolding. But he ordered you to make donuts dough by the evening. Loving donuts so much, he can't live without eating tens of donuts everyday. What a chore for suc...
#include<iostream> #include<set> #include<vector> using namespace std; #define rep(i, n) for (int i = 0; i < int(n); ++i) int dx[] = {-1, -1, -1, 0, 0, 1, 1, 1}; int dy[] = {-1, 0, 1, -1, 1, -1, 0, 1}; int main() { int h, w; while (true) { set<string> s; vector<string> vs; string res; cin >> h >...
### Prompt Construct a CPP code solution to the problem outlined: Your master went to the town for a day. You could have a relaxed day without hearing his scolding. But he ordered you to make donuts dough by the evening. Loving donuts so much, he can't live without eating tens of donuts everyday. What a chore for suc...
//29 #include<iostream> #include<string> #include<set> using namespace std; int main(){ for(int h,w;cin>>h>>w,h|w;){ char g[10][21]; for(int i=0;i<h;i++){ cin>>g[i]; } set<string> s; string t; for(int i=0;i<h;i++){ for(int j=0;j<w;j++){ for(int k=-1;k<=1;k++){ for(int l=-1;l<...
### Prompt Your challenge is to write a Cpp solution to the following problem: Your master went to the town for a day. You could have a relaxed day without hearing his scolding. But he ordered you to make donuts dough by the evening. Loving donuts so much, he can't live without eating tens of donuts everyday. What a ...
#include <iostream> #include <map> using namespace std; #define REP(i,n) for (int i=0; i<n; i++) int main(){ while (1){ int w, h; char mp[20][30]; const int diff[] = {1, 0, -1, 0, 1, 1, -1, -1, 1}; map<string, int> spells; string input, ans=""; cin >> h >> w; if (w==0 && h==0){ ...
### Prompt Please create a solution in cpp to the following problem: Your master went to the town for a day. You could have a relaxed day without hearing his scolding. But he ordered you to make donuts dough by the evening. Loving donuts so much, he can't live without eating tens of donuts everyday. What a chore for ...
#define _USE_MATH_DEFINES #include <algorithm> #include <cstdio> #include <functional> #include <iostream> #include <cfloat> #include <climits> #include <cstring> #include <cmath> #include <map> #include <queue> #include <set> #include <sstream> #include <stack> #include <string> #include <time.h> #include <vector> usi...
### Prompt Generate a CPP solution to the following problem: Your master went to the town for a day. You could have a relaxed day without hearing his scolding. But he ordered you to make donuts dough by the evening. Loving donuts so much, he can't live without eating tens of donuts everyday. What a chore for such a b...
#include <iostream> #include <algorithm> #include <set> using namespace std; typedef unsigned long long ulli; const int MAXH = 10; const int MAXW = 20; const ulli mod = 100000007ULL; int H, W; char G[MAXH][MAXW]; int cnt; int vis[MAXH][MAXW]; int main() { while(cin >> H >> W && (H|W)) { for(int i = 0; i < H; +...
### Prompt Develop a solution in Cpp to the problem described below: Your master went to the town for a day. You could have a relaxed day without hearing his scolding. But he ordered you to make donuts dough by the evening. Loving donuts so much, he can't live without eating tens of donuts everyday. What a chore for ...
#include <iostream> #include <map> #include <vector> #include <string> #include <set> #include <algorithm> using namespace std; // w := 幅, h := 高さ, len := 最も長い文字列の長さ int w, h, len; // memo[y][x] := (x,y) を調べたかどうか bool memo[20][20]; // S := 登場した文字列 set<string> S; // ans := 解の候補 vector<string> ans; int dx[8] = {-1,-1,-...
### Prompt Your challenge is to write a CPP solution to the following problem: Your master went to the town for a day. You could have a relaxed day without hearing his scolding. But he ordered you to make donuts dough by the evening. Loving donuts so much, he can't live without eating tens of donuts everyday. What a ...
#include <cstdio> #include <cstring> #include <string> #include <iostream> #include <map> #include <vector> #include <algorithm> using namespace std; int h,w; string fie[11]; int dx[8]={1,0,-1,0,1,1,-1,-1}; int dy[8]={0,1,0,-1,1,-1,1,-1}; map<string,int> cnt; bool used[11][21]; vector<string> index2; void dfs(int y,i...
### Prompt Create a solution in Cpp for the following problem: Your master went to the town for a day. You could have a relaxed day without hearing his scolding. But he ordered you to make donuts dough by the evening. Loving donuts so much, he can't live without eating tens of donuts everyday. What a chore for such a...
#include <bits/stdc++.h> using namespace std; #define rep(i,x,y) for(int i=(x);i<(y);++i) #define debug(x) #x << "=" << (x) #ifdef DEBUG #define _GLIBCXX_DEBUG #define print(x) std::cerr << debug(x) << " (L:" << __LINE__ << ")" << std::endl #else #define print(x) #endif const int inf=1e9; const int64_t inf64=1e18; c...
### Prompt Please formulate a Cpp solution to the following problem: Your master went to the town for a day. You could have a relaxed day without hearing his scolding. But he ordered you to make donuts dough by the evening. Loving donuts so much, he can't live without eating tens of donuts everyday. What a chore for ...
#include<cstdio> #include<cstring> #include<iostream> #include<string> #include<map> using namespace std; int W,H,i,j,k,l,p,m[3]={0,1,-1},h,w,sh,sw; char D[10][21]; string T,R; map<string,int> S; int main() { for(;scanf("%d%d\n",&H,&W),H;) { S.clear(); R="0"; for(i=k=0,l=1;i<H;i++)gets(D[i]); for(sh=0;sh<H;s...
### Prompt Develop a solution in cpp to the problem described below: Your master went to the town for a day. You could have a relaxed day without hearing his scolding. But he ordered you to make donuts dough by the evening. Loving donuts so much, he can't live without eating tens of donuts everyday. What a chore for ...
#include<iostream> #include<string> #include<vector> #include<algorithm> using namespace std; vector<string>vec; char c[20][20]; int H, W; bool used[20][20]; int dx[8] = { 1,1,1,0,-1,-1,-1,0 }; int dy[8] = { -1,0,1,1,1,0,-1,-1 }; int main() { while (true) { cin >> H >> W; vec.clear(); if (H == 0)break; for (int i ...
### Prompt Please create a solution in CPP to the following problem: Your master went to the town for a day. You could have a relaxed day without hearing his scolding. But he ordered you to make donuts dough by the evening. Loving donuts so much, he can't live without eating tens of donuts everyday. What a chore for ...
#include <iostream> #include <string> #include <vector> #include <algorithm> #include <set> #define REP(i,a,b) for (int i = (a); i < (b); i++) #define rep(i,a) REP(i,0,a) using namespace std; int H, W; int dw[] = {1,1,0,-1,-1,-1,0,1}; int dh[] = {0,1,1,1,0,-1,-1,-1}; int main(void){ while (cin >> H >> W && H) { ...
### Prompt Please create a solution in cpp to the following problem: Your master went to the town for a day. You could have a relaxed day without hearing his scolding. But he ordered you to make donuts dough by the evening. Loving donuts so much, he can't live without eating tens of donuts everyday. What a chore for ...
#include <iostream> #include <vector> #include <algorithm> #include <cmath> #include <map> #include <string> #include <sstream> using namespace std; int main() { while(1) { int nb_lignes,nb_colonnes; cin>>nb_lignes>>nb_colonnes; if(nb_lignes==0) { break; } ...
### Prompt Create a solution in Cpp for the following problem: Your master went to the town for a day. You could have a relaxed day without hearing his scolding. But he ordered you to make donuts dough by the evening. Loving donuts so much, he can't live without eating tens of donuts everyday. What a chore for such a...
#include<iostream> #include<map> #include<vector> using namespace std; int gcd(int a,int b){return b?gcd(b,a%b):a;} int lcm(int a,int b){return a/gcd(a,b)*b;} int main(){ int h,w; string g[10]; int dx[] = {0,1,1,1,0,-1,-1,-1},dy[] ={-1,-1,0,1,1,1,0,-1}; int lm; while(cin>> h >> w &&(h||w)){ for(int i=0...
### Prompt Please provide a CPP coded solution to the problem described below: Your master went to the town for a day. You could have a relaxed day without hearing his scolding. But he ordered you to make donuts dough by the evening. Loving donuts so much, he can't live without eating tens of donuts everyday. What a ...
#include <algorithm> #include <cmath> #include <climits> #include <cstdio> #include <cstdlib> #include <cstring> #include <fstream> #include <iostream> #include <list> #include <map> #include <queue> #include <set> #include <sstream> #include <stack> #include <string> #include <vector> #include <cassert> #include <func...
### Prompt Your task is to create a cpp solution to the following problem: Your master went to the town for a day. You could have a relaxed day without hearing his scolding. But he ordered you to make donuts dough by the evening. Loving donuts so much, he can't live without eating tens of donuts everyday. What a chor...
#include <iostream> #include <vector> #include <algorithm> #include <string> #include <map> using namespace std; const int dy[] = {1, -1, 0, 0, 1, -1, 1, -1}; const int dx[] = {0, 0, 1, -1, 1, -1, -1, 1}; int h, w, sy, sx, max_size; map<string, int> mp; string table[15]; string str; void solve(char ch) { for(int i = 0...
### Prompt In Cpp, your task is to solve the following problem: Your master went to the town for a day. You could have a relaxed day without hearing his scolding. But he ordered you to make donuts dough by the evening. Loving donuts so much, he can't live without eating tens of donuts everyday. What a chore for such ...
#include "bits/stdc++.h" #define REP(i,n) for(ll i=0;i<n;++i) #define RREP(i,n) for(ll i=n-1;i>=0;--i) #define FOR(i,m,n) for(ll i=m;i<n;++i) #define RFOR(i,m,n) for(ll i=n-1;i>=m;--i) #define ALL(v) (v).begin(),(v).end() #define PB(a) push_back(a) #define UNIQUE(v) v.erase(unique(ALL(v)),v.end()); #define DUMP(v) REP...
### Prompt Your task is to create a CPP solution to the following problem: Your master went to the town for a day. You could have a relaxed day without hearing his scolding. But he ordered you to make donuts dough by the evening. Loving donuts so much, he can't live without eating tens of donuts everyday. What a chor...
#include <iostream> #include <iomanip> #include <cstdio> #include <cmath> #include <cstdlib> #include <map> #include <set> #include <list> #include <queue> #include <deque> #include <stack> #include <vector> #include <algorithm> #include <functional> #include <cstring> #include <string> #include <sstream> #include <bit...
### Prompt Please formulate a Cpp solution to the following problem: Your master went to the town for a day. You could have a relaxed day without hearing his scolding. But he ordered you to make donuts dough by the evening. Loving donuts so much, he can't live without eating tens of donuts everyday. What a chore for ...
#include <iostream> #include <vector> #include <string> #include <cstring> #include <algorithm> #include <sstream> #include <map> #include <set> #define REP(i,k,n) for(int i=k;i<n;i++) #define rep(i,n) for(int i=0;i<n;i++) #define INF 1<<30 #define pb push_back #define mp make_pair using namespace std; typedef long l...
### Prompt Create a solution in cpp for the following problem: Your master went to the town for a day. You could have a relaxed day without hearing his scolding. But he ordered you to make donuts dough by the evening. Loving donuts so much, he can't live without eating tens of donuts everyday. What a chore for such a...
#include <bits/stdc++.h> typedef long long LL; #define SORT(c) sort((c).begin(),(c).end()) #define FOR(i,a,b) for(int i=(a);i<(b);++i) #define REP(i,n) FOR(i,0,n) using namespace std; int main(void) { for(;;){ int h,w; cin >> h >> w; if(!h) return 0; vector<string> f(h); REP(i,h) cin >> f[i]; ...
### Prompt Develop a solution in CPP to the problem described below: Your master went to the town for a day. You could have a relaxed day without hearing his scolding. But he ordered you to make donuts dough by the evening. Loving donuts so much, he can't live without eating tens of donuts everyday. What a chore for ...
#include <bits/stdc++.h> using namespace std; typedef long long ll; typedef pair<int, int> pii; pii d[8] = {{-1, -1}, {-1, 0}, {-1, 1}, {0, -1}, {0, 1}, {1, -1}, {1, 0}, {1, 1}}; int main() { cin.tie(0); ios_base::sync_with_stdio(false); int h, w; while (cin >> h >> w, h) { vector<string> s(h); fo...
### Prompt Please formulate a CPP solution to the following problem: Your master went to the town for a day. You could have a relaxed day without hearing his scolding. But he ordered you to make donuts dough by the evening. Loving donuts so much, he can't live without eating tens of donuts everyday. What a chore for ...
#include <bits/stdc++.h> using namespace std; #define fi first #define se second #define repl(i,a,b) for(int i=(int)(a);i<(int)(b);i++) #define rep(i,n) repl(i,0,n) #define each(itr,v) for(auto itr:v) #define pb(s) push_back(s) #define mp(a,b) make_pair(a,b) #define all(x) (x).begin(),(x).end() #define dbg(x) cout<<#x...
### Prompt Develop a solution in cpp to the problem described below: Your master went to the town for a day. You could have a relaxed day without hearing his scolding. But he ordered you to make donuts dough by the evening. Loving donuts so much, he can't live without eating tens of donuts everyday. What a chore for ...
#define _USE_MATH_DEFINES #define INF 0x3f3f3f3f #include <cstdio> #include <iostream> #include <sstream> #include <cmath> #include <cstdlib> #include <algorithm> #include <queue> #include <stack> #include <limits> #include <map> #include <string> #include <cstring> #include <set> #include <deque> #incl...
### Prompt Construct a Cpp code solution to the problem outlined: Your master went to the town for a day. You could have a relaxed day without hearing his scolding. But he ordered you to make donuts dough by the evening. Loving donuts so much, he can't live without eating tens of donuts everyday. What a chore for suc...
#include <iostream> #include <map> using namespace std; int main(){ int h,w; while(cin>>h>>w,h){ char D[h][w]; for(int i=0;i<h;i++){ for(int j=0;j<w;j++){ cin>>D[i][j]; } } map<string,int> M; for(int i=0;i<h;i++){ for(i...
### Prompt In cpp, your task is to solve the following problem: Your master went to the town for a day. You could have a relaxed day without hearing his scolding. But he ordered you to make donuts dough by the evening. Loving donuts so much, he can't live without eating tens of donuts everyday. What a chore for such ...
#include <bits/stdc++.h> using namespace std; #define for_(i,a,b) for(int i=a;i<b;++i) #define allof(a) a.begin(),a.end() #define minit(a,b) memset(a,b,sizeof(a)) typedef long long ll; typedef pair<int, int> pii; struct Spell { int size; string s; Spell(int _size, string _s) : size(_size), s(_s) {} }; bool operato...
### Prompt Please provide a CPP coded solution to the problem described below: Your master went to the town for a day. You could have a relaxed day without hearing his scolding. But he ordered you to make donuts dough by the evening. Loving donuts so much, he can't live without eating tens of donuts everyday. What a ...
#include <vector> #include <list> #include <map> #include <set> #include <stack> #include <queue> #include <deque> #include <algorithm> #include <utility> #include <functional> #include <sstream> #include <iostream> #include <cstdio> #include <cmath> #include <cstdlib> #include <cctype> #include <string> #include <cstr...
### Prompt Develop a solution in cpp to the problem described below: Your master went to the town for a day. You could have a relaxed day without hearing his scolding. But he ordered you to make donuts dough by the evening. Loving donuts so much, he can't live without eating tens of donuts everyday. What a chore for ...
#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> //C++11 #if __cplusplus == 201103L #include <tuple> #endif using na...
### Prompt In Cpp, your task is to solve the following problem: Your master went to the town for a day. You could have a relaxed day without hearing his scolding. But he ordered you to make donuts dough by the evening. Loving donuts so much, he can't live without eating tens of donuts everyday. What a chore for such ...
#include <vector> #include <iostream> #include <map> #include <algorithm> #include <stack> using namespace std; int h, w; string board[20]; const int dx[] = {0, 1, 1, 1, 0, -1, -1, -1}; const int dy[] = {-1, -1, 0, 1, 1, 1, 0, -1}; void Solve() { map<string, int> memo; string res; for (int i = 0; i < h...
### Prompt Please formulate a CPP solution to the following problem: Your master went to the town for a day. You could have a relaxed day without hearing his scolding. But he ordered you to make donuts dough by the evening. Loving donuts so much, he can't live without eating tens of donuts everyday. What a chore for ...
#include<bits/stdc++.h> using namespace std; void reg(int& x,int m){ x%=m; x+=m; x%=m; return; } int main(){ int h,w; while(cin>>h>>w,h){ vector<string> s(h); for(int i=0;i<h;i++) cin>>s[i]; vector<int> dh={1,-1,0,0,1,1,-1,-1}; vector<int> dw={0,0,1,-1,1,-1,1,-1}; map<string,int> dic; ...
### Prompt In cpp, your task is to solve the following problem: Your master went to the town for a day. You could have a relaxed day without hearing his scolding. But he ordered you to make donuts dough by the evening. Loving donuts so much, he can't live without eating tens of donuts everyday. What a chore for such ...
#include<iostream> #include<vector> #include<algorithm> #include<set> using namespace std; #define rep(i,n) for(int i=0;i<(n);i++) int main(){ while(true){ int h, w; cin>> h>> w; if(h==0 && w==0) break; vector<string> a(h); rep(i, h) cin>> a[i]; string best=""; set<string> dict; const i...
### Prompt Your challenge is to write a CPP solution to the following problem: Your master went to the town for a day. You could have a relaxed day without hearing his scolding. But he ordered you to make donuts dough by the evening. Loving donuts so much, he can't live without eating tens of donuts everyday. What a ...
#include "bits/stdc++.h" using namespace std; #define ll long long //http://judge.u-aizu.ac.jp/onlinejudge/description.jsp?id=1316 int h, w; int dy[8] = { -1, -1, -1, 0, 0, 1, 1, 1 }; int dx[8] = { -1, 0, 1, -1, 1, -1, 0, 1 }; set<string> Set; int Maxlen = 0; string ans; vector<string> donut; vector<vector<int>> usa...
### Prompt In CPP, your task is to solve the following problem: Your master went to the town for a day. You could have a relaxed day without hearing his scolding. But he ordered you to make donuts dough by the evening. Loving donuts so much, he can't live without eating tens of donuts everyday. What a chore for such ...
#include <iostream> #include <string> #include <algorithm> #include <vector> #include <utility> #include <cstring> #include <map> using namespace std; #define rep(i,n) for(int i=0; i<n; i++) typedef long long ll; int main() { int h, w; while(cin >> h >> w, h || w) { vector<string> in(h); rep(y,h) { cin >> in...
### Prompt Generate a Cpp solution to the following problem: Your master went to the town for a day. You could have a relaxed day without hearing his scolding. But he ordered you to make donuts dough by the evening. Loving donuts so much, he can't live without eating tens of donuts everyday. What a chore for such a b...
#include <bits/stdc++.h> #define rep(i, a, n) for(int i = a; i < n; i++) #define repb(i, a, b) for(int i = a; i >= b; i--) #define all(a) a.begin(), a.end() #define o(a) cout << a << endl #define int long long #define first fi #define second se using namespace std; typedef pair<int, int> P; int dy[8] = {1, 1, 1, 0, 0,...
### Prompt Please formulate a Cpp solution to the following problem: Your master went to the town for a day. You could have a relaxed day without hearing his scolding. But he ordered you to make donuts dough by the evening. Loving donuts so much, he can't live without eating tens of donuts everyday. What a chore for ...
#include <bits/stdc++.h> using namespace std; #define REP(i, s, e) for(int i = (int)(s); i < (int)(e); ++i) #define rep(i, n) REP(i, 0, n) int main() { int h, w; while(cin >> h >> w) { if(h == 0 && w == 0) break; vector<string> s(h); rep(i, h) cin >> s[i]; map<string, int> mp; rep(i, h) rep(j, w...
### Prompt Create a solution in cpp for the following problem: Your master went to the town for a day. You could have a relaxed day without hearing his scolding. But he ordered you to make donuts dough by the evening. Loving donuts so much, he can't live without eating tens of donuts everyday. What a chore for such a...
#include <iostream> #include <algorithm> #include <string> #include <vector> using namespace std; int main() { int H, W; while (cin >> H >> W, H) { string field[10]; for (int i = 0; i < H; i++) { cin >> field[i]; } vector<string> cand; for (int y = 0; y < H...
### Prompt Your task is to create a Cpp solution to the following problem: Your master went to the town for a day. You could have a relaxed day without hearing his scolding. But he ordered you to make donuts dough by the evening. Loving donuts so much, he can't live without eating tens of donuts everyday. What a chor...
#include <cstdio> #include <cstring> #include <algorithm> using namespace std; const int N = 310; const int dx[] = {0, 1, 0, -1, 1, 1, -1, -1}; const int dy[] = {1, 0, -1, 0, 1, -1, 1, -1}; int ch[400000][26]; int sz; char mz[22][22]; char str[N], ans[N]; int la; int n, m; void getstr(int sx, int sy, int d, char *s)...
### Prompt Generate a cpp solution to the following problem: Your master went to the town for a day. You could have a relaxed day without hearing his scolding. But he ordered you to make donuts dough by the evening. Loving donuts so much, he can't live without eating tens of donuts everyday. What a chore for such a b...
#include <iostream> #include <vector> #include <string> #include <set> using namespace std; const int dx[] = { -1, 0, 1, 1, 1, 0, -1, -1 }; const int dy[] = { -1, -1, -1, 0, 1, 1, 1, 0 }; int main(){ while(true){ int w, h; cin >> h >> w; if(h == 0 && w == 0){ break; } vector<string> v(h); for(int i = 0; i...
### Prompt In CPP, your task is to solve the following problem: Your master went to the town for a day. You could have a relaxed day without hearing his scolding. But he ordered you to make donuts dough by the evening. Loving donuts so much, he can't live without eating tens of donuts everyday. What a chore for such ...
#include<iostream> #include<vector> #include<algorithm> #include<cstring> using namespace std; const int MAXH = 10; const int MAXW = 20; int W,H; char field[MAXH][MAXW]; bool come[MAXH][MAXW]; int dx[] = {0,1,0,-1,1,1,-1,-1}; int dy[] = {1,0,-1,0,1,-1,1,-1}; void input(){ for(int i = 0; i < H; i++) for(int ...
### Prompt Please create a solution in cpp to the following problem: Your master went to the town for a day. You could have a relaxed day without hearing his scolding. But he ordered you to make donuts dough by the evening. Loving donuts so much, he can't live without eating tens of donuts everyday. What a chore for ...
#include <bits/stdc++.h> using namespace std; template<typename T1,typename T2> inline void chmin(T1 &a,T2 b){if(a>b) a=b;} template<typename T1,typename T2> inline void chmax(T1 &a,T2 b){if(a<b) a=b;} using ll = long long; const char newl = '\n'; #define var auto void solver(int h, int w) { vector< vector< char > >...
### Prompt Develop a solution in Cpp to the problem described below: Your master went to the town for a day. You could have a relaxed day without hearing his scolding. But he ordered you to make donuts dough by the evening. Loving donuts so much, he can't live without eating tens of donuts everyday. What a chore for ...
#include<map> #include<string> #include<cstdio> #define rep(i,n) for(int i=0;i<(n);i++) using namespace std; const int dx[]={1,1,0,-1,-1,-1,0,1},dy[]={0,-1,-1,-1,0,1,1,1}; int main(){ for(int h,w;scanf("%d%d",&h,&w),h;){ char D[10][21]; rep(i,h) scanf("%s",D[i]); map<string,int> f; rep(i,h) rep(j,w) rep(k...
### Prompt Please create a solution in Cpp to the following problem: Your master went to the town for a day. You could have a relaxed day without hearing his scolding. But he ordered you to make donuts dough by the evening. Loving donuts so much, he can't live without eating tens of donuts everyday. What a chore for ...
#include <bits/stdc++.h> using namespace std; #define int long long // <-----!!!!!!!!!!!!!!!!!!! #define rep(i,n) for (int i=0;i<(n);i++) #define rep2(i,a,b) for (int i=(a);i<(b);i++) #define rrep(i,n) for (int i=(n)-1;i>=0;i--) #define rrep2(i,a,b) for (int i=(b)-1;i>=(a);i--) #define all(a) (a).begin(),(a).end() ...
### Prompt Construct a CPP code solution to the problem outlined: Your master went to the town for a day. You could have a relaxed day without hearing his scolding. But he ordered you to make donuts dough by the evening. Loving donuts so much, he can't live without eating tens of donuts everyday. What a chore for suc...
#include <string> #include <vector> #include <iostream> #include <algorithm> using namespace std; int H, W; string s[11]; int main() { while (cin >> H >> W, H | W) { for (int i = 0; i < H; i++) cin >> s[i]; vector<string> res; for (int i = 0; i < H; i++) { for (int j = 0; j < W; j++) { for (int dy = -1; d...
### Prompt Your challenge is to write a CPP solution to the following problem: Your master went to the town for a day. You could have a relaxed day without hearing his scolding. But he ordered you to make donuts dough by the evening. Loving donuts so much, he can't live without eating tens of donuts everyday. What a ...
#include<iostream> #include<cmath> #include<cstdio> #include<algorithm> #include<vector> #include<cstring> #include<queue> #include<stack> using namespace std; #define INF 999999999 #define REP(i,n) for(int i=0; i<(int)(n); i++) vector<string> donut(10); vector<string> lis(200); int main(){ int i, j, w, h; int d[...
### Prompt Please create a solution in CPP to the following problem: Your master went to the town for a day. You could have a relaxed day without hearing his scolding. But he ordered you to make donuts dough by the evening. Loving donuts so much, he can't live without eating tens of donuts everyday. What a chore for ...
#include <iostream> #include <cstdio> #include <vector> #include <set> #include <map> #include <queue> #include <deque> #include <stack> #include <algorithm> #include <cstring> #include <functional> #include <cmath> using namespace std; #define rep(i,n) for(int i=0;i<(n);++i) #define rep1(i,n) for(int i=1;i<=(n);++i) #...
### Prompt Please create a solution in Cpp to the following problem: Your master went to the town for a day. You could have a relaxed day without hearing his scolding. But he ordered you to make donuts dough by the evening. Loving donuts so much, he can't live without eating tens of donuts everyday. What a chore for ...
#include <bits/stdc++.h> using namespace std; int H,W; bool visited[25][25]; char field[25][25]; map<string,int> mp; const int dx[] = {-1,-1,-1,0,0,1,1,1}; const int dy[] = {-1,0,1,-1,1,-1,0,1}; void rec(int x,int y,int d,string s){ if(visited[y][x]) return; visited[y][x] = true; int nx = (x + dx[d] +...
### Prompt Please formulate a cpp solution to the following problem: Your master went to the town for a day. You could have a relaxed day without hearing his scolding. But he ordered you to make donuts dough by the evening. Loving donuts so much, he can't live without eating tens of donuts everyday. What a chore for ...
#include <iostream> #include <cstdio> #include <vector> #include <string> #include <set> using namespace std; int dy[8] = { 0, 1, 1, 1, 0,-1,-1,-1}; int dx[8] = { 1, 1, 0,-1,-1,-1, 0, 1}; int main(void){ int h, w; while (cin>>h>>w && h) { vector<string> s(h); for (int i = 0; i < h; i++) cin >...
### Prompt Develop a solution in cpp to the problem described below: Your master went to the town for a day. You could have a relaxed day without hearing his scolding. But he ordered you to make donuts dough by the evening. Loving donuts so much, he can't live without eating tens of donuts everyday. What a chore for ...
#include <iostream> #include <vector> #include <string> #include <map> using namespace std; int dx[8] = {0,1,1,1,0,-1,-1,-1}; int dy[8] = {1,1,0,-1,-1,-1,0,1}; int main(){ int h,w; while(cin>>h>>w,h){ vector<string> s(h); for(int i = 0;i < h;i++){ cin>>s[i]; } map<string,int> mp; for(int i...
### Prompt Please create a solution in CPP to the following problem: Your master went to the town for a day. You could have a relaxed day without hearing his scolding. But he ordered you to make donuts dough by the evening. Loving donuts so much, he can't live without eating tens of donuts everyday. What a chore for ...
#include <bits/stdc++.h> using namespace std; int H,W; bool visited[25][25]; char field[25][25]; map<string,int> mp; const int dx[] = {-1,-1,-1,0,0,1,1,1}; const int dy[] = {-1,0,1,-1,1,-1,0,1}; void rec(int x,int y,int d,string s){ if(visited[y][x]){ return; } visited[y][x] = true; int nx = (x + dx[d] + W) % ...
### Prompt Generate a cpp solution to the following problem: Your master went to the town for a day. You could have a relaxed day without hearing his scolding. But he ordered you to make donuts dough by the evening. Loving donuts so much, he can't live without eating tens of donuts everyday. What a chore for such a b...
#include <bits/stdc++.h> using namespace std; #define all(c) (c).begin(),(c).end() #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 rep(i,n) REP(i,0,n) #define iter(c) __typeof((c).begin()) #define tr(it,c) for(iter(c) it=(c).begin();it!=(c).end();it++) #def...
### Prompt Your challenge is to write a cpp solution to the following problem: Your master went to the town for a day. You could have a relaxed day without hearing his scolding. But he ordered you to make donuts dough by the evening. Loving donuts so much, he can't live without eating tens of donuts everyday. What a ...
#include <iostream> #include <algorithm> #include <vector> #include <stack> #include <queue> #include <string> #include <set> #include <map> #include <list> #include <cstdlib> #include <cstring> #include <ctime> #include <cstdio> #include <cmath> #include <functional> using namespace std; #define PQ priority_queue #d...
### Prompt Create a solution in Cpp for the following problem: Your master went to the town for a day. You could have a relaxed day without hearing his scolding. But he ordered you to make donuts dough by the evening. Loving donuts so much, he can't live without eating tens of donuts everyday. What a chore for such a...
#include <bits/stdc++.h> using namespace std; typedef long long ll; #define rep(i,n) for(int (i)=0;(i)<(int)(n);++(i)) #define each(itr,c) for(__typeof(c.begin()) itr=c.begin(); itr!=c.end(); ++itr) #define all(x) (x).begin(),(x).end() #define mp make_pair #define pb push_back #define fi first #define se second int m...
### Prompt In Cpp, your task is to solve the following problem: Your master went to the town for a day. You could have a relaxed day without hearing his scolding. But he ordered you to make donuts dough by the evening. Loving donuts so much, he can't live without eating tens of donuts everyday. What a chore for such ...
#include <iostream> #include <string> #include <stdio.h> #include <set> using namespace std; #define dirmax 8 int l[2]; int dir[8][2] = { {0,1}, {1,0}, {-1,0}, {0,-1}, {1,1}, {-1,1}, {1,-1}, {-1,-1} }; string ans; void search( set<string> *v, int pos[2] , char ch[10][20]){ for(int i = 0; i < dirmax; i++) { strin...
### Prompt Your challenge is to write a CPP solution to the following problem: Your master went to the town for a day. You could have a relaxed day without hearing his scolding. But he ordered you to make donuts dough by the evening. Loving donuts so much, he can't live without eating tens of donuts everyday. What a ...
#include <iostream> #include <vector> #include <string> #include <map> #include <algorithm> #define REP(i,n) for(int i=0;i<(int)(n);i++) using namespace std; int main() { while(1) { int h,w; cin>>h>>w; if(!h)break; vector<string> t(h); REP(i,h)cin>>t[i]; vector<string> alls; REP(i,h)REP...
### Prompt Create a solution in CPP for the following problem: Your master went to the town for a day. You could have a relaxed day without hearing his scolding. But he ordered you to make donuts dough by the evening. Loving donuts so much, he can't live without eating tens of donuts everyday. What a chore for such a...
#include <cstdio> #include <string> #include <map> using namespace std; int h, w; char str[32][32]; int dy[] = {0, 1, 0, -1, 1, -1, 1, -1}; int dx[] = {1, 0, -1, 0, 1, 1, -1, -1}; void generate(int sy, int sx, map<string, int> &rec) { char tmp[2] = {0, 0}; for (int i = 0; i < 8; i++){ tmp[0] = str[sy][sx]; ...
### Prompt Please formulate a CPP solution to the following problem: Your master went to the town for a day. You could have a relaxed day without hearing his scolding. But he ordered you to make donuts dough by the evening. Loving donuts so much, he can't live without eating tens of donuts everyday. What a chore for ...
#include <iostream> #include <algorithm> #include <string> #include <vector> using namespace std; int H, W; char F[10][21]; string get(int y1, int x1, int y2, int x2, int d1, int d2) { static int dy[] = { 0, -1, -1, -1, 0, 1, 1, 1 }; static int dx[] = { 1, 1, 0, -1, -1, -1, 0, 1 }; string tmp; int sy1 = y1; ...
### Prompt Please create a solution in Cpp to the following problem: Your master went to the town for a day. You could have a relaxed day without hearing his scolding. But he ordered you to make donuts dough by the evening. Loving donuts so much, he can't live without eating tens of donuts everyday. What a chore for ...
#include <bits/stdc++.h> using namespace std; vector<int> dy = {1, 1, 0, -1, -1, -1, 0, 1}; vector<int> dx = {0, 1, 1, 1, 0, -1, -1, -1}; void spell(map<string, int> &mp, vector<vector<char>> &c, int y, int x, int d){ int h = c.size(); int w = c[0].size(); string S; int y2 = y; int x2 = x; while (1){ S ...
### Prompt Please formulate a CPP solution to the following problem: Your master went to the town for a day. You could have a relaxed day without hearing his scolding. But he ordered you to make donuts dough by the evening. Loving donuts so much, he can't live without eating tens of donuts everyday. What a chore for ...
#include<string> #include<vector> #include<algorithm> #include<stdio.h> using namespace std; char str[10][21]; int dx[]={1,1,1,0,0,-1,-1,-1}; int dy[]={1,0,-1,1,-1,1,0,-1}; vector<string> V; int main(){ int a,b; while(scanf("%d%d",&a,&b),a){ V.clear(); for(int i=0;i<a;i++)scanf("%s",str[i]); for(int i=0;i<a;i++...
### Prompt Please create a solution in CPP to the following problem: Your master went to the town for a day. You could have a relaxed day without hearing his scolding. But he ordered you to make donuts dough by the evening. Loving donuts so much, he can't live without eating tens of donuts everyday. What a chore for ...
#include <iostream> #include <vector> #include <string> #include <algorithm> #include <set> using namespace std; int main() { int dy[] = {-1, -1, 0, 1, 1, 1, 0, -1}; int dx[] = {0, 1, 1, 1, 0, -1, -1, -1}; for(;;){ int h, w; cin >> h >> w; if(h == 0) return 0; vect...
### Prompt Please create a solution in cpp to the following problem: Your master went to the town for a day. You could have a relaxed day without hearing his scolding. But he ordered you to make donuts dough by the evening. Loving donuts so much, he can't live without eating tens of donuts everyday. What a chore for ...
#include <iostream> #include <string> #include <vector> #include <set> using namespace std; #define rep(i, n) for(int i=0; i<(n); ++i) #define mp(a, b) make_pair(a, b) template<typename T, typename Compare = greater<T> > inline void chmax(T& t, T f, Compare comp){if(!comp(t, f))t = f;} int h, w; string solve(vecto...
### Prompt Please create a solution in CPP to the following problem: Your master went to the town for a day. You could have a relaxed day without hearing his scolding. But he ordered you to make donuts dough by the evening. Loving donuts so much, he can't live without eating tens of donuts everyday. What a chore for ...
#include <bits/stdc++.h> using namespace std; inline int toInt(string s) {int v; istringstream sin(s);sin>>v;return v;} template<class T> inline string toString(T x) {ostringstream sout;sout<<x;return sout.str();} template<class T> inline T sqr(T x) {return x*x;} typedef vector<int> vi; typedef vector<vi> vvi; typed...
### Prompt Create a solution in cpp for the following problem: Your master went to the town for a day. You could have a relaxed day without hearing his scolding. But he ordered you to make donuts dough by the evening. Loving donuts so much, he can't live without eating tens of donuts everyday. What a chore for such a...
#include <iostream> #include <string> #include <vector> #include <algorithm> #include <map> using namespace std; int dx[] = {-1, 0, 1, 0, -1, -1, 1, 1}; int dy[] = {0, -1, 0, 1, -1, 1, -1, 1}; bool comp(const string& a, const string& b) { if(a.size() != b.size()) return a.size() > b.size(); return a < b; } int mai...
### Prompt Create a solution in Cpp for the following problem: Your master went to the town for a day. You could have a relaxed day without hearing his scolding. But he ordered you to make donuts dough by the evening. Loving donuts so much, he can't live without eating tens of donuts everyday. What a chore for such a...
#include <bits/stdc++.h> using namespace std; #define REP(i,n) for(int i=0;i<(int)(n);++i) #define FOR(i,c) for(__typeof((c).begin())i=(c).begin();i!=(c).end();++i) #define ALL(c) (c).begin(), (c).end() #define valid(y,x,h,w) (0<=y&&y<h&&0<=x&&x<w) #define tpl(...) make_tuple(__VA_ARGS__) const int INF = 0x3f3f3f3f; co...
### Prompt Please formulate a cpp solution to the following problem: Hint In solving this problem, the following may be referred to. Shows how to convert an integer value to a string. Assign value as a string to str. For C include <stdio.h> int main () { int value = 123; // Convert this value to a string char st...
#include <bits/stdc++.h> using namespace std; #define for_(i,a,b) for(int i=a;i<b;++i) #define allof(a) a.begin(),a.end() #define minit(a,b) memset(a,b,sizeof(a)) #define size_of(a) (int)a.size() typedef long long lint; typedef pair<int, int> pii; int n, m, c[11]; int ans; void rec(int i, int mm, int sum) { if (i ...
### Prompt Generate a Cpp solution to the following problem: Hint In solving this problem, the following may be referred to. Shows how to convert an integer value to a string. Assign value as a string to str. For C include <stdio.h> int main () { int value = 123; // Convert this value to a string char str [6]; /...
#include <string> #include <vector> #include<iostream> #include<cstdio> #include<cstdlib> #include<stack> #include<queue> #include<cmath> #include<algorithm> #include<functional> #include<list> #include<deque> #include<bitset> #include<set> #include<map> #include<cstring> #include<sstream> #include<complex> #define X f...
### Prompt Your challenge is to write a CPP solution to the following problem: Hint In solving this problem, the following may be referred to. Shows how to convert an integer value to a string. Assign value as a string to str. For C include <stdio.h> int main () { int value = 123; // Convert this value to a stri...
#include <iostream> #include <vector> using namespace std; int n,m; vector<int> vec(10); const int INF = 1<<28; int ans = INF; string ans_s = ""; void res(int index,string sum,int rest){ if(rest < 0)return; if(index == n && ans > stoi(sum)){ ans = stoi(sum); ans_s = sum; return; } if(index ...
### Prompt Construct a CPP code solution to the problem outlined: Hint In solving this problem, the following may be referred to. Shows how to convert an integer value to a string. Assign value as a string to str. For C include <stdio.h> int main () { int value = 123; // Convert this value to a string char str [...
/* * a.cc: */ #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> #include<functi...
### Prompt In cpp, your task is to solve the following problem: Hint In solving this problem, the following may be referred to. Shows how to convert an integer value to a string. Assign value as a string to str. For C include <stdio.h> int main () { int value = 123; // Convert this value to a string char str [6]...
#include<bits/stdc++.h> using namespace std; string toString(int x, int k){ stringstream ss; ss << x; string res = ss.str(); while((int)res.size()<k)res = "0" + res; return res; } int main(){ int n,m; int c[10]; cin >> n >> m; for(int i=0;i<10;i++)cin >> c[i]; int lim = 1; for(int i=0;i<n;i++)...
### Prompt In Cpp, your task is to solve the following problem: Hint In solving this problem, the following may be referred to. Shows how to convert an integer value to a string. Assign value as a string to str. For C include <stdio.h> int main () { int value = 123; // Convert this value to a string char str [6]...
#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 Please provide a CPP coded solution to the problem described below: Hint In solving this problem, the following may be referred to. Shows how to convert an integer value to a string. Assign value as a string to str. For C include <stdio.h> int main () { int value = 123; // Convert this value to a stri...
#include<bits/stdc++.h> typedef long long int ll; typedef unsigned long long int ull; #define BIG_NUM 2000000000 #define HUGE_NUM 99999999999999999 #define MOD 1000000007 #define EPS 0.000000001 using namespace std; int N,budget; int table[10]; bool FLG; int ans[6],TMP[6]; void recursive(int num,int count,int rest)...
### Prompt Generate a cpp solution to the following problem: Hint In solving this problem, the following may be referred to. Shows how to convert an integer value to a string. Assign value as a string to str. For C include <stdio.h> int main () { int value = 123; // Convert this value to a string char str [6]; /...
#include <bits/stdc++.h> class Solve { private: public: bool is_last_query{}; Solve() { int n, m; scanf("%d%d", &n, &m); std::vector<int> cost(10); for (auto& e: cost) scanf("%d", &e); int min{1 << 30}; int limit{1}; for (int i{}; i < n; i++) limit *= 10; for (int i{}; i < limit; i++) { int ...
### Prompt Create a solution in Cpp for the following problem: Hint In solving this problem, the following may be referred to. Shows how to convert an integer value to a string. Assign value as a string to str. For C include <stdio.h> int main () { int value = 123; // Convert this value to a string char str [6];...
#include <iostream> #include <vector> #include <string> #include <stack> #include <queue> #include <deque> #include <set> #include <map> #include <algorithm> // require sort next_permutation count __gcd reverse etc. #include <cstdlib> // require abs exit #include <cstdio> // require scanf printf #include <functional> #...
### Prompt Please formulate a CPP solution to the following problem: Hint In solving this problem, the following may be referred to. Shows how to convert an integer value to a string. Assign value as a string to str. For C include <stdio.h> int main () { int value = 123; // Convert this value to a string char st...
#include <iostream> #include <vector> #include <algorithm> #include <string> #include <sstream> #include <cstring> #include <cstdio> #include <cstdlib> #include <cmath> #include <queue> #include <stack> #include <map> #include <set> #include <numeric> #include <cctype> #include <tuple> #include <array> #include <climit...
### Prompt In CPP, your task is to solve the following problem: Hint In solving this problem, the following may be referred to. Shows how to convert an integer value to a string. Assign value as a string to str. For C include <stdio.h> int main () { int value = 123; // Convert this value to a string char str [6]...
#include<iostream> using namespace std; int n, m, c[10]; string ans = ""; void dfs(int num, int use, int res){ if(use == 0){ cout << ans << endl; exit(0); } if(num == 10) return; for(int i = min(use, res/c[num]); i >= 0; i--){ for(int j = 0; j < i; j++) ans += (char)('0'+num...
### Prompt In CPP, your task is to solve the following problem: Hint In solving this problem, the following may be referred to. Shows how to convert an integer value to a string. Assign value as a string to str. For C include <stdio.h> int main () { int value = 123; // Convert this value to a string char str [6]...
#include <bits/stdc++.h> using namespace std; using ll = long long; #define rep(i,n) for(int (i)=0;(i)<(int)(n);++(i)) #define all(x) (x).begin(),(x).end() #define pb push_back #define fi first #define se second #define dbg(x) cout<<#x" = "<<((x))<<endl template<class T,class U> ostream& operator<<(ostream& o, const pa...
### Prompt Please provide a Cpp coded solution to the problem described below: Hint In solving this problem, the following may be referred to. Shows how to convert an integer value to a string. Assign value as a string to str. For C include <stdio.h> int main () { int value = 123; // Convert this value to a stri...
#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 main(){ int n,m; cin>>n...
### Prompt Please create a solution in Cpp to the following problem: Hint In solving this problem, the following may be referred to. Shows how to convert an integer value to a string. Assign value as a string to str. For C include <stdio.h> int main () { int value = 123; // Convert this value to a string char st...
#include <vector> #include <list> #include <map> #include <set> #include <queue> #include <deque> #include <tuple> #include <stack> #include <bitset> #include <algorithm> #include <functional> #include <numeric> #include <utility> #include <sstream> #include <iostream> #include <iomanip> #include <cstdio> #include <cma...
### Prompt Please create a solution in CPP to the following problem: Hint In solving this problem, the following may be referred to. Shows how to convert an integer value to a string. Assign value as a string to str. For C include <stdio.h> int main () { int value = 123; // Convert this value to a string char st...
#include <iostream> #include <vector> using namespace std; class range { private: struct Iterator { int val; int operator*() {return val;} bool operator!=(Iterator &itr) {return val < itr.val;} void operator++() {++val;} }; Iterator i, n; public: range(int n) : i({0}), n({n}) {} range(int i,...
### Prompt Generate a Cpp solution to the following problem: Hint In solving this problem, the following may be referred to. Shows how to convert an integer value to a string. Assign value as a string to str. For C include <stdio.h> int main () { int value = 123; // Convert this value to a string char str [6]; /...
#include <iostream> #include <vector> #include <algorithm> #include <string> #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,b) FOR(i,0,b) const int INF=1<<30; using namespace std; int main() { // your code goes here int n,m,price[10],minium=INF; string ans; ...
### Prompt Develop a solution in CPP to the problem described below: Hint In solving this problem, the following may be referred to. Shows how to convert an integer value to a string. Assign value as a string to str. For C include <stdio.h> int main () { int value = 123; // Convert this value to a string char st...
#include<cstdio> #include<cstdlib> #include<cstring> #include<cmath> #include<iostream> #include<sstream> #include<utility> #include<map> #include<vector> #include<queue> #include<algorithm> using namespace std; typedef long long ll; typedef pair<int,int>P; int N,M,p[11]; int dfs(int n,int f,int pra) { int t,r=-1; i...
### Prompt Your challenge is to write a cpp solution to the following problem: Hint In solving this problem, the following may be referred to. Shows how to convert an integer value to a string. Assign value as a string to str. For C include <stdio.h> int main () { int value = 123; // Convert this value to a stri...
#include <iostream> #include <vector> #include <algorithm> #include <complex> #include <cmath> #include <cstring> using namespace std; const double EPS=(1e-10); bool EQ(double a,double b){ return abs(a-b)<EPS; } typedef complex<double> P; typedef pair<double,double> pdd; double calc(double a1,double b1,double a...
### Prompt Please create a solution in Cpp to the following problem: Nathan O. Davis is taking a class of signal processing as a student in engineering. Today’s topic of the class was autocorrelation. It is a mathematical tool for analysis of signals represented by functions or series of values. Autocorrelation gives...
#include<cstdio> #include<vector> #include<complex> #include<algorithm> #define rep(i,n) for(int i=0;i<(n);i++) using namespace std; typedef complex<double> Point; const double EPS=1e-9; namespace std{ bool operator <(const Point &a,const Point &b){ return abs(a.real()-b.real())<EPS?(a.imag()+EPS<b.imag()):(a.r...
### Prompt Develop a solution in Cpp to the problem described below: Nathan O. Davis is taking a class of signal processing as a student in engineering. Today’s topic of the class was autocorrelation. It is a mathematical tool for analysis of signals represented by functions or series of values. Autocorrelation gives...
#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 Generate a Cpp solution to the following problem: Nathan O. Davis is taking a class of signal processing as a student in engineering. Today’s topic of the class was autocorrelation. It is a mathematical tool for analysis of signals represented by functions or series of values. Autocorrelation gives correla...
#include<iostream> #include<algorithm> #include<vector> using namespace std; #define REP(i,b,n) for(int i=b;i<n;i++) #define rep(i,n) REP(i,0,n) class EQ{ public: double a,b; double xs,xe; }; double compute(double a,double b,double c,double x){ return a*x*x*x+b*x*x+c*x; } double integ(double ai,double bi,dou...
### Prompt In cpp, your task is to solve the following problem: Nathan O. Davis is taking a class of signal processing as a student in engineering. Today’s topic of the class was autocorrelation. It is a mathematical tool for analysis of signals represented by functions or series of values. Autocorrelation gives corr...
#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 Your challenge is to write a CPP solution to the following problem: Nathan O. Davis is taking a class of signal processing as a student in engineering. Today’s topic of the class was autocorrelation. It is a mathematical tool for analysis of signals represented by functions or series of values. Autocorrela...
#include<cstdio> #include<cstdlib> #include<cstring> #include<cmath> #include<iostream> #include<string> #include<vector> #include<map> #include<set> #include<list> #include<queue> #include<deque> #include<algorithm> #include<numeric> #include<utility> #include<complex> #include<functional> using namespace std; /* c...
### Prompt Develop a solution in cpp to the problem described below: Nathan O. Davis is taking a class of signal processing as a student in engineering. Today’s topic of the class was autocorrelation. It is a mathematical tool for analysis of signals represented by functions or series of values. Autocorrelation gives...
#include <bits/stdc++.h> #define _overload(_1,_2,_3,name,...) name #define _rep(i,n) _range(i,0,n) #define _range(i,a,b) for(int i=int(a);i<int(b);++i) #define rep(...) _overload(__VA_ARGS__,_range,_rep,)(__VA_ARGS__) #define _rrep(i,n) _rrange(i,n,0) #define _rrange(i,a,b) for(int i=int(a)-1;i>=int(b);--i) #define r...
### Prompt Please provide a CPP coded solution to the problem described below: Nathan O. Davis is taking a class of signal processing as a student in engineering. Today’s topic of the class was autocorrelation. It is a mathematical tool for analysis of signals represented by functions or series of values. Autocorrela...
#include <iostream> #include <vector> #include <algorithm> #include <complex> #include <cmath> #include <cstring> using namespace std; const double EPS=(1e-10); bool EQ(double a,double b){ return abs(a-b)<EPS; } typedef complex<double> P; typedef pair<double,double> pdd; double calc(double a1,double b1,double a...
### Prompt Your challenge is to write a cpp solution to the following problem: Nathan O. Davis is taking a class of signal processing as a student in engineering. Today’s topic of the class was autocorrelation. It is a mathematical tool for analysis of signals represented by functions or series of values. Autocorrela...
#include <iostream> #include <vector> #include <algorithm> #include <complex> #include <cmath> #include <cstring> using namespace std; const double EPS=(1e-10); bool EQ(double a,double b){ return abs(a-b)<EPS; } typedef complex<double> P; typedef pair<double,double> pdd; double calc(double a1,double b1,double a...
### Prompt Construct a cpp code solution to the problem outlined: Nathan O. Davis is taking a class of signal processing as a student in engineering. Today’s topic of the class was autocorrelation. It is a mathematical tool for analysis of signals represented by functions or series of values. Autocorrelation gives co...
#include <bits/stdc++.h> #define REP(i,n) for(int i=0; i<(int)(n); ++i) using namespace std; typedef long long LL; int main(){ int N; double R; while(cin >> N >> R && N > 0) { vector<double> xs(N), ys(N); REP(i, N) cin >> xs[i] >> ys[i]; vector<double> p; REP(i, xs.size()){...
### Prompt Please formulate a Cpp solution to the following problem: Nathan O. Davis is taking a class of signal processing as a student in engineering. Today’s topic of the class was autocorrelation. It is a mathematical tool for analysis of signals represented by functions or series of values. Autocorrelation gives...
#include <iostream> #include <vector> #include <algorithm> #include <complex> #include <cmath> #include <cstring> using namespace std; const double EPS=(1e-10); bool EQ(double a,double b){ return abs(a-b)<EPS; } typedef complex<double> P; typedef pair<double,double> pdd; double calc(double a1,double b1,double a...
### Prompt Construct a cpp code solution to the problem outlined: Nathan O. Davis is taking a class of signal processing as a student in engineering. Today’s topic of the class was autocorrelation. It is a mathematical tool for analysis of signals represented by functions or series of values. Autocorrelation gives co...
#include <iostream> #include <vector> #include <cmath> using namespace std; using P = pair<double,double>; int N; double L; vector<P> V; bool eval(double u){ double l=L; for(auto v:V){ l+=v.first*(u-v.second); l=min(L,l); if(l<=0) return false; } double l1=l; for(auto v:V){...
### Prompt Your task is to create a Cpp solution to the following problem: You built an apartment. The apartment has a water tank with a capacity of L in order to store water for the residents. The tank works as a buffer between the water company and the residents. It is required to keep the tank "not empty" at leas...