text stringlengths 8 6.88M |
|---|
#include<stdio.h>
#include<conio.h>
void main()
{
clrscr();
int arr[7];
int *p;
printf(" arr[0] %u",&arr[0]);
printf("\n arr[1] %u",&arr[1]);
printf("\n arr[2] %u",&arr[2]);
printf("\n arr[3] %u",&arr[3]);
printf("\n arr[4] %u",&arr[4]);
printf("\n arr[5] %u",&arr[5]);
printf("\n arr[6] %u",&arr[6]);
printf("\n arr[7] ... |
#include "3Dmodel.h"
void Modelo::trasladar_figurax(float traslacion){
for (int i = 0; i < vertices.size(); i++){
vertices[i].x+=traslacion;
}
}
void Modelo::trasladar_figuray(float traslacion){
for (int i = 0; i < vertices.size(); i++){
vertices[i].y+=traslacion;
}
}
void Modelo::escalar(double escalado){
_ve... |
// Calculates the sum of dist(v,u) for all pairs of vertices v, u.
// Running time: O(n)
int distsum, n;
int dfs(int v, int p=-1, int w=0) {
int k = 1;
for (int i = 0; i < G[v].size(); i++) {
int u = G[v][i].first, w = G[v][i].second;
if (u != p) k += dfs(u, v, w);
}
distsum += w*(n-k)*k;
return k;
}
|
/**
* Author : BurningTiles
* Created : 2020-08-07 01:02:38
**/
#include <bits/stdc++.h>
#define ll long long
using namespace std;
int main(){
ll i, d, z, tt;
bool flag = false;
cin >> tt;
while(tt--){
flag = false;
cin >> i >> d >> z;
for(int j=2; j<=z; ++j){
if((i+d)%j==0 && z%j==0){
flag = tr... |
//
// Created by hw730 on 2020/6/11.
//
#ifndef DEFENCE_GAME_MONSTERLINKLISTMANAGER_H
#define DEFENCE_GAME_MONSTERLINKLISTMANAGER_H
class MonsterLinkListManager {
};
#endif //DEFENCE_GAME_MONSTERLINKLISTMANAGER_H
|
#include <iostream>
#include <unistd.h>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <sys/types.h> // socket 及 宏定义头文件
#include <sys/socket.h>
#include <netinet/in.h> //sockaddr_in htonl等
#include <arpa/inet.h> // inet_pton 等
#include <fcntl.h>
#include <sys/select.h>
#include <sys/time.h>
using ... |
#include<bits/stdc++.h>
using namespace std;
int main()
{
int n,k,x=0,count=0;
cin>>n>>k;
n=n+1;
vector<int> v;
int a[1000]={0};
for(int i=4;i<=n;i+=2)
a[i]=1;
for(int i=3;i<=sqrt(n);i+=2)
{
if(a[i]==0){
for(int j=i*i;j<n;j+=i)
{
a[j]=1;
... |
#ifndef ROSE_RTIHELPERS_H
#define ROSE_RTIHELPERS_H
#include <string>
#include <vector>
#include <list>
#include <set>
#include <sstream>
#include <iomanip>
#include <boost/lexical_cast.hpp>
// Helpful functions for Cxx_GrammarRTI.C
// Probably should not be included anywhere else
#if ROSE_USE_VALGRIND
#include <va... |
/*
Copyright (c) 2005-2023, University of Oxford.
All rights reserved.
University of Oxford means the Chancellor, Masters and Scholars of the
University of Oxford, having an administrative office at Wellington
Square, Oxford OX1 2JD, UK.
This file is part of Chaste.
Redistribution and use in source and binary forms... |
#pragma once
#include <SFML/Graphics.hpp>
#include <SFML/Window.hpp>
#include "object.h"
class Bound:public Object{
private:
sf::Sprite shape;
int w;
int h;
sf::Texture texture;
public:
Bound(int _x, int _y, int _w, int _h, int _r, int _g, int _b);
void draw(sf::RenderWindow& window);
int getW();
int get... |
#include "configReader.h"
#ifdef __ROOT__
ClassImp(ConfigReader)
#endif
ConfigReader::ConfigReader()
{
mCommentString = "#";
mSectionString = "%";
}
ConfigReader::ConfigReader(string fileName)
{
mCommentString = "#";
mSectionString = "%";
readFile(fileName);
}
void ConfigReader::readFile(string ... |
#include <bits/stdc++.h>
using namespace std;
int main()
{
int n, p, p2;
cin>>n>>p;
p2 = (n%2==0 ? n+1-p : n-p);
p = (p%2==0 ? p/2 : (p-1)/2);
p2 = (p2%2==0 ? p2/2 : (p2-1)/2);
cout<<min(p, p2)<<endl;
} |
#include "../inc.h"
TreeNode * help(TreeNode * root)
{
if(!root)
return NULL;
TreeNode * r = help(root->left);
if(r)
return r;
r = help(root->right);
if(r)
return r;
return (root->val ? root : NULL);
}
void solve(TreeNode * root)
{
if(!root)
return;
if(0... |
/**
* Class Controller
* @author Patricio Ferreira <3dimentionar@gmail.com>
* Copyright (c) 2017 nahuelio. All rights reserved.
**/
#include <iostream>
#include "headers/Controller.h"
#include <GLFW/glfw3.h>
using namespace game_controller;
Controller::Controller() {};
void Controller::onError(int error, const ... |
#include <cstdio>
#include <cstring>
#include <iostream>
using namespace std;
typedef long long ll;
#define nx (x + xx[i])
#define ny (y + yy[i])
const int maxn = 505;
int n, m, h[maxn][maxn];
bool vis[maxn][maxn] = { false };
int s[maxn][maxn], t[maxn][maxn], xx[4] = { -1, 1, 0, 0 }, yy[4] = { 0, 0, -1, 1 };
void in... |
#include <stdio.h>
#include <stdlib.h>
class Graph
{
private:
int **arr;
bool *visited;
public:
int n;
Graph()
{
int N;
FILE * f;
f = fopen("input.txt", "r");
fscanf(f, "%d", &N);
this->n = N;
visited = (bool *)calloc(sizeof(bool), N);
arr = (int **)calloc(sizeof(int*),N);
for (int i = 0; i < N; i+... |
/**
* Copyright (c) William Niemiec.
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*/
#pragma once
#include <fstream>
#include <string>
#include <initializer_list>
#include <functional>
#include <list>
#include "HistoryConsolex.hpp"
... |
#include <iostream>
#include <algorithm>
#include <queue>
#include <string>
using namespace std;
char map[51][51];
int dp[51][51],startp,endp;
queue<pair<int,int>> stream,mole;
int dir[4][2] = {{1,0},{0,1},{-1,0},{0,-1}};
int main() {
int R,C;
cin >> R >> C;
for(int i=0;i<R;i++){
string buf;
cin >> buf;
... |
// -*- C++ -*-
//
// Copyright (C) 1998, 1999, 2000, 2002 Los Alamos National Laboratory,
// Copyright (C) 1998, 1999, 2000, 2002 CodeSourcery, LLC
//
// This file is part of FreePOOMA.
//
// FreePOOMA is free software; you can redistribute it and/or modify it
// under the terms of the Expat license.
//
// This progr... |
/* value_test_utils.cpp -*- C++ -*-
Rémi Attab (remi.attab@gmail.com), 25 Apr 2015
FreeBSD-style copyright and disclaimer apply
*/
#include "test_types.h"
#include "dsl/all.h"
#include "types/primitives.h"
#include "types/std/map.h"
#include "types/std/vector.h"
#include "types/s... |
//=======================================================================================
// CardManager.cpp
// カード管理関連のソースファイル
//=======================================================================================
// ヘッダファイルの読み込み ================================================
#include <iostream>
#include ... |
#include "ScrambleString.hpp"
#include <vector>
using namespace std;
bool ScrambleString::isScramble(string s1, string s2) {
if (s1.size() != s2.size())
return false;
if (s1 == s2)
return true;
int n = s1.size();
vector<vector<vector<bool>>> dp(n, vector<vector<bool>>(n, vector<bool... |
#include "boost_logger_severity.h"
// The operator is used for regular stream formatting
std::ostream& operator<< (std::ostream& strm, SysLogSeverity level)
{
static const char* strings[] =
{
"EMERGENCY",
"ALERT",
"CRITICAL",
"ERROR",
"WARNING",
"NOTICE",
"INFO",
"DEBUG"
};
if (static_cast< std::s... |
#include "NoxTacticEngine.h"
#include <string>
std::string inttostring(int a) {
char buf[100];
_itoa_s(a, buf, 10);
std::string tmp(buf);
return tmp;
}
const CoordD Input::GlitchyInputRepresentationScale = CoordD(1.0204081632653061224489795918367, 1.0714285714285714285714285714286);
#pragma warning (dis... |
/**********************************************************
* License: The MIT License
* https://www.github.com/doc97/TxtAdv/blob/master/LICENSE
**********************************************************/
#pragma once
#include <unordered_map>
#include "LineReader.h"
namespace txt
{
/* Struct: CtrlContent
* Represe... |
#include "Common.h"
#include <algorithm>
#include <iostream>
#include <unordered_map>
int partOne(std::vector<int> lines) {
std::unordered_map<int, int> dict;
for (const auto &n : lines)
dict[n] = lines[n];
for (const auto &n : lines) {
if (dict.find(2020 - n) != dict.end())
return n * (2020 - n)... |
//
// Copyright (c) 2017-2019 Native Instruments GmbH, Berlin
//
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to deal
// in the Software without restriction, including without limitation the rights
// to use, cop... |
#include <iostream>
#include <string>
class Shape{
protected:
std::string name;
public:
Shape(std::string name = "Amorphous Base Shape"): name(name){}
std::string getName(){ return name; }
};
class Triangle : public Shape{
public:
Triangle(std::string name = "Nice Triangle!") : Shape(name){}
//!TODO add met... |
#ifndef PAGES_H
#define PAGES_H
#include <mgui.h>
// this file declares your different pages
// pagecontroller handles input/output switches pages for you etc
class PageController : public PageControllerBase {
DigitalInputButton // declare some inputs
_upBtn,
_downBtn,
_okBtn;
... |
// This MFC Samples source code demonstrates using MFC Microsoft Office Fluent User Interface
// (the "Fluent UI") and is provided only as referential material to supplement the
// Microsoft Foundation Classes Reference and related electronic documentation
// included with the MFC C++ library software.
// Lice... |
//
// encryptor.cpp
// CPSC_441_assign_3_server
//
// Created by Keenan on 2018-10-16.
// Copyright © 2018 Keenan. All rights reserved.
//
#include "encryptor.h"
#include <stdlib.h>
#include <string>
#include <string.h>
#include <iostream>
#include <stdexcept>
Encryptor::Encryptor(){
//initialize map
seqn... |
#include <cmath>
#include <cstdio>
#include <vector>
#include <iostream>
#include <set>
#include <algorithm>
#include <map>
#include <algorithm>
using namespace std;
int main() {
map<string, int> m;
int n, a, val;
string key;
cin >> n;
for(int i=0; i<n; i++) {
cin >>... |
#pragma once
// ReSharper disable once CppUnusedIncludeDirective
#include <cstdint>
#include <DirectXCollision.h>
namespace GraphicsEngine
{
struct SubmeshGeometry
{
uint32_t IndexCount = 0;
uint32_t StartIndexLocation = 0;
uint32_t BaseVertexLocation = 0;
DirectX::BoundingBox Bounds;
};
}
|
#include <cmath>
#include <iostream>
#include <list>
#include <map>
#include <numeric>
#include <queue>
#include <unordered_map>
#include <unordered_set>
#include <vector>
#include <set>
#include <stack>
#include <sstream>
#include <string>
using namespace std;
struct TreeNode
{
int val;
TreeNode* left;
Tr... |
#include <stdint.h>
#include <stdio.h>
extern "C"
{
#include <SDL.h>
#include <SDL2_gfxPrimitives.h>
#include <math.h>
}
const int SCREEN_WIDTH = 1280;
const int SCREEN_HEIGHT = 720;
SDL_Window* window = NULL;
SDL_Renderer* renderer = NULL;
SDL_Event event;
// List of leds per view and of view sizes
uint16_t fa... |
#include<stdio.h>
#include<stdlib.h>
partition(int arr[],int start,int end)
{
int pivot=arr[end],i,index=start,temp;
for(i=start;i<end;i++)
{
if(arr[i]<=pivot)
{
temp=arr[i];
arr[i]=arr[index];
arr[index]=temp;
index++;
}
}
arr[end]=arr[index];
arr[index]=pivot;
return index;
}
vo... |
#include <iostream>
#include <string.h>
#include <arpa/inet.h>
#include <thread>
#include "mypcap.h"
#include <vector>
//using std::thread;
using namespace std;
void onefunction(char* interface, char** argv,int is,struct packet_addr pd){
getMacIPAddress(interface, pd.mymac, pd.myip);
printf("==============... |
#include<bits/stdc++.h>
using namespace std;
main()
{
string s;
int n;
cin >> n;
cin >> s;
int a = 0;
int b = 0;
for(int i = 0 ; s[i] != 0; i++)
{
if(s[i] == 'A')
a++;
else if(s[i] == 'B')
b++;
}
if(b > a)
cout << "B\n";
else if( a > b)
cout << "A\n";
else
cout << "Tie\n";
... |
#include <iostream>
using namespace std;
void main()
{
int N;
cin >> N;
if (N%2==0) cout<<"even";
else cout<<"odd";
}
|
#include<bits/stdc++.h>
using namespace std;
#define ll long long int
int main(){
int tc;cin>>tc;
while(tc--){
int n;cin>>n;int k;cin>>k;
vector<int> arr(n);
for(int i=0;i<n;i++) cin>>arr[i];
map<int,int> mp;
for(int i=0;i<n;i++){
mp[arr[i]]++;
}
int count=0;
for(auto i:mp){
count+=min(k,i.sec... |
#include <string>
#include <iostream>
#include <sys/types.h>
#include <sys/socket.h>
#include <netinet/in.h>
#include <netdb.h>
#include <arpa/inet.h>
#include <sys/stat.h>
#include <fcntl.h>
#include <unistd.h>
#include <stdio.h>
#include <string.h>
int main()
{
std::string httpPost = "POST /device-api/site/query... |
#include <iostream>
#include <stdio.h>
#include <stdlib.h>
#include <bits/stdc++.h>
using namespace std;
void solve(vector<int> arr){
int _currMin = 0;
int _currMax = 0;
map<int,int> pairs;
for(int i = 0; i < arr.size(); i++){
if(arr[i] > arr[_currMax]){
... |
#include<iostream>
using namespace std;
int arr[] = {0, 8, 4, 12, 2, 10, 6, 14, 1, 9, 5, 13, 3, 11, 7, 15};//{ 18, 22, 9, 17, 21, 50, 51};
int n = sizeof(arr)/sizeof(arr[0]);
int dp[100];
int lis(int i)
{
//cout<<i<<endl;
if(i>=n) return 0;
if(dp[i]!=-1) return dp[i];
int ans=0;
for(i... |
#ifndef __DUAL_EVO24X9_H__
#define __DUAL_EVO24X9_H__
#include <math.h>
#include <string.h>
#include "esp_log.h"
#include "driver.h"
#include "device.h"
#include "i2c-dev.h"
#include "driver/uart.h"
#include "kidbright32.h"
class DualEVO24X9 : public Device {
private:
enum {
s_detect,
s_wait,
} state;
... |
#include <algorithm>
#include <array>
#include <cstdio>
#include <iostream>
#include <iterator>
#include <map>
#include <math.h>
#include <numeric>
#include <queue>
#include <set>
#include <stack>
#include <vector>
#define ll long long
using namespace std;
typedef tuple<ll, ll, ll> tp;
typedef pair<ll, ll> pr;
const l... |
#ifndef ANGRA_MC_EVENT
#define ANGRA_MC_EVENT
#include "TClonesArray.h"
#include "TRefArray.h"
#include "TVector3.h"
#include "TLorentzVector.h"
#include "TDatabasePDG.h"
#include "TROOT.h"
#include <iostream>
TDatabasePDG *fPDGTable = new TDatabasePDG();
enum AngraPMTLocation {kTarget=0, kInnerVeto=1, kBoxVeto=2};... |
/***************************************************************************
Copyright (c) 1999-2003 Apple Computer, Inc. All Rights Reserved.
2010-2020 DADI ORISTAR TECHNOLOGY DEVELOPMENT(BEIJING)CO.,LTD
FileName: OSQueue.cpp
Description: Provide a queue operation class.
Comment: copy from Darwin Stre... |
//
// Bullet.cpp
// Fighters
//
// Created by zhutun on 15/5/24.
// Copyright (c) 2015年 zhutun. All rights reserved.
//
#include "Bullet.h"
Bullet::Bullet()
{
this->setTexture(this->texture);
}
Bullet::~Bullet()
{
}
void Bullet::move(char direction){
if (direction=='w') {
this->setPosition(... |
//Implement non-recursive linear search algorithm.
#include<iostream>
using namespace std;
int main()
{
int i,n,search,flag=0;
cout<<"Enter No of elements : ";
cin>>n;
int a[n];
for ( i = 0; i < n; i++)
{
cout<<"Element : ";
cin>>a[i];
}
cout<<"\nEnter Element to be sea... |
#include <iostream>
#include <vector>
#include "solution.h"
using namespace std;
int main() {
Solution s;
vector<int> ivec1 = {1, 3};
vector<int> ivec2 = {2};
vector<int> ivec3 = {1, 2};
vector<int> ivec4 = {3, 4};
cout << s.findMedianSortedArrays(ivec1, ivec2) << endl;
cout << s.findMedianSortedArr... |
#include "Sampling.h"
#include "Utils.h"
#include "omp.h"
#define NUM_THREADS 4
#define MAX_SIZE_CLUSTER 100
#define MAX_NUM_DISTANCES 100
Sampling::Sampling(string filename, int samplesize)
{
ifstream fn(filename.c_str());
fn >> N >> K;
S = MIN(N, samplesize);
//cerr << "size " << N << " attributes " << K << ... |
#pragma once
#include <Windows.h>
#include <windowsx.h>
#include <cstring>
#include <string>
#include <vector>
#include <map>
#include "resource.h"
#define MSG_LEN 64
#define WM_CHILDEND (WM_USER+1)
#define WM_SETOPTION (WM_USER+2)
#define WM_LISTEDITDONE (WM_USER+2)
#define MSG_CALLWND 0
#define MSG_G... |
/*
* File: main.cpp
* Author: Angel Gil
* Function: Able to Play a simple version of the card game WAR.
* Created on June 1, 2019, 1:00 PM
*/
//System Libraries
#include <cstdlib> //Random Seed
#include <iomanip> //Location Manipulation
#include <iostream> //Input and Output Library
#include ... |
#ifndef MAINWINDOW_H
#define MAINWINDOW_H
#include <QMainWindow>
#include <QMenuBar>
#include <QMenu>
#include <QStackedWidget>
class MainWindow : public QMainWindow
{
Q_OBJECT
public:
explicit MainWindow(QWidget *parent = 0);
~MainWindow();
signals:
public slots:
private:
void setupMenu();
QSt... |
#include <bits/stdc++.h>
using namespace std;
//CODED BY SUMIT KUMAR PRAJAPATI
typedef unsigned long long ull;
typedef long long ll;
typedef pair<int, int> pii;
typedef pair<ll, ll> pl;
#define si(x) scanf("%d",&x)
#define sl(x) scanf("%lld",&x)
#define ss(s) scanf("%s",s)
#define pi(x) printf("%d\n",x)
#define pl(x... |
#include "test_util.h"
void TEST_RM_4(const string &tableName, const int nameLength, const string &name, const int age, const float height, const int salary)
{
// Functions Tested
// 1. Insert tuple
// 2. Read Attributes **
cout << "****In Test Case 4****" << endl;
RID rid;
int tupleSi... |
//
// Created by Jelle Spijker on 8/8/20.
//
#ifndef GCODEHERMENEUS_PARAMETERS_H
#define GCODEHERMENEUS_PARAMETERS_H
#include <string_view>
#include <vector>
namespace GHermeneus
{
/*!
* @brief A type containing the parameter key (e.q. X, Y, Z, F, E)
* @tparam T the primitive type of the parameter value, this shou... |
/**
* @file Newton3OnOffTest.cpp
* @author seckler
* @date 18.04.18
*/
#include "Newton3OnOffTest.h"
#include "autopas/utils/Logger.h"
using ::testing::_; // anything is ok
using ::testing::Combine;
using ::testing::Return;
using ::testing::ValuesIn;
// Parse combination strings and call actual test function
TE... |
void setup()
{
Serial.begin(9600);
//-----UDP-----
Ethernet.begin(mac, machine1);
Udp.begin(localPort);
Serial.println("Machine 1 prête.");
//-----Leds-----
LED_1.begin();
LED_2.begin();
GYRO.begin();
//-----Boutons-----
pinMode(BTN_0, INPUT_PULLUP);
pinMode(BTN_1, INPUT_PULLUP);
pinM... |
class Solution {
typedef pair<int, int> ii;
int dist(ii &a, ii &b) {
return (a.first - b.first) * (a.first - b.first) +
(a.second - b.second) * (a.second - b.second);
}
int dot(ii &a, ii &b) {
return a.first * b.first + a.second * b.second;
}
public:
bool v... |
#include<stdio.h>
int main() {
int s = 0;//sum
s = s + 1;
s = s + 2;
s = s + 3;
s = s + 4;
s = s + 5;
s = s + 6;
s = s + 7;
s = s + 8;
s = s + 9;
s = s + 10;
printf("%d\n", s);
return 0;
}
|
#include "SpotifyFilter.h"
std::string SpotifyFilter::filterATEndpoint(QJsonDocument api_response) {
assert(api_response.object().contains("access_token"));
return api_response["access_token"].toString().toStdString();
}
std::vector<PlaylistElement> SpotifyFilter::filterSearchArtistEndpoint(QJsonDocument api_respons... |
#include <touchgfx/hal/Types.hpp>
FONT_GLYPH_LOCATION_FLASH_PRAGMA
KEEP extern const uint8_t unicodes_arial_14_4bpp_0[] FONT_GLYPH_LOCATION_FLASH_ATTRIBUTE =
{
// Unicode: [0x0021, exclam]
0xBC, 0xBC, 0xBC, 0xAB, 0x9A, 0x89, 0x78, 0x67, 0x11, 0x56, 0xAB,
// Unicode: [0x0022, quotedbl]
0xF5, 0xF2, 0x05,... |
#include "SwapChainDX12.hpp"
#include "Common/Logger.hpp"
#include "Device.hpp"
#include "HardwareManager.hpp"
namespace engine {
Bool SwapChain::Create(ComPtr<ID3D12CommandQueue>& commandQueue) {
DXGI_MODE_DESC displayMode = m_hardwareManager->GetCurrentDisplayMode();
DXGI_SWAP_CHAIN_DESC1 swapChainDesc;
swapCh... |
#pragma once
#include <string>
#include <string_view>
#include <vector>
#include "dvc/log.h"
namespace dvc {
inline std::vector<std::byte> HexStringToByteArray(std::string_view hex_string);
inline std::string ByteArrayToHexString(const std::byte* data, size_t size);
inline std::string ByteArrayToHexString(
cons... |
#include <iostream>
using namespace std;
struct Stack{
int top=0;
int a[100];
};
struct Queue{
int a[100];
int head=0;
int tail=0;
};
int deQueue(Queue* Q){
int val = Q->a[Q->head];
Q->head = Q->head + 1;
cout<<"Element "<<val<<" dequeued from Q"<<endl;
return val;
};
void enQueue(Queue* Q,int va... |
#ifndef KATANA_LIBSUPPORT_KATANA_RESULT_H_
#define KATANA_LIBSUPPORT_KATANA_RESULT_H_
#include <cassert>
#include <cerrno>
#include <future>
#include <boost/outcome/outcome.hpp>
#include "katana/Logging.h"
namespace katana {
template <class T>
using Result = BOOST_OUTCOME_V2_NAMESPACE::std_result<T>;
static inlin... |
#ifndef CONTROL_H
#define CONTROL_H
#include "Packet.h"
#include "Config.h"
/*
Functions and time delay for activating parachute Solenoids
*/
extern volatile bool chuteDeployed;
const int time_out = 75;
void sealChuteLid()
{
analogWrite(PARACHUTE_PIN, 128);
delay(time_out);
analogWrite(PARACHUTE_PIN, 0);
ch... |
/*
15686. 치킨배달 다시풀기
*/
#include <iostream>
#include <vector>
#include <math.h>
using namespace std;
typedef pair<int, int> pii;
typedef long long ll;
int N, M;
int board[50][50];
vector<pii> ch;
vector<pii> h;
bool selected[13];
int chicken_distance = 987654321;
int distance(int r, int c, int rr, int cc)
{
re... |
#include "MotorPwm.hpp"
extern "C" {
extern void set_r_motor_mode(enum MotorMode mode);
extern void set_r_motor_pwm(int pwm);
}
#include "motor_driver.h"
MotorPwm::MotorPwm()
{
}
void MotorPwm::setLevel(int level)
{
if (level > 0) {
set_r_motor_mode(MOTOR_FORWARD);
set_r_motor_pwm(level);
... |
//
// Copyright Jason Rice 2016
// Distributed under the Boost Software License, Version 1.0.
// (See accompanying file LICENSE_1_0.txt or copy at
// http://www.boost.org/LICENSE_1_0.txt)
//
#ifndef NBDL_DEF_BUILDER_ENTITY_MESSAGE_IS_FROM_ROOT_HPP
#define NBDL_DEF_BUILDER_ENTITY_MESSAGE_IS_FROM_ROOT_HPP
#include <nbdl... |
#include "Craftable.h"
Craftable::Craftable() { height = 0; }
Craftable::~Craftable() {}
void Craftable::setCraft(Inventory& inv)
{
craft_position.clear();
std::map<std::string, std::vector<int>>::iterator it; //for the craft list
std::vector<int>::iterator innerit; //for each weapon... |
#ifndef PERSON_H
#define PERSON_H
#include <iostream>
#include <string>
#include <sstream>
#include <iomanip>
#include <fstream>
using namespace std;
const string DATA_FILE = "data.txt";
class Person
{
private:
string mName, mID, mPhoneNum, mEmail, mCourseName;
static int mCount;
public:
Person();
~Person();
... |
#include "Node.h"
Node::Node() {};
void Node::setNextNodes(set<int>& nodes) {
this->nextNodes = nodes;
}
void Node::addNextNode(int nodeID) {
this->nextNodes.insert(nodeID);
}
void Node::setVisited() {
this->visited = true;
}
void Node::setPostOrder(int num) {
this->postOrderNum = num;
}
s... |
#ifndef WEBXX_WS_SESSION
#define WEBXX_WS_SESSION
#include <boost/asio.hpp>
#include <boost/algorithm/string.hpp>
#include <boost/uuid/sha1.hpp>
#include "base64.hpp"
#include "receiver.hh"
#include <thread>
namespace webxx { namespace ws {
class Session
{
public:
Session(std::string handshake, boost::asio::i... |
#include "Coins.h"
#define screenWidth 1200
#define screenHeight 800
/**
* \brief Konstruktor klasy Coins
* \details Ustawienie odopowiedniej grafiki, pozycji, originu, skali.
* \param x Współrzędna x nadawana podczas inicjalizacji obiektu.
* \param y Współrzędna y nadawana podczas inicjalizacji obiektu.
*... |
// AUTHOR: Sumit Prajapati
#include <bits/stdc++.h>
using namespace std;
#define ull unsigned long long
#define ll long long
#define pii pair<int, int>
#define pll pair<ll, ll>
#define pb push_back
#define mk ... |
/*
Copyright (c) 2005-2023, University of Oxford.
All rights reserved.
University of Oxford means the Chancellor, Masters and Scholars of the
University of Oxford, having an administrative office at Wellington
Square, Oxford OX1 2JD, UK.
This file is part of Chaste.
Redistribution and use in source and binary forms... |
/*
* 说明:这是以字符串处理算法为主的库
* 编号:002
* 备注:字符串处理
*/
#include "Header.h"
namespace STRING
{
/*
* 编号:002_1
* 函数名称:_Uppcase_Str
* 描述:返回输入字符串的大写模式
*/
string _Uppcase_Str(string _Dest_Str)
{
_FOR_(i, _Dest_Str.length())
{
if (_Dest_Str[i] >= 'a'&&_Dest_Str[i] <= 'z')
{
_Dest_Str[i] = (char)('A' + _Dest_Str[... |
/*
* common.h
*
* Created on: 2013-4-2
* Author: chunwei
*/
#ifndef COMMON_H_
#define COMMON_H_
#include <iostream>
#include <string>
#include <vector>
#include <math.h>
#include <ostream>
#include <sstream>
#include <algorithm>
#include <fstream>
#include <time.h>
using namespace std;
// 包含数据类型定义等
// size... |
#pragma once
#include <VulkanWrapper/VulkanBaseApp.h>
#include <map>
#include <Base/VertexTypes.h>
#include <Base/Camera.h>
//Application to test Mesh generation/loading using debug render pipelines
class Mesh;
namespace vkw
{
class GraphicsPipeline;
class Buffer;
class DescriptorPool;
class DescriptorSet;
class... |
#include <iostream>
using namespace std;
struct Stack{
int top=0;
int a[100];
};
void pushS(Stack* st,int v){
st->a[st->top] = v;
st->top = st->top + 1;
};
char popS(Stack* st){
int v;
st->top = st->top - 1;
v = st->a[st->top];
return v;
};
int main(){
Stack S;
Stack P;
int a[10] = {5,3,8,9,... |
#ifndef _PARALIGN_OPTIONS_H_
#define _PARALIGN_OPTIONS_H_
#include <iosfwd>
#include <string>
namespace paralign {
// Options for controlling the alignment
struct Options {
// Reverse estimation (swap source and target during training)
bool reverse;
// Use a static alignment distribution that assigns higher pro... |
#ifndef DWIZ_COMMON_PROTOCOLS_V0_PROTOCOL_V0_FACTORY_H
#define DWIZ_COMMON_PROTOCOLS_V0_PROTOCOL_V0_FACTORY_H
#include <common/dwiz_std.h>
#include <common/protocols/protocol_factory_interface.h>
namespace dwiz
{
class ProtocolV0Factory : public ProtocolFactoryInterface
{
public:
virtual std::unique_ptr<LoginProt... |
#pragma once
#include <string>
#include <unordered_map>
#include <unordered_set>
#include <vector>
#include <cmath>
#include <tuple>
#include "../../EngineLayer/PeptideSpectralMatch.h"
#include "../../EngineLayer/ProteinParsimony/ProteinGroup.h"
#include "Chemistry/Chemistry.h"
using namespace Chemistry;
using name... |
// Copyright (c) 2012 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#include "google/cacheinvalidation/types.pb.h"
#include "sync/notifier/mock_sync_notifier_observer.h"
#include "sync/notifier/sync_notifier_registrar.... |
#include <iostream>
#include "../../src/mutex_thread/mutex_thread.h"
class Q: public mutex_thread::mutex_thread
{
public:
Q() : mutex_thread::mutex_thread()
{};
virtual ~Q()
{
}
private:
void do_job();
};
void Q::do_job()
{
std::cout << "ASD";
}
int main()
{
Q a;
a();
a.stop();
} |
#ifndef __FLYWEIGHT_FACTORY_H__
#define __FLYWEIGHT_FACTORY_H__
#include "Flyweight.h"
#include <map>
#include <memory>
class FlyweightFactory
{
public:
std::shared_ptr<Flyweight> getCode(const int key);
private:
std::map<int, std::shared_ptr<Flyweight>> m_list;
};
#endif // __FLYWEIGHT_FACTORY_H__
|
#pragma once
#include <string>
#include "ReClassNET_Plugin.hpp"
#include "PipeStream/BinaryReader.hpp"
#include "PipeStream/BinaryWriter.hpp"
class MessageClient;
enum class MessageType
{
StatusResponse = 1,
OpenProcessRequest = 2,
CloseProcessRequest = 3,
IsValidRequest = 4,
ReadMemoryRequest = 5,
ReadMemor... |
/*************************************************************
Author : qmeng
MailTo : qmeng1128@163.com
QQ : 1163306125
Blog : http://blog.csdn.net/Mq_Go/
Create : 2018-03-22 16:56:55
Version: 1.0
**************************************************************/
#include <cstdio>
#include <iostream>
using namesp... |
#ifdef FASTCG_OPENGL
#if defined FASTCG_WINDOWS
#include <FastCG/Platform/Windows/WindowsApplication.h>
#elif defined FASTCG_LINUX
#include <FastCG/Platform/Linux/X11Application.h>
#endif
#include <FastCG/Graphics/OpenGL/OpenGLUtils.h>
#include <FastCG/Graphics/OpenGL/OpenGLGraphicsSystem.h>
#include <FastCG/Graphics/... |
#include<iostream>
using namespace std;
int main() {
float a;
cin >> a;
if (a >= 20 && a <= 30) {
cout << 1;
}
else {
cout << 0;
}
}
|
/*
Lowest common ancestor in a BST
*/
#include<iostream>
using namespace std;
struct node
{
int data;
node *l,*r;
}*root;
node *insert(int a,node *ptr)
{
if(ptr==NULL)
{
ptr=new node;
ptr->data=a;
ptr->l=ptr->r=NULL;
}
else if(a>ptr->data)
ptr->r=insert(a,ptr->r);
els... |
/*
* Warrior.h
*
* Created on: Dec 27, 2018
* Author: ise
*/
#ifndef WARRIOR_H_
#define WARRIOR_H_
#include "Hero.h"
class Warrior : public Hero{
public:
Warrior();
virtual ~Warrior() {};
Warrior(string name);
Warrior(string name,double newgold,int bd,int wiz, int arch, int vamp, int zomb, int tot);
... |
#include "StreamParser.h"
#include "Registry.h"
using RegistryeHandlerRegistry = Registry<Type,Parser>;
template<>template<>
bool RegistryeHandlerRegistry::SelfRegister<StreamParser>::_registered
= RegistryeHandlerRegistry::SelfRegister<StreamParser>::selfRegister();
StreamParser::StreamParser()
{}
const Type& ... |
#include "Widget.h"
#include <QtGui>
Widget::Widget( QWidget * parent )
: QWidget( parent )
{
createWidgets();
setWindowTitle( tr("Echo client %1").arg( PORT ) );
connect( &socket, SIGNAL( connected() ), SLOT( slotConnected() ) );
connect( &socket, SIGNAL( disconnected() ), SLOT( slotDisconnected() ) );
conn... |
/**
* [Question]
* - 合計すると与えられた数字と同じになる整数の配列のすべての組み合わせを探すにはどうすればよいですか?
*
* [Solution]
* - 再帰関数で深さ優先探索を実装
* - 分岐は "足した" or "足していない" の2つ
* - 一度計算した値を保持する,メモ化再帰で実装
* - 部分和が与えたれた値を超えるとそれ以降計算する必要がないので,枝狩りを実装
*/
#include <iostream>
#include <vector>
/* INPUT */
int n = 17;
std::vector<int> v = {2, 4, ... |
/* GPA2 - IFC
Criado Por: Natalia Kelim Thiel
Data: 06/04/2016
Descrição:
Cabeçalho (header) da biblioteca para uso do Teclado Analógico
*/
#ifndef Teclado_h
#define Teclado_h
#include "Arduino.h"
#include "Registro.h"
#include "Ajuste.h"
class Teclado{
public:
Teclado();
int static ler();
... |
#import <vector>
#import <iostream>
void PrintVector(const std::vector<int> &vec) {
std::cout << "[ ";
for (int i = 0; i < vec.size(); i++) {
std::cout << vec[i] << " ";
}
std::cout << "]" << std::endl;
}
void Swap(std::vector<int> &vec, int x, int y) {
int temp = vec[x];
vec[x] = vec[y];
vec[y] = t... |
class Solution {
public:
string convert(string s, int numRows) {
if(s.empty())
return "";
if (numRows == 1 || s.length() == 1)
return s;
string res;
int cur_line = 1;
int start = 0;
while (cur_line <= numRows && res.length() < s.length... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.