text stringlengths 8 6.88M |
|---|
/**
* Copyright (C) 2019 Sergey Morozov <sergey@morozov.ch>
*
* 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, ... |
#include "quicksorter.h"
template<typename T>
void Quicksorter<T>::Quicksort( std::vector<T> &items, int start, int end)
{
if( start >= end ) {
return;
}
int p = Partition( items, start, end );
Quicksort(items, start, p);
Quicksort(items, p+1, end);
}
template<typename T>
int Quicksorter<T... |
//
// SSH1106 driver 132x64
//
#ifndef SJSU_DEV_OLEDDRIVER_H
#define SJSU_DEV_OLEDDRIVER_H
#include "i2c2.hpp"
#include "utilities.h"
#include "string.h"
/**
* Contains specs. of OLED, addresses, and registers
*/
enum {
OLED_WIDTH = 132,
OLED_HEIGHT = 64,
PAGE_COUNT = 8,
OLED_ADDRESS = 0x78,
... |
// Copyright 2020 Arthur Sonzogni. All rights reserved.
// Use of this source code is governed by the MIT license that can be found in
// the LICENSE file.
#include <iostream>
#include <sstream>
#include <vector>
#include "screen/Screen.h"
#include "translator/Translator.h"
namespace {
// clang-format off
//------... |
#pragma once
#include "Shape.h"
class Rect : public Shape
{
int m_left, m_right, m_top, m_bottom;
public:
Rect();
Rect(int left, int right, int top, int bottom, Color c = RED);
Rect(const Rect & other);
~Rect();
void WhereAmI();
void Inflate(int left, int right, int top, int bottom);
void Inflate(int dX ... |
#include<stdio.h>
int max(int a[],int n)
{
int i,m,ind;
m=a[0];
ind=0;
for(i=0; i<n; i++)
{
if(a[i]>m)
{
m=a[i];
ind=i;
}
}
return ind;
}
int min(int a[],int n)
{
int i,m,ind;
m=a[0];
ind=0;
for(i=0; i<n; i++)
{
if(a... |
//
// Example for a DHT11 sensor
//
#include <Wire.h>
#include <dht.h>
#define DHT11PIN 8
dht1wire DHT(DHT11PIN, dht::DHT11);
void setup()
{
Serial.begin(9600);
Serial.println(F("DHTxx TEST PROGRAM"));
}
void loop()
{
unsigned long b = micros();
dht::ReadStatus chk = DHT.read();
unsigned long e = micros()... |
#ifndef SINGLETON_HPP
#define SINGLETON_HPP
#include <atomic>
#include <mutex>
class Singleton{
public:
static Singleton* getInstance();
private:
static std::atomic<Singleton*> instance;
static std::mutex m_mutex;
};
#endif
|
#include<bits/stdc++.h>
using namespace std;
// O(n2) and O(1) space
int main()
{
int n;
cin >> n;
int* arr = new int[n];
for(int i=0;i<n;i++)
{
cin >> arr[i];
}
int i=1;
while(i<=n-1)
{
for(int j=0;j<n-1;j++)
{
if(arr[j] > arr[j+1])
{
int temp = arr[j];
arr[j]=arr[j+1];
arr[j+1]=temp;... |
#ifndef TEXT_FIELD
#define TEXT_FIELD 1
#include<qlineedit.h>
class textField:public QLineEdit{
Q_OBJECT
public:
textField(QWidget*parent=0);
signals:
void valueChanged(float);
public slots:
void setFloat(float);
private slots:
void text(const QString&);
};
#endif
|
#pragma once
/**
* \brief Represents one cell in a field
*/
class Cell
{
public:
Cell(int x, int y);
~Cell();
void PlantMine();
void AddNeighbouringMine();
void Clear();
bool IsMine();
bool IsCleared();
bool IsFlagged();
void DiscoverMine();
int MinesNeighbouring();
void ToggleFlag();
void Blank();
priva... |
#include<iostream>
#include"Grid.h"
Grid::Grid(int X, int Y)
{
setXY(X, Y);
initialize();
}
Grid::~Grid()
{
destroy();
}
Grid::Grid(const Grid& other)
{
copy(other);
}
Grid& Grid::operator=(const Grid& other)
{
if (this != &other)
{
destroy();
copy(other);
}
return *this;
}
... |
#include "header.h"
#include <iostream>
#include <string>
#include <algorithm>
using namespace std;
void string_sort(){
string str;
cout << "please type a string" << endl;
getline(cin,str,'\r');
sort(str.begin(),str.end());
cout << str;
}
|
#include <iostream>
#include <string>
#include <stdlib.h>
#include "battle.h"
battle::battle(){
//be careful, think about what might happen if you construct and empty battle array with nothing in it. Remember to take precautions with this (later on though because too lazy).
}
battle::battle(player user, ene... |
#include "04_abstractlistmodel/animallistmodel.h"
AnimalListModel::AnimalListModel(QObject *parent) : QAbstractListModel(parent)
{
}
int AnimalListModel::rowCount(const QModelIndex &parent) const
{
Q_UNUSED(parent);
return mListAnimals.count();
}
QVariant AnimalListModel::data(const QModelIndex &index, int ... |
// github.com/andy489
#include <stdio.h>
int main() {
int n, k;
scanf("%d %d", &n, &k);
int a[n], i, j;
for (i = 0; i < n; ++i) {
scanf("%d", a + i);
}
int c = 0, pg = 1;
for (i = 0; i < n; ++i) {
for (j = 1; j <= a[i]; ++j) {
if (j == pg)
++c;
... |
/*************************************************************************
* adamkov Bedside Clock
* (c) 2018-2019
* code based on William Moeur's Arduino_ESP8266 examples
* https://github.com/moeur/Arduino_ESP8266
*************************************************************************/
/* You must dedicate tw... |
/*********************************************************************************
Pubnub Subscribe
*********************************************************************************/
#include <ESP8266WiFi.h>
#include "VirtualDelay.h"
#include <math.h>
VirtualDelay virtualDelay(millis);
#include "ShiftRegister74HC5... |
#include <bits/stdc++.h>
using namespace std;
const int MAX_INT = std::numeric_limits<int>::max();
const int MIN_INT = std::numeric_limits<int>::min();
const int INF = 1000000000;
const int NEG_INF = -1000000000;
#define max(a,b)(a>b?a:b)
#define min(a,b)(a<b?a:b)
#define MEM(arr,val)memset(arr,val, sizeof arr)
#defi... |
/*************************************************************
* > File Name : P2176.cpp
* > Author : Tony
* > Created Time : 2019年01月22日 星期二 15时51分24秒
**************************************************************/
#include<bits/stdc++.h>
using namespace std;
const int maxn = 110;
const in... |
#include <windows.h>
#include <vector>
#include <cstdint>
#include <algorithm>
#include <functional>
#include <string>
#include "ReClassNET_Plugin.hpp"
bool IsValidMemoryRange(LPCVOID address, int length)
{
const auto endAddress = static_cast<const uint8_t*>(address) + length;
do
{
MEMORY_BASIC_INFORMATION info... |
#define _CRT_SECURE_NO_WARNINGS
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
typedef struct book
{
char bookTitle[20];
char nameOfAuthor[20];
int volumes;
book* next;
}book;
book* library = NULL; //global variable
void addBook()
{
char bookName[20];
char author[20];
printf("Input Book title: ... |
/***************************************************************************
Copyright (c) 2020 Philip Fortier
This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License
as published by the Free Software Foundation; either version 2
of the License, or... |
#include "ProtoManager.h"
#include "Log.h"
#include "Testing.h"
#include "Crypt.h"
#include "FileUtils.h"
#include "StringUtils.h"
#include "IniFile.h"
ProtoManager ProtoMngr;
template< class T >
static void WriteProtosToBinary( UCharVec& data, const map< hash, T* >& protos )
{
WriteData( data, (uint... |
#include <iostream>
using namespace std;
int main(int argc, char *argv[]) {
unsigned long long t, a, b;
cin >> t;
for (unsigned long long i = 0; i < t; i++){
cin >> a >> b;
if (a > b) cout << ">\n";
else if (a < b) cout << "<\n";
else cout << "=\n";
}
return 0;
}
|
// This file has been generated by Py++.
#ifndef _PropertyInitialiser__value_traits_pypp_hpp_hpp__pyplusplus_wrapper
#define _PropertyInitialiser__value_traits_pypp_hpp_hpp__pyplusplus_wrapper
namespace boost { namespace python { namespace indexing {
template<>
struct value_traits< CEGUI::PropertyInitialiser >{
... |
#ifndef _FITMODEL_H_
#define _FITMODEL_H_
#include<iostream>
#include<vector>
#include<string>
#include <algorithm>
#include <Rinternals.h>
enum MODEL{ DISEASE=0, HETERO=1, QT=2 };
enum HYPOTHESIS{ H0, H1 };
using namespace std;
extern "C"{
class CNV_signal
{
public:
int nind, ncomp, length, ncohorts;
dou... |
#include "gltools_Renderable.hpp"
#include <mutex>
#include <sstream>
#include "gltools_Loader.hpp"
#include "cpptools_Logger.hpp"
#include "cpptools_Strings.hpp"
#include "Settings.hpp"
#include "helpers/Consts.hpp"
#include "helpers/GLAssert.hpp"
namespace imog {
// * static
// =============================... |
#pragma once
#ifndef _SERIAL_HADLER_H_
#define _SERIAL_HADLER_H_
#include <iostream>
#include <string>
#include <boost/asio.hpp>
#include <boost/bind.hpp>
#include <boost/asio/serial_port.hpp>
class Serial
{
private:
boost::asio::serial_port* port;
union Scomp_float
{
float n_float;
uint32_t n_int;
... |
#include<iostream>
#include<stdlib.h>
using namespace std;
int main()
{
int n,i,j,d;
cin>>n;
int a[n];
for(i=0;i<n;i++)
cin>>a[i];
d=n;
int min=n;
int f=0;
for(i=0;i<n;i++)
{
for(j=0;j<n;j++)
{
if(i!=j && a[i]==a[j])
... |
#include <bits/stdc++.h>
using namespace std;
string frequencySort(string s)
{
map<char, int> m;
for (auto c : s)
m[c]++;
priority_queue<pair<int, char>> max_heap;
for (auto el : m)
max_heap.push(make_pair(el.second, el.first));
string ans = "";
while (!max_heap.empty())
{
... |
#include <TESTS/test_assertions.h>
#include <TESTS/testcase.h>
#include <CORE/HASH/crc32.h>
#include <CORE/types.h>
#include <cstring>
using namespace core::hash;
REGISTER_TEST_CASE(crc32TestHash) {
const char *hellostr = "Hello World";
const size_t hellolen = strlen(hellostr);
TEST(testing::assertEquals(0x4A... |
//======================================================================================
// Game Institute - C++ Module 1 Textbook Exercises
// Main.cpp The main Program Entry point.
// Exercise 7.9.1 - Fraction Class
// TODO: -
//
// Your program output should be formatted as follows:
//
/*
*/
//===================... |
#ifndef MYGLWIDGET_H
#define MYGLWIDGET_H
#pragma once
#include "paint_color.h"
#include "modelloader.h"
#include "planet.h"
#include "shadercontext.h"
#include <QWidget>
#include <QOpenGLWidget>
#include <QOpenGLBuffer>
#include <QOpenGLVertexArrayObject>
#include <QOpenGLShaderProgram>
#include <QOpenGLTexture>
#inc... |
#include <bits/stdc++.h>
using namespace std;
int main() {
int n,temp;
cin >> n;
int ans = 0;
//no need to store entire array somewhere
//keep adding elements to the ans while reading input
for(int i=0;i<n;i++){
cin >> temp;
ans += temp;
}
cout << ans;
return 0;
} |
#include<iostream>
using namespace std;
// 拷贝构造函数的调用时机:
//1. 使用一个已经创建完成的对象来初始化一个新对象
//2. 值传递的方式给函数参数传值
//3. 以值方式返回局部对象
class Person
{
public:
Person()
{
cout<<"Person默认函数构造"<<endl;
}
Person(int age)
{
m_age = age;
cout<<"Person有参函数构造"<<endl;
}
Person(con... |
#include <stdio.h>
int H, W, N;
int maxAns = 0, minAns = 2e9, bCnt;
struct node {
int sx, sy, ex, ey, color;
node* left, *right;
node* mAlloc(int _sx, int _sy, int _ex, int _ey, int _color) {
sx = _sx, sy = _sy, ex = _ex, ey = _ey, color = _color;
return this;
}
void push(int x, int y, node buf[]) {
// lea... |
#include <stdio.h>
#include <iostream>
#include <fstream>
#include <string>
#include <signal.h>
#include <stdio.h>
#include <string.h>
#include "BasicTasks.h"
#include "InternalCommands.h"
#include "ExternalCommands.h"
#include "Pipe.h"
#include <ctype.h>
#include <unistd.h>
#include <algorithm>
using namespace std;
v... |
#ifndef BSCHEDULER_CONFIG_HH_IN
#define BSCHEDULER_CONFIG_HH_IN
#include "@kernel_header@"
#define BSCHEDULER_KERNEL_TYPE @kernel_type@
#endif // BSCHEDULER_CONFIG_HH_IN vim:filetype=cpp
|
#ifndef SCREENSCHECK_H
#define SCREENSCHECK_H
#include <QObject>
#include <QGuiApplication>
#include <QDebug>
#include <QThread>
class ScreensCheck : public QObject
{
Q_OBJECT
public:
ScreensCheck(QObject *parent = 0);
public slots:
void check();
signals:
// true, если несклько мониторов
voi... |
#include <iostream>
using namespace std;
bool kiemTraSoDoiGuong(int i){
int soBanDau=i;
int soDao = 0;
int chuSo=0;
while(i>0){
chuSo = i%10;
soDao = soDao * 10 + chuSo;
i = i/10;
}
if(soDao==soBanDau){
return true;
} else {
return false;
}
}
int... |
//
// DarkIllusion.cpp
// Boids
//
// Created by chenyanjie on 5/27/15.
//
//
#include "DarkIllusion.h"
#include "../../Utils.h"
#include "../../scene/BattleLayer.h"
#include "../../AI/Terrain.h"
using namespace cocos2d;
DarkIllusion::DarkIllusion() {
}
DarkIllusion::~DarkIllusion() {
}
DarkIllusion* ... |
#include <Windows.h>
#include <stdio.h>
#include <stdlib.h>
#include "dllfunc.h"
#include "showmodule.h"
void waitInput()
{
getchar();
}
int main(int argc, const char* argv[])
{
showmodule(L"main");
dllfunc();
return 0;
} |
// Copyright Epic Games, Inc. All Rights Reserved.
/*===========================================================================
Generated code exported from UnrealHeaderTool.
DO NOT modify this manually! Edit the corresponding .h files instead!
========================================================================... |
#include "native_edge_detection.hpp"
#include "edge_detector.hpp"
#include "image_processor.hpp"
#include <stdlib.h>
#include <opencv2/opencv.hpp>
extern "C" __attribute__((visibility("default"))) __attribute__((used))
struct Coordinate *create_coordinate(double x, double y)
{
struct Coordinate *coordinate = (str... |
#include "pill.h"
#include <stdlib.h> /* srand, rand */
using namespace std;
namespace haunted_house
{
//TODO Make this global for haunted_house
const int RED = 0;
const int BLUE = 1;
const int GREEN = 2;
const int YELLOW = 3;
const int MAX_MAGIC = 100;
Pill::Pill(){
m_color = GREEN;
m_name = "Gr... |
#include "life.h"
Life::Life(int rows, int cols)
{
init(rows, cols);
}
Life::Life(std::string filename)
{
std::ifstream file;
file.open(filename);
if(file.fail())
exit(1);
int rows, cols;
char ca, cr; // char: active and char: read
file >> rows >> cols >> ca;
init(rows, cols);
... |
#include<iostream>
#define _rep(a,b,c) for(int (a)=(b);(a)<(c);(a)++)
using namespace std;
#define N 33
#define OJ 98
int mp[N][N];
int res[N][N];
int main()
{
#ifndef OJ
freopen("201512-2.txt","r",stdin);
#endif
int n,m;
cin>>n>>m;
_rep(i,0,n)
{
_rep(j,0,m)
{
cin>>mp[i][j];
res[i][j]=mp[i][j];
//读取... |
#include <bits/stdc++.h>
using namespace std;
class Solution
{
public:
int minSteps(int n)
{
int curr = 1, count = 0, buffer = 0;
while (curr < n)
{
int rest = n - curr;
if (rest % curr == 0)
{
buffer = curr;
curr += bu... |
#include<bits/stdc++.h>
typedef long long ll;
using namespace std;
int main()
{
int n,x,a,b,c;
double m;
cin>>n;
ll count=0;
for(int i=1;i<=n;i++)
{
m=sqrt(i+1);
{
m=(int)m;
a=m*m-1;
b=2*m;
c=m*m+1;
if(a>0&&b>0&&c>0){
cout<<a<<" "<<... |
/*
==============================================================================
KrushSync.cpp
Created: 22 Nov 2018 4:10:18pm
Author: rkubiak
==============================================================================
*/
#include "KrushSync.h"
KrushSync::KrushSync()
: internalSync... |
#include <Network/player_client.hpp>
namespace Network
{
PlayerClient::PlayerClient(const PrimeClient& client)
: client(client)
{
std::cout << "Created a new player client for " << client.to_string() << std::endl;
// TODO: Wait for information such as nickname (ofc limited time, consid... |
#include "GPUOCLLayer.h"
#include "crandom.h"
#include "cl_scan_gpu.h"
#include <algorithm>
#undef min
#undef max
void GPUOCLLayer::trace1D_Rev(int a_minBounce, int a_maxBounce, cl_mem a_rpos, cl_mem a_rdir, size_t a_size,
cl_mem a_outColor)
{
runKernel_ClearAllInternalTempBuffers(a_si... |
#pragma once
#include <deque>
#include <memory>
#include "Client.h"
#include "Game.h"
#include <boost/asio.hpp>
#include "util\Protos.pb.h"
#include "util\Util.h"
#include <mutex>
using boost::asio::ip::tcp;
using namespace util;
typedef std::deque<protos::Message> message_queue;
class Session
: public Client,
... |
#include "pch.h"
#include "Object.h"
#include "Ray.h"
Object::~Object()
{
}
|
//! Bismillahi-Rahamanirahim.
/** ========================================**
** @Author: Md. Abu Farhad ( RUET, CSE'15)
** @Category:
/** ========================================**/
#include<bits/stdc++.h>
#include<stdio.h>
using namespace std;
#define ll long long
#define scl(n) cin>... |
#include "readpara.h"
ReaderFileAss::ReaderFileAss (string fn1, string fn2, int maxLine) {
this->scoreFileName = fn1;
this->targetFileName = fn2;
this->maxLine = maxLine;
this->nusr = 0;
this->nmsg = 0;
}
void ReaderFileAss::getDataDimension () {
ifstream inf;
inf.open(this->scoreFileName.c_str(... |
#include "Conta.h"
#include "ContaEspecial.h"
#include "IConta.h"
#include "SaldoNaoDisponivelException.h"
#include <iostream>
using namespace std;
//g++ mainConta.cpp ContaEspecial.cpp Conta.cpp IConta.cpp SaldoNaoDisponivelException.cpp
int main(){
string n;
double slm, sl, lt , vl;
int nc;
int op;... |
/**
* @file UDPSocket.cpp
* Implements the UDPSocket class.
* @date Jun 21, 2013
* @author: Alper Sinan Akyurek
*/
#include "UDPSocket.h"
UDPSocket::UDPSocket( void )
{
}
UDPSocket::~UDPSocket( void )
{
}
UDPSocket::TNumberOfBytes
UDPSocket::SendData( const TBuffer buffer, const TNumberOfBy... |
/*
*chapter 6
* A is an array
i is the index
heapSize is the size of A
*/
void heapsort(A)
{
build_max_heap(A);
while (1 < A.heapSize)
{
exchange A[1] with A[A.heapSize];
A.heapSize -= 1;
max_heapify(A, 1);
}
}
|
#ifndef _PLAYER_VIEW_H_
#define _PLAYER_VIEW_H_
//forward declaration
class PathingGraph;
#include "IGameView.h"
/*
This is AI Player View
*/
class AIPlayerView : public IGameView
{
private:
std::shared_ptr<PathingGraph> m_pPathingGraph;
protected:
unsigned int m_ViewId;
unsigned int m_PlayerActorId;
public:
... |
#include <QApplication>
#include "gui_basis/mainwindow.h"
#include "kernel/ifc/ICore.h"
#include "Context.h"
using namespace smeta3d;
int main(int argc, char *argv[])
{
QApplication a(argc, argv);
SP_ICore ptrCore = GetSingltonCore();
CMainWindow w;
CContext* context = new CContext(&w);
w.setCentralWidget... |
#include "stdafx.h"
BackBuffer::BackBuffer()
{
hMemDC = NULL;
hBit = NULL;
hOldBit = NULL;
width = 0;
height = 0;
}
void BackBuffer::Init(int _width, int _height)
{
HDC hdc = GetDC(hWnd);
hMemDC = CreateCompatibleDC(hdc);
hBit = CreateCompatibleBitmap(hdc, _width, _height);
hOldBit = (HBITMAP)SelectObject(h... |
#include "PIDcontroller.h"
PIDcontroller::PIDcontroller()
{
Kp = 0.0;
Ki = 0.0;
Kd = 0.0;
dT = 0.0;
e_prev = 0.0;
e_int = 0.0;
}
PIDcontroller::PIDcontroller(double Kp_in, double Ki_in, double Kd_in, double dT_in, double e_prev_in, double e_int_in){
Kp = Kp_in;
Ki = Ki_in;
Kd = Kd_in;
dT = dT_in;
e_prev =... |
#include "gui\Singularity.Gui.h"
using namespace Singularity::Inputs;
namespace Singularity
{
namespace Gui
{
ListBox::ListBox(String name)
: TextControl(name, ""), m_pOptionTexture(NULL), m_pOptionHighlightTexture(NULL), m_cOptionColor(Color(1,1,1,1)), m_cOptionHighlightColor(Color(1,1,1,1... |
// C++ for the Windows Runtime vv1.0.170303.6
// Copyright (c) 2017 Microsoft Corporation. All rights reserved.
#pragma once
#include "base.h"
WINRT_WARNING_PUSH
#include "internal/Windows.UI.Xaml.Media.3.h"
#include "internal/Windows.Foundation.Collections.3.h"
#include "internal/Windows.UI.Xaml.3.h"
#include "inte... |
#include "..\Render\VertexBuffer.h"
#include <stdlib.h>
#include "..\GLRender\opengl.h"
VertexBuffer::~VertexBuffer()
{
}
class gl_VertexBuffer : public VertexBuffer
{
public:
gl_VertexBuffer(const unsigned char versionGL[2]);
virtual ~gl_VertexBuffer() override { release(); }
virtual void release(void) overri... |
/* Firmware to read wireless UART data from datalogger FE4
*/
const int ledPin = 13; // the pin that the LED is attached to, internal is 13
uint8_t incomingByte; // a variable to read incoming serial data into
uint8_t xbee_msg[16];
uint16_t id;
uint32_t timestamp;
uint8_t data[8];
uint8_t delimiter[2];
void... |
#include <algorithm>
#include <array>
#include <cstdio>
#include <iostream>
#include <iterator>
#include <map>
#include <math.h>
#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 ll MOD = 1000000007;... |
#include "pch.h"
#include "DbColumn.h"
#include "DbColumnDataSource.h"
#include "DbColumnStorage.h"
DbColumn::DbColumn(DATA_TYPE dt, const int n_max_, DbColumnDataSourceFactory* factory, const int j)
: source(factory->create(j)),
n(0)
{
if (dt == DT_BOOL)
dt = DT_UNKNOWN;
storage.push_back(new DbColumnS... |
#include "abonnemnt_park.h"
#include <QDebug>
Abonnemnt_park::Abonnemnt_park()
{
id_abonnement=0;
nom="";
prenom="";
type_abonnement="";
d_f="";
}
Abonnemnt_park::Abonnemnt_park(int id_abonnement,QString nom,QString prenom,QString d_f,QString type_abonnement)
{
this->id_abonnement=id_abonnement;
this->nom=nom... |
/* json_test.cpp -*- C++ -*-
Rémi Attab (remi.attab@gmail.com), 20 Apr 2014
FreeBSD-style copyright and disclaimer apply
Json tests.
*/
#define BOOST_TEST_MAIN
#define BOOST_TEST_DYN_LINK
#define REFLECT_USE_EXCEPTIONS 1
#include "reflect.h"
#include "types/primitives.h"
#inc... |
#include <fstream>
using namespace std;
ifstream cin ("minimal.in");
ofstream cout ("minimal.out");
int q, n, m;
int a[501], b[501];
int f[501];
#define ma 100000000
void qsort (int left, int right, int *a) {
int l=left, r=right,x=a[l];
while (l<r) {
while (l<r && a[r]>x)
... |
#include <cstdio>
#include <cmath>
#include <vector>
using namespace std;
typedef long long ll;
const int MAX_N = 40;
//INPUT
int N;
int X[MAX_N], Y[MAX_N], R[MAX_N];
// the set of circles which are covered by a circle centered (x,y) and radius r
ll cover(double x, double y, double r){
ll S=0;
for(int i=0; i<N;... |
/*
* dolier-times.cpp
*
* Created on: Feb 14, 2014
* Author: vbonnici
*/
#include <math.h>
#include <stdio.h>
#include <stdlib.h>
#include <iostream>
#include <string>
#include <sstream>
#include <fstream>
#include <algorithm>
#include "data_ts.h"
#include "trim.h"
#include "pars_t.h"
#include <set>
#i... |
#ifndef _LOG_H
#define _LOG_H
#include <string>
#include <cstdio>
class cLog {
public:
//Constructor
cLog(std::string &);
//Loguea un mensaje
void loguear(const std::string &mensaje);
private:
std::string dominio; //Dominio al cual se loguea
//Archivos para loguear
FILE *f... |
#ifndef FUZZYCORE_UNSUPPORTEDCOMPILEREXCEPTION_H
#define FUZZYCORE_UNSUPPORTEDCOMPILEREXCEPTION_H
#include "EnvironmentException.h"
class UnsupportedCompilerException : EnvironmentException {
public:
explicit UnsupportedCompilerException(const std::string &);
};
#endif
|
#ifndef CIP_IMPL_TEMPLATE_H
#define CIP_IMPL_TEMPLATE_H
#include "cip.hpp"
#include "func.hpp"
#include "exp_func.hpp"
#include "cut_exp.hpp"
#include "delta.hpp"
#include "lin_func.hpp"
#include "op.hpp"
//#include <boost/static_assert.hpp>
#include <boost/type_traits.hpp>
#include <boost/utility/enable_if.hpp>
n... |
#include <iostream>
// Input: sorted integer array, integer query
// Output: integer representing index of query in array (or -1
// if query is not in array)
int BinarySearch(int array[], int size, int query) {
int lower_bound = 0;
int upper_bound = size - 1;
// Iterate repeatedly until we've found the spot w... |
//fill array with random number
#include <iostream>
#include <stdlib.h>
#include <time.h>
//zaeem 19L-1196
using namespace std;
int main(){
const int size=5;
int myarray[size];
srand(time(NULL));
int rand_num;
for(int i=0; i<5; i++){
rand_num = rand()%21+5;
myarray[i]=rand_num;
}
for(int i=... |
#pragma once
// IResourceFile.h
#include "../Resource/Resource.h"
namespace liman {
class IResourceFile
{
public:
virtual bool Open() = 0;
virtual int GetRawResourceSize(const Resource &r) = 0;
virtual int GetRawResource(const Resource &r, char *buffer) = 0;
virtual int GetNumResources() const = 0;
virt... |
#include<bits/stdc++.h>
using namespace std;
int solve(vector<int>& arr,int n)
{
sort(arr.begin(),arr.end());
int count = 0;
int sum = 0;
for(int i=0;i<n;i++)
{
sum+=arr[i];
}
int temp = 0;
for(int i=n-1;i>=0;i--)
{
temp+=arr[i];
count+=1;
int rem = sum - temp;
if(temp > rem)
{
return count;
... |
// -*- 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... |
// C++ for the Windows Runtime vv1.0.170303.6
// Copyright (c) 2017 Microsoft Corporation. All rights reserved.
#pragma once
#include "base.h"
WINRT_WARNING_PUSH
#include "internal/Windows.Storage.Streams.3.h"
#include "internal/Windows.Foundation.3.h"
#include "internal/Windows.Networking.Sockets.3.h"
#include "int... |
#include "wizpopupwidget.h"
#include <QtGui>
#include "wizmisc.h"
#ifdef Q_OS_WIN
//#include "wizwindowshelper.h"
#endif
CWizPopupWidget::CWizPopupWidget(QWidget* parent)
: QWidget(parent, Qt::Popup | Qt::FramelessWindowHint)
, m_leftAlign(false)
{
setContentsMargins(8, 20, 8, 8);
QPalette pal = p... |
#include "AngraMCMixer.h"
AngraMCMixer::AngraMCMixer() : currentPrimary(0), currentEvent(0), currentTime(0), outFile(), theTree(), pulseDB(), rates(), pulseBuffer(), bufferSize(0)
{
}
void AngraMCMixer::AddPrimary(PulseTree * aPulseTree, double rate)
{
std::cout << " AngraMCMixer: Adding a generator" << std::end... |
#pragma once
#include "Algorithm.h"
#include "Timer.h"
#include <time.h>
class AlgorithmRunningTime
{
Algorithm algorithm;
Timer timer;
public:
AlgorithmRunningTime();
time_t getInterchangeSortRunningTime(std::vector<int> data); // O(n^2)
time_t getLinearSeachRunningTime(std::vector<int> data, int searchValue); /... |
#ifndef _I2C_DEVICE_H_
#define _I2C_DEVICE_H_
#include <string>
#include "sim_avr.h"
#include "sim_irq.h"
#include "avr_twi.h"
#include "device.h"
class i2c_device : public device{
public:
i2c_device(uint8_t address, const char* name);
~i2c_device();
virtual uint8_t read() = 0;
virtual void write(uint8_t da... |
#include "ros/ros.h"
#include "ball_chaser/DriveToTarget.h"
#include <sensor_msgs/Image.h>
// Define a global client that can request services
ros::ServiceClient client;
// This function calls the command_robot service to drive the robot in the specified direction
void drive_robot(float lin_x, float ang_z)
{
// T... |
#ifndef PARTICLEBOX_H
#define PARTICLEBOX_H
#define TRUNC 3.0 //Truncate forces after this distance
#define EPS1 0.001 //minimum distance will calculate forces
#define CONST1 24.0
#define CONST2 4.0
#define SIG13 1.0
#define SIG12 1.0
#define SIG7 1.0
#define SIG6 1.0
typedef struct{
double xp0, xp1; //x positio... |
#include <Servo.h>
Servo servo1;
void setup()
{
servo1.attach(2);
servo1.write(125);
delay(5000);
servo1.write(90);
delay(200);
servo1.write(125);
delay(710);
}
void loop()
{
servo1.write(90); //1
delay(200);
servo1.write(125);
delay(600);
}
|
//Copyright 2015-2016 Tomas Mikalauskas. All rights reserved.
#pragma once
//forward declared
class GLLineDrawer;
struct srfTriangles_t;
struct glconfig_st;
struct gl_params;
#include "IRenderer.h"
struct glconfig_st
{
const char * renderer_string;
const char * vendor_string;
const char * version_string;
co... |
#include <bits/stdc++.h>
#define rep(i,n) for (int i = 0; i < (n); ++i)
#define ok() puts(ok?"Yes":"No");
using namespace std;
typedef long long ll;
typedef vector<int> vi;
typedef pair<int, int> ii;
typedef vector<vi> vvi;
typedef vector<ii> vii;
typedef vector<bool> vb;
typedef vector<vb> vvb;
typedef set<int> si;
ty... |
#include <iostream>
#include <string>
#include <fstream>
#include <string.h>
#include <stdlib.h>
#include <stdio.h>
#include <algorithm>
#include <new>
#include <ctype.h>
#include <stdlib.h>
#include <sstream>
using namespace std;
//**************************** LISTA EQU **********************************************... |
#ifndef HTTPS_CLIENT_HPP_ //并不是通用的,只是获取网络资源并保存到文件
#define HTTPS_CLIENT_HPP_
#include <cstdlib>
#include <boost/bind/bind.hpp>
#include <boost/asio.hpp>
#include <boost/asio/ssl.hpp>
#include <string>
#include <fstream>
#include <iostream>
#include <istream>
#include <ostream>
#include "util.h"
class HttpsClient
{
pub... |
class Solution {
public:
int computeArea(int A, int B, int C, int D, int E, int F, int G, int H) {
int cover = 0;
int a = max(A, E);
int b = min(C, G);
int c = max(B, F);
int d = min(D, H);
if(b > a && d > c)
cover = (b - a) * (d - c);
return abs(G... |
#ifndef CEVENTSTATS_H
#define CEVENTSTATS_H
#include "TObject.h"
#include <map>
#include <string>
#include "TTree.h"
class TFile;
class CEventStats {
public:
TFile *rootFile;
TTree *simTree;
TTree *geoTree;
TFile *outputFile;
TTree *outputTree;
std::map<int, std::string> decayMode;
... |
/* SOLUTION OF LINEAR EQUATION CODE BY PRABHAT KUAMR (RIT2010043)
INPUT FORMAT
3
1 3 -2
3 5 6
2 4 3
5 7 8
*/
#include<iostream>
#include<math.h>
using namespace std;
void cof(int *arr,int *tarr,int s,int x,int y)
{
int l=0,m;
for(int i=0;i<s;i++)
{ if(i!=x)
{ m=0;
for(int j=0;j<s;j++)
if(j... |
#include<iostream>
#include<iomanip>
using namespace std;
int main()
{
//int a = 3, b=78, c = 1254;
//cout<<"the value of a is :"<<setw(4)<<a<<endl;
//cout<<"the value of b is :"<<b<<endl;
//cout<<"the value of c is :"<<c<<endl;
/* OPERATOR PRECEDENCE */
int a = 3, b=4;
int c = (a*5)+b-44+65;
cout<<c;
retur... |
#include<bits/stdc++.h>
using namespace std;
#define debug(x) cerr << #x << ": " << x << endl;
#define iosbase ios_base::sync_with_stdio(false)
#define tie cin.tie();cout.tie();
#define endl '\n'
typedef pair<int, int> ii;
typedef long long ll;
#define cima 1
#define esq 2
#define dir 3
#define baixo 4
string m[2... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.