text stringlengths 8 6.88M |
|---|
#pragma once
#include <boost/spirit/home/lex/lexer/lexer.hpp>
#include <ostream>
namespace perseus
{
namespace detail
{
namespace token_id
{
enum token_id
{
whitespace = 1,
comment,
// constants
string,
decimal_integer,
hexadecimal_integer,
... |
//By SCJ
//#include<iostream>
#include<bits/stdc++.h>
using namespace std;
#define endl '\n'
int ans[1002],b[1002];
bool useda[1002],usedb[1002];
int main()
{
ios::sync_with_stdio(0);
cin.tie(0);
int n,ca=1;
while(cin>>n)
{
if(n==0) break;
cout<<"Game "<<ca++<<":"<<endl;
for(int i=0;i<n;++i) cin>>ans[i];
whi... |
#pragma once
namespace MY_UTIL
{
float GetAngle(float startX, float startY, float endX, float endY);
float GetDistance(float startX, float startY, float endX, float endY);
}
|
#include "drawManager.h"
DrawManager::DrawManager() : offset(0, 0) { }
DrawManager::~DrawManager() { }
Point<int> DrawManager::getOffset() {
return offset;
}
void DrawManager::setOffset(Point<int> newOffset) {
offset = newOffset;
}
|
#include <iostream>
// A reference is an alias, or an alternate name to an existing variable
void display(int val, int &ref, int *ptr)
{
std::cout<<"In funciton -> ref: "<< ref <<", ptr: "<< *ptr <<"\n"; // you don't have to dereference ref.
val = 55; // copy of varaible
ref = 99;
*ptr = 777;
}
void... |
/*
* sup.h
*
* Created on: Nov 26, 2012
* Author: chjd
*/
#ifndef SUP_H_
#define SUP_H_
/*
* sup algorithm:
* initial row & col vector 0~N, by analysis instance
* sup elem & re-index, only for nullor, switch, & shorted elem
* only sup for F,G,H,Vs, no re-index
* initial stamp entry
* example:
... |
/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
file Copyright.txt or https://cmake.org/licensing for details. */
#include "cmCustomCommandLines.h"
cmCustomCommandLine cmMakeCommandLine(
std::initializer_list<cm::string_view> ilist)
{
cmCustomCommandLine commandLine;
commandLine... |
#include <iostream>
#include <vector>
using namespace std;
int Strassen (int n, int A[][128], int B[][128], int &C[][128], int &comp)
{
int n, umbral;
Suma_Matriz (n/2, A11, A22, R1)
Suma_Matriz (n/2, B11, B22, R2)
Strassen (n/2, R1, R2, M1)
Calcular C11 hasta C22 utilizando M1 a M7
... |
#include <iostream>
using namespace std;
int main() {
int Q;
cin >> Q;
for (int q = 0; q < Q; ++q) {
int l, r, d;
cin >> l >> r >> d;
cout << (d < l ? d : (r / d + 1) * d) << endl;
}
return 0;
}
|
#pragma once
#include "Viruss.h"
#include <list>
class FluViruss : public Viruss
{
private:
int m_color;
public:
FluViruss();
FluViruss(int color, char *dna, int resistance);
FluViruss(const FluViruss *fluviruss);
~FluViruss();
void SetColor(int color);
int GetColor();
void DoBorn();
list<Viruss*> DoClone();... |
#include <cmath>
#include "../vector3.h"
#include "../border.h"
class Trefoil: public Border {
public:
/* t va da 0 a 4\pi */
double R; //raggio grande
double r; //raggio piccolo
double r1; //altezza?
Trefoil(): R(1.0), r(0.2), r1(0.4) {}
double mysqrt(double x)
{
return x;
// return x>0?sq... |
#include "RandomSeedGenerator.h"
RandomSeedGenerator::RandomSeedGenerator(int _width, int _height, int _count) : SeedGenerator(_width, _height), count(_count), current(0)
{
srand((int)time(NULL));
}
RandomSeedGenerator::~RandomSeedGenerator()
{
}
Vector3 RandomSeedGenerator::getNextPoint() {
if (direction > 0.0f) ... |
/* -*- Mode: c++; tab-width: 4; indent-tabs-mode: t; c-basic-offset: 4 -*-
*
* Copyright (C) 1995-2008 Opera Software AS. All rights reserved.
*
* This file is part of the Opera web browser. It may not be distributed
* under any circumstances.
*/
#ifndef ELEMENT_EXPANDER_H
#define ELEMENT_EXPANDER_H
#include "... |
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
int main(){
ll h, w;
cin >> h >> w;
ll ans = 0;
if(h == 1 && w == 1) ans = 1LL;
else if(h == 1 || w == 1) ans = max(h, w) - 2LL;
else ans = (h-2LL) * (w-2LL);
cout << ans << endl;
return 0;
} |
#include "catch.hpp"
#include "../Input.h"
#include "../Model.h"
#include "../ModelAnalyzer.h"
const double BENCHMARK_ACCURACY = 0.70;
TEST_CASE("Benchmark accuracy") {
std::string trainingDataLocation = "yelp_train.csv";
std::string testingDataLocation = "yelp_test.csv";
Input trainingInput;
trainingInput.fetc... |
#include <cstdio>
#include <algorithm>
using namespace std;
const int MAXN = 10010;
int main(){
int n, dp[MAXN], first[MAXN], num[MAXN];
bool flag = false;
scanf("%d", &n);
for(int i = 0; i < n; i++){
scanf("%d", &num[i]);
if(num[i] >= 0){
flag = true;
}
}
if... |
#include <iostream>
#include <string>
#include "opencv2/core/core.hpp"
#include "opencv2/calib3d/calib3d.hpp"
#include <opencv2/highgui/highgui.hpp>
#include <opencv2/imgproc/imgproc.hpp>
#include <stdio.h>
#include <opencv2/contrib/contrib.hpp>
using namespace cv;
using namespace std;
Mat img;
void mouseEvent(in... |
/*
* OtsuHand.cpp
*
* Created on: 2017年3月15日
* Author: lcy
*/
#include "OtsuHand.hpp"
cv::Mat& OtsuHand::start(cv::Mat &src)
{
SkinRGB(src);
cv::cvtColor(dst,dst,cv::COLOR_BGR2GRAY);
cv::threshold(dst,dst,255,255,cv::THRESH_OTSU);
return dst;
}
cv::Mat& OtsuHand::justRGB(cv::Mat& src)
{
SkinRGB(src);
... |
#include "VRJOgreApp.hpp"
// system header
#include <gadget/Type/Position/PositionUnitConversion.h>
#include <jccl/Config/ConfigElement.h>
#include <vpr/Util/Debug.h>
#include <vrj/Draw/OpenGL/Window.h>
#include <OGRE/OgreCamera.h>
#include <OGRE/OgreLog.h>
#include <OGRE/OgreRenderWindow.h>
#include <OGRE/OgreRoot... |
#ifndef ASSOCIATIVE_CONTAINER_HPP
#define ASSOCIATIVE_CONTAINER_HPP
#include <map>
#include <iostream>
#include <string>
#include <initializer_list>
#include <set>
#include <unordered_set>
class AssociativeContainer
{
public:
void associative_container_usage();
};
struct Record
{
std::string label;
int value;
}... |
#include <bits/stdc++.h>
using namespace std;
int A[10001], B[200002];
int N;
int main(){
freopen("TONGVONG.inp", "r", stdin);
freopen("TONGVONG.out", "w", stdout);
cin >> N;
for (int i = 1; i <= N; i++){
cin >> A[i];
}
for (int i = 1; i <= N; i++) {
B[i] = A[i];
B[N + i] = A[i];
}
int ... |
/* -*- Mode: c++; tab-width: 4; indent-tabs-mode: t; 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
*/
#ifndef _URL_DYNAMIC_ATTRIBUTE_INT_H
#defi... |
#include <iostream>
#include <cstdlib>
#include "tensor.h"
#include "roottracer.h"
//DEBUG_FLAG:1
namespace tensorflow {
//static class member initialization
RootTracer<Tensor, Buffer> Tensor::tensor_tracer = RootTracer<Tensor, Buffer>();
Tensor::Tensor(int tid){
this->buf_ = new Buffer;
this->buf_->setid(tid);... |
#include "mainwindow.h"
#include "ui_mainwindow.h"
#include "botan/rng.h"
#include "botan/auto_rng.h"
#include "botan/pipe.h"
#include "botan/aes.h"
#include "botan/filters.h"
MainWindow::MainWindow(QWidget *parent) : QMainWindow(parent), ui(new Ui::MainWindow)
{
ui->setupUi(this);
//Botan::InitializationVect... |
#include "ofMain.h"
#include "kflCAImageRecompElemVertPropApp.h"
#include "kflCAImageRecompElemTimePropApp.h"
#include "kflCAImageRecompTotalTimePropApp.h"
//========================================================================
int main( int argc, char* argv[] ){
ofSetupOpenGL(1280, 720,OF_WINDOW); // <-------- ... |
#include "Bullet.h"
#include "TextureManager.h"
#include "Util.h"
Bullet::Bullet(glm::vec2 _pos, glm::vec2 _dir, float _angle)
{
m_direction = _dir / Util::magnitude(_dir);
getTransform()->position = _pos;
m_rotation = _angle;
TextureManager::Instance()->loadSpriteSheet(
"../Assets/sprites/playerBullet.txt",
... |
// Copyright (c) 2021 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 published
// by the Free Software Foundation, with special ... |
// ------------------------------------------------------------------
// Fast R-CNN
// Copyright (c) 2015 Microsoft
// Licensed under The MIT License [see fast-rcnn/LICENSE for details]
// Written by Ross Girshick
// ------------------------------------------------------------------
#include <iomanip>
#include "caffe/... |
/* -*- 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(_NATIVE... |
#include <iostream>
#include <cstdlib>
#include <ctime>
#include <cmath>
void game();
void computerVsPlayer();
void getUserInput(int* player_coins, char* coins);
void playerVsPlayer();
void game()
{
srand(time(nullptr));
std::cout
<< "Hello! Welcome to my simple game.\n"
<< "The rules of the game:\n"
<< "In a... |
// Выведите все исходные точки в порядке возрастания их расстояний от начала координат.
// Входные данные
// Программа получает на вход набор точек на плоскости. Сначала задано количество точек n,
// затем идет последовательность из n строк, каждая из которых содержит два числа: координаты точки.
// Величина n не п... |
#include <iostream>
#include <string>
#include <vector>
using namespace std;
class Phone
{
public:
Phone(string name)
{
cout << "Phone的构造函数" << endl;
pho_name = name;
}
~Phone()
{
cout << "Phone的析构函数" << endl;
}
string pho_name;
};
class Game
{
public:
Game... |
// Action class
#pragma once
namespace SSW
{
class Action
{
public:
Action() = default;
virtual ~Action() = default;
virtual bool execute() { return false; };
virtual bool execute() const { return false; };
virtual void reset() { };
}; // class Action
} // namespace SSW
|
#include<iostream>
#include<vector>
#include<map>
#include <iomanip>
#include <fstream>
#include<string>
#include<set>
using namespace std;
#define ll long long
bool slidingWindow(vector<int>& ans, int k, int t) {
//edge cases
if(k <= 0 || t <0) return false;
set<int> c(ans.begin(), ans.end());
if(t == 0 && ans.s... |
/* -*- Mode: c++; tab-width: 4; indent-tabs-mode: t; c-basic-offset: 4 -*-
**
** Copyright 2002-2009 Opera Software ASA. All rights reserved.
**
** This file is part of the Opera web browser. It may not be distributed
** under any circumstances.
**
** Peter Karlsson
*/
#include "core/pch.h"
#ifdef PREFS_HAVE_MAC
#... |
//---------------------------------------------------------------------------
#ifndef wyconfigH
#define wyconfigH
#include <vcl.h>
#include "amap.h"
#include "cspin.h"
#include <IniFiles.hpp>
//用于保存和读取用户设置
//保存模式 默认值,控件的Tag
enum ValueSaveType{vsDefault,vsTag};
//--------------------------------------------------------... |
/* XMRig
* Copyright 2010 Jeff Garzik <jgarzik@pobox.com>
* Copyright 2012-2014 pooler <pooler@litecoinpool.org>
* Copyright 2014 Lucas Jones <https://github.com/lucasjones>
* Copyright 2014-2016 Wolf9466 <https://github.com/OhGodAPet>
* Copyright 2016 Jay D Dee <jayddee246@gmail.com>
* C... |
// Created on: 2013-11-12
// Created by: Maxim YAKUNIN (myn)
// Copyright (c) 2002-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 ... |
//Compiler Error in last cout statement as call to max is ambiguous.
#include <iostream>
using namespace std;
template <typename T>
T max(T x, T y)
{
return (x > y)? x : y;
}
int main()
{
cout << max(3, 7) << std::endl;
cout << max(3.0, 7.0) << std::endl;
cout << max(3, 7.0) << st... |
#include "aeCriticalSection.h"
namespace aeEngineSDK
{
struct CRITICAL_SECTION_DATA
{
std::mutex Lock;
};
aeCriticalSection::aeCriticalSection()
{
m_pData = ae_new<CRITICAL_SECTION_DATA>();
}
aeCriticalSection::~aeCriticalSection()
{
ae_delete(m_pData);
}
void aeCriticalSection::Lock()
{
m_pData-... |
/*
Petar 'PetarV' Velickovic
Algorithm: Extended Euclidean Algorithm
*/
#include <stdio.h>
#include <math.h>
#include <string.h>
#include <assert.h>
#include <iostream>
#include <vector>
#include <list>
#include <string>
#include <algorithm>
#include <queue>
#include <stack>
#include <set>
#include <map>
#include <c... |
// Copyright (c) 2020 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 published
// by the Free Software Foundation, with special ... |
// Created on: 2004-10-29
// Created by: Alexander BORODIN
// Copyright (c) 2004-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.... |
// Fill out your copyright notice in the Description page of Project Settings.
#include "Trap1.h"
#include "Trap1Info.h"
ATrap1::ATrap1() {
PrimaryActorTick.bCanEverTick = false;
if (!RootComponent) {
RootComponent = CreateDefaultSubobject<USceneComponent>(TEXT("Root Component"));
}
InteractorComponent = Cre... |
#include <iostream>
#include <vector>
using namespace std;
void merge(vector<int> &v, unsigned int left, unsigned int right, unsigned int mid) {
unsigned int u1 = left;
unsigned int u2 = mid;
vector<int> res((int)right - left);
while (u1 < mid && u2 < right) {
if (v[u1] < v[u2]) {
... |
/* -*- Mode: c++; tab-width: 4; indent-tabs-mode: t; c-basic-offset: 4 -*-
*
* Copyright (C) 1995-2009 Opera Software ASA. All rights reserved.
*
* This file is part of the Opera web browser.
* It may not be distributed under any circumstances.
*/
#ifndef QUICK_MENU_H
#define QUICK_MENU_H
#include "adjunct/quic... |
/*
** EPITECH PROJECT, 2019
** OOP_indie_studio_2018
** File description:
** FileNotFoundException
*/
#include <iostream>
#include "FileNotFoundException.hpp"
FileNotFoundException::FileNotFoundException(const std::string &message)
: Exception(message)
{
}
FileNotFoundException::~FileNotFoundException()
{
}
con... |
/*
Basic ESP8266 MQTT example
This sketch demonstrates the capabilities of the pubsub library in combination
with the ESP8266 board/library.
It connects to an MQTT server then:
- publishes "hello world" to the topic "outTopic" every two seconds
- subscribes to the topic "inTopic", printing out any messages
... |
#include "item/finished_product.h"
#include <QInputDialog>
#include <QPainter>
#include <QStyleOptionGraphicsItem>
#include <QGraphicsSceneMouseEvent>
#include <QFocusEvent>
#include <QFontMetricsF>
using namespace std::string_literals;
unique_ptr<finished_product> finished_product::make(QPointF point)
{
auto re... |
#include <stdio.h>
#include <stdlib.h>
#include <iostream>
#include <fcntl.h>
#include "client.h"
#include "protocol.h"
#include "interface.h"
#include "path.h"
#include "main_thread.h"
const char* VERSION = "2.0.1";
#if defined(_WIN32)
EXPRESS_CLIENT_LIB int open_client(char* bind_ip, char* remote_ip, int remote_p... |
/*create magic box using c++
distribute number from 1 to 9 where sum of any column = sum of any row = sum of any diagonal
algrothim used go to center put first number (1) then check if it is divide by n (which 3 or 4 ..)
if divide row++ then continue els row-- and column -- then continue
note : matrix dimension is ... |
// Copyright (c) 2016 peposso All Rights Reserved.
// Released under the MIT license
#pragma once
#include <type_traits>
#include <string>
#include <sstream>
#include <vector>
#include <msgpack.hpp>
#include "yaml_config.hpp"
#include "utils.hpp"
#include "relation_map.hpp"
#define DISABLE_ANY XLSXCONVERTER_UTILS_DISA... |
#include "mainProgramFunctions.h"
void solveGeneratedProblem(int d1, int d2, int B) //Generate and Solve
{
BivariatePolynomial * Bp1 = new BivariatePolynomial(d1);
BivariatePolynomial * Bp2 = new BivariatePolynomial(d2);
SylvesterMatrix * SM = new SylvesterMatrix(Bp1, Bp2);
int SpDeg = getHiddenMa... |
#include <iostream>
#include <vector>
#include <map>
#include <string>
#include <bitset>
#include <queue>
#include <algorithm>
#include <functional>
#include <cstdio>
using namespace std;
int dp[52] = {0};
class P8XGraphBuilder {
public:
int solve(vector <int> scores)
{
int node = static_cast<int>(scores.size())... |
#include<bits/stdc++.h>
using namespace std;
class Solution {
public:
int maxArea(vector<int>& height) {
int i=0,j=height.size()-1;
int res = 0,h=0,x=0;
while(i<j){
x=j-i;
h=min(height[i],height[j]);
res = max(x*h, res);
if(height[i]<height[j])i++;
else j--;
}
return res;
}
};
|
//Car.h
#ifndef CAR_H
#define CAR_H
#include "Automobile.h"
#include <string>
using namespace std;
class Car : public Automobile
{
public:
Car(string name, string name1);
string getName1();
//int pay();
private:
string name1;
protected:
int pay();
};
#endif // CAR_H |
/**
* @file macs-config.hpp
*
* This file contains necessary macros, such as DEBUG.
*/
#ifndef MACS_CONFIG_HPP
#define MACS_CONFIG_HPP
/**
* DEBUG macro. If enabled, generate debugging code.
*/
// #define DEBUG
#endif
|
/****************************************
Cat Got Bored
*****************************************/
#include <bits/stdc++.h>
#define FOR(i, s, e) for(int i=s; i<e; i++) //excluding end point
#define loop(i, n) for(int i=0; i<n; i++) //n times
#define loop(n) for(int i=0;i<n;i++) // n times
#define getint(n) s... |
/**
* @file testCommand.cxx
* @author Krzysztof Ciba (Krzysztof.Ciba@NOSPAMagh.edu.pl)
* @date 23/11/2006
* @brief Just a test program for Command interface.
*/
// includes from standard libraries
#include <string>
#include <iostream>
// local includes
#ifndef DUMMYGEN_EXTERN_C_H
#include "DUMMYGEN_extern_C.h"
#... |
#ifndef VISUALIZEPREDICTEDDATADIALOG_H
#define VISUALIZEPREDICTEDDATADIALOG_H
#include <QDialog>
#include "ui_VisualizePredictedDataDialog.h"
class VisualizePredictedDataDialog : public QDialog
{
Q_OBJECT
public:
VisualizePredictedDataDialog(QWidget *parent = 0);
~VisualizePredictedDataDialog();
public slots:
... |
#pragma once
#include "s3ePointer.h"
/* Class for working with user input*/
class Input {
int x, y; /* Pointer coordinates */
bool isTouched, prevTouched; /* Pointer states */
public:
Input();
void Update();
void Reset();
int getX();
int getY();
bool getTouchedState();
bool getPre... |
#include <dmp_lib/GatingFunction/ExpGatingFunction.h>
#include <dmp_lib/io/io.h>
namespace as64_
{
namespace dmp_
{
ExpGatingFunction::ExpGatingFunction(double u0, double u_end)
{
this->init(u0, u_end);
}
void ExpGatingFunction::init(double u0, double u_end)
{
this->u0 = u0;
this->a_u = this->u0 - u_end;
... |
#include <bits/stdc++.h>
using namespace std;
int main(){
int a, b, k;
cin >> a >> b >> k;
vector<int> v;
for(int i=1; i<=min(a,b); i++){
if(a%i == 0 && b%i == 0) v.push_back(i);
}
cout << v[v.size() - k] << endl;
return 0;
} |
#include "core.h"
int** ArrayIn(int size, int sizec)
{
int** array = new int* [size];
for (int i = 0; i < size; i++)
array[i] = new int[sizec];
for (int i = 0; i < size; i++)
for (int j = 0; j < sizec; j++)
array[i][j] = EnterInt();
return array;
} |
/* -*- Mode: c++; tab-width: 4; indent-tabs-mode: t; c-basic-offset: 4; c-file-style: "stroustrup" -*-
**
** Copyright (C) 1995-2003 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"
#ifdef XSLT_SU... |
/* Indra Bhurtel */
#include <iostream>
#include <string>
#include <sstream>
#include <iomanip>
using namespace std;
int main()
{
/* variables to read user input*/
string userInput;
/* created arrays to store shapes and shape info*/
string shapes[] = {"Triangle","Square","Circle"};
string in... |
// This file contains the linked implementation of class
// UnsortedType.
#include "unsorted.h"
#include <iostream>
using namespace std;
struct NodeType
{
ItemType info;
NodeType* next;
};
UnsortedType::UnsortedType() // Class constructor
{
length = 0;
listData = NULL;
}
bool UnsortedType::IsFull() con... |
//
// Created by goturak on 21/02/19.
//
#include <iostream>
#include <unistd.h>
#include "Matrix.hpp"
#include "Operation.hpp"
#include "Addition.h"
#include "Multiplication.h"
#include "Substraction.h"
int **Matrix::getElements() const {
return elements;
}
int Matrix::getWidth() const {
return width;
}
... |
//
// Created by manout on 18-1-19.
//
#include <vector>
#include <string>
#include <set>
using std::vector;
using std::string;
using std::pair;
using std::set;
/** Write a program of a simple dictionary which implements the following instructions
* 1: insert str. insert a string into a dictionary
* 2: find s... |
#include <stdio.h>
#include <string.h>
int main(void)
{
printf("%d\n", strlen("nnn"));
return 0;
}
|
#include<bits/stdc++.h>
using namespace std;
int gcdExtended(int a, int b, int* x, int* y){
if(a==0){
*x=0;
*y=1;
return b;
}
int x1, y1;
int gcd = gcdExtended(b%a, a, &x1, &y1);
*x = y1- (b/a)*x1;
*y = x1;
return gcd;
}
void modInverse(int a, int m){
int x, y... |
#ifndef __SRC_UTLIS_TIME_H__
#define __SRC_UTLIS_TIME_H__
#include<time.h>
#include<stdint.h>
#include "define.h"
namespace Utils {
class Clock {
public:
// 绝对时间
Clock(const char * now);
// 相对时间
Clock(time_t now, uint32_t interval);
public:
// 转换为时间戳
time_t convert() const { return... |
// https://oj.leetcode.com/problems/reverse-nodes-in-k-group/
/**
* Definition for singly-linked list.
* struct ListNode {
* int val;
* ListNode *next;
* ListNode(int x) : val(x), next(NULL) {}
* };
*/
class Solution {
void reverse(ListNode* &begin, ListNode* cur, ListNode* &end) {
if (c... |
#ifndef VORONOI_TESSELLATION_H_INCLUDED
#define VORONOI_TESSELLATION_H_INCLUDED
#include "geometry.h"
#include <vector>
#include <queue>
#include <deque>
#include <string>
#include <fstream>
#include <cmath>
#include <ext/rope>
using namespace std;
class Event;
class Arc;
struct LessThanEvent
{
... |
// dp state transition equation: s[k][i] = max(s[k][i-1], p[i] - p[j] + s[k-1][j]) = max(s[k][i-1], p[i] + max(s[k-1][j] - p[j]))
class Solution {
public:
int maxProfit(vector<int>& prices) {
if (prices.empty()) {
return 0;
}
int maxProf = 0;
int n = prices.size(... |
#include "gamecore.h"
#include "ui.h"
#include "jiki.h"
#include "arduis_bitmaps.h"
extern Option option[OPTION_MAX];
Ui::Ui() {
}
void Ui::update() {
static const byte* bitmaps[] = { gaugeEnable, gaugeSpeedUp_1, gaugeSpeedUp_2, gaugeSpeedUp_3,
gaugeDouble, gaugeLaser, gaugeOption, gaugeBarrier };
... |
/* -*- Mode: c++; tab-width: 4; indent-tabs-mode: t; c-basic-offset: 4 -*-
*
* Copyright (C) 1995-2012 Opera Software ASA. All rights reserved.
*
* This file is part of the Opera web browser.
* It may not be distributed under any circumstances.
*/
#ifndef PI_DEVICE_API_OPRADIOINFO_H
#define PI_DEVICE_API_OPRADIO... |
#include "json/json.h"
#include <string.h>
#include <map>
#include <iostream>
#include <fstream>
#include <dirent.h>
#include "Logger.h"
#include "IniFile.h"
#include "CConfig.h"
#include "Util.h"
#include "StrFunc.h"
#include "JsonValueConvert.h"
typedef bool(*pfnGetFile)(const std::string& file, Json::Value& json)... |
#include <bits/stdc++.h>
using namespace std;
#define MOD 1000000007
#define rep(i, n) for(int i = 0; i < (int)(n); i++)
#define rep1(i, n) for(int i = 1; i <= (int)(n); i++)
#define showmap(is, js, x) {rep(i, is){rep(j, js){cout << x[i][j] << " ";}cout << endl;}}
#define show(x) {for(auto i: x){cout << i << " ";} cout... |
#include "tspgraph.h"
#include <QHash>
#include "edge.h"
TSPGraph::TSPGraph(unsigned int n, QVector<Vertex*> V) {
N = n;
Distances = new unsigned int* [n-1];
for (unsigned int i = 0; i<(n-1) ; i++) {
Distances[i] = new unsigned int[i+1];
for (unsigned int j = 0 ; j<(i+1) ; j++)
... |
/******************************************************
** Program: moments.cpp
** Author: Rachel Villarreal
** Date: 4/20/2021
** Description: this program solves for the maximum moment
along a bridge and reports the max moment,
for a given k value
** Input: input a k value th... |
//
// EPITECH PROJECT, 2018
// zappy
// File description:
// Button.hpp
//
#ifndef BUTTON_HPP
#define BUTTON_HPP
#include <iostream>
#include "include.hpp"
#include "Rectangle.hpp"
#include <string>
class Menu;
class Button
{
public:
enum Action {
NONE,
TEST,
MENU_CANCEL,
MENU_OPEN,
CREDITS_CANCEL,
C... |
/*************************************************************************
> File Name: hello.cpp
> Author: billowqiu
> Mail: billowqiu@billowqiu.com
> Created Time: 2017-11-13 22:12:59
> Last Changed: 2017-11-13 22:12:59
*************************************************************************/
#include <boost/p... |
#pragma once
#include "IMultipleInputOperationNodesFactory.hpp"
#include "Nodes/MultipleInputOperators/AddOperation.hpp"
template<class Type>
struct AddNodeFactory : IMultipleInputOperationNodesFactory<Type>
{
std::unique_ptr<MultipleInputOperationNode<Type>> create(std::vector<NotNull<ComputationNode<Type>>> cons... |
#include "texture.h"
#include <sdl/SDL.h>
#include "renderer.h"
library<texture> texture_library(2048u);
texture::texture(std::string path)
{
SDL_Surface* surface = SDL_LoadBMP(path.c_str());
if(!surface)
{
std::cout << "failed to load: " << path << std::endl;
SDL_FreeSurface(surface... |
//write a program to add two complex number using + operator.
#include<iostream>
using namespace std;
class complex
{
private:
int a,b;
public:
void setdata (int x,int y)
{
a=x;
b=y;
}
void showdata()
{
cout<<"a="<<a<<"\nb="<<b<<endl;
cout<<"In the form of... |
// TraceRouteDlg.cpp: 实现文件
//
#include "stdafx.h"
#include "TraceRoute.h"
#include "TraceRouteDlg.h"
#include "afxdialogex.h"
#ifdef _DEBUG
#define new DEBUG_NEW
#endif
// 用于应用程序“关于”菜单项的 CAboutDlg 对话框
class CAboutDlg : public CDialogEx
{
public:
CAboutDlg();
// 对话框数据
#ifdef AFX_DESIGN_TIME
enum { IDD = IDD_AB... |
/* -*- Mode: c++; tab-width: 4; indent-tabs-mode: t; c-basic-offset: 4 -*-
*
* Copyright (C) 1995-2011 Opera Software AS. All rights reserved.
*
* This file is part of the Opera web browser. It may not be distributed
* under any circumstances.
*/
#ifndef GENERIC_THUMBNAIL_CONTENT_H
#define GENERIC_THUMBNAIL_CO... |
#include <gtest/gtest.h>
#include "utl/pool.h"
#include "_util.h"
constexpr size_t test_size = 5;
using pool_t = utl::pool<tester, test_size>;
static void verify_pool(const pool_t& obj, size_t copy, size_t move, size_t taken)
{
ASSERT_EQ(obj.capacity(), test_size);
ASSERT_EQ(obj.left(), test_size - taken);
... |
#ifndef MYARMSIM_H
#define MYARMSIM_H
/*
The project is developed as part of Computer Architecture class
Project Name: Functional Simulator for subset of RISCV Processor
Developer's Name:
Developer's Email id:
Date:
*/
/* myRISCVSim.h
Purpose of this file: header file for myRISCVSim
*/
//Regi... |
/* String operations
* Implementation of some popular string functions.
*/
#include <iostream>
#define CATCH_CONFIG_MAIN
#include "../catch.hpp"
//************************************************************
namespace jimp{
bool strcmp(const char *s1, const char *s2){
unsigned int i = 0;
while(s1[i] == s2[i... |
/* offer 38
*
*
*
*/
#include<stdio.h>
#include<cstring>
#include<iostream>
#include<algorithm> // std::sort
#include<cstring>
#include<vector>
#include<set>
#include<string>
#include<map>
#include<queue>
#include<stack>
#include<deque>
#include<unordered_set>
#include<unordered_map>
using namespace std;
class Sol... |
#include<iostream>
using namespace std;
#define max 10
int queue[max];
int front=-1,rear=-1;
void store(int data);
void retrieve();
int main()
{
int data,prompt=1;
while(prompt!=0)
{
cout<<"Enter <1>To store data\n"<<endl;
cout<<"Enter <2>To retrieve data\n"<<endl;
cout<<"Enter <0>To exit\n"<<e... |
#include <iostream>
using namespace std;
int main(){
cout << "Enter two integers: ";
int num1, num2;
cin >> num1 >> num2;
cout << "The sum is " << num1 + num2 << "." << endl;
cout << "The product is " << num1 * num2 << "." << endl;
cout << "The difference is " << num1 - num2 << "." << endl;
cout << "Th... |
#pragma once
#include "VoronoiLayer.h"
#include "Stone.h"
#include "Stones.h"
#include "NoiseFieldCutter.h"
#include "NoiseTexture.h"
#include "ofMain.h"
#include "ofxPostProcessing.h"
#include "ofxVectorField.h"
#include <algorithm>
class StopMotionStones
{
public:
StopMotionStones();
~StopMoti... |
/* -*- Mode: c++; tab-width: 4; indent-tabs-mode: t; c-basic-offset: 4 -*-
*
* Copyright (C) 1995-2012 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 "platforms/windows/pi/WindowsOpDra... |
/* -*- Mode: c++; tab-width: 4; c-basic-offset: 4 -*-
*
* Copyright (C) 1995-2007 Opera Software ASA. All rights reserved.
*
* This file is part of the Opera web browser.
* It may not be distributed under any circumstances.
*
* @file
* @author Owner: Espen Sand (espen)
* @author Co-owner: Karianne Ekern (k... |
/* -*- Mode: c++; tab-width: 4; c-basic-offset: 4 -*-
*
* Copyright (C) 1995-2008 Opera Software AS. All rights reserved.
*
* This file is part of the Opera web browser.
* It may not be distributed under any circumstances.
*
* @author Patricia Aas (psmaas)
*/
#include "core/pch.h"
#include "platforms/viewix/... |
// Single Responsibility Principle
// a class should only have a single responsibility
#include <fstream>
#include <string>
#include <vector>
struct Journal {
std::string title;
std::vector<std::string> entries;
explicit Journal(const std::string& title) : title{title} {}
void add(const std::s... |
#pragma once
#include <algorithm>
#include <tuple>
#include <type_traits>
#include <utility>
#include <cmath>
#include <cstddef>
namespace utils {
///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
// Helper to allow static_asserts to fail in if c... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.