text stringlengths 8 6.88M |
|---|
#include <iostream>
#include <time.h>
#include <vector>
#include <fstream>
#include <sstream>
#include <iomanip>
#include <string>
using namespace std;
#include "sortClass.h"
#include "testSort.h"
#include "csvProcess.h"
int main(){
double costTime, aveCostTime;
// 存储排序类型名称 选择排序、冒泡排序、合并排序、快速排序、插入排序
// s... |
#include "Event.h"
#include "Position.h"
#include "Player.h"
#include "Unit.h"
using namespace System::Runtime::InteropServices;
namespace BroodWar
{
namespace Api
{
Event^ ConvertEvent(BWAPI::Event ev)
{
return gcnew Event(ev);
}
Event::Event(BWAPI::Event* ev)
{
instance = ev;
dispose = false;
... |
#define DDRD_reg (*((*volatile uint8_t*) 0x2A))
#define DDRD_IO (*((volatile uint8_t*) 0x0A))
#define uint8_t red 5
#define uint8_t green 6
#define uint8_t blue 7
#define uint8_t button 3
void setup() {
// put your setup code here, to run once:
Serial.begin(9600);
/*
pinMode(red,OUTPUT);
pinMode(green... |
/* -*- Mode: c++; tab-width: 4; indent-tabs-mode: t; c-basic-offset: 4; c-file-style:"stroustrup" -*-
**
** Copyright (C) 1995-2009 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 "adj... |
#include "utils.hpp"
#include "login_back_ground_ptts.hpp"
using namespace std;
namespace pc = proto::config;
namespace nora {
namespace config {
login_back_ground_ptts& login_back_ground_ptts_instance() {
static login_back_ground_ptts inst;
re... |
#include <iostream>
#include<bits/stdc++.h>
#include<algorithm>
#include<cmath>
#include<string>
#include<cstring>
#include<vector>
#include<map>
#include<set>
#include<list>
#include<unordered_map>
#include<unordered_set>
#define ll long long
#define MAX 100000003
using namespace std;
int main()
{
int n;
cin... |
#include "nv/context.h"
#include "nv/commands.h"
#include "util/memory_input_stream.hpp"
#include "util/memory_output_stream.hpp"
#include <gtest/gtest.h>
using nv_test::MemoryInputStream;
using nv_test::MemoryOutputStream;
TEST(nv_context, init_default)
{
MemoryInputStream in;
MemoryOutputStream out;
Mem... |
#include "GnGamePCH.h"
#include "GMultiShootAttack.h"
#include "GGameDefine.h"
void GMultiShootAttack::RegisterCreateFunction()
{
static bool bRegistered = false;
if(bRegistered)
return;
GFarAttack::RegCreateFunction( eIndexItemMissile, GMultiShootAttack::CreateAttack );
bRegistered = true;
}
GF... |
#ifndef SCHEDULERDIALOG_H
#define SCHEDULERDIALOG_H
#include <QMainWindow>
#include <QButtonGroup>
namespace Ui {
class SchedulerDialog;
}
class SchedulerDialog : public QMainWindow
{
Q_OBJECT
public:
explicit SchedulerDialog(QWidget *parent = 0);
~SchedulerDialog();
public slots:
void requestC... |
#pragma once
#include <Tanker/BlockGenerator.hpp>
#include <Tanker/ContactStore.hpp>
#include <Tanker/Crypto/Crypto.hpp>
#include <Tanker/Device.hpp>
#include <Tanker/DeviceKeys.hpp>
#include <Tanker/Entry.hpp>
#include <Tanker/Groups/Group.hpp>
#include <Tanker/Groups/GroupStore.hpp>
#include <Tanker/Identity/Delegat... |
#pragma once
#include "bricks/java/jclass.h"
#include <jni.h>
namespace Bricks { namespace Java {
class JMethod : public Object
{
protected:
AutoPointer<JClass> clazz;
jmethodID method;
virtual ReturnPointer<JObject> CallObjectVariadic(JReference* object, va_list args);
virtual ReturnPointer<JObject> Cal... |
// 0927_2.cpp : 定义控制台应用程序的入口点。
//多边形面积
//输入数据包含多个测试实例,每个测试实例占一行,每行的开始是一个整数n(3 <= n <= 100),
//它表示多边形的边数(当然也是顶点数),
//然后是按照逆时针顺序给出的n个顶点的坐标(x1, y1, x2, y2... xn, yn),
//为了简化问题,这里的所有坐标都用整数表示。
//输入数据中所有的整数都在32位整数范围内,n = 0表示数据的结束,不做处理。
#include<iostream>
using namespace std;
int main()
{
int n;
while (cin >> n)
{
if ... |
#pragma once
//-------------------------------------------------------------------------------------------------
// Custom ostream manipulator to simplify colorizing
class StreamColors
{
public:
typedef std::ostream& (*ManipPtr)(std::ostream&);
StreamColors(ManipPtr foreground, bool bold = false) :
f... |
/**
* Copyright (c) 2022, Timothy Stack
*
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
*
* * Redistributions of source code must retain the above copyright notice, this
* list of condi... |
/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
file Copyright.txt or https://cmake.org/licensing for details. */
#include "cmSetPropertyCommand.h"
#include <set>
#include <sstream>
#include "cmExecutionStatus.h"
#include "cmGlobalGenerator.h"
#include "cmInstalledFile.h"
#include "c... |
/******************************************************************************
******************************************************************************/
/** \file market_watcher_handler.cpp
* watch market data for an instrument example program using low level handler.
*/
// L I C E N S E #################... |
//
// Created by Vasili Siachko on 15.12.2019.
//
#ifndef UP_LAB10_BIDIRECTIONALLIST_H
#define UP_LAB10_BIDIRECTIONALLIST_H
#include <iostream>
#include <cassert>
#include <vector>
template<class T>
class BiDirectionalList
{
public:
struct Node // Структура для компоненты списка
{
... |
#ifndef M580_H
#define M580_H
#include <QObject>
#include <QPushButton>
#include <QWidget>
#include <QDebug>
#include <QLabel>
#include <QVBoxLayout>
#include <QIcon>
class M580 : public QPushButton
{
Q_OBJECT
public:
M580(QWidget *parent = nullptr);
bool getpower();
QLabel* getlabel();
~M580();
... |
#ifndef SUBTRACT_H
#define SUBTRACT_H
#include "Subtract.h"
Subtract::Subtract()
{
value1 = 0;
value2 = 0;
}
Subtract::Subtract(Base* input1, Base* input2)
{
value1 = input1;
value2 = input2;
}
double Subtract::evaluate()
{
return (value1->evaluate() - value2->evaluate());
}
#endif
|
#include "qdynamicvb.h"
namespace qEngine
{
qDynamicVB::qDynamicVB(void)
{
}
qDynamicVB::~qDynamicVB(void)
{
}
} |
#include "senoid_widget.h"
#include <QtWidgets>
#include <QDebug>
SenoidWidget::SenoidWidget(QWidget *parent) : QWidget(parent), timer(this), multiplier(1), velocity(10), current_sample(0)
{
setMouseTracking(true);
pen.setStyle(Qt::PenStyle::SolidLine);
pen.setColor(QColor(0xff, 0, 0));
timer.callOnT... |
// KC Text Adventure Framework - (c) Rachel J. Morris, 2012 - 2013. zlib license. Moosader.com
#include "People.h"
#include "../IOUtils/Utils.h"
#include "../IOUtils/GameIO.h"
void People::Init( lua_State* state, Notebook& notebook )
{
m_wPeople.Init( state );
m_ptrNotebook = ¬ebook;
}
void People::Displa... |
// My University number is: *** to be filled in ***
#include <iostream>
#include <cstdlib>
#include "TimeSeries.hpp"
#include "ComputeMovingAverage.hpp"
#include "LoadIBMData.hpp"
void time_series_test_main()
{
TimeSeries TS;
std::cout << "Loading and setting data...";
TS.setValues(LoadIBMData());
std::cout << " ... |
#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;
bool isMatch(const char *s, const char *p){
string str = s;
s... |
#include "XBee.h"
#include <SoftwareSerial.h>
String deviceID = "Node1"; // the name of the device, for use in the JSON object that is published in the Zigbee payload
uint8_t recv = 10;
uint8_t trans = 11;
SoftwareSerial soft_serial(recv, trans);
XBee xbee = XBee();
ZBRxIoSampleResponse ioSample = ZBRxIoSampleResp... |
#ifndef SRC_INIT_H
#define SRC_INIT_H
/**
* Default constructor
*/
template<class T> TrieNode<T>::TrieNode() : parent(NULL) {}
/**
* Initialize a TrieNode with the given value.
*/
template<class T> TrieNode<T>::TrieNode(T val) : value(val), parent(NULL) {}
/**
* Initialize a TrieNode with the given value, and a... |
/*********************************************************\
* 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 "../headers/Brick.h"
Brick::Brick(SDL_Renderer* pRenderer):Drawable(BRICK_BMP_PATH, pRenderer) {
}
Brick::~Brick() {
}
/*
void Brick::draw() {
//SDL_RenderCopy(pRenderer_, GetTexture(), &bmpRectangle, &rendererRectangle);
}*/
void Brick::moveDown() {
}
void Brick::moveUp() {
} |
#ifndef INC_SHADY_ENGINE_LOGGER_H
#define INC_SHADY_ENGINE_LOGGER_H
//C++ headers
#include<cstdio>
#include<cstdarg>
#include<memory>
namespace shady_engine
{
class logger
{
public:
~logger();
inline static std::shared_ptr<logger> getInstance()
{
static std::shared_ptr<logger> instance(new l... |
#pragma once
#include <functional>
namespace detoursnetruntime
{
///
/// @brief Handle RAI for a lambda function
///
class Defered
{
public:
///
/// @param deferedFunction function to call when RAI
///
Defered(const std::function<void(void)>& deferedFunction);
Defered(std::function<void(void)>&& defere... |
#ifndef WALI_DOMAINS_BIDOMAIN_HPP
#define WALI_DOMAINS_BIDOMAIN_HPP
#include <cxxabi.h>
#include <ostream>
#include <boost/function.hpp>
#include "wali/SemElem.hpp"
namespace wali {
namespace domains {
inline
std::string
demangle(std::string const & mangled) {
int out;
char* demangled = abi... |
// Copyright (c) 2021 ICHIRO ITS
//
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to deal
// in the Software without restriction, including without limitation the rights
// to use, copy, modify, merge, publish, di... |
#include "Ray.h"
sf::Vertex line[2];
Ray::Ray()
{
this->angle = 0;
this->line[0].position = sf::Vector2f(0, 0);
this->line[1].position = sf::Vector2f(0, 0);
}
Ray::Ray(float x, float y, float angle)
{
this->line[0].position = sf::Vector2f(x, y);
this->line[1].position = sf::Vector2f(x + 200, y + 20... |
#include "Enemy.h"
#include "Monster.h"
#include "Ninja.h"
int main(){
Ninja ninja;
Monster monstruo;
Enemy *e1 = &ninja;
Enemy *e2 = &monstruo;
e1->setAttackPower(20);
e2->setAttackPower(80);
e1->gritar();
e1 = &monstruo;
e1->gritar();
return 0;
} |
/**
* Definition for binary tree
* struct TreeNode {
* int val;
* TreeNode *left;
* TreeNode *right;
* TreeNode(int x) : val(x), left(NULL), right(NULL) {}
* };
*/
class Solution {
public:
int maxDepth(TreeNode *root) {
// Note: The Solution object is instantiated only once and is re... |
/* -*- 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 "Team.hpp"
int Team::cpt = -1;
Team::Team() : id(++cpt) {} // Défaut
Team::Team(const Team& t) : id(t.id), players(t.players) {} // Copie
Team::~Team(){
}
Team& Team::operator=(const Team& x) {
id = x.getId();
players = x.getPlayers();
return (*this);
}
// METHODES ================================... |
#include "tensorflow/core/tensorgc/buftracer.h"
#include "tensorflow/core/framework/tensor.h"
#include <set>
#include <iostream>
#include <cstdlib>
#include <assert.h>
namespace tensorflow {
template <typename T>
BufTracer<T>::BufTracer(int tracing_thresh){
this->buffer_set_size = 0;
this->tracing_thresh = traci... |
#include "nsphere.h"
namespace sbg {
namespace shape {
template<int n>
NSphere<n>::NSphere(double radius) : _radius{radius} {}
template<int n>
double NSphere<n>::getRadius() const
{
return _radius;
}
template<int n>
void NSphere<n>::setRadius(double radius)
{
_radius = radius;
}
template struct NSphere<2>;
templ... |
// Fill out your copyright notice in the Description page of Project Settings.
#include "BehaviorTree/BehaviorTreeComponent.h"
#include "Engine.h"
#include "BehaviorTree/BehaviorTree.h"
#include "BehaviorTree/BlackboardComponent.h"
#include "UObject/ConstructorHelpers.h"
#include "AICpp_Character.h"
#include "AICpp_NP... |
/* -*- Mode: c++; indent-tabs-mode: nil; c-file-style: "gnu" -*-
*
* Copyright (C) 1995-2002 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 "modules/xmlparser/xmlcommon.h"
#include ... |
#include "SSAOPipeline.h"
#include "RenderTarget.h"
#include "SceneManager.h"
#include "engine_struct.h"
#include "ResourceManager.h"
#include "pass.h"
#include "RenderSystem.h"
#include "TextureManager.h"
#include "EGLUtil.h"
#include "Image.h"
#include <random>
void SSAOEffect::Init()
{
auto& rt_mgr = RenderTargetMa... |
#include <bits/stdc++.h>
using namespace std;
#define TESTC ""
#define PROBLEM "401"
#define USE_CPPIO() ios_base::sync_with_stdio(0); cin.tie(0)
map <char,char> table;
bool is_mir(string str){
for(int i = 0,j = str.size()-1 ; i <= j ; i++,j-- )
if( table[str[i]] != str[j] )
return false;
return true;
}
... |
// Created on: 1994-12-21
// Created by: Dieter THIEMANN
// 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... |
/* -*- Mode: c++; tab-width: 4; indent-tabs-mode: t; c-basic-offset: 4 -*-
*
* Copyright (C) Opera Software ASA 2006-2012
*/
#include "core/pch.h"
#if defined(WEBSERVER_SUPPORT) && defined(NATIVE_ROOT_SERVICE_SUPPORT)
#include "modules/formats/uri_escape.h"
#include "modules/webserver/webserver_request.h"
#include... |
#include<iostream>
#include<stdlib.h>
#include<string.h>
using namespace std;
typedef struct Stack {
char *arr;
int top;
}Stack;
Stack *stack;
void createstack(int n)
{
stack->arr = (char *) malloc(n*sizeof(char));
stack->top=-1;
}
void push(char a)
{
++stack->top;
stack->arr[stack->top]=... |
#pragma once
#include "Object.h"
namespace Utils
{
//Generates bright colour range from 0-1 (based on HSV)
Vector4 GenColour(float scalar, float alpha);
Object* BuildSphereObject(const std::string& name, const Vector3& pos, float radius, float invmass = 0.0f, bool collidable = true, bool dragable = true, const ... |
#include "mainwindow.h"
#include "ui_mainwindow.h"
#include <QFileDialog>
#include <QTreeWidgetItem>
#include <QDir>
#include <QThread>
#include <QMessageBox>
MainWindow::MainWindow(QWidget *parent) :
QMainWindow(parent),
ui(new Ui::MainWindow)
{
ui->setupUi(this);
readJosn();
m_pAddredit=new CIpAd... |
#include"conio.h"
#include"stdio.h"
void main(void)
{
clrscr();
int a=1,b=3,c=10,d=5;
printf("While loop\n\n\n");
while(a<=9)
{
printf("@");
a++;
}
printf("\n\n");
while(b<=8)
{
printf("%d#",b);
b++;
}
printf("\n\n");
while(c>=2)
{
printf("%d,",c);
c--;
}
printf("\n\n");
while(d<=30)
{
printf("%d,",d);
d+=5;
}
g... |
#pragma once
#include "utility/tcp.h"
#include <QMessageBox>
#include "qt-tools/message_box.hpp"
#include <QPushButton>
#include <memory>
#include "utility/encryption.h"
#include <experimental/string_view>
#include "utility/raii.hpp"
#include <QDebug>
inline std::vector<std::pair<std::string, std::string>> check_for_... |
#include <PA9.h>
#include "Maps.h"
#include "Map.h"
#include "DSspecs.h"
#include "STDfunctions.h"
Map g_maps[MAP_NUMBER];
Map * g_map = NULL;
void InitMaps(){
ResetMaps(g_maps, MAP_NUMBER);
u8 id=0;
//level 1 - using the stylus to attack
SetMap(&g_maps[id], "Tutorial 1", "You own the red cells. U... |
//---------------------------------------------------------------------------
#ifndef accechoH
#define accechoH
#include <vcl.h>
#include "blockclient.h"
typedef void __fastcall (__closure *TON_REFRESH_SUCCESS)(void);
class CAccPing
{
private:
TStringList * ServerList;
TStringList * ServerInfo;
int BestServe... |
#ifndef ABSTRACTTETRISPIECE_H
#define ABSTRACTTETRISPIECE_H
#include "tetrispiece.h"
template <typename T>
class AbstractTetrisPiece : public TetrisPiece
{
public:
AbstractTetrisPiece(
const TetrisCoordinate& centerCoordinate,
int orientation,
std::vector<TetrisCoordinate>&& co... |
#ifndef TEXT_RENDERER_H
#define TEXT_RENDERER_H
#include <shader.h>
#include <iostream>
#include <map>
#include <glm/glm.hpp>
#include <GL/glew.h>
#include <ft2build.h>
#include FT_FREETYPE_H
enum FONTSIZE
{
FS_12,
FS_18,
FS_24,
FS_48,
MAX_NUM_FONTSIZES
};
struct Character {
GLuint Text... |
#include <iostream>
#include <sstream>
#include <cstdlib>
#include <cstdio>
#include <vector>
#include <queue>
#include <deque>
#include <stack>
#include <list>
#include <map>
#include <iomanip>
#include <set>
#include <climits>
#include <ctime>
#include <complex>
#include <cmath>
#include <string>
#in... |
#pragma once
#include "SM_Vector.h"
#include <vector>
namespace sm
{
std::vector<std::vector<vec2>>
polygon_intersection(const std::vector<std::vector<vec2>>& subject, const std::vector<vec2>& clip);
std::vector<std::vector<vec2>>
polygon_union(const std::vector<std::vector<vec2>>& subject, const std::vector<vec2... |
#include "std_lib_facilities.h"
struct Date{
int year;
int month;
int day;
Date(int y, int m, int d);
void add_day(int n);
};
Date::Date(int y, int m, int d)
{
if (y>0)
year= y;
else
error("Invalid year");
if (m<13 && m>0)
month = m;
else
error("Invalid month");
if (d<32 && d>0)
day = d;
else
e... |
#error This should be excluded from all target
|
// Copyright (c) 2012-2017 The Cryptonote developers
// Copyright (c) 2018-2023 Conceal Network & Conceal Devs
// Distributed under the MIT/X11 software license, see the accompanying
// file COPYING or http://www.opensource.org/licenses/mit-license.php.
#include "gtest/gtest.h"
#include "Logging/LoggerManager.h"
#inc... |
// Fill out your copyright notice in the Description page of Project Settings.
#include "ABCharacter.h"
#include "ABAnimInstance.h"
#include "ABWeapon.h"
#include "ABAIController.h"
// Sets default values
AABCharacter::AABCharacter()
{
// Set this character to call Tick() every frame. You can turn this off to imp... |
#ifdef DEBUG
#define _GLIBCXX_DEBUG
#endif
#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 <deque>
#include <map>
#include <functional>... |
#include "helper.h"
// Check if possible to go to position (x, y)
// Already visited cells are not accessible
bool isAccessible(std::vector< std::vector<char> > &labyrinth,
std::vector< std::vector<int> > &visited, int x, int y)
{
if (labyrinth[x][y] == '#' || visited[x][y]) {
return false;
... |
//O(n) + O(n/2).
class Solution {
public:
ListNode* middleNode(ListNode* head) {
int count = 0;
ListNode* t = head;
while(t != NULL){
count++;
t = t -> next;
}
int middleIndex;
if(count % 2 == 0){
middleIndex = count / 2;
}e... |
#include <cmath>
#include <cstdio>
#include <vector>
#include <iostream>
#include <algorithm>
#include <queue>
#include <set>
using namespace std;
float median(int ar[], int n){
if(n%2==0){
return float(ar[n/2]+ar[(n/2)-1])/float(2);
}
else{
return ar[n/2];
}
}
float findMedianSortedArrays... |
#include <bits/stdc++.h>
using namespace std;
class Solution {
public:
int calculate(string s) {
int number = 0;
stack<int> number_stack;
stack<char> operator_stack;
map<char,int> M;
M['+'] = 1;
M['-'] = 1;
M['*'] = 2;
M['/'] = 2;
for(int i=0 ... |
#pragma once
#include "declspec.h"
#include <vector>
#include <string>
namespace pure
{
PUREENGINE_API std::vector<std::string> splitString(const std::string& string, char delim);
} |
#ifndef AWS_AWS_H
#define AWS_AWS_H
/*
* aws/aws.h
* AwesomeScript Main Header
* Author: Dominykas Djacenka
* Email: Chaosteil@gmail.com
*/
//! AwesomeScript namespace.
/*!
* Contains all classes for handling AwesomeScript.
*/
namespace AwS{};
#include "exception.h"
#include "parser.h"
#include "token.h"
#in... |
/****************************************************************************
* *
* Author : lukasz.iwaszkiewicz@gmail.com *
* ~~~~~~~~ *
* Lice... |
#include <iostream>
#include <memory.h>
#include <queue>
using namespace std;
template <typename T>
constexpr void SafeDeleteArray(T** arr, int length) noexcept
{
if (arr)
{
for (int i = 0; i < length; i++)
delete[] arr[i];
delete[] arr;
arr = nullptr;
}
}
struct Point
{
int x;
int y;
};
int directX[]... |
#include <stdio.h>
#include <math.h>
double res = 0;
int n;
void nhap(){
scanf("%d",&n);
}
void solve(){
for(int i = 1; i <= n; i++) res = res + (double)(1/pow(i,3));
printf("%0.3lf",res);
}
int main(){
nhap();
solve();
return 0;
}
|
/**********************************************************************************************//**
* @struct aeVector2
*
* @brief This structure purpose is to make mathematical operations in a 2 dimensional space.
*
* @author Alvaro Estrada
* @date 14/05/2016
***********************************************************... |
#include "stdafx.h"
#include <GL\glut.h>
// This class will not use any specific data structure
namespace drawUtil
{
void drawBox(float xmin, float ymin, float zmin,
float xMax, float yMax, float zMax)
{
glBegin(GL_LINES);
// Lower face
glVertex3f(xmin, ymin, zmin);
glVertex3f(xMax, ymin, zmin);
glVe... |
#include "player.h"
using namespace std;
bool Player::get_gold(){
return has_gold;
}
void Player::set_gold(bool set_to){
has_gold = set_to;
}
int Player::get_arrows(){
return arrows_left;
}
void Player::set_arrows(int new_count){
arrows_left = new_count;
} |
#include <stdio.h>
long long int fun(int n) {
if (n == 0) return 0;
if(n == 1)
return 1;
else
return 2 * fun(n - 1) + 1;
}
int main() {
int a;
while(~scanf("%d",&a)) {
printf("%lld\n",fun(a));
}
return 0;
}
|
#pragma once
#include <nclgl\OGLRenderer.h>
#include <nclgl\Shader.h>
#include <ncltech\SceneRenderer.h>
enum SurfaceBlurMode
{
SURFACE_BLUR_GAUSSIAN = 0,
SURFACE_BLUR_BILATERAL,
SURFACE_BLUR_CURVEFLOW
};
struct PingPongTex
{
public:
PingPongTex() : current(false) { tex[0] = NULL; tex[1] = NULL; }
void Release(... |
// Copyright (c) 2013-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
// by the Free Software Foundation, with spe... |
#pragma once
#include "QuestionViewController.h"
#include "MultipleResponseQuestionState_fwd.h"
#include "MultipleResponseQuestionView_fwd.h"
namespace qp
{
class CMultipleResponseQuestionViewController : public CQuestionViewController
{
public:
CMultipleResponseQuestionViewController(CMultipleResponseQue... |
/* -*- Mode: c++; indent-tabs-mode: nil; c-file-style: "gnu" -*-
*
* 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.
*/
#include "core/pch.h"
#ifdef XSLT_SUPPORT
#include "modules/xslt/src/xs... |
class Solution {
public:
int count;
int InversePairs(vector<int> data) {
if(data.size() < 2){
return 0;
}
count = 0;
mergeSort(data,0,data.size()-1);
return count%1000000007;
}
void mergeSort(vector<int> &data,int start,int end){
if(start >= en... |
// SettleFileViewer.h : main header file for the PROJECT_NAME application
//
#pragma once
#ifndef __AFXWIN_H__
#error "include 'stdafx.h' before including this file for PCH"
#endif
#include "resource.h" // main symbols
// CSettleFileViewerApp:
// See SettleFileViewer.cpp for the implementation of th... |
#include "light.h"
Light::Light(QString place)
{
this->place = place;
}
void Light::on() {
cout << "Vklyuchenie sveta" << endl;
}
void Light::off() {
cout << "Vyklyuchenie sveta" << endl;
}
|
//-------------------------------------------------------------------
// studentList Class Definition
//-------------------------------------------------------------------
#include <iostream>
#include <string>
#include <fstream>
#include <iomanip>
#include "studentList.h"
using namespace std;
/... |
#if !defined NULL
#define NULL 0
#endif
#if !defined (STACKDEQUE_H)
#define STACKDEQUE_H
#include "DequeArray.h"
template < class T>
class StackDeque
{
private:
DequeArray<T>* dqA;
public:
StackDeque();
~StackDeque();
int size();
bool isEmpty();
T* peek();
T* pop();
void popAll(... |
#include "Linear_layer.h"
Linear_layer::Linear_layer(int dimension): Layer(dimension)
{
}
Linear_layer::~Linear_layer()
{
}
MatrixXd Linear_layer::act_func(MatrixXd input)
{
if(input.rows() != dimension() || input.cols() != 1)
{
std::cerr << "Error: Wrong dimension for direvative of activation function" << std::... |
/*
* File: Choice.h
* Author: Daniel Canales
*
* Created on July 15, 2014, 11:39 AM
*
* Will be used to give player a choice of atk/def/item
* uses a switch statement with another for checking enemy type
* and outputs to corresponding
*/
#ifndef PLCHOICE_H
#define PLCHOICE_H
#include "STATS.H"
#include <... |
/* XMRig
* Copyright (c) 2018-2021 SChernykh <https://github.com/SChernykh>
* Copyright (c) 2016-2021 XMRig <https://github.com/xmrig>, <support@xmrig.com>
*
* 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
* ... |
#ifndef __LTSS_HPP__
#define __LTSS_HPP__
#include <list>
#include <utility>
#include <vector>
#include <limits>
#include <iterator>
#include <algorithm>
#include <memory>
#include "port_utils.hpp"
#include "score.hpp"
using namespace Objectives;
class LTSSSolver {
public:
LTSSSolver(int n,
std::vector<floa... |
#include "core/pch.h"
#ifdef ES_JSON_LITE
#include "modules/ecmascript/json_parser.h"
JSONParser::JSONParser(JSONListener *listener)
: m_parser(m_lexer)
, m_listener(listener)
{
OP_ASSERT(listener);
}
OP_STATUS
JSONParser::Parse(const uni_char *data, unsigned length)
{
m_data = data;
m_length = length;
RETURN... |
#include<cstdio>
#include<iostream>
#include<string>
#include<queue>
#include<algorithm>
#include<cstdio>
#include<deque>
#include<iomanip>
#include<sstream>
using namespace std;
int main(){
int t,cas=0;
cin>>t;
while(t--){
if(cas)
cout<<endl;
cas++;
int n;
cin>>n;
getchar();
strin... |
/* -*- Mode: c++; tab-width: 4; indent-tabs-mode: t; c-basic-offset: 4; c-file-style: "stroustrup" -*-
*
* Copyright (C) 2009-2011 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_system_includes.h... |
#include "Game.h"
#ifndef LINUX
#include <windows.h>
#endif
/*
==================
Main
==================
*/
#ifndef LINUX
int WINAPI WinMain (HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpCmdLine, int nCmdShow) // Linux users should quit this line
#else
int main()
#endif
// int main () // Linux users should ... |
//using 2D array
#include <iostream>
#include <vector>
#include <string>
#include <queue>
using namespace std;
int main(){
int N, M;
cin >> N >> M;
vector<vector<int>> map;
vector<vector<int>> visited;
int query = 1;
map.resize(N);
visited.resize(N);
for(int i=0; i<N; i++){
map[i].resize(M);
string dig... |
#ifndef _WALL_H_
#define _WALL_H_
#include<stdio.h>
#include<vector>
#include<cmath>
#include "point.h"
using namespace std;
class Face {
friend class Wall;
public:
Face(int live) : live(live){
}
private:
int live;
};
class Wall {
public:
Wall(Point3D center, Point3D px, Point3D py, Point3D pz, int accx, in... |
#include <iostream>
#include <vector>
#include <algorithm>
#include <string>
int main()
{
std::ios_base::sync_with_stdio(false);
std::cin.tie(0);
std::cout.tie(0);
int n;
std::cin >> n;
for (int i = 0; i < n; ++i)
{
int a;
std::cin >> a;
std::vector<int> num(a);
... |
/* -*- 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.
*
* @author Owner: Karianne Ekern (karie), Deepak Arora (deepaka)
*
*/
#if... |
//
// main.cpp
// largest-number
//
// Created by xiedeping01 on 15/11/8.
// Copyright (c) 2015年 xiedeping01. All rights reserved.
//
#include <iostream>
#include <string>
#include <vector>
using namespace std;
class Solution {
public:
string largestNumber(vector<int>& nums) {
// 本质上,这是一道排序题
/... |
#include "stdio.h"
#include "conio.h"
#include "string.h"
int upper(char *phrase){
strupr(phrase);
printf("\n\n%s",phrase);
}
void main(){
clrscr();
char phrase[20];
printf("Enter any phrase: ");
gets(phrase);
upper(phrase);
getch();
}
|
# include<iostream>
using namespace std;
int solve(int x,int y) {
if(x == 0 || y == 0) {
return 1;
} else {
return solve(x-1,y) + solve(x,y-1);
}
}
int main(void) {
int N = 0, E = 0;
cin >> N >> E;
cout << "Enter rows and columns apart: Rows and columns apart: " << N << " " << E << endl;
int ans = solve(N... |
/*
A cookie recipe calls for the following ingredients:
- 1.5 cups of sugar
- 1 cup of butter
- 2.75 cups of flour
The recipe produces 48 cookies with this amount of the ingredients. Write a
program that asks the user how many cookies he or she wants to make, and then
displays the number of cups of each ingredien... |
#pragma once
struct Point { int i, j; };//The hien 2 gia tri hoanh do tung do cua ma tran
class list
{
private:
Point arr[16];
int count = 0;
public:
list();
~list();
void push(Point);//them 1 point vao mang list
void clear();//xoa mang chho count =0
Point get(int);//tra ve Point thu i
int size();//tra ve cou... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.