text stringlengths 8 6.88M |
|---|
vector<int> Solution::solve(vector<int> &A, int B) {
vector<int> ans;
sort(A.begin(),A.end(),greater<int>());
for(int i=0;i<B;i++){
ans.push_back(A[i]);
}
return ans;
}
|
#include <bits/stdc++.h>
using namespace std;
#define TESTC ""
#define PROBLEM "673"
#define USE_CPPIO() ios_base::sync_with_stdio(0); cin.tie(0)
int main(int argc, char const *argv[])
{
#ifdef DBG
freopen("uva" PROBLEM TESTC ".in", "r", stdin);
freopen("uva" PROBLEM ".out", "w", stdout);
#endif
int times;
s... |
#ifndef RIGIDBODY_H
#define RIGIDBODY_H
#include "object.h"
#include "CollisionFilter.h"
class RigidBody:public Object,public btRigidBody
{
public:
///this class inherits from btrigidbody, so you can use addforce, etc for moving objects
RigidBody(btScalar mass, btMotionState* motionState,btCollisionShape* colli... |
/*
Copyright 2021 University of Manchester
Licensed under the Apache License, Version 2.0(the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http: // www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, s... |
#include <QObject> //included at the top to fix an issue with the boost::foreach macro shadowing qt foreach (see http://stackoverflow.com/questions/15191361/boostq-foreach-has-not-been-declared)
#include "SmurfItemFactory.h"
#include <envire_core/items/Item.hpp>
#include <QWidget>
#include <QVBoxLayout>
#include <QLabe... |
#include<bits/stdc++.h>
using namespace std;
#define MOD 1000000007
#define pb push_back
#define mp make_pair
typedef long long ll;
#define inf 0x7fffffff
long long int A[100003], B[100003];
int tree[500005];
void build_tree(int node, int a, int b) {
if(a > b) return;
if(a == b) {
tree[node] = ... |
#include <bits/stdc++.h>
using namespace std;
void solve () {
int n, d;
cin >> n >> d;
string s;
cin >> s;
vector<int> a(n);
for (int i=0; i<n; ++i) {
a[i] = s[i] - '0';
}
// for (auto it: a) cout << it << " ";
// cout << endl;
int l=0, prev=0;
int step=0;
while (l<n-1) {
// cout <<... |
#include "stdafx.h"
#include "Inventory2.h"
Inventory2::Inventory2()
{
}
Inventory2::~Inventory2()
{
}
void Inventory2::ItemSetup()
{
tagItemInfo item;
item.itemKind = ITEM_MONSTERBALL;
item.name = "몬스터볼";
item.price = 200;
item.attribute = 1;
item.description = "야생 포켓몬에게 던져서 잡기 위한 볼. 캡슐식으로 되어있다.";
item.cou... |
//
// Trilateration.cpp
//
// Created by waynewang on 17/5/14.
// Copyright (c) 2014 waynewang. All rights reserved.
//
#pragma warning(push)
#pragma warning(disable : 4267)
#include <cppunit/extensions/TestFactoryRegistry.h>
#include <cppunit/ui/text/TestRunner.h>
#include <cppunit/extensions/HelperMacros.h>
#inclu... |
//chocolate distribution problem
//minimize the diff between max and min chocolates given
//m kids each get a packet
//give: arr of packet where each element denotes number of chocolates in that packet
//2 3 4 7 9 12 56
#include <iostream>
#include <algorithm>
using namespace std;
int min(int a,int b){
return a<b?a:b... |
//TMRpcm library is needed
#include "SD.h"
#define SD_ChipSelectPin 4
#include "TMRpcm.h"
#include "SPI.h"
#include "Wire.h"
//MISO -> Dpin12
//MOSI -> Dpin11
//SCK -> 13
TMRpcm tmrpcm;
byte address = 8;
void setup()
{
tmrpcm.speakerPin = 9;
Wire.begin(address);
Wire.onReceive(receiveEvent); // register event... |
#include "iostream"
#include "X.h"
#include "Y.h"
using namespace std;
X::X(int num):m(1),m2(num){
this->n=1;
cout<<"construct X n="<<this->n<<endl;
};
X::~X(){
cout<<"deconstruct X"<<endl;
}
//X::X(const X&){
// cout<<"copy construct X"<<endl;
// this->n=10;
//}
X& X::operator =(const X &){
cout<<"X::operator... |
// Created on: 1993-03-04
// Created by: Jacques GOUSSARD
// Copyright (c) 1993-1999 Matra Datavision
// Copyright (c) 1999-2014 OPEN CASCADE SAS
//
// This file is part of Open CASCADE Technology software library.
//
// This library is free software; you can redistribute it and/or modify it under
// the terms of the G... |
#include <bits/stdc++.h>
using namespace std;
# define VEC(x, y)
class Solution {
public:
vector<vector<int>> intervalIntersection(vector<vector<int>>& firstList, vector<vector<int>>& secondList) {
vector<vector<int>> result;
auto first_it = firstList.begin();
auto second_it = se... |
// Created on: 1994-06-06
// Created by: Jean Yves LEBEY
// Copyright (c) 1994-1999 Matra Datavision
// Copyright (c) 1999-2014 OPEN CASCADE SAS
//
// This file is part of Open CASCADE Technology software library.
//
// This library is free software; you can redistribute it and/or modify it under
// the terms of the GN... |
#pragma once
#ifndef CAMERA_H
#define CAMERA_H
#include <GL/glew.h>
#include <glfw3.h>
#include <glm/glm.hpp>
#include <glm/gtc/matrix_transform.hpp>
#include <glm/gtx/euler_angles.hpp>
#include "input.h"
class Camera {
public:
Camera();
Camera(glm::vec3 position);
//get the view matrix
glm::mat4 getViewMatrix... |
/* -*- Mode: c++; tab-width: 4; indent-tabs-mode: t; c-basic-offset: 4 -*-
*
* Copyright (C) 1995-2010 Opera Software AS. All rights reserved.
*
* This file is part of the Opera web browser. It may not be distributed
* under any circumstances.
*/
#include "core/pch.h"
#include "modules/layout/layout_module.h"... |
#include "stdafx.h"
#include "player.h"
#include "CPR_Framework.h"
#include "game/world.h"
#include "game/bullet.h"
#include "debugutils/debugrenderer.h"
static const cPlayerDef sDefaultPlayerDef(0.5f, 5.0f, 0.5f * 2.0f, TO_RADIANS(0.2f), 0.8f);
namespace
{
static bool sTestCollisionsOnLookAt = true;
static bool ... |
//程序中用到的功能函数声明
#pragma once
#include "stdafx.h"
//将文本内容读入字符串str
std::string & filetostr(std::string file,std::string & str);
bool strtofile(std::string file,const std::string & str);
//将实数a保留l位小数(四舍五入) 然后转化为字符串
std::string dtos(double a, int l=1);
|
#include "stdafx.h"
#include "../EditTool.h"
#include "../Editor.h"
#include "../Resource.h"
#include "../TerrainModifyDialog.h"
#include "TerrainModifyTool.h"
IMPLEMENT_DYNCREATE(CTerrainModifyTool, CEditTool)
CTerrainModifyTool::CTerrainModifyTool()
: mBrushType(E_TERRAIN_BRUSH_NULL_TYPE),
mbBegin... |
// Created on: 1997-02-06
// Created by: Laurent BOURESCHE
// Copyright (c) 1997-1999 Matra Datavision
// Copyright (c) 1999-2014 OPEN CASCADE SAS
//
// This file is part of Open CASCADE Technology software library.
//
// This library is free software; you can redistribute it and/or modify it under
// the terms of the ... |
#include <iostream>
#include<vector>
using namespace std;
void Out(vector<int> arr)
{
int Size=arr.size();
for(int i=0;i<Size;i++)
{
cout<<arr[i]<<" ";
}
}
int main()
{
vector<int> arr;
arr.push_back(1);
arr.push_back(2);
arr.push_back(3);
arr.push_back(4);
arr.push_back(... |
#include "H/Memory.h"
uint_8 UsableMemoryRegionCount;
MemoryMapEntry* UsableMemoryRegions[10];
void memcpy(void* destination, void* source, uint_64 num){
if (num <= 8) {
uint8* valPtr = (uint8*)&source;
for (uint8* ptr = (uint8*)destination; ptr < (uint8*)((uint_64)destination + num); ptr++) {
... |
#include<ros/ros.h>
#include <actionlib/client/simple_action_client.h>
#include <mbot_visual_servoing_imagebased/GraspObjectAction.h>
int main(int argc, char** argv) {
ros::init(argc, argv, "action_client_vs");
mbot_visual_servoing_imagebased::GraspObjectGoal goal;
actionlib::SimpleActionClient<mbot_visua... |
#include "stdafx.h"
#include "Alien.h"
Alien::Alien()
{
}
Alien::~Alien()
{
}
HRESULT Alien::Init(const char * imageName, POINT position)
{
// 에너미에서 먼저 init
Enemy::Init(imageName, position);
// 추가적으로 Init
this->_died = IMAGE->FindImage("alien_died");
_frameCount = 0;
_currentFrameX2 = 0;
return S_OK;
}
... |
#include<iostream>
#include<string>
#include<stack>
bool correspondence ( char openedOne, char closedOne ) {
if (( '[' == openedOne && ']' == closedOne) || ( '(' == openedOne && ')' == closedOne ) || ( '{' == openedOne && '}' == closedOne)
|| ( '"' == openedOne && '"' == closedOne) || ( '\'' == openedOne && '\'' =... |
/* -*- Mode: c++; tab-width: 4; indent-tabs-mode: t; c-basic-offset: 4 -*-
**
** Copyright (C) 1995-2010 Opera Software AS. All rights reserved.
**
** This file is part of the Opera web browser. It may not be distributed
** under any circumstances.
*/
#ifndef OP_SCOPE_NETWORK_LISTENER_H
#define OP_SCOPE_NETWORK_LIST... |
#pragma once
#ifndef FLIGHT_H
#define FLIGHT_H
class City;
class Flight {
private:
City* bcity;
City* ecity;
int mileage;
int cost;
public:
Flight(City *x, City *y, int mile, int price) {
bcity = x;
ecity = y;
mileage = mile;
cost = price;
};
City* getDestination() const { return e... |
//
// 1249. Minimum Remove to Make Valid Parentheses.cpp
// leetcode
//
// Created by xujian chen on 6/2/20.
// Copyright © 2020 xujian chen. All rights reserved.
//
/*
1249. Minimum Remove to Make Valid Parentheses
Medium
675
23
Add to List
Share
Given a string s of '(' , ')' and lowercase English char... |
#include <iostream>
#include <vector>
#include <string>
#include <map>
using namespace std;
typedef long long ll;
typedef vector<int> vi;
typedef pair<int, int> pii;
typedef map<int, int> mii;
void solve (int n) {
if (n == 2 || (n / 2) % 2 != 0) {
cout << "NO\n";
return;
}
int sum_even = 0;
int sum_o... |
#include "precompiled.h"
#include "misc/alias.h"
#include "vfs/vfs.h"
using namespace misc;
void AliasList::load(const string& filename)
{
list.clear();
vfs::File file = vfs::getFile(filename.c_str());
if (!file)
return;
char buf[MAX_PATH * 2];
while (file->readLine(buf, MAX_PATH * 2))
{
... |
//
// Created by sergo on 12/6/19.
//
#include <iostream>
#include <chrono>
#include "matrix.hpp"
using namespace std;
template <typename F>
Matrix<int>* printExecTime(F &function, Matrix<int>& A, Matrix<int>& B) {
auto start = chrono::high_resolution_clock::now();
auto res = function(A, B);
auto end = ch... |
#include <QQmlEngine>
#include <QQmlComponent>
#include <QProcess>
#include <QDebug>
#include <QDBusConnection>
#include <QCoreApplication>
#include "qmlloader.h"
QmlLoader::QmlLoader(QObject *parent)
:QObject(parent)
{
engine = new QQmlEngine(this);
component = new QQmlComponent(engine, this);
rootC... |
#include <iostream>
using namespace std;
int main() {
int a;
cin >> a;
while(a--) {
int n, m;
cin >> n >> m;
if(n % (m + 1) == 0)
printf("second\n");
else
printf("first\n");
}
return 0;
}
|
#include "pch.h"
#include "GameUserManager.h"
GameUserManager::GameUserManager()
{
}
GameUserManager::~GameUserManager()
{
}
BOOL GameUserManager::Begin()
{
m_GameUserMap.clear();
m_CurrentUserCount = 0;
return TRUE;
}
BOOL GameUserManager::End()
{
m_GameUserMap.clear();
m_CurrentUserCount = 0;
return TRUE;... |
/*
* SDEV 340 Week 9 Problem 1
* An abstract class for representing a sequence, with two concrete subclass implementations to demonstrate
* Benjamin Lovy
*/
#include <iostream>
class AbstractSeq
{
public:
// Return the kth value of the seq
virtual int fun(int k) const = 0;
// Print the sequence from k to ... |
/*
* Copyright 2016 Freeman Zhang <zhanggyb@gmail.com>
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applic... |
#include "game.h"
#include "ui_game.h"
#include <ctime>
Game::Game(QWidget *parent,bool type,player *p1,player *p2) :
QWidget(parent),
ui(new Ui::Game)
{
ui->setupUi(this);
this->setWindowFlags(Qt::FramelessWindowHint);
this->setFixedSize(520,330);
QBrush *brush = new QBrush;
QPalette *palet... |
#include<iostream>
#include<cstdio>
#include<map>
#include<set>
#include<vector>
#include<stack>
#include<queue>
#include<string>
#include<cstring>
#include<sstream>
#include<algorithm>
#include<cmath>
using namespace std;
const int inf = 1e9 + 7;
int f[110][110],a[110];
int main() {
int n;
whi... |
#include <iostream>
using namespace std;
typedef long long ll;
int main() {
// your code goes here
ll t,d,D,P,Q; cin>>t;
while (t--) {
cin>>D>>d>>P>>Q;
ll ans=P*D;
ll total=D/d;
ans += Q*(total*(total-1)/2)*d;
ans += Q*(total)*(D%d);
cout<<ans<<"\n";
}
return 0;
}
|
#include "stdafx.h"
#include "BackGround.h"
#include "Common\Camera.h"
BackGround::BackGround()
{
}
BackGround::~BackGround()
{
}
void BackGround::Init()
{
// 쉐이더 초기화
// 에러값 확인이 어려우므로
// 쉐이더 로딩시 에러가 나면 에러 내용을 받아올 꺼
LPD3DXBUFFER pError = NULL;
// 쉐이더 옵션 지정
DWORD shaderFlag = 0;
// 지정되어야만 디버깅시 쉐이더 확인이 가능함
#... |
#include "vehicle.h"
#include <iostream>
#include <iostream>
#include <math.h>
#include "cost.h"
// mile per seconds to mile per hour
const double MS_TO_MPH = 2.23694;
// mile per hour to mile per second
const double MPH_TO_MS = 0.44704;
Vehicle::Vehicle(int lane, double target_speed){
ref_speed = target_speed;
... |
#include <LiquidCrystal.h>
#include "DHT.h"
#include "Wire.h"
#include "Adafruit_BMP085.h"
#define DHTPIN 2
#define DHTTYPE DHT11
LiquidCrystal lcd(8, 7, 6, 5, 4, 3);
DHT dht(DHTPIN, DHTTYPE);
Adafruit_BMP085 basincsensoru;
byte santigratderece[8] = {
0b11000,
0b11000,
0b00110,
0b01001,
... |
#include "transform.hpp"
Matrix3d Euler2A(const double& phi, const double& theta, const double& psi)
{
MyAngles vehicleAngles(phi, theta, psi);
// I
Matrix3d result;
result(0, 0) = cos(theta) * cos(psi);
result(0, 1) = cos(psi) * sin(theta) * sin(phi) - cos(phi) * sin(psi);
result(0, 2) = cos(... |
//===========================================================================
//! @file filter_manager.cpp
//! @brief 描画に使用するフィルター管理
//===========================================================================
//---------------------------------------------------------------------------
//! 初期化
//------------------... |
#include <gtest/gtest.h>
#include <solvers/sqp.hpp>
using namespace sqp;
namespace sqp_test {
struct SimpleNLP : public NonLinearProblem<double> {
using Vector = NonLinearProblem<double>::Vector;
using Matrix = NonLinearProblem<double>::Matrix;
const Scalar infinity = std::numeric_limits<Scalar>::infini... |
#include "treeface/scene/SceneNodeManager.h"
#include "treeface/scene/Geometry.h"
#include "treeface/scene/GeometryManager.h"
#include "treeface/scene/SceneGraphMaterial.h"
#include "treeface/scene/SceneNode.h"
#include "treeface/scene/VisualObject.h"
#include "treeface/gl/VertexArray.h"
#include "treeface/misc/Erro... |
#include "graph.h"
#include <iostream>
Vertex::Vertex(int n)
{
id = n;
}
bool Vertex::add_neighbor(Vertex& v, int distance)
{
// check if the neighbor is already in the list
for (std::vector<Neighbor>::iterator neighbor_itr = adj_list.begin();
neighbor_itr != adj_list.end(); ++neighbor_itr)
{... |
/*********************************************************\
* Copyright (c) 2012-2018 The Unrimp Team
*
* 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 wit... |
#pragma once
#include <vector>
#include <deque>
#include <set>
#include <utility>
#include "Cluster.h"
#include "OriginPoint.h"
#include "ClusterPoint.h"
using std::vector;
using std::set;
using std::deque;
using std::pair;
class Chameleon
{
private:
int k; //knn近邻子图
double **adjMat; //邻接矩阵
vector<ClusterPoint> Poi... |
#pragma once
#include <iberbar/RHI/CommandContext.h>
#include <iberbar/RHI/OpenGL/Headers.h>
namespace iberbar
{
namespace RHI
{
class CShaderState;
namespace OpenGL
{
class CDevice;
class CVertexBuffer;
class CIndexBuffer;
class CShaderState;
class CShaderVariableTable;
class CTexture;
... |
#ifndef TCP_HEADER_HPP
#define TCP_HEADER_HPP 1
//
// 0 1 2 3
// 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1
// +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
// | Source Port | Destination Port ... |
/********************************************************************************
This file contains functions used for generating QRcodes
********************************************************************************/
/********************************************************************************
This routine... |
/**
* @file test_fklib.cpp
*
*
* @author Fan Kai(fk), Peking University
*
*/
#include "fklib.h"
#include <boost/timer.hpp>
using namespace std;
int main() {
cout <<"Test Timer ..." <<endl;
fk::Timer t;
cout <<t.elapsed() <<endl;
sleep(1);
cout <<t.elapsed() <<endl;
cout <<"Test norm... |
// ==========================================================================
// $Id: g_PtrAdapter.h 3389 2012-10-19 08:23:25Z jlang $
// Wrapper code to interface g_plane
// ==========================================================================
// (C)opyright:
//
// Jochen Lang
// SITE, University of Ottawa
//... |
#include <bits/stdc++.h>
using namespace std;
int main()
{
char str[10][4]={'.',',','?','"','a','b','c','%','d','e','f','%','g','h','i','%','j','k','l','%','m','n','o','%','p','q','r','s','t','u','v','%','w','x','y','z'};
int t,a,i,arr[1005];
scanf("%d",&t);
while(t--){
// printf("%c\n",... |
#include<iostream>
using namespace std;
class index1{
protected:
int count;
public:
index1(){
count =0;
}
void operator ++(){
count=count+200;
}
void operator ++(int){
count=count+100;
}
void display(){
cout<<endl<<count;
}
};
int main(){
ind... |
#pragma once
class CSKTracker : public Tracker
{
public:
CSKTracker(void){ setDefaults(); };
virtual void init(const cv::Rect& bbox, const cv::Mat& image);
virtual cv::Rect track(const cv::Mat& image);
virtual bool empty() const { return !_isinitialized; }
private:
// parameters
... |
//------------------------------------------------------------------------------
/*
This file is part of Beast: https://github.com/vinniefalco/Beast
Copyright 2013, Vinnie Falco <vinnie.falco@gmail.com>
Portions of this file are from JUCE.
Copyright (c) 2013 - Raw Material Software Ltd.
Please visi... |
#pragma once
#include "gmock/gmock.h"
#include "gtest/gtest.h"
#include "Biom.hh"
#include "CppCommons.hh"
#include "DBFactory.hh"
#include "DBManager.hh"
#include "Town.hh"
#include "TownTemplate.hh"
namespace dbfactory_test {
using namespace CCC;
using namespace HotaSim;
static const char* DB_PATH = "resources... |
// **********************************************************************
//
// Copyright (c) 2003-2011 ZeroC, Inc. All rights reserved.
//
// This copy of Ice is licensed to you under the terms described in the
// ICE_LICENSE file included in this distribution.
//
// ***************************************************... |
#include "Vulkan/VulkanBuffer.h"
using namespace Rocket;
void VulkanBufferStruct::Create(
Ref<VulkanDevice> device,
VkBufferUsageFlags usageFlags,
VkMemoryPropertyFlags memoryPropertyFlags,
VkDeviceSize size, bool map)
{
RK_GRAPHICS_TRACE("VulkanBufferStruct Create");
this->device = device->logicalDevice;
this... |
/****************************************************************************
** Meta object code from reading C++ file 'clavier.h'
**
** Created by: The Qt Meta Object Compiler version 63 (Qt 4.8.6)
**
** WARNING! All changes made in this file will be lost!
*************************************************************... |
#include <iostream>
#include <vector>
#include <algorithm>
using namespace std;
void print(std::vector<int> arr)
{
for(auto it = arr.cbegin(); it != arr.cend(); it++)
{
std::cout << *it << " ";
}
std::cout << "\n";
}
vector<int> quickSort(vector <int> &arr, int size)
{
//test unit input-... |
/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
file Copyright.txt or https://cmake.org/licensing for details. */
#include "cmFileMonitor.h"
#include <cassert>
#include <cstddef>
#include <unordered_map>
#include <utility>
#include <cm/memory>
#include "cmsys/SystemTools.hxx"
names... |
#pragma once
/*
* Lanq(Lan Quick)
* Solodov A. N. (hotSAN)
* 2016
* LqShdPtr - Pointer on shared object.
* Object must have public integer field "CountPointers".
*/
#include "LqOs.h"
#include "LqAtm.hpp"
#include "LqLock.hpp"
#include <type_traits>
template<typename T>
void SHARED_POINTERDeleteProc(T* p) { dele... |
// 4.7-2.h: 4.7-2 应用程序的主头文件
//
#pragma once
#ifndef __AFXWIN_H__
#error "在包含此文件之前包含 'pch.h' 以生成 PCH"
#endif
#include "resource.h" // 主符号
// CMy472App:
// 有关此类的实现,请参阅 4.7-2.cpp
//
class CMy472App : public CWinApp
{
public:
CMy472App() noexcept;
// 重写
public:
virtual BOOL InitInstance();
virtual int Ex... |
#include "Failure.h"
#include "GameSeaquenceController.h"
#include "Ready.h"
#include "GameOver.h"
Failure::Failure()
{
std::cout << "failure" << std::endl;
mCount = 0;
}
Failure::~Failure()
{
}
//ミス表示
Boot* Failure::Update(GameSeaquenceController* controller){
Boot* next = this;
if (mCount >= 60){
if (contro... |
#include <iostream>
#include <cstdio>
#include <algorithm>
#include <vector>
#include <functional>
#include <queue>
#include <string>
#include <cstring>
#include <numeric>
#include <cstdlib>
#include <cmath>
using namespace std;
typedef long long ll;
#define INF 10e8
#define rep(i,n) for(int i=0; i<n; i++)
#define re... |
/*********************************************************\
* Copyright (c) 2012-2018 The Unrimp Team
*
* 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 wit... |
#include <iostream>
#include <fstream>
#include <vector>
#include <cmath>
#include <cstdlib>
#include "TFile.h"
#include "TTree.h"
#include "TH2.h"
#include "TVector3.h"
#include "TRandom3.h"
#include "TGraphAsymmErrors.h"
#include "constants.h"
#include "AccMap.h"
using namespace std;
// Vectors which describe all... |
#include <stdio.h>
#include <stdlib.h>
#include <iostream>
using namespace std;
void printStr(char * str, int * seqVisited, int size) {
for (int i = 0; i < size; i++) {
cout << str[seqVisited[i]];
}
cout << endl;
}
void permutationUtil(char * str, int size,int i, bool * visited, int * seqVisited, int length) {
i... |
/**
Copyright (c) 2015 Eric Bruneton
All rights reserved.
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions are met:
1. Redistributions of source code must retain the above copyright notice, this
list of conditions and the follo... |
#include "pch.h"
GameSessionManager::GameSessionManager()
{
}
GameSessionManager::~GameSessionManager()
{
}
BOOL GameSessionManager::Begin(DWORD maxUserCount, SOCKET listenSocket)
{
CThreadSync Sync;
m_ListenSocket = listenSocket;
for (DWORD i = 0; i < maxUserCount; i++)
{
GameSession* user = new GameSession... |
// Created on: 1993-01-09
// Created by: CKY / Contract Toubro-Larsen ( SIVA )
// Copyright (c) 1993-1999 Matra Datavision
// Copyright (c) 1999-2014 OPEN CASCADE SAS
//
// This file is part of Open CASCADE Technology software library.
//
// This library is free software; you can redistribute it and/or modify it under
... |
#ifndef RADWINDOW_HPP_
#define RADWINDOW_HPP_
#include "MWindowBase.hpp"
#include "MRubberBand.hpp"
#include "DialogRes.hpp"
#include <set>
#include <map>
class MRadCtrl : public MWindowBase
{
public:
BOOL m_bTopCtrl;
HWND m_hwndRubberBand;
BOOL m_bMoving;
BOOL m_bSizing;
INT m_nIn... |
#pragma once
namespace Jaraffe
{
// TODO : Àӽà ¼ÂÆÃ.
class Material : public Jaraffe::Object
{
// ****************************************************************************
// Constructor/Destructor)
// ----------------------------------------------------------------------------
public:
Material();
virtual ~Mat... |
// https://github.com/vinniefalco/LuaBridge
//
// Copyright 2018, Dmitry Tarakanov
// SPDX-License-Identifier: MIT
#pragma once
#include <LuaBridge/detail/Stack.h>
#include <array>
namespace luabridge {
template <class T, std::size_t s>
struct Stack <std::array <T,s> >
{
static void push (lua_State* L, std::arra... |
//
// Created by 송지원 on 2020-03-13.
//
#include <iostream>
#define UPPER(X,R) ((X)%(R)==0) ? ((X)/(R)) : (((X)/(R))+1)
using namespace std;
int arr[100000+5];
int main() {
int N, K;
int I;
int L, R;
scanf("%d %d", &N, &K);
for (int i=0; i<N; i++) {
scanf("%d", &arr[i]);
if (arr... |
#include "Value.h"
#include <iostream>
void Value::Parse(std::string)
{
}
namespace Parser
{
std::string FindRange(int p,std::vector<std::string>* w)
{
std::string d = "";
return d;
}
} |
/*
* Copyright (c) 2015 Samsung Electronics Co., Ltd All Rights Reserved
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
... |
//
// Created by JACK on 11/6/2015.
//
#include "Vehicle.h"
Vehicle::Vehicle(): Transport(),name(""),price(0) { }
Vehicle::Vehicle(string trans,string name,int price): Transport(trans),name(name),price(price) { }
Vehicle::Vehicle(const Vehicle& vehicle1): Transport(vehicle1),name(vehicle1.name),price(vehicle1.price... |
// g++ -O3 -Wall -shared -std=c++11 -fPIC `python3 -m pybind11 --includes` c/pyGetData.cpp -lodbc -fpermissive -o /home/bwp/miniconda3/lib/python3.7/site-packages/quantitate`python3-config --extension-suffix`
#include <iostream>
#include <string>
#include <sqlext.h>
#include <sqltypes.h>
#include <sql.h>
#include <std... |
#pragma once
#include"common.h"
//考虑线程安全,采用单例模式
class CentralCache
{
public:
static CentralCache* GetInstance()
{
return &Inst;
}
//从中心缓存取出一定量内存给线程缓存
size_t FetchRangeObj(void*& start, void*& end, size_t n, size_t byte);
//将一定数量内存释放到span跨度
void ReleaseListToSpans(void* strat, size_t byte_size... |
#include "Game.hpp"
Game::Game(){
ball = 1;
};
void Game::ballDrain(){
};
|
// random_gens.cpp
#include "BlobCrystallinOligomer/random_gens.h"
namespace random_gens {
RandomGens::RandomGens() {
std::random_device true_random_engine {};
auto seed {true_random_engine()};
m_random_engine.seed(seed);
}
double RandomGens::uniform_real() {
return m_... |
class Solution {
public:
int minCut(string s) {
if(s.empty()) return 0;
int len = s.size();
vector<int> dp(len+1,0);
dp[len] = -1;
vector<vector<bool> > p(len+1,vector<bool> (len+1,false));
for(int i=len-1; i>=0; --i){
dp[i] = INT_MAX;
for(int ... |
#include <iostream>
using namespace std;
class Reynold
{
public:
double velocity;
double viscosity;
double reynold;
};
double reynoldnum(int type)
{
float diameter;
cout << "Please enter your fluid selection: ";
cin >> type;
cout << "Please... |
// Created on: 2014-03-17
// Created by: Kirill GAVRILOV
// Copyright (c) 2014 OPEN CASCADE SAS
//
// This file is part of Open CASCADE Technology software library.
//
// This library is free software; you can redistribute it and/or modify it under
// the terms of the GNU Lesser General Public License version 2.1 as pu... |
// https://oj.leetcode.com/problems/decode-ways/
class Solution {
public:
int numDecodings(string s) {
int ssize = s.size();
if (ssize == 0) {
return 0;
}
vector<int> num(ssize + 1, 0);
num[0] = 1; // always has one way from start
num[1] = (... |
#pragma once
#if defined(__GNUC__) && defined(__GXX_EXPERIMENTAL_CXX0X__)
#include "type_list_cpp11.hpp"
#else
#include "type_list_cpp03.hpp"
#endif
|
#include "gmock/gmock.h"
#include "Person.h"
class MockPerson : public Person {
public:
MockPerson(std::string firstName,
std::string lastName,
int year, int month, int date) : Person(firstName, lastName, year, month, date) {}
MOCK_METHOD(std::string, getFirstName, (), (ove... |
// my way
class Solution {
public:
int maxProfit(vector<int>& prices) {
int lowest = INT_MAX, maxProf = 0;
for(int i = 0; i < prices.size(); ++i){
if(prices[i] < lowest){
lowest = prices[i];
}else{
maxProf = max(maxProf, prices[i]-lowest);
... |
/*
* LSST Data Management System
* Copyright 2014-2015 AURA/LSST.
*
* This product includes software developed by the
* LSST Project (http://www.lsst.org/).
*
* 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... |
/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
file Copyright.txt or https://cmake.org/licensing for details. */
#include "cmStringReplaceHelper.h"
#include <sstream>
#include <utility>
#include "cmMakefile.h"
cmStringReplaceHelper::cmStringReplaceHelper(const std::string& regex,
... |
/* -*- Mode: c++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*-
**
** Copyright (C) 2000-2008 Opera Software AS. All rights reserved.
**
** This file is part of the Opera web browser. It may not be distributed
** under any circumstances.
**
** Yngve Pettersen
**
*/
#include "core/pch.h"
#if defined(_NA... |
/*
* Copyright (c) 2017 Ensign Energy Incorporated
* All Rights Reserved.
*
* NOTICE: All information contained herein is, and remains
* the property of Ensign Energy Incorporated and its suppliers,
* if any. The intellectual and technical concepts contained
* herein are proprietary to Ensign Energy Incorpor... |
/*
* Copyright (c) 2015-2017 Morwenn
* SPDX-License-Identifier: MIT
*/
#ifndef CPPSORT_DETAIL_FRONT_INSERTER6_H_
#define CPPSORT_DETAIL_FRONT_INSERTER6_H_
////////////////////////////////////////////////////////////
// Headers
////////////////////////////////////////////////////////////
#include <cpp-sort/utility/a... |
#pragma once
#include <include/glm.h>
#include <include/math.h>
/*
This is a simple implementation of a camera 2D. It's inspired from Laborator
5. It has only the necessary things to capture a 2D image.
*/
class Camera
{
public:
Camera(const glm::vec3 &position, const glm::vec3 ¢er,
const glm::vec3 &up);... |
#ifndef POINTSTATE_H
#define POINTSTATE_H
#include "Execute.h"
class State;
class Player;
class PointState
{
public:
PointState();
void speedX(int x);
void speedY(int y);
int gspeedX();
int gspeedY();
private:
Player* m_players;
int xSpeed =0;
int ySpeed =0;
};
#endif |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.