text stringlengths 8 6.88M |
|---|
#include <iostream>
#include <vector>
constexpr int kNotFound = -1;
int LinearSearch(int element, const int* v, int size) {
for(int i=0; i < size; i++) {
if(v[i] == element) {
return i;
}
}
return kNotFound;
}
int BinarySearch(int element, const int* v, int size) {
int lef... |
#pragma once
#include<string>
#include<vector>
#include<iostream>
#include<fstream>
#include<iomanip>
#include<stack>
#include<map>
#include<Windows.h>
#include"Interfaces.h"
using std::ifstream;
using std::ofstream;
using std::string;
using std::vector;
using std::cout;
using std::cin;
using std::cerr;
using std::e... |
// ------------------------------------------------------------------------------------------------
#include "Common.hpp"
// ------------------------------------------------------------------------------------------------
#include <cerrno>
#include <cstdio>
#include <cstdlib>
#include <cstring>
// -------------------... |
//! Bismillahi-Rahamanirahim.
/** ========================================**
** @Author: Md. Abu Farhad ( RUET, CSE'15)
** @Category:
/** ========================================**/
#include<bits/stdc++.h>
#include<stdio.h>
using namespace std;
#define ll long long
int main()
{
ll i,w,h,s_w,s_h... |
vector<int> Solution::solve(vector<int> &A, int B) {
vector<int> ans;
priority_queue<int, vector<int>, greater<int> > pq; // Creating a min-heap
for(int i=0;i<A.size();i++){
pq.push(A[i]);
if(pq.size()>B){
pq.pop();
}
}
while(!pq.empty()){
ans... |
#pragma once
#include "HumanoidFootprintManager.hpp"
namespace FootStepPlanner {
class FootStepManager {
public :
virtual ~FootStepManager();
private :
};
}
|
#ifndef EXTERNALCOMMANDS_H
#define EXTERNALCOMMANDS_H
using namespace std;
//int bg_pid;
//int fg_pid;
class ExternalCommands {
public:
ExternalCommands();
~ExternalCommands();
void callExternal(int fg, vector<string> args);
};
#endif
|
#include <bits/stdc++.h>
#define ll long long
using namespace std;
int main()
{
int t;cin>>t;
while(t--)
{
int n,v,q;cin>>n;
string x;
char ch;
map<char,int>ara;
ll ans=0;
while(n--)
{
getchar();
ch=getchar();
cin>>v... |
#include"Maltese.h"
#include<cstdio>
Maltese::Maltese(const char* name) : Dog(LivesInterface::Origin::EVERYWHERE, name) {
setColor(FUR_COLOR_WHITE);
}
Maltese::~Maltese() {}
void Maltese::printToConsole() {
using namespace std;
cout << "우리 귀여운 말티즈~" << endl;
Dog::printToConsole();
cout << endl;
... |
#include"LinkListStack.h"
#include"ArrayStack.h"
#include<ctime>
//int main() {
// LinkListStack<int>* Stack = new LinkListStack<int>();
// for (int i = 0; i < 5; i++)
// {
// Stack->push(i);
// Stack->print();
// }
//
// Stack->pop();
// Stack->print();
//
// return 0;
//}
template<typename T>
double test(T *e, int ... |
#pragma once
#include <stdlib.h>
namespace _5_задание___работа_с_массивами {
using namespace System;
using namespace System::ComponentModel;
using namespace System::Collections;
using namespace System::Windows::Forms;
using namespace System::Data;
using namespace System::Drawing;
/// <summary>
/// Сводка д... |
#include <cstdio>
#include <algorithm>
using namespace std;
bool cmp(int a, int b)
{
return a > b;
}
// 0-1背包问题,需要记录选择
int main()
{
const int MAXM = 110;
const int MAXN = 10010;
int N, M;
scanf("%d%d", &N, &M);
int c[MAXN];
for (int i = 0; i < N; i++)
scanf("%d", &c[i]);
// 默认升... |
#include <algorithm>
#include <cstdio>
#include <iostream>
using namespace std;
typedef long long ll;
struct Rubbish {
int t, h, e;
Rubbish() {}
bool operator<(Rubbish& a) { return t < a.t; }
};
const int maxn = 105, maxh = 1005;
int h, n;
Rubbish rub[maxn];
// dp[i][j]表示前i个垃圾到达高度j时能维持的最大生命时间
int dp[maxn]... |
#include "Command_Line_UI/ui.hpp"
int main(int argc, char** argv)
{
#ifndef FUNDRAISING_USE_UI
Fundraising::Command_Line::command_line_run(argc, argv);
#else
Fundraising::UI::run();
#endif
return 0;
} |
#ifndef WBPEOWNER_H
#define WBPEOWNER_H
#include "wbpe.h"
class WBPEOwner : public WBPE
{
public:
WBPEOwner();
virtual ~WBPEOwner();
DEFINE_WBPE_FACTORY( Owner );
virtual void InitializeFromDefinition( const SimpleString& DefinitionName );
virtual void Evaluate( const WBParamEvaluator::SPEContext& Context, WBP... |
#ifndef _HS_SFM_CALIBRATE_PLANAR_CALIBRATION_GENERATOR_HPP_
#define _HS_SFM_CALIBRATE_PLANAR_CALIBRATION_GENERATOR_HPP_
#include <cmath>
#include "hs_math/random/uniform_random_var.hpp"
#include "hs_math/random/normal_random_var.hpp"
#include "hs_math/linear_algebra/eigen_macro.hpp"
#include "hs_math/geometry/euler_... |
//////////////////////////////////////////////////////////////////////
// GLFBO.h
//
// Fangyang SHEN, VRLab, Beihang University
// me@shenfy.net
//
// Edited by BAI Gang, for unsigned char pixel values...
//
// (C) Copyright VRLab, Beihang University 2009.
/////////////////////////////////////////////////////... |
// *****************************************************************
// This file is part of the CYBERMED Libraries
//
// Copyright (C) 2007 LabTEVE (http://www.de.ufpb.br/~labteve),
// Federal University of Paraiba and University of São Paulo.
// All rights reserved.
//
// This program is free software; you can redist... |
#ifndef TREEWIDZARD_INSTRUCTIVETREEDECOMPOSITION_H
#define TREEWIDZARD_INSTRUCTIVETREEDECOMPOSITION_H
#include <algorithm>
#include <cstring>
#include <experimental/filesystem>
#include <iostream>
#include <sstream>
#include "../Multigraph/MultiGraph.h"
#include "ConcreteTreeDecomposition.h"
#include "Term.h"
class In... |
#include "Inventory.h"
Inventory::Inventory() : IStorage(4, 1)
{
}
|
#include <bits/stdc++.h>
#define ll long long
#define MOD 1000000007
using namespace std;
ll n, x, y, cx, cy, ans;
ll f[2000006];
ll r[2000006];
int main()
{
ios_base::sync_with_stdio(false);
cin.tie(0);
cout.tie(0);
cin >> x >> y;
f[0] = 0;
f[1] = 1;
for(int i=2; i<=max(x,y)+1; i++)
... |
#include <iostream>
#include <math.h>
using namespace std;
float median_h(int arr[], int size){
float median = 0.0;
if(size%2 == 0)
median = (arr[size/2] + arr[(size/2)-1])/2;
else median = arr[(int)ceil((float)size/(float)2)];
return median;
}
float median(int arr1[], int arr2[], int size_1, ... |
#include "main.h"
int main(int argc, char* argv[]) {
MyTAR mytar = MyTAR();
if(!mytar.openFile(argc, argv)) return 0;
mytar.readFile();
mytar.printList();
return 0;
} |
/*
ID: hjl11841
TASK: namenum
LANG: C++
*/
#include<bits/stdc++.h>
using namespace std;
string name[5000];
char a[10][4]={{},{},"ABC","DEF","GHI","JKL","MNO","PRS","TUV","WXY"};
int main(){
freopen("namenum.in","r",stdin);
freopen("namenum.out","w",stdout);
int n=0;
cin>>name[n];
n++;
freopen("d... |
# include "velocityBound.h"
VelocityBound velocityBound(double q[6], double qMin[6], double qMax[6], double V[6], double A[6], double Ts)
{
// qDotMin <= qDot <= qDotMax
// Eq. (13) in "Control of Redundant Robots Under Hard Joint
// Constraints: Saturation in the Null Space", F, Flacco, A. De Luca,
... |
#ifndef STICKUINO_UTILITIES_LOOPABLE_H
#define STICKUINO_UTILITIES_LOOPABLE_H
#include "DynamicArray.h"
#include <Arduino.h>
namespace Stickuino {
namespace Utilities {
template <typename SelfType>
class ScheduledTask;
/// <summary>
/// A loopable object.
/// </summary>
class Loopable {
public:
///... |
#include <iostream>
#include "RegistrationSystem.h"
RegistrationSystem::RegistrationSystem():students(NULL),studentNumber(0) {
}
RegistrationSystem::~RegistrationSystem() {
delete[] students;
}
void RegistrationSystem::addStudent(const int studentId, const string firstName, const string lastName) {
if (studen... |
/*
* SomaPares.cpp
*
* Created on: 17 de fev de 2018
* Author: kryptonian
*/
#include <iostream>
using namespace std;
int cnt, soma;
int main(){
for (int c = 1; c <= 500; c++){
if (c % 2 == 0){
cnt += 1;
soma += c;
}
}
cout << "\nExistem " << cnt << " números pa... |
#include "pch.hpp"
#include "DirectXHelper.hpp"
#include "Math.hpp"
#define STB_TRUETYPE_IMPLEMENTATION
#define STB_RECT_PACK_IMPLEMENTATION
#include "Core/StbRectPack.hpp"
#include "TextRenderer.hpp"
using Microsoft::WRL::ComPtr;
using Windows::ApplicationModel::Package;
AppCore::BitmapFont::BitmapFont(
const std:... |
#include<iostream>
using namespace std;
int main()
{
cout<<"rishikesh";
cout<<"bioinformatics";
return 0;
}
|
#include "BinarySearchTree.hpp"
BinarySearchTree::BinarySearchTree()
{
this->root = NULL;
}
BinarySearchTree::~BinarySearchTree()
{
// TODO: メモリ解放: delete()
}
void BinarySearchTree::insert_node(int key)
{
// 挿入するノードの宣言と初期化
node_t *z = new node_t();
z->key = key;
z->parent = NULL;
z->left ... |
/**
* @file GaussianGenerator.h
* @author F. Gratl
* @date 7/31/18
*/
#pragma once
#include <random>
#include "autopas/AutoPas.h"
/**
* Generator class for gaussian distributions
*/
class GaussianGenerator {
public:
/**
* Fills any container (also AutoPas object) with randomly 3D gaussian distributed par... |
#include <bits/stdc++.h>
using namespace std;
// Complete the flippingBits function below.
long flippingBits(long n) {
string s = bitset<32>(n).to_string();
for (int i=0; i<s.length(); i++)
{
if (s[i]=='0')
s[i] = '1';
else
s[i] = '0';
}
bitset<32> s_caste... |
#ifndef EDAFOS_H
#define EDAFOS_H
#include "Planitis.h"
#include <iostream>
#include <cstdlib>
#include <ctime>
using std::cout;
using std::endl;
class Edafos:public Planitis{
public:
Edafos(); //constructor Edafos
// sinartiseis pliroforiwn kai simvolwn
virtual void PrintInfo() const;
... |
#include <math.h>
#include <cstdlib>
#include <time.h>
#include <cstdio>
#include <iostream>
#include "opencv2/core/core.hpp"
#include "opencv2/features2d/features2d.hpp"
#include "opencv2/highgui/highgui.hpp"
#include "opencv2/nonfree/nonfree.hpp"
#include "cv.h"
using namespace std;
double M_pi = 3.141... |
#include<bits/stdc++.h>
using namespace std;
int main()
{
int n;
cin>>n;
int edges;
cin>>edges;
int arr[n];
int adj[n][n];
for(int i=0;i<n;i++)
{
arr[i]=0;
for(int j=0;j<n;j++)
{
adj[i][j]=0;
}
}
int src;
cin>>src... |
class Solution {
public:
bool increasingTriplet(vector<int>& nums) {
if(nums.empty()) return false;
int n = nums.size();
if(n < 3) return false;
int large = INT_MAX;
int small = nums[0];
for(int i = 1; i < nums.size(); i++)
{
if(nums[i] > large) re... |
#include <Arduino.h>
#include "AccelStepper.h"
#include "MultiStepper.h"
#include "axisDirectionStruct.h" //importing AxisAndDirection
#define STEPPER_X_STEP_PIN 2
#define STEPPER_X_DIR_PIN 3
#define STEPPER_Z_STEP_PIN 6
#define STEPPER_Z_DIR_PIN 7
#define STEPPER_Y_STEP_PIN 9
#define STEPPER_Y_DIR_PIN 10
#define led... |
#include "componentfactory.h"
#include "arrowitem.h"
#include "lineitem.h"
#include "grawitem.h"
#include "circleitem.h"
#include "rectangletextitem.h"
#include "elements/polylineitem.h"
#include "elements/graphnode.h"
#include "elements/twogtext.h"
#include "elements/svgitem.h"
#include "rectangleitem.h"
// В GrawIte... |
#include <iostream>
#include "interpreter.hpp"
#include <fstream>
using std::cout;
using std::cin;
int main(int argc, char*argv[])
{
int Output;
Expression Error("Error");
if (argc == 1)
{
Interpreter Interp;
std::string input;
Expression output;
while (1)
{
cout << "vtscript> ";
getline(cin, inp... |
// <algorithm> includes the various algorithms
#include<iostream>
#include<algorithm>
using namespace std;
// This is for calculating the GCD of two numbers using the in-built function
// EUCLID'S GCD Algorithm
// Complexity - O(log2n) ( log2n -> log(n) to the base 2 ), n - upper limit of (a,b)
// For details - https... |
/*
* Multiple MAX7221 can be chained. !CS must be kept low while clocking all bytes through, LEDs are set when !CS goes high.
*
* I assume we can send data to a device down the line without affecting the earlier ones if we just send 0-bytes to push the
* "real" one.
*
* Clock does not run when !CS is high, hope... |
#include "code_generator.h"
#include "html.h"
#include "html_print.h"
#include "css_print.h"
#include "file.h"
HTML_Element* compileLayout(Compiler* compiler, AST_Layout* layout, CompilerParameters* properties = NULL);
CompilerValue evaluateExpression(Compiler* compiler, AST_Expression* expression);
inline AST_Compon... |
#ifndef ENTT_LIB_EMITTER_PLUGIN_STD_PROXY_H
#define ENTT_LIB_EMITTER_PLUGIN_STD_PROXY_H
#include "types.h"
struct proxy: emitter_proxy {
proxy(test_emitter &);
void publish(message) override;
void publish(event) override;
private:
test_emitter *emitter;
};
#endif
|
// C++ for the Windows Runtime vv1.0.170303.6
// Copyright (c) 2017 Microsoft Corporation. All rights reserved.
#pragma once
WINRT_EXPORT namespace winrt {
namespace ABI::Windows::UI::Notifications {
struct IAdaptiveNotificationContent;
struct IAdaptiveNotificationText;
struct IBadgeNotification;
struct IBadgeNoti... |
//
// Copyright Jason Rice 2017
// 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_BINDER_JS_HPP
#define NBDL_BINDER_JS_HPP
#include <nbdl/bind_map.hpp>
#include <nbdl/bind_sequence.hpp>
#include <n... |
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
void solve(){
int n,sum;cin>>n>>sum;
vector<vector<int>>a(n,vector<int>(2));
for(int i=0;i<n;i++){
cin>>a[i][0];
a[i][1]=i;
}
sort(a.begin(),a.end());
int l=0,r=n-1;
while(l<r){
if(a[l][0]+a[r][0]==sum){
cout<<a[l][1]+1<<" "<<a[r][1... |
/*MetaNodeTest.cpp
MetaNode
copyright Vixac Ltd. All Rights Reserved
*/
#include "MetaNode.h"
#include <gtest/gtest.h>
namespace VI = vixac;
namespace IN = VI::inout;
TEST(MetaNode, aTest)
{
/// EXPECT_STREQ( "write some tests for MetaNode", "TODO");
}
|
#pragma once
#include <iostream>
class ArcParse
{
public:
ArcParse();
ArcParse(int argc, char **argv);
~ArcParse();
char *input_file = NULL;
int width = 100;
int height = 100;
char *output_file = NULL;
float depth_min = 0;
float depth_max = 1;
char *depth_file = NULL;
char *normal_file = NULL;
bool shade_b... |
#include <iostream>
using namespace std;
int main()
{
string jenjang, program, kode_fti;
int kode_prodi, tahun;
cout << "Jenjang Studi : "; getline(cin, jenjang);
if(jenjang == "S1"){
cout << "Program Studi : "; getline(cin, program);
kode_fti = "12";
if(program == "Teknik Kimia"){
kode_prod... |
#include <Wifi_S08_v2.h>
#define SSID "ESPeezy"
#define PASSWD "MOMENTUM"
#define POLLPERIOD 1000
ESP8266 wifi = ESP8266(0,false);
String MAC;
unsigned long lastRequest = 0;
void setup() {
Serial.begin(115200);
wifi.begin();
MAC = wifi.getMAC();
wifi.connectWifi(SSID, PASSWD);
while (!wifi.isConnected()... |
/*
* Copyright (C) 2007-2015 Frank Mertens.
*
* Use of this source is governed by a BSD-style license that can be
* found in the LICENSE file.
*
*/
#include <flux/Format>
#include <flux/meta/JsonWriter>
namespace flux {
namespace meta {
Ref<JsonWriter> JsonWriter::create(Format format, String indent) { return ... |
#include "wrapper.h"
hCAnimBlendHierarchy_Constructor OLD_CAnimBlendHierarchy_Constructor = (hCAnimBlendHierarchy_Constructor)0x4CF270;
void CAnimBlendHierarchy_Constructor ( CAnimBlendHierarchy * pAnimHierarchy )
{
int pThis = (int)pAnimHierarchy;
*(DWORD *)(pThis + 4) = 0;
*(WORD *)(pThis + 8) = 0;
... |
#pragma once
#include "../MetaMorpheusEngineResults.h"
#include <string>
#include <unordered_map>
#include <unordered_set>
#include <tuple>
#include "stringbuilder.h"
//C# TO C++ CONVERTER NOTE: Forward class declarations:
namespace EngineLayer { class MetaMorpheusEngine; }
using namespace Proteomics;
namespace En... |
// OnHScrollPageLeft.h
#ifndef _ONHSCROLLPAGELEFT_H
#define _ONHSCROLLPAGELEFT_H
#include "HorizontalScroll.h"
#include "ScrollAction.h"
class OnHScrollPageLeft : public ScrollAction {
public:
OnHScrollPageLeft(HorizontalScroll *horizontalScroll);
OnHScrollPageLeft(const OnHScrollPageLeft& source);
virtual ~OnHSc... |
/*
The MIT License (MIT)
Copyright 2016 Luca Beldi
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, copy, modify, merge, publis... |
#pragma once
#include "VulkanWrapper/VulkanBaseApp.h"
class App : vkw::VulkanBaseApp
{
public:
App(vkw::VulkanDevice* pDevice):VulkanBaseApp(pDevice, "App"){};
~App() {};
void Init(uint32_t width, uint32_t height) override;
bool Update(float dTime) override;
void Render() override;
void Cleanup() override;
protec... |
/*
* File: CrazyRandomSword.cpp
* Author: Cody
*
*/
#include "CrazyRandomSword.h"
//Sword randomly ignores armor from 0 to half of current armor.
double CrazyRandomSword::hit(double armor){
double damage = hitPoints - (rand() % int(.5 * armor));
return damage;
} |
#pragma once
#ifndef _DTL_SIMD_INCLUDED
#error "Never use <dtl/simd/vec.hpp> directly; include <dtl/simd.hpp> instead."
#endif
#include "../adept.hpp"
#include "../math.hpp"
#include <array>
#include <bitset>
#include <functional>
#include <type_traits>
namespace dtl {
namespace simd {
/// Base class for a vector ... |
#include <cstdio>
#include <cstdlib>
#include <cmath>
#include <cassert>
#include <string>
using namespace std;
int main()
{
srand(19910724);
for (int testcase = 0; testcase < 10; ++ testcase) {
char filename[100];
sprintf(filename, "test/%d.in", testcase);
FILE* out = fopen(filename, ... |
/* CAN Receive and Decode Line Follower message
created 2/17/19 BD
*/
#include <mcp_can.h>
#include <SPI.h>
long unsigned int rxId;
unsigned char len = 0;
unsigned char rxBuf[8];
char msgString[128]; // Array to store serial string
unsigned long prevTX = 0; // Variable to store last... |
#include "func.h"
void gen_key(unsigned char *k, int r){
for(int i = 0; i < r; ++i)
k[i] = rand() % 255;
}
void init(unsigned char *s, unsigned char *k, const int r){
unsigned char q = 0, temp;
for(unsigned char i = 0; i < 255; ++i) s[i] = i;
s[255] = 255;
for(unsigned char i = 0; i < 2... |
/*
* 부분 문자열 길이가 고정이므로 a,c,g 세개의 빈도수가 같으면 t는 당연히 같으므로
* a,c,g 의 개수로만 처리해도 된다.
*/
#include<iostream>
#include<unordered_map>
#include<string>
using namespace std;
//전체 개수 중 T는 나머지가 같으면 같은거니 계산 제외함 (성능 업)
//3개만 1001진법 이상으로 하면 overflow 가능성 줄어드니.
struct Data {
int a, c, g;
//bool operator==(const Data&r) const {
// ret... |
/*******************************************************************************
* Cristian Alexandrescu *
* 2163013577ba2bc237f22b3f4d006856 *
* 11a4bb2c77aca6a9927b85f259d9af10db791ce5cf884bb31e7f7a889d4fb385 ... |
#include <iostream>
using std::cout;
using std::endl;
void Swap(int a, int b);
void Swap(int* a, int* b);
int main()
{
int x = 10;
int y = 15;
cout << "x = " << x << " y = " << y << endl;
Swap(x, y);
cout << "x = " << x << " y = " << y << endl;
Swap(&x, &y);
cout << "x = " << x << " y = " << y << endl;
sys... |
class Solution {
public:
int minFlipsMonoIncr(string s) {
int n = s.size(), res = INT_MAX;
// cnt1[i]: num flipping 1 to 0 in s[0:i-1] to make monotone increasing
// cnt2[j]: num flipping 0 to 1 in s[j:n-1] to make monotone increasing
vector<int> cnt1(n + 1), cnt2(n + 1);
... |
/**
* Print functions for the Header part of a generated proto message.
*/
#ifndef FISHY_PROTO_PRINTER_HEADER_H
#define FISHY_PROTO_PRINTER_HEADER_H
#include <CORE/TYPES/protobuf.h>
#include <string>
bool PrintHeader(const core::types::ProtoDef &def, const std::string &fileName);
#endif
|
//
// Created by 王润基 on 2017/4/19.
//
#ifndef INC_2RAYTRACE_OBJECTMATERIAL_H
#define INC_2RAYTRACE_OBJECTMATERIAL_H
#include "Material.h"
class ObjectMaterial {
public:
std::string name;
shared_ptr<Texture> diffuse = nullptr; // 漫反射
shared_ptr<Texture> ambient = nullptr; // 环境光
Material m;
pub... |
#include <iostream>
#include <string>
#include "../Headers/Fight.h"
fight::fight() {
round = 1;
}
void fight::YourTurn(Player &p, Status &s, weapon &w, opponent& a) const {
if (round % 2 == 1) {
int dmg = w.ReturnDmg();
std::cout << "You have attacked the " << a.ReturnName() << " and dealt " ... |
#include <Windows.h>
#include <tchar.h>
#define IDS_APP_TITLE 103
#define IDR_MAINFRAME 128
#define IDD_LAB2_DIALOG 102
#define IDD_ABOUTBOX 103
#define IDM_ABOUT 104
#define IDM_EXIT 105
#define IDI_LAB2 107
#define IDI_SMALL 108
#define IDC_LAB2 109
#define IDC_MYICON 2
#ifndef IDC_STATIC
#defi... |
#include"iostream"
using namespace std;
struct node{
int data;
node *ptr;
};
node *head;
node *tail;
void insert(int x){
node *temp=new node;
temp->data=x;
temp->ptr=NULL;
if(head==NULL){
head=temp;
tail=temp;
}
else{
tail->ptr=temp;
tail=tail->ptr;
}
}
void display(){
node *temp=head;
while(temp!... |
#include<bits/stdc++.h>
using namespace std;
int main(){
int t;
cin>>t;
while(t--){
long a,c,b,r;
cin>>a>>b>>c>>r;
long total = 0;
long s = c-r;
long e= c+r;
if(b>a){
if( (s<a && e<a) || (s>b && e>b)){
total = abs(b-a);
cout<<total<<"\n";
continue;
}
if(s>=a && e<=b){
total = abs(b-... |
/* Copyright (c) 2008 NVIDIA CORPORATION
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, copy, modify, merge, publish, dis... |
#include "ColorVertex.h"
std::vector<Gx::VertexElement> ColorVertex::declaration()
{
return { Gx::VertexElement::Position, Gx::VertexElement::Color };
}
|
/*
* Copyright (C) 2007-2015 Frank Mertens.
*
* Use of this source is governed by a BSD-style license that can be
* found in the LICENSE file.
*
*/
#ifndef FLUX_TIMER_H
#define FLUX_TIMER_H
#include <flux/Thread>
#include <flux/Channel>
#include <flux/System>
namespace flux {
/** \brief interval timer thread
... |
#include "serial.h"
#include <Arduino.h>
#include <VescUart.h>
#include <datatypes.h>
#include <driver/uart.h>
#include "analog.h"
#include "mpu.h"
#include <PID_v1.h>
double Setpoint, Input, Output;
double Kp=1, Ki=3, Kd=4;
PID myPID(&Input, &Output, &Setpoint, Kp, Ki, Kd, DIRECT);
struct bldcMeasure measuredVa... |
#include <iostream>
#include <sstream>
#include <fstream>
#include "gl_helpers.h"
namespace {
std::string load_source_from_file(const std::string& file_path) {
std::ifstream source_file{file_path};
if (!source_file.is_open()) {
std::cout << "Could not find file:\n" << file_path << "\nExiting" << std::... |
#ifndef GAME_H
#define GAME_H
#include <cstdio>
#include <string>
#include <sstream>
#include <vector>
#include <SDL2/SDL.h>
#include <SDL2/SDL_image.h>
#include <SDL2/SDL_ttf.h>
#include "constants.hpp"
#include "Base.hpp"
#include "Views/BaseMap.hpp"
#include "Building.hpp"
#include "Button.hpp"
#include "Electrol... |
/********************************************************************************
** Form generated from reading UI file 'mainwindow.ui'
**
** Created by: Qt User Interface Compiler version 5.2.1
**
** WARNING! All changes made in this file will be lost when recompiling UI file!
****************************************... |
#ifndef CORE_ENGINE_HPP
# define CORE_ENGINE_HPP
# include <iostream>
# include <sys/time.h>
# include <unistd.h>
# include "OpenGlLib.hpp"
# include "../core/GameObject.hpp"
# include "../game/Gomoku.hpp"
# define SECOND (1000000.0)
class CoreEngine
{
public:
CoreEngine( float fps );
CoreEngine( CoreEngine const ... |
#pragma once
#include "ofMain.h"
#include "ofxGui.h"
class ofApp : public ofBaseApp{
public:
void setup();
void update();
void draw();
void keyPressed(int key);
void keyReleased(int key);
void mouseMoved(int x, int y);
void mouseDragged(int x, int y, int button);
void mousePressed(i... |
#pragma once
#include <algorithm>
#include <cmath>
namespace utils {
inline unsigned int factorial(unsigned int const factor)
{
return static_cast<unsigned int>(std::tgamma(factor + 1.0));
}
inline unsigned int num_combinations(unsigned int const num_items,
unsigned int const chosen_items_at_time)
{
return fa... |
#include "../Include/PainterForEllipse.h"
#include "../Include/Window.h"
#include "../Include/Graph.h"
#include "../Include/World.h"
PainterForEllipse::PainterForEllipse(Application * targetApp, Window * targetWindow, World * targetWorld)
: Painter(targetApp, targetWindow, targetWorld)
{
requiredClicks = 1;
}
Pain... |
class Solution {
public:
vector<vector<string>> result;
vector<vector<string>> solveNQueens(int n) {
vector<vector<int>> xie(n, vector<int>(n,0));
vector<string> temp;
backtrack(n,0,temp,xie);
return result;
}
void backtrack(int n, int row, vector<string> temp, vector<vec... |
/****************************************************************************
Author: Luma (stubma@gmail.com)
https://github.com/stubma/cocos2dx-better
@2015 QuanNguyen
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Softwar... |
#include "guiutils.h"
GuiUtils::GuiUtils()
{
}
GuiUtils::~GuiUtils()
{
}
std::string GuiUtils::getFilePath(QWidget *parent)
{
QFileDialog *dialog = new QFileDialog(parent);
QString fileName = dialog->getOpenFileName(parent, QString("Open File"), QString(), QString());
dialog->close();
dialog->~QFil... |
#include <bits/stdc++.h>
#define ull unsigned long long
#define ll long long
#define il inline
#define db double
#define ls rt << 1
#define rs rt << 1 | 1
#define pb push_back
#define mp make_pair
#define pii pair<int, int>
#define X first
#define Y second
#define pcc pair<char, char>
#define vi vector<int>
#define vl ... |
//
// AudioManager.cpp
// Boids
//
// Created by Yanjie Chen on 3/9/15.
//
//
#include "AudioManager.h"
#include "audio/include/SimpleAudioEngine.h"
#include "audio/include/AudioEngine.h"
using namespace cocos2d;
using namespace CocosDenshion;
using namespace experimental;
AudioManager* AudioManager::_instance = ... |
// Copyright Epic Games, Inc. All Rights Reserved.
#include "TempCapstoneProjectGameMode.h"
#include "TempCapstoneProjectCharacter.h"
#include "DummyPawn.h"
#include "UObject/ConstructorHelpers.h"
#include "SplitScreenGameViewportClient.h"
#include "TempCapstoneProjectGameState.h"
#include "Engine/LevelStreaming.h"
... |
#include<stdio.h>
int print1();
int print2();
int main(){
char a[10]="hhh";
char b[10]="hhh";
if(a==b)
printf("nkfndknfk");
print1();
print1();
print2();
print2();
return 0;
}
int print1(){
static int x=10;
x +=5;
printf("%d ",x);
}
int print2(){
static int x;
x=10;
x+=5;
printf("%d ",x);
}
|
/********************************************************************************
** Form generated from reading UI file 'PointCloudTools.ui'
**
** Created by: Qt User Interface Compiler version 5.7.0
**
** WARNING! All changes made in this file will be lost when recompiling UI file!
***********************************... |
#include<iostream>
using namespace std;
class Node{
private:
int data;
Node *next;
public:
Node(){
data=0;
next=NULL;
}
int getData(){
return data;
}
void setData(int data){
this->data = data;
}
Node* getNext(){
return next;
}
void setNext(Node* te... |
//
// Copyright (C) 2017 Ruslan Manaev (manavrion@yandex.com)
// This file is part of the Modern Expert System
//
#pragma once
#include "AddQuestionPage.g.h"
#include "MainPageController.h"
#include <string>
#include <map>
#include <utility>
#include <vector>
namespace modern_expert_system {
struct ThreeTextBox... |
/***********************************************************************
created: 15/6/2004
author: Paul D Turner
purpose: Implementation of List header segment widget.
*************************************************************************/
/**********************************************************************... |
// ===============================================
// @file update.cpp
// @author janeQuinn
// @practical defender
// @brief Update file for the defender game
// ===============================================
#include "defender.h"
void Ship::update(float dt) {
// clamp the x
if(position.x < (level->position.x ... |
//#include <opencv2/opencv.hpp>
//using namespace cv;
//using namespace std;
//
//bool check_match(Mat img, Point start, Mat mask, int mode = 0)
//{
// for (int u = 0; u < mask.rows; u++) {
// for (int v = 0; v < mask.cols; v++) {
// Point pt(v, u);
// int m = mask.at<uchar>(pt); // 마스크 계수
// int p = img.a... |
#include "boardbutton.h"
#include <QtWidgets>
BoardButton::BoardButton(QGraphicsItem *parent, QString text) : BoardPart(parent), m_text(text), click(false)
{
setCursor(Qt::OpenHandCursor);
setAcceptedMouseButtons(Qt::LeftButton);
}
QRectF BoardButton::boundingRect() const
{
return QRectF(0, 0, 90, 50);
}... |
#include <stdio.h>
#include <stdlib.h>
#include <ctime>
#include "smart_home_sql.h"
using namespace std;
void mainMenu()
{
printf("Enter the following:\n");
printf("1. To show users\n");
printf("2. To set active user\n");
printf("3. To add user\n");
printf("4. To control lock\n");
printf("5. To dele... |
#pragma once
#include "DrawingObject.h"
#include <SFML/OpenGL.hpp>
using namespace std;
class DrawingGL : public DrawingObject
{
public:
DrawingGL(std::string ressource);
DrawingGL(void);
~DrawingGL(void);
void Draw(sf::RenderWindow& renderWindow);
bool isGL();
virtual void AI(sf::RenderWindow& renderWindow, std... |
#include <iostream>
using namespace std;
#include "add.h"
void usage() {
cerr << "usage: ./addCmdLine a b" << endl;
}
int main(int argc, char const *argv[]) {
if (argc != 3) {
usage();
return 1;
}
try {
int a = stoi(argv[1]);
int b = stoi(argv[2]);
cout << "sum = " << addEm(a,b) << end... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.