text stringlengths 8 6.88M |
|---|
#pragma once
enum Target
{
tNone,
me = 100,
buddy,
enemy,
};
enum What
{
wNone,
hp = 200,
mp,
state,
action,
};
enum BL
{
bNone,
big = 300,
little
};
enum Num
{
nNone,
n1 = 400,
n10,
n30,
n50,
n70,
n90,
n100
};
enum State
{
sNone,
doku = 600,
bili,
};
enum Action
{
aNone,
attack = 500,
leav... |
/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
file Copyright.txt or https://cmake.org/licensing for details. */
#include "cmServerProtocol.h"
#include <algorithm>
#include <cassert>
#include <functional>
#include <string>
#include <utility>
#include <vector>
#include <cm/memory>
#... |
/*
* rsaencryption.cpp
*
* Created on: Nov 22, 2013
* Author: Maxx Boehme
*/
#include <iostream>
#include <stdlib.h>
#include <fstream>
#include <cmath>
#include <ctime>
using namespace std;
typedef unsigned long long ULong;
typedef char byte;
ULong findHighestSetBit(ULong);
unsigned int fastModularExp(... |
#include <QMessageBox>
#include <fstream>
#include "officergui.h"
#include "ui_officergui.h"
OfficerGUI::OfficerGUI(QWidget *parent, QString _firstName, QString _lastName, QString _id) :
QDialog(parent),
ui(new Ui::OfficerGUI)
{
ui->setupUi(this);
}
OfficerGUI::~OfficerGUI()
{
delete ui;
}
void Offi... |
#ifndef __depth_first_search_h__
#define __depth_first_search_h__
#include <stack>
#include <random>
class sudoku;
class depth_first_search
{
protected:
std::stack<sudoku*> _stack;
std::mt19937 gen;
public:
depth_first_search();
~depth_first_search();
void init(sudoku* init_state);
bool... |
#ifndef __SRC_UTILS_LRUCACHE_H__
#define __SRC_UTILS_LRUCACHE_H__
#include <list>
#include "define.h"
namespace Utils {
template <typename Key, typename Value>
class LRUCache {
public:
typedef Key key_type;
typedef Value value_type;
typedef size_t size_type;
public:
explicit LRU... |
/* -*- C++ -*- */
#pragma once
/*menu functions/event handlers*/
#include <menu.h>
Menu::result save_program();
Menu::result set_program();
|
// ::std
#include <string>
#include <sstream>
#include <fstream>
#include <algorithm>
#include <cctype>
namespace{
// waliRoot is prepended to this to get an absolute path
std::string regrDir = "Tests/harness/unit-tests/regression_baseline";
//declarations
static void writeOutput(
std::string testname,... |
#include <cstdio>
#include <iostream>
#include <vector>
#include <string>
#include <stack>
#include <unordered_map>
#include <unordered_set>
#include <queue>
#include <algorithm>
#define INT_MAX 0x7fffffff
#define INT_MIN 0x80000000
using namespace std;
struct Interval{
int start;
int end;
Interval() : start(0) ,... |
#ifndef DEDVS_AUXILIARY_H
#define DEDVS_AUXILIARY_H
#include <vector>
#include <fstream>
#include <Eigen/Dense>
#include "Edvs/Event.hpp"
#include "Edvs/EventStream.hpp"
//OpenNI
#include "OpenNI.h"
#include "config.h"
#include <memory>
namespace dedvs {
const Eigen::Matrix3f kR = (Eigen::Matrix3f() << kR11, ... |
//Write aC++ program that reads a number and check whether it is Armstrong’s number or not.
#include<iostream>
using namespace std;
int main()
{
int n,r,sum=0,temp;
cout<<"Enter any number:"<<endl;
cin>>n;
temp=n;
while(n>0)
{
r=n%10;
sum=sum+(r*r*r);
n=n/10;
}
if... |
// must traverse twice
/**
* Definition for singly-linked list.
* struct ListNode {
* int val;
* ListNode *next;
* ListNode(int x) : val(x), next(NULL) {}
* };
*/
class Solution {
public:
ListNode* reverseKGroup(ListNode* head, int k) {
if (head == NULL || k == 1) return head;
... |
#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 10e10
#define rep(i,n) for(int i=0; i<n; i++)
#define r... |
#pragma once
class SBase
{
public:
SBase(){};
~SBase(){};
virtual double compute(double a, double b, double c, double d,double e, double f)= 0;
};
|
#ifndef GREEDYSNAKE_CONTROLLER_H
#define GREEDYSNAKE_CONTROLLER_H
#endif //GREEDYSNAKE_CONTROLLER_H
class Controller {
public:
Controller() : speed(200), key(1), score(0) {}
void Start(); //开始界面
void Select(); //选择难度
void DrawGame(); //绘制地图等游戏信息界面
int PlayGame(); //游戏的二级循环
void Update... |
//Charles Matthews 2019
//this is designed for a Pro Micro, and A4/A5 were not available for some reason
int sensors[] = {A0, A1, A2, A3, A8, A9, A6, A7};
//set up an array so to avoid duplicate data later on
int lastValues[] = {-1, -1, -1, -1, -1, -1, -1, -1};
//I'm lazily using the Bare Conductive Touch Board arc... |
#pragma once
#include <pthread.h>
typedef struct node{
int value;
struct node* left;
struct node* right;
pthread_mutex_t mtx;
node(int val){
value = val;
left = nullptr;
right = nullptr;
}
} node_t;
class CTree{
public:
CTree();
~CTree();
bool Add(int va... |
#ifndef SHOWMAPS_H
#define SHOWMAPS_H
#include <QGeoLocation>
#include <QGeoCoordinate>
#include <QGeoPositionInfoSource>
#include <iostream>
#include <istream>
#include <fstream>
#include <QDialog>
#include <QWidget>
#include <QtWidgets>
class Showmaps : public QObject
{
Q_OBJECT
public:
Showmaps(QObject *p... |
// Mon May 2 14:34:46 EDT 2016
// Evan S Weinberg
// C++ file for successive overrelaxation.
// To do:
// 1. Template to support float, double.
#include <iostream>
#include <cmath>
#include <string>
#include <sstream>
#include <complex>
#include "generic_vector.h"
#include "generic_sor.h"
using namespace std;
... |
#include "AnimationView.h"
#pragma once
class AnimationWindow : public CFrameWnd
{
public:
DECLARE_DYNCREATE(AnimationWindow)
DECLARE_MESSAGE_MAP()
AnimationWindow();
~AnimationWindow();
// Initialize look of the animation window
CToolBar m_wndToolBar;
virtual BOOL OnCreateClient(LPCREATESTRUCT lpcs, CCrea... |
#pragma once
#include "Position.h"
#include "Size.h"
#include "hgesprite.h"
#include <memory>
#include <vector>
class Pointer
{
private:
Position pos_for_goal;
Position pos;
Size size;
Size size_for_goal;
int numb;
int numb_current;
int goal_numb;
int color;
int goal_color;
std::shared_ptr<hgeSprite> sprite;
... |
#ifndef MOLDYCAT_ATOM_ATOM_H
#define MOLDYCAT_ATOM_ATOM_H
#include <vector>
#include <cmath>
#include "armadillo"
#include "vect3.h"
#include "../sim/simulation.hpp"
#include <iostream>
using namespace std;
using namespace arma;
namespace moldycat
{
//-----------------------------------------------------------------... |
//
// ControlLayer.h
// Aircraft
//
// Created by lc on 11/27/14.
//
//
#ifndef __Aircraft__ControlLayer__
#define __Aircraft__ControlLayer__
#include <stdio.h>
#include "PlaneLayer.h"
#include <string.h>
USING_NS_CC;
using namespace std;
const int ENEMY1_LIFE = 1;
const int ENEMY2_LIFE = 2;
const int ENEMY3_L... |
/*
ID: stevenh6
TASK: skidesign
LANG: C++
*/
#include <iostream>
#include <fstream>
#include <string>
#include <climits>
using namespace std;
ofstream fout ("skidesign.out");
ifstream fin ("skidesign.in");
int main() {
int N;
fin >> N;
int hills[N];
for (int i = 0; i < N; i++) {
fin >> hills... |
/*
* touch_dispatcher.cpp
*
*
*
*/
#include "touch_dispatcher.h"
#include "ulcd_component.h"
/*
* private defines
*
*/
/*
* private variables
*
*/
/*
* constructor
*
*/
touch_dispatcher::touch_dispatcher()
{
}
touch_dispatcher::~touch_dispatcher()
{
}
/*
* private functions
*
*/
/*
* pu... |
#include <iostream>
using namespace std;
int* weird_sum(int a, int b)
{
int c;
c=a+b;
return &c;
}
int main()
{
//int *pX;
/*
int *pX=NULL;
*pX=0;
*/
//cout<<*(weird_sum(7,5));
/*
int a=20, b=25, *pG;
{
int g;
pG=&g;
g=a+b;
}
{
... |
/*
* Copyright (C) 2020 The LineageOS Project
*
* 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 la... |
/* -*- Mode: c++; tab-width: 4; indent-tabs-mode: t; c-basic-offset: 4 -*-
**
** Copyright (C) 1995-2005 Opera Software AS. All rights reserved.
**
** This file is part of the Opera web browser. It may not be distributed
** under any circumstances.
*/
#ifndef MODULES_SPATIAL_NAVIGATION_SPATIAL_NAVIGATION_MODULE_H
#d... |
#ifndef MESSAGE_HH
#define MESSAGE_HH
#include <vector>
#include <string>
#include <cassert>
#include <cstdint>
namespace cpprofiler {
static const int32_t PROFILER_PROTOCOL_VERSION = 3;
enum NodeStatus {
SOLVED = 0, ///< Node representing a solution
FAILED = 1, ///< Node representing failure
BR... |
#include <iostream>
#include <string.h>
#include <algorithm>
using namespace std;
int n, triangle[100][100];
int cache[100][100];
// (y,x) 위치부터 맨 아래줄까지 내려가면서 얻을 수 있는 최대 경로의 합을 반환한다.
int path(int y, int x)
{
// 기저 사례
if (y == n - 1)
return triangle[y][x];
// 메모이제이션
int &ret = cache[y][x];
i... |
#include <iostream>
enum Example : char {
A, B, C //A = 0 B = 1 C = 2
};
int main() {
Example value = B; // I can only choose A B OR C.
if (value == 1) {
//do something
}
std::cin.get();
}
|
#include<bits/stdc++.h>
using namespace std;
#define maxn 6000
#define INF 0x7ffffff
struct turtle {
int w;
int s;
} t[maxn];
int ind=0;
int dp[maxn];
bool cmp(struct turtle a,struct turtle b) {
return a.s<b.s;
}
int main() {
while(~scanf("%d%d",&t[ind].w,&t[ind].s)) {
ind++;
... |
#ifndef _SCROLL_H_
#define _SCROLL_H_
#include "scrollinterface.h"
class ScrollInterfaceMagicMissile;
class ScrollImp;
class Scroll : public ScrollInterface
{
public:
Scroll();
~Scroll();
virtual void accept(ScrollInterfaceMagicMissile *);
protected:
ScrollImp *getScrollImp();
private:
ScrollImp *_imp... |
#ifndef FILEIOSERVICE_H
#define FILEIOSERVICE_H
#include<string>
#include"IOService.h"
using namespace std;
class FileIOService : public IOService
{
public:
FileIOService(string, string);
virtual void readMachineInput(TuringMachine&);
virtual void writeMachineOutput(TuringMachine&);
private:
string inputFile;
... |
#ifndef WCLIENTLIST_H
#define WCLIENTLIST_H
#include "wevent.h"
#include <QVector>
#include <QPair>
#include <QString>
#include <QDataStream>
class WClientList : public WEvent
{
public:
WClientList();
void pushModified(quint64 id, const QString& nick);
void pushModified(const QPair<quint64, QString>& pa... |
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <utility>
#define ll long long
using namespace std;
int main() {
ios::sync_with_stdio(false);
ll bubblegum;
ll limit;
ll temp, ctr=0;
ll zeta;
ll arr[100000];
cin >> bubblegum >> limit;
for(int i=0; i<bubblegum; i++)
cin >... |
#include <iostream>
#include <algorithm>
#include <stdio.h>
#include <stdlib.h>
#include <time.h>
#include <memory.h>
#include <math.h>
#include <string>
#include <string.h>
#include <queue>
#include <vector>
#include <set>
#include <map>
typedef long long LL;
typedef unsigned long long ULL;
#define PI 3.141592653589... |
#include <Arduino.h>
#include "secrets.h"
#include <WiFiClientSecure.h>
#include <MQTTClient.h>
#include <ArduinoJson.h>
#include "WiFi.h"
#include <Adafruit_Sensor.h>
#include <Adafruit_AM2320.h>
// The MQTT topics that this device should publish/subscribe
#define AWS_IOT_PUBLISH_TOPIC "esp32/pub"
#define AWS_IOT_... |
/* -*- Mode: c++; tab-width: 4; indent-tabs-mode: t; c-basic-offset: 4 -*-
*
* Copyright (C) 1995-2006 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-own... |
#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;
int sum[110],a[110];
int f[110][110],vis[110][110];
int dfs(int i,int j) {
if... |
#ifndef CNetClt_H
#define CNetClt_H
#include "CNetStruct.h"
#include "../SMonitorServer/CNetMessage.h"
#include "SrvException.h"
#include <QStringList>
#include <QList>
#include <QObject>
class CMessageEventMediator;
class CMessageFactory;
class CNetClt : public QObject
{
Q_OBJECT
public:
CNetClt(CMessageEventMedia... |
#include <iostream>
using namespace std;
//Fibonacci
long double ciag[30000],dzielenie;
int main()
{
ciag[0]=ciag[1]=1;
cout.precision(30);
for (int i=0;i<30000;i++) //1300 ok
{
ciag[i+2]=ciag[i+1]+ciag[i];
dzielenie=ciag[i+1]/ciag[i];
// cout<<i+1<<". " << ciag[i]<<"\t\t... |
#ifndef __rlrpg_equipment_hpp_defined
#define __rlrpg_equipment_hpp_defined
#include "Attribute.hpp"
#include "Enchantment.hpp"
#include "EquipmentType.hpp"
#include "Generated.hpp"
#include "RNG.hpp"
#include "QDValue.hpp"
#include <vector>
namespace rlrpg
{
/* Types. */
class EquipmentDesc;
class Equipment;
/*... |
/* this holds data for interfacing with the graphics card, both from OpenGl and OpenCL. These data
* are held in buffered objects. Buffer objects are also how OpenGL and OpenCL share information
* and as such this class will also be responsible for creating the interopability between them on
* these buffer objects. ... |
/* -*- Mode: c++; tab-width: 4; indent-tabs-mode: t; c-basic-offset: 4 -*-
*
* Copyright (C) 1995-2007 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 "adjunct/quick/Application.h"
#inc... |
//Phoenix_RK
/*
https://leetcode.com/problems/max-consecutive-ones/
Given a binary array, find the maximum number of consecutive 1s in this array.
Example 1:
Input: [1,1,0,1,1,1]
Output: 3
Explanation: The first two digits or the last three digits are consecutive 1s.
The maximum number of consecutive 1s is 3.
... |
/*=============================================================================
Copyright (c) 2001-2011 Joel de Guzman
Copyright (c) 2007-2021 Hartmut Kaiser
// SPDX-License-Identifier: BSL-1.0
Distributed under the Boost Software License, Version 1.0. (See accompanying
file LICENSE_1_0.txt or copy at... |
#include "NetworkController.h"
#include <Arduino.h>
#include <SoftwareSerial.h>
#define SERIAL_BOUND_RATE 9600
String const SERVER_ADRESS="http://192.168.0.109:5000";
NetworkController::NetworkController(int pinRx, int pinTx, String ssid, String pw){
PIN_RX = pinRx;
PIN_TX = pinTx;
//establishConnection(... |
/* -*- Mode: c++; tab-width: 4; indent-tabs-mode: t; c-basic-offset: 4 -*-
*
* Copyright (C) 1995-2010 Opera Software ASA. All rights reserved.
*
* This file is part of the Opera web browser.
* It may not be distributed under any circumstances.
*/
#ifndef CREATE_FILE_OPERATION_H
#define CREATE_FILE_OPERATION_H
... |
#include <iostream>
#include <utility>
using namespace std;
void findPair(int n, pair<int, int> &pair){
pair.first = 1;
pair.second = 0;
for(int i = 0; i < n; i++){
int tmpFirst = pair.first;
int tmpSecond = pair.second;
pair.first = tmpSecond;
pair.second = tmpFirst+tmpSe... |
/*
Copyright (c) 2014 Mircea Daniel Ispas
This file is part of "Push Game Engine" released under zlib license
For conditions of distribution and use, see copyright notice in Push.hpp
*/
#pragma once
#include "Core/Platform.hpp"
#ifdef PUSH_PLATFORM_MACOS
#import <OpenGL/gl.h>
#import <Cocoa/Cocoa.h>
@interface GLVi... |
#include "Bone_Animation.h"
Bone_Animation::Bone_Animation()
{
}
Bone_Animation::~Bone_Animation()
{
}
void Bone_Animation::init()
{
root_position = { 2.0f,1.0f,2.0f };
scale_vector =
{
{1.0f,1.0f,1.0f}, // root
{0.5f,4.0f,0.5f}, // upp
{0.5f,3.0f,0.5f}, // mid
{0.5f,2.0f,0... |
/**
* Tiny and cross-device compatible timer library.
*
* Timers used by microcontroller
* Atmel AVR: Timer2
*
* @copyright Naguissa
* @author Naguissa
* @email naguissa@foroelectro.net
* @version 0.1.0
* @created 2018-01-27
*/
#ifndef _uTimerLib_
#define _uTimerLib_
#include "Arduino.h"
// Operation mo... |
#include <iostream>
#include <vector>
using namespace std;
class Solution {
public:
int maxArea(vector<int>& height) {
int left = 0, right = height.size() - 1, maxArea = 0;
while(left != right){
maxArea = max(maxArea, (right - left) * min(height[left], height[right]));
if(height[right] > hei... |
// RAVEN BEGIN
// bdube: note that this file is no longer merged with Doom3 updates
//
// MERGE_DATE 09/30/2004
#include "../idlib/precompiled.h"
#pragma hdrstop
#include "Game_local.h"
#if !defined(__GAME_PROJECTILE_H__)
#include "Projectile.h"
#endif
#if !defined(__GAME_VEHICLE_H__)
#include "Vehicle/Vehicle.h"... |
#ifndef STATEMENT_H
#define STATEMENT_H
#include<fstream>
#include "..\defs.h"
#include "Connector.h"
//class Output;
#include "..\GUI\Output.h"
class ApplicationManager;
struct Variable
{string name;
double value;
int repeat;
};
//Base class for all Statements
class Statement
{
protected:
int ID; //Each Statemen... |
#ifndef GROUP3D_H
#define GROUP3D_H
#include <QMatrix4x4>
#include <QVector3D>
#include <QVector>
#include "simpleobject3d.h"
class Group3D : public Parameters
{
private:
QMatrix4x4 m_viewMatrix;
QMatrix4x4 m_globalTransform;
QVector3D m_tra... |
/* -*- Mode: c++; tab-width: 4; indent-tabs-mode: t; c-basic-offset: 4 -*-
**
** Copyright (C) 1995-2007 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"
#if defined(VEGA_SUPPORT) && (defined(V... |
#include "pch.h"
#include "StoplossMonitor.h"
/*
2.
Load all StoplossMsg from buffer
3.
Compare TickMsg Update Stoploss
Send a SignalMsg to buffer if Tick is lower than Stoploss
*/
|
//
// 22.cpp
// REVIEW BAGUS
//
// Created by Mikha Yupikha on 16/10/2016.
// Copyright © 2016 Mikha Yupikha. All rights reserved.
//
#include <iostream>
using namespace std;
int main()
{
int temperature;
cout << "Please input the temperature in fahrenheit: ";
cin >> temperature;
if (tem... |
/* -*- Mode: c++; tab-width: 4; indent-tabs-mode: t; c-basic-offset: 4 -*-
**
** Copyright (C) 2010-2011 Opera Software ASA. All rights reserved.
**
** This file is part of the Opera web browser. It may not be distributed
** under any circumstances.
**
** Niklas Beischer <no@opera.com>, Erik Moller <emoller@opera.com... |
/* -*- 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 MODULES_AUTH_URL_MODULE_H
#define MODULES_AUTH_URL_MODULE... |
#include "main.hpp"
int main( int argv, char** argc )
{
namespace fs = std::filesystem;
const string inputPath = "./srcImg/";
auto savepath = fs::path( "./dstImg/" );
if ( !fs::exists( savepath ) )
fs::create_directory( savepath );
auto logpath = fs::path( "./log" );
if ( !fs::exists(... |
#pragma once
#include "thread_group_serializer_cpp03.hpp"
#include "ucontext_thread_group_cpp03.hpp"
#include "serial_thread_group_cpp03.hpp"
namespace test
{
namespace detail
{
template<typename Function, typename Tuple>
inline void inplace_async(std::size_t num_groups, std::size_t num_threads, Function f, Tuple ... |
#include <iostream>
#include <vector>
#include "common.h"
#include "CImg.h"
using namespace std;
using namespace cimg_library;
/**
* Day 8 - Space Image Format
*
* Dependency: CImg library, http://cimg.eu/
*/
typedef vector<long>
memory_t;
int main(int argc, char *args[])
{
if (argc < 2)
{
c... |
#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 10000000
#define rep(i,n) for(int i=0; i<n; i++)
#defin... |
// Copyright (c) 2020 ETH Zurich
// Copyright (c) 2002-2006 Pavol Droba
//
// SPDX-License-Identifier: BSL-1.0
// 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)
#pragma once
#include <pika/config/forward.hpp>
... |
#include "..\h\stamp.h"
CStamp::CStamp() :
m_hBitMap(0)
{}
CStamp::CStamp(HBITMAP _bitmap, int _x, int _y) {
m_hBitMap = _bitmap;
m_iStartX = _x;
m_iStartY = _y;
GetObject(m_hBitMap, sizeof(BITMAP), &m_bitmapStructure);
}
// virtual
CStamp::~CStamp() {
DeleteObject(m_hBitMap);
}
// virtual
void CStamp::Dr... |
#ifndef Geometry_MTDNumberingBuilder_CmsMTDDiscBuilder_H
#define Geometry_MTDNumberingBuilder_CmsMTDDiscBuilder_H
#include "Geometry/MTDNumberingBuilder/plugins/CmsMTDLevelBuilder.h"
#include "FWCore/ParameterSet/interface/types.h"
#include <string>
/**
* Class which contructs Phase2 Outer Tracker/Discs.
*/
class C... |
#include<bits/stdc++.h>
#define rep(i,n) for (int i =0; i <(n); i++)
using namespace std;
using ll = long long;
const double PI = 3.14159265358979323846;
int main(){
int a,b,x,y;
cin >> a >> b >> x >> y;
//2回xするほうが階段降りるより早いとき、斜め→横移動が早い
if(x*2 < y) y = 2 * x;
if(a > b)cout << x + (a... |
#include <iostream>
#include "tree.hpp"
int main() {
Tree* t = new Tree;
t -> add(60);
t -> add(9);
t -> add(68);
t -> add(8);
t -> add(10);
t -> add(7);
t -> add(70);
// t -> add(2);
// t -> add(3);
// t -> add(4);
// t -> add(5);
// t -> add(6);
// t -> add(7);
// t -> add(40);
/... |
//l,r节点包含的子树左右边界,c线段树区间点表示的原节点序号
int l[maxn],r[maxn],c[maxn];
int tot;//dfs树节点的序号
vector<int>G[maxn];
int dfs(int x,int fa)
{
l[x]=++tot;
c[tot]=x;
for(const auto &i:G[x]){
if(i==fa)
continue;
dfs(i,x);
}
r[x]=tot;
} |
#include "Bludger.h"
using namespace std;
Bludger::Bludger(int i) :id(i)
{
center = Point3();
radius = BALL_RADIUS;
center.axis[0] = cos(jiao2hu(BLUDGER_INTERVAL_RADIUS * id)) * BLUDGER_INIT_DISTANCE;
center.axis[2] = sin(jiao2hu(BLUDGER_INTERVAL_RADIUS * id)) * BLUDGER_INIT_DISTANCE;
center.axis[1] = Ge... |
/* -*- Mode: c++; tab-width: 4; indent-tabs-mode: t; c-basic-offset: 4 -*-
**
** Copyright (C) 2005-2007 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
*/
#if !defined OPCONSOLEPREFSHELPER_H && defi... |
// Copyright (c) 1991-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 GNU Lesser General Public License version 2.1 as published
... |
#include <cassert> //lets us use assertions in C ++
#include<iostream>
using namespace std;
#ifndef DATE_H
#define DATE_H
class Date
{
public:
int month;
int day;
int year;
Date();
Date(int month,int day,int year);
void display1();
void display2();
void increment();
Date &oper... |
#include <PA9.h>
#include "Button.h"
#include "DSspecs.h"
#include "IdGenerator.h"
#include "Menu.h"
#include <maxmod9.h>
#include "soundbank_bin.h"
#include "soundbank.h"
#define STATE_ALIVE (1<<0)
#define STATE_SELECTED (1<<1)
Button::Button():
m_screen(0), m_x(0), m_y(0), m_state(0),
m... |
#pragma once
#include "GcPropertyEntity.h"
class GnAnimationKeyManager;
class GcAnimationKeyPropEntity : public GcPropertyEntity
{
GtDeclareEntity(GcAnimationKeyPropEntity);
public:
enum eMessage
{
MSG_KEYTIME = 350,
MSG_TEGID,
};
struct ThisEntityData : public EntityData
{
int mAniKeyIndex;
};
private:
... |
#include "LayoutConfig.h"
#include "qmessagebox.h"
#include "qlayout.h"
#include "qtextedit.h"
#include "qtextstream.h"
#include "qstringlist.h"
#include "qregularexpression.h"
#include "qdebug.h"
void NewQPushButton::setFunNum(const QString& num){
funNumber = num;
}
LayoutConfig::LayoutConfig(MainWindow* m){
mainW... |
#pragma once
const int dimension = 3;
enum class NumberType : int { Real, Complex, Fraction, Constant };
class Number {
private:
NumberType type;
int numerator;
int denominator;
public:
Number() : numerator(1), denominator(1) { }
};
class Vector {
private:
Number x,
y,
z;
public:
Vector();
};
class ... |
protocol = 1;
publishedid = 1999239394;
name = "Taskforce47";
timestamp = 5248860571078422363;
|
// -*- Mode: c++; tab-width: 4; indent-tabs-mode: t; c-basic-offset: 4 -*-
//
// Copyright (C) 1995-2005 Opera Software ASA. 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 "StartPanel.h"
#include "adjunc... |
#include "collision_manager.hpp"
collision_manager::handle collision_manager::register_collider(collider& new_collider)
{
colliders_.push_front(&new_collider);
return {this, std::begin(colliders_)};
}
void collision_manager::handle_collisions()
{
for (auto it0 = std::begin(colliders_); it0 != std::end(col... |
/**
* Peripheral Definition File
*
* RTC - Real-time clock
*
* MCUs containing this peripheral:
* - STM32F0xx
*/
#pragma once
#include <cstdint>
#include <cstddef>
#include "io/reg/stm32/_common/rtc_v2.hpp"
namespace io {
namespace base {
static const size_t RTC = 0x40002800;
}
static Rtc &RTC = *reinterpret_c... |
#include<iostream>
#include<vector>
#include<algorithm>
using namespace std;
struct VectorizeRow
{
const size_t size;
VectorizeRow(size_t s) :size(s) {}
vector<int> operator()(const int* a) const
{
return vector<int>(a,a+size);
}
};
int main()
{
int arr[3][4]={{7,4,3,5},{2,5,8},{5,4,3,2}};
vector<vector<int... |
// Created on: 1999-06-21
// Created by: Galina KULIKOVA
// Copyright (c) 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 GNU Les... |
#pragma once
#include <stdio.h>
#include <stack>
#ifdef __linux__
// OpenGL includes for Raspberry Pi
#include <GL/glu.h>
#include "GLES2/gl2.h"
#include "EGL/egl.h"
#include "EGL/eglext.h"
#else
// OpenGL includes for Windows
#include <gl\glew.h>
#include <gl\GLU.h>
#include <SDL_opengl.h>
#endif
// GLM
#include "g... |
// Copyright 2018 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#include "ash/wm/pip/pip_positioner.h"
#include <memory>
#include <string>
#include "ash/shelf/shelf.h"
#include "ash/shell.h"
#include "ash/test/ash_te... |
//__LICENCE
#include "EasyDefines.h"
//#include "../externalLibs/CImg.h"
#include <windows.h>
#include <fstream>
namespace EasyDefines
{
//------------------------------------------------------//
void showMessageBox(std::string pText)
{
/*
typedef std::string TString;
unsigned int maxcharwidth = 60;
unsig... |
#include<bits/stdc++.h>
using namespace std;
#define PI 3.1415926535897932
int gcd (long long a, long long b){
if (b==0) return a;
gcd(b, a%b);
}
int main(){
int a=85,b=100;
int c=1025,d=820;
printf("%d and %d gcd_%d\n",a,b,gcd(max(a,b),min(a,b)));
printf("%d and %d gcd_%d\n",a,b,__gcd(min(a,b... |
// -*- Mode: c++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*-
//
// 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"
#include "WindowsComplexScript.h"
#ifde... |
#include <iostream>
#include <fstream>
#include <string.h>
#include <stdio.h>
#include <stdlib.h>
#include <ncurses.h>
#include <string>
using namespace std;
int n, r, l, sum, val[111];
void input() {
scanf("%d", &n);
for (int i = 0; i < n; i++)
scanf("%d", &val[i]);
}
void solve() {
for (int i... |
#include "common.h"
#include "udp_dealer.h"
#include "json/json.h"
#include "app_dealer.h"
/*
inter json prerequisite
{
uid:"546567uy4657",
cmd:"reg_log",
payload:""
//or other things below
...
}
*/
UdpDealer::UdpDealer(boost::asio::io_service& io_service, short port)
: socket_(io... |
#include <iostream>
#include <fstream>
#include <string>
#include <vector>
#include <unordered_map>
#include <algorithm>
#include "parser.h"
#include "equationNode.h"
using namespace std;
int main(int argc, char *argv[]) {
// grab the file name argument from command line
char* filename = argv[1];
// cout ... |
/** Underscore
@file /.../Source/Kabuki_SDK-Impl/_App/Window.h
@author Cale McCollough
@copyright Copyright 2016 Cale McCollough ©
@license http://www.apache.org/licenses/LICENSE-2.0
@brief This file contains the _ class.
*/
#include <stdint.h>
#include "_G/Cell.h"
namespace _A... |
#include "StdAfx.h"
#include "CocosTool.h"
#include "GcExtraDataPropEntity.h"
#include "GcPropertyGridNumberPair.h"
#include "GcPropertyGridTwoButtonsProperty.h"
GcExtraDataPropEntity::GcExtraDataPropEntity(void)
{
Init();
}
GcExtraDataPropEntity::~GcExtraDataPropEntity(void)
{
}
bool GcExtraDataPropEntity::Init()... |
#pragma once
#include "StdAfx.h"
class UIManager
{
MyGUI::Gui* mGUI;
float infoTimer;
public:
UIManager(MyGUI::Gui* mGUI);
virtual ~UIManager();
void update(float deltaT);
void showInfo(const MyGUI::UString& value, float time);
void updateScore(int score1, int score2);
void showGameType(const ... |
#include <iostream>
#include <vector>
using namespace std;
void search_minimal_difference(vector<int> lhs, vector<int> rhs, int ans[]) {
int i = 0;
int j = 0;
int difference = 0;
bool is_fisrt_difference = true;
while (i < lhs.size() && j < rhs.size()) {
if (is_fisrt_difference) {
... |
#include <iostream>
#include <iomanip>
using namespace std;
int main(){
int dias,aux;
cin >> dias;
cout << dias/365 << " ano(s)" << endl;
aux = dias%365;
cout << aux/30 << " mes(es)" << endl;
aux = aux%30;
cout << aux << " dia(s)" << endl;
return 0;
}
|
#include<iostream>
#include<conio.h>
#include<math.h>
class Deap
{
public:
int maxsize;
int size;
public:
int *h;
public:
Deap(int,int);
int leftchild(int);
int rightchild(int);
int parent(int);
bool isleaf(int);
void swap(int,int);
void display();
int MaxHeap(int);
int Min... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.