text stringlengths 8 6.88M |
|---|
#include "RoundEntity.h"
#include <iostream>
RoundEntity::RoundEntity(sf::Color color, float size, sf::Vector2f pos) : Entity("RoundEntity", Tag::Ball, new sf::CircleShape(size), color, pos){}
RoundEntity::RoundEntity() {}
RoundEntity::~RoundEntity(){}
void RoundEntity::ReactToCollision(sf::Vector2f from, sf::Vector2f... |
#include "stru_stu.h"
#include "dao_stu.h"
#include "dao_cor.h"
#include <iostream>
#include <string.h>
#include "stru_cor.h"
#include "act_cor.h"
using namespace std;
int stuidMaker = 11111;
StuNode *makeStu(const char *content)
{
StuNode *stup = (StuNode *)malloc(sizeof(StuNode));
if (content == "")
{
... |
#include <bits/stdc++.h>
using namespace std;
#define ll long long
void print(vector<int> t) {
for (int a : t)
cout << a << " ";
cout << endl;
}
void merge_(vector<int> &a, int l, int m, int r) {
int t1 = l, t2 = m;
int* x = new int[r - l];
for (int t = 0; t < r - l; ++t) {
if (t1... |
/********************************************************************/
/** image.h by Alex Koukoulas (C) 2017 All Rights Reserved **/
/** File Description: Interface to the Image class, mostly used to **/
/** store and save constructed scenes **/
/***********************************... |
/**
* A + B > C
* 给定区间[-2^31, 2^31]内的3个整数A、B和C,请判断A+B是否大于C。
* ATTENTION: Range
* */
#include <cstdio>
int main() {
int T = 0;
long long a = 0, b = 0, c = 0;
scanf("%d", &T);
for(int i = 0; i < T; i++) {
scanf("%lld %lld %lld", &a, &b, &c);
if(a + b > c) {
printf("Case #%d: true", i+1... |
#ifndef DataHeader_hpp
#define DataHeader_hpp
#include <stdint.h>
#include <vector>
#include <string>
#include <type_traits>
#include <sstream>
#include <iomanip>
class DataHeader {
public:
template<typename T>
static void write_combined_h(
const std::vector<T> &data,
const std::string &head... |
// ****************** WaveSimulator0.cpp *******************************
// Generated by TwinCAT Target for MATLAB/Simulink (TE1400)
// MATLAB R2019a (win64)
// TwinCAT 3.1.4022
// TwinCAT Target 1.2.1237
// Beckhoff Automation GmbH & Co. KG (www.beckhoff.com)
// ***************************************************... |
//
// Created by Admin on 6/14/2020.
//
#include "Headers.h"
#include <iostream>
#include <cstdlib>
#include <ctime>
#include <set>
using namespace std;
//Default constructor
Maze::Maze() {};
//Generates the Maze
void Maze::generateMaze() {
//Fill in the area with walls for now
for(int y = 0; y < yDimension... |
#include "GraphicsDevice.h"
#include "RenderWindow.h"
namespace revel
{
namespace renderer
{
GraphicsDevice::GraphicsDevice()
{
}
GraphicsDevice::~GraphicsDevice()
{
}
} // ::revel::renderer
} // ::revel
|
/** Copyright John Reid 2013
*
* \file Exposes seqan parts of STEME algorithm to python.
*/
#include "pyseqan_pch.h"
#include <seqan/python/defs.h>
#include <seqan/python/string.h>
/**
* Expose seqan functionality.
*/
void
expose_strings() {
using namespace seqan;
using namespace seqan::python;
expose... |
// Copyright (C) 2017 Elviss Strazdins
// This file is part of the Ouzel engine.
#pragma once
class SoundSample: public ouzel::scene::Scene
{
public:
SoundSample();
private:
bool handleGamepad(ouzel::Event::Type type, const ouzel::GamepadEvent& event);
bool handleUI(ouzel::Event::Type type, const ouzel::... |
#include "OI.h"
OI::OI()
{
joystick = new Joystick(0);
}
Joystick* OI::GetJoystick() {
return joystick;
}
|
#include <stdio.h>
#include <conio.h>
#include <string.h>
int main()
{
char a[30];
gets(a);
puts(a);
}
|
#include <places/indoor.h>
#include <characters/human.h>
using namespace lab3::places;
using namespace lab3;
Indoor::Indoor(const std::string &name, bool is_open)
: Place(name), is_open_(is_open)
{}
Indoor::~Indoor()
{}
bool Indoor::isOpen() const {return this->is_open_;}
void Indoor::setOpen(bool open){ this-... |
#include "node.h"
#include "basicheaders.h"
#include "basicqtheader.h"
/**
* @brief Node::Node : по умолчанию создаём пустой узел
*/
Node::Node()
{
next = nullptr;
isAtom = 0;
content.expr = nullptr;
content.character = '\0';
content.number = 0;
}
Node::Node(int number): Node()
{
isAtom = 1;... |
//11340 - Newspaper
#include<bits/stdc++.h>
using namespace std;
#define pb push_back
#define mp make_pair
#define INF 1<<28
#define lli long long int
#define ulli unsigned long long int
#define MX 1000000000
#define SIZE 1000000
#define sfint(a) scanf("%d",&a)
#define sfllint(a) scanf("%lld",&a)
#define sfch(a) scanf(... |
#include <bits/stdc++.h>
using namespace std;
long long int ar[1001];
int get_change(int m) {
return m / 4;
}
int main() {
ar[0]=0;
for(int i=1; i <1001;i++)
ar[i] = INT_MAX;
int coin[3]={1,3,4};
ar[1]=1;
ar[2]=2;
ar[3]=1;
ar[4]=1;
for(int i=5;i<=1000;i++)
{
for(int j=0;j<3;j++)
{
if(coin[j]<=i)
... |
#include<bits/stdc++.h>
using namespace std;
#define debug(x) cerr << #x << ": " << x << endl;
#define iosbase ios_base::sync_with_stdio(false)
#define tie cin.tie();cout.tie();
#define endl '\n'
typedef pair<int, int> ii;
typedef long long ll;
int n, m;
int main(){
iosbase;
tie;
long long int x; cin >> x;
... |
#include "Waiter.h"
Waiter::Waiter(unsigned int ms_per_tick)
: lasttime(std::chrono::high_resolution_clock::now()),
tick_length(ms_per_tick) {}
void Waiter::wait_if_fast() {
auto goal_time = lasttime + tick_length;
// lasttime refreshed for next tick
lasttime = std::chrono::high_resolution_clock::now... |
#ifndef DRIVER_H
#define DRIVER_H
/// @file Driver.h
/// @brief Driver のヘッダファイル
/// @author Yusuke Matsunaga (松永 裕介)
///
/// Copyright (C) 2005-2012 Yusuke Matsunaga
/// All rights reserved.
#include "bb_nsdef.h"
#include "YmUtils/MsgMgr.h"
BEGIN_NAMESPACE_YM_BB
class PtMgr;
class Lexer;
class PtNode;
union YYS... |
/****************************************
*
* INSERT-PROJECT-NAME-HERE - INSERT-GENERIC-NAME-HERE
* Copyright (C) 2019 Victor Tran
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundati... |
#include "Patcher_ShowExplorationPercent.h"
#include "../Addr.h"
#include "../FileSystem.h"
//-----------------------------------------------------------------------------
// Static variable initialization
wchar_t CPatcher_ShowExplorationPercent::dataExplStr[] = L"Expl Lv{1} {0}%";
wchar_t CPatcher_ShowExplorationPer... |
#ifndef FUNCTIONAL_OBJECT_H
#define FUNCTIONAL_OBJECT_H
template <class T> class SelectObject
{
public:
virtual bool operator()(const T& t) const = 0;
virtual ~SelectObject() {}
};
template <class T> class SelectObject1 : public SelectObject<T>
{
T sel;
public:
SelectObject1(const T& t) : sel(t) {}
... |
#include "matrix.h"
Matrix::Matrix(uint dim): n(dim)
{
// орти в порядку X0, X1, X2, X3...
for (uint i = 0; i < n; i++) {
matrix.push_back(vector<double>(n)); // init matrix
ortArr.push_back(i); // init orts
barr.push_back(0); // init add column b
}
}
Matrix::Matrix(const Matrix& g)
{
n = g.n;
matrix.res... |
#ifndef __DASH_STATE_H__
#define __DASH_STATE_H__
#include "../GameState.h"
class DashState : public GameState
{
protected:
float translateX;
float timePress;
public:
explicit DashState(GamePlayer* gp);
~DashState() = default;
void handlerKeyBoard(std::map<int, bool> keys, float dt) override;
void onCollisio... |
/***************************************************************************
Copyright (c) 2020 Philip Fortier
This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License
as published by the Free Software Foundation; either version 2
of the License, or... |
#include "Cart.h"
Cart::Cart(const std::string &name, const int price, const int number) : Element(name, price, number)
{
}
void Cart::accept(std::shared_ptr<Visitor> visitor)
{
visitor->order(shared_from_this());
}
int Cart::getTax(const int tax)
{
return (m_price * m_number) * tax / 100;
}
const std::stri... |
#pragma once
#include "CWEIncludedAPI.h"
#include "CWEError.h"
namespace CWE
{
// 前方宣言
struct Eye;
namespace math
{
// π
#define CWE_PI 3.14159265358979323846
#define CWE_PI_F XM_PI
// 誤差値
constexpr static const float EPSILON =0.00000001f;
struct Int4;
struct Int4A;
struct Float2;
struct Float2A;
struct Float3;... |
#pragma once
#include "myexception.h"
class MyExceptionEmptyQueue : public MyException
{
public:
MyExceptionEmptyQueue(const char *text);
};
|
#include <iostream>
#include <cassert>
#include <unordered_map>
#include <fstream>
struct CallStackEntry
{
std::string caller;
std::string callee;
bool operator == (const CallStackEntry& callStackEntry) const
{
return caller == callStackEntry.caller && callee == callStackEntry.callee;
}
}... |
# include <iostream>
# include <cstring>
using namespace std;
bool adj_mat[505][505], visited[505];
int n, m, i, k[505], x, y, a, b, min_age;
char t;
void change(int v1, int v2) {
bool c1, c2;
c1 = adj_mat[v1][v2]; c2 = adj_mat[v2][v1];
for (int i = 0; i < n; ++i) swap(adj_mat[v1][i], adj_mat[v2][i]);
... |
#include "Arduino.h" // for eclipse
// Analog
const int pin_microphone = 0;
//The setup function is called once at startup of the sketch
void setup()
{
pinMode(pin_microphone, INPUT);
Serial.begin(9600);
}
// The loop function is called in an endless loop
void loop()
{
int val_microphone = ana... |
#include <iostream>
#include <algorithm> // для std::sort
int main()
{
const int length = 5;
int array[length] = { 30, 50, 20, 10, 40 };
std::sort(array, array+length);
for (int i=0; i < length; ++i)
std::cout << array[i] << ' ';
return 0;
}
|
//========================================================================
/**@file dl/platforms/win32.hpp
* @author Ekinox <ekinox1995@gmail.com>
* @version 1.0
* @date
* Created: sam. 15 mai 2010 20:22:14 CEST \n
*/
/*------------------------------------------------------------------------
* Description: This ... |
#include <bits/stdc++.h>
#include <fstream>
#include <string>
using namespace std;
class CSVHelper {
private:
fstream fs;
const char delim = ',';
const char nl = '\n';
public:
vector<vector<float>> data;
void openFile(string fileName) {
fs.open(fileName, ... |
#include <QGuiApplication>
#include <QQmlApplicationEngine>
#include<hexagone.h>
#include<iostream>
#include <QQuickStyle>
#include <QQmlComponent>
#include <cmath>
#include <QGeoCoordinate>
using namespace std;
vector<Hexagone> generateHexagones(int);
void sendHexagonesToQml(QObject* ,vector<Hexagone... |
#include "Counter.h"
Counter::Counter()
{
n=0;
}
Counter& Counter::set(int i)
{
n=i;
return *this;
}
int Counter::get()
{
return n;
}
Counter& Counter::incr()
{
++n;
return *this;
}
|
#include "database.h"
#include "ui_database.h"
bool issaveflag = false;
Database::Database(QWidget *parent) :
QDialog(parent),
ui(new Ui::Database)
{
ui->setupUi(this);
databasethread = new Databasethread;
databasethread->start();
}
Database::~Database()
{
delete ui;
}
void Database::on_push... |
#include <iostream>
using namespace std;
int main(void) {
ios::sync_with_stdio(false);
int n;
int count=0;
cin>>n;
while(n>0){
if(count==0){
n -= 1;
count++;
continue;
}
n -= 6*count;
count++;
}
cout<<count<<endl;
... |
/*
* Copyright (C) 2017 Ben Smith
*
* This software may be modified and distributed under the terms
* of the MIT license. See the LICENSE file for details.
*/
#include <assert.h>
#include <inttypes.h>
#include <stdarg.h>
#include <stdio.h>
#include <algorithm>
#include <string>
#include <utility>
#include "emul... |
/* Isyana is given the number of visitors at her local theme park on N consecutive
days. The number of visitors on the i-th day is Vi. A day is record breaking if it
satisfies both of the following conditions:
● The number of visitors on the day is strictly larger than the number of
visitors on each of the previous day... |
#include <bits/stdc++.h>
#define ll long long
const ll MOD = 1000000007;
const ll INF = 1e18;
using namespace std;
template <typename T> void print(const T &t) {
std::copy(t.cbegin(), t.cend(),
std::ostream_iterator<typename T::value_type>(std::cout, " "));
cout << endl;
}
template <typename T> void p... |
//
// Created by wiktor on 06.04.18.
//
#include "Child.h"
Child::Child() {
name_ = "Dziecko";
surname_ = "Bobas";
age_ = 2;
school_ = "Nic";
} |
#ifndef AUDIO_SYS_HPP
#define AUDIO_SYS_HPP
#include "common_utils_cpp.hpp"
#include <ck_ring.h>
#include <ck_pr.h>
#include "sdl.hpp"
#include "external_libraries/freeverb/freeverb.c"
//#include "external_libraries/mini_al/extras/dr_flac.h" // Enables FLAC decoding.
//#include "external_libraries/mini_al/extras/d... |
#pragma GCC optimize("Ofast")
#include<bits/stdc++.h>
using namespace std;
#define int long long int
#define double long double
#define rep(i, begin, end) for (__typeof(end) i = (begin) - ((begin) > (end)); i != (end) - ((begin) > (end)); i += 1 - 2 * ((begin) > (end)))
#define endl '\n'
#define ff first
#define ss sec... |
// License: Apache 2.0. See LICENSE file in root directory.
// Copyright(c) 2016 Intel Corporation. All Rights Reserved.
#include "ds5-auto-calibration.h"
#include "../third-party/json.hpp"
#include "ds5-device.h"
#include "ds5-private.h"
namespace librealsense
{
#pragma pack(push, 1)
#pragma pack(1)
struct Dire... |
/*
* The IzPack Launcher
* http://izpack.org/
* http://izpack.codehaus.org/
*
* Copyright (c) 2004 - 2008 Julien Ponge - All rights reserved.
*
* 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 ... |
#include <iostream>
#include <sstream>
#include <utility>
using namespace std;
bool str(float* st, int n)
{
bool h = true;
string t;
getline(cin, t);
istringstream stream(t);
for (unsigned int i = 0; i < n; i++)
{
if (!(stream >> st[i]))
{
h = false;
retu... |
/*
* Person.cpp
*
* Created on: 2014年11月2日
* Author: jt
*/
#include "Person.h"
#include <string>
Person::Person(std::istream &is) {
// TODO Auto-generated constructor stub
read(is, *this);
}
Person::~Person() {
// TODO Auto-generated destructor stub
}
const std::string &Person::getAddress() const {
r... |
#include <bits/stdc++.h>
using namespace std;
void in(int s){
int soBanDau = s;
int chuSo = 0;
int dem = 0;
while (s>0){
chuSo = s%10;
if(chuSo!=0 && soBanDau%chuSo==0){
dem++;
}
s = s/10;
}
cout << dem <<... |
#include "DUIWinObject.h"
DUI_BGN_NAMESPCE
CDUIWinObject::CDUIWinObject()
{
m_hWnd = NULL;
}
LPVOID CDUIWinObject::GetInterface(const CDUIString& strName)
{
if(strName.compare(IWinObject) == 0)
{
return (IDUIWinObject*)this;
}
return theBase::GetInterface(strName);
}
CRefPtr<IDUIControl> CDUIWinObject::Clon... |
//
// Created by KURAPIKA.dll on 8/13/2020.
//
#include <iostream>
#include <cmath>
#include "cercle.h"
using namespace std;
cercle::cercle() {
cout<<"constractor" <<endl;
}
cercle::cercle(int a, int b, int z) {
x=a;
y=b;
r=z;
}
void cercle::setcentre(int a, int b) {
this->x=a;
this->y=b;
}
i... |
#include "DX12GraphicsEngine.h"
DX12GraphicsEngine::DX12GraphicsEngine() :
frame_index(0),
first_update(TRUE)
{
start = clock.now();
last_update = clock.now();
camera_constant.world_view_proj = Identity4x4();
camera_rb.orientation = { 0, 0, 0 };
camera_rb.position = { 0, 400, -2 };
camera_rb.velocity = { 0, -5... |
//
// main.cpp
// https://open.kattis.com/problems/compoundwords
//
// Created by Sofian Hadianto on 26/01/19.
// Copyright © 2019 Sofian Hadianto. All rights reserved.
//
#include <bits/stdc++.h>
using namespace std;
#define rep(i, a, b) for(size_t i = a; i < (b); ++i)
#define trav(i, m) for (auto i = m.begin(); ... |
// 10개의 수를 입력 받아, 그 중에서 홀수만 더한 값을 출력하는 프로그램을 작성하라.
#include <iostream>
// #include <vector>
using namespace std;
int main(){
int tcase;
cin>>tcase;
for(int i=0 ; i<tcase; i ++){
int A[10];
scanf("%d %d %d %d %d %d %d %d %d %d",&A[0],&A[1],&A[2],&A[3],&A[4],&A[5],&A[6],&A[7],&A[8],&A[9]);
int sum=0;
... |
inline float AnimationClip::Get_Duration() const { return this->m_fDuration; };
inline void AnimationClip::Set_Duration(float value) { this->m_fDuration = value; }
inline DynamicList<Frame> AnimationClip::Get_Frames() { return this->m_pFrames; };
inline unsigned AnimationClip::Get_FrameCount() const { return th... |
/*
* Behavior.h
*/
#ifndef BEHAVIOR_H_
#define BEHAVIOR_H_
//#pragma once
#include "robot.h"
#include "ANode.h"
#include "Globals.h"
#include "math.h"
#include "Particle.h"
#include "wayPoint.h"
#include "Position.h"
class Behavior {
Behavior** _next;
int _arrSize;
protected:
Robot* _robot;
public:
Behavior(R... |
#include <mapview.h>
#include <QWheelEvent>
MapView::MapView(QWidget *parent) :
QGraphicsView(parent)
{}
MapView::~MapView()
{}
void MapView::wheelEvent(QWheelEvent * event)
{
float dlt = event->angleDelta().y();
dlt /= 360.0f*2.0f;
dlt += 1.0f;
setTransformationAnchor(AnchorUnderMouse);
sca... |
#include <iostream>
#include<stdio.h>
#include<stdlib.h>
#include<cstdlib>
#include<time.h>
using namespace std;
#define ERROR 0
#define OK 1
#define MAXSIZE 1000
/*************************************
静态链表
数据结构:每个数组节点都有值和游标.
游标表示下一个节点,节点分为已用节点和备用节点
第一个节点和最后节点保留:
第一个节点游标表示备用节点起始位置
最后一个节点游标表示已用节点的起始位... |
// github.com/andy489
#include<iostream>
#include<map>
using namespace std;
int main() {
map<int, string> numberNames { {2, "two"} };
for (int i = 0; i < numberNames.size(); i++) {
cout << numberNames[i] << ",";
}
return 0;
}
// What will the above code print?
// a) zero, onem two,
// b) ,,t... |
//#write includes statements
#include"loops.h"
#include<iostream>
using std::cout;
using std::cin;
//write using statements for cin and cout
/*
Use a do while loop to prompt the user for
a number, call the factorial function, and display the number's
factorial. Also, loop continues as long as user wants to.
*/
in... |
/*
* Useful functions used in debug
*/
#ifndef DEBUGUTIL_H_
#define DEBUGUTIL_H_
#include <functional>
#include <vector>
#include <core/logger/LoggerManager.h>
#include <core/logger/Loggers.h>
#define _CONFIG_BASIC_LOGGERS \
typedef std::shared_ptr<core::Logger> LoggerPtr;\
std::vector<LoggerPtr> _bas... |
// Domineering.cpp : Defines the entry point for the console application.
//
#include "stdafx.h"
#include <vector>
#include <stack>
class Board;
struct Move
{
public:
int x, y, h_or_v;
Move(int p_x, int p_y, int p_h_or_v) : x(p_x), y(p_y), h_or_v( p_h_or_v)
{
}
static bool CanMoveBeDone(int p_x, int p_y, ... |
////////////////////////////////////////////////////////////////////////////////
//
// Copyright (c) 2006-2010 MStar Semiconductor, Inc.
// All rights reserved.
//
// Unless otherwise stipulated in writing, any and all information contained
// herein regardless in any format shall remain the sole proprietary of
... |
#include "..\inc.h"
/**
* 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 minDepth(TreeNode *root) {
if(!root)
return 0;
vec... |
#include <iostream>
#include <fstream>
#include <vector>
#include <algorithm>
#include <cfloat>
#include <cmath>
using namespace std;
ifstream f("date.in");
class punct{
private:
int x,y;
public:
punct(){};
punct(int a,int b){x = a; y = b;};
int Get_x(){return x;};
int Get_y(){return y;};
vo... |
#include <TimerOne.h> // inclui biblioteca Timer1(Dimmer)
#include <Adafruit_MAX31865.h> //Biblioteca módulo temp
//Definições sobre o termopar
Adafruit_MAX31865 max = Adafruit_MAX31865(10, 11, 12, 13);
#define RREF 430.0
#define RNOMINAL 99.75
#define valv_in 8
#define valv_out 9
//Definições do dimmer
#def... |
//
// ImageAutoPolygon.h
// SMFrameWork
//
// Created by KimSteve on 2016. 11. 16..
//
//
#ifndef ImageAutoPolygon_h
#define ImageAutoPolygon_h
#include <vector>
#include <platform/CCImage.h>
#include <renderer/CCTrianglesCommand.h>
#include <2d/CCAutoPolygon.h>
class ImageAutoPolygon
{
public:
ImageAutoPolyg... |
/***********************************************************************
created: Sep 18 2016
author: Georger Araujo <georger_br@yahoo.com.br>
*************************************************************************/
/***************************************************************************
* Copyri... |
#ifndef LISTA_H
#define LISTA_H
#include <string>
#include "nodocabhora.h"
#include "nodocabecera.h"
class lista
{
public:
lista();
void crearActividad(const std::string& dia,const std::string& hora, const std::string& act);
void imprimirDia(const std::string& dia);
void insertarEnHora(nodoCabHora *nue... |
/*
C++ program using parameterised constructor for finding whether a number is prime or not
*/
#include <iostream>
class Number {
private:
int number;
public:
Number(int n) { number = n; }
bool isPrime() {
if (number < 2) {
return false;
}
for (int ... |
#include "info.h"
Info::Info(string n, string s, string a, string t, string e) : name(n), surname(s),
address(a), telephonNumber(t), email(e) {}
void Info::setName(string newName){
name=newName;
}
void Info::setSurname(string newSurname){
surname=newSurname;
}
void Info::setAddress(string newAddress){
a... |
#include <QStringList>
#include <QProcess>
#include <QComboBox>
#include <QLineEdit>
#include <QLabel>
#include "ultragrid_option.hpp"
#include "v4l2.hpp"
QStringList UltragridOption::getAvailOpts(const QString &executable,
const QString &helpCommand)
{
QStringList out;
QProcess process;
QString command = exe... |
#include <cstdio>
#include "hollow_process.h"
int _tmain(int argc, PTSTR argv[])
{
if (argc != 3)
{
printf("Usage:\tHollowProcess old new\n");
printf("Example:\t svchost.exe new.exe");
return 1;
}
TEST_HOLLOW_PROCESS(argv[1], argv[2]);
return 0;
} |
#include<cstdio>
#include<iostream>
using namespace std;
int num[200010], sum[2], del[2];
int main()
{
int n;
while(~scanf("%d",&n))
{
sum[0] = sum[1] = del[0] = del[1] = 0;
for(int i = 1; i <= n; i++) {
cin >> num[i];
sum[i%2] += num[i];
}
int res = ... |
#include "plorg.h"
int main()
{
Plorg p;
p.show();
p.reset(33);
p.show();
return 0;
}
|
class Solution {
public:
vector<string> removeInvalidParentheses(string s) {
vector<string> res;
unordered_set<string> visited {{s}}; // record had-been-visited substring
queue<string> q{{s}}; // record new-generated substrings after removing some parentheses
bool found = false;... |
#include<stdio.h>
#include<stdlib.h>
// 结构体定义
typedef struct BiTNode{
BiTNode *lchild;
int data;
BiTNode *rchild;
}BiTNode,*BiTree;
// 函数声明
// 构造空树
void InitBiTree(BiTree &T);
// 创建树
void CreateBiTree(BiTree &T);
// 判断二叉树是否为空
bool BiTreeEmpty(BiTree T);
// 获取树的深度
int BiTreeDepth(BiTree T);
// 先序遍历
void Preor... |
/*
* Copyright (C) 2007-2015 Frank Mertens.
*
* Use of this source is governed by a BSD-style license that can be
* found in the LICENSE file.
*
*/
#ifndef FLUX_EXCEPTIONS_H
#define FLUX_EXCEPTIONS_H
/** \file exceptions
* \brief Common exception classes
*/
#include <errno.h>
#include <flux/Exception>
name... |
#include "arp.h"
#include "buffer.h"
#include "host.h"
#include "fmt.h"
#include "eth.h"
#include <stdio.h>
using namespace unet;
bool arp_cache::add(const arp_hdr &hdr, const arp_ip &data)
{
return add(data.sip, data.smac, static_cast<arphrd>(hdr.hwtype));
}
bool arp_cache::add(uint32_t ip, const uint8_t *mac, ar... |
#include "pch.h"
#include "OptimizationCode.h"
OptimizationCode::OptimizationCode(string filename) {
Parser par(filename);
par.program();
middlecode = par.return_middleCode();
set = par.return_symbolset();
set.curFTab.func_name("");
if (par.err_flag == 0) {
gen_block_subscript();
gen_all_block();
Print_al... |
#pragma once
#include <SFML/System/Vector2.hpp>
#include<glm/gtc/matrix_transform.hpp>
#include<glm/gtc/type_ptr.hpp>
struct FloatRect
{
FloatRect(float left, float top, float width, float height)
{
this->left = left;
this->top = top;
this->width = width;
this->height = height;
}
float lef... |
// Copyright (c) 2015 University of Szeged.
// Copyright (c) 2015 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 "sprocket/android/manager.h"
#include "base/android/jni_android.h"
#include "base/android/jni... |
#ifndef NODEARRAY_H
#define NODEARRAY_H
#include <Structs/Graphs/dynamicGraph.h>
#include <Structs/Maps/pmMap.h>
template< typename dataType, typename GraphType>
class NodeArray
{
public:
typedef GraphType Graph;
typedef typename Graph::NodeIterator node;
typedef typename Graph:... |
#include "SimDataDrawer.h"
#include "Source/Viewers/IMGuiViewer/OpenGL/Shader.h"
#include "Source/Viewers/IMGuiViewer/OpenGL/Sphere.h"
#include "Camera.h"
#include <algorithm>
namespace solar
{
namespace drawers
{
namespace
{
// Number of rings to aproximate sphere with.
constexpr size_t resolution = 32;
... |
// C++ for the Windows Runtime vv1.0.170303.6
// Copyright (c) 2017 Microsoft Corporation. All rights reserved.
#pragma once
#include "Windows.UI.Xaml.Automation.Provider.1.h"
#include "Windows.UI.Xaml.1.h"
#include "Windows.UI.Xaml.2.h"
WINRT_EXPORT namespace winrt {
namespace Windows::UI::Xaml::Automation::Provid... |
#ifndef INCLUDED_SINGLYLINKEDLIST_H
#define INCLUDED_SINGLYLINKEDLIST_H
#include <iostream>
/* 片方向連結リストのノード */
typedef struct singly_node_t
{
int key;
singly_node_t *next;
} singly_node_t;
/* 片方向連結リストのクラス */
class SinglyLinkedList
{
public:
SinglyLinkedList();
~SinglyLinkedList();
/*... |
/*******************************************************************
* CS 307 Programming Assignment 2
* Author: Benjmin hoang
* Desc: traffic simulation
* Date: 4/15/2017
* I attest that this program is entirely my own work
*******************************************************************/
#include<s... |
/**
* Definition for a binary tree node.
* struct TreeNode {
* int val;
* TreeNode *left;
* TreeNode *right;
* TreeNode(int x) : val(x), left(NULL), right(NULL) {}
* };
*/
class Solution {
public:
void levelhelper(TreeNode * root, int level, vector<vector<int>> &result) {
if(root ... |
// Fill out your copyright notice in the Description page of Project Settings.
#include "Spool.h"
#include "Neuron.h"
Neuron::Neuron(unsigned int numOutputs, std::size_t id)
{
//printf("Debug a Neuron was added\n");
_id = id;
_outputWeights.reserve(numOutputs);
for (std::size_t c = 0; c < numOutputs; ++c) {
_ou... |
#include "notepad.h"
#include <fstream>
#include <QFileDialog>
#include <QMessageBox>
#include <QHBoxLayout>
#include <QVBoxLayout>
using namespace std;
Notepad::Notepad() {
// ctor: build the GUI
// QObject::tr translates GUI texts (see Qt Linguist)
auto button_layout = new QVBoxLayout;
button_lay... |
#include "FileWithExpenses.h"
bool FileWithExpenses::addExpenseToFile(Expense expense) {
if (!checkIfFileExists()) {
xml.SetDoc("<?xml version=\"1.0\" encoding=\"UTF-8\"?>\r\n");
xml.AddElem("Expenses");
}
xml.FindElem();
xml.IntoElem();
xml.AddElem("Expense");
xml.IntoElem();... |
//
// MainScene.h
// SMCocosTest
//
// Created by KimSteve on 2017. 4. 13..
// Copyright © 2017년 KimSteve. All rights reserved.
//
#ifndef MainScene_h
#define MainScene_h
#include "../SMFrameWork/Base/SMScene.h"
#include <cocos2d.h>
#define MEDIA_TEST
#ifdef MEDIA_TEST
#include <ui/UIEditBox/UIEditBox.h>
#if ... |
// *****************************************************************
// This file is part of the CYBERMED Libraries
//
// Copyright (C) 2007 LabTEVE (http://www.de.ufpb.br/~labteve),
// Federal University of Paraiba and University of São Paulo.
// All rights reserved.
//
// This program is free software; you can redist... |
//UVA- P562
//Undefined_Error
//Dept. ICE, NSTU-11 Batch
#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define SZ 100005
#define MX 100000000
#define sfint(a) scanf("%d",&a)
#define sfint2(a,b) scanf("%d%d",&a,&b)
#define sfint3(a,b,c) scanf("%d%d%d",&a,&b,&c)
#define forlp0(i,n) for(int i=0;i<n;i+... |
//
// display.hpp
// led_matrix
//
// Created by Alex on 15.11.15.
//
//
#include "ofMain.h"
#ifndef auraDisplay_h
#define auraDisplay_h
class auraDisplay {
public:
void setup();
void update();
void generateMirrorTestFrame();
void drawLEDMatrix(ofColor pixelMatrix[][10]);
void ... |
////////////////////////////////////////////////////////////////////////////////
//
// Copyright (c) 2006-2010 MStar Semiconductor, Inc.
// All rights reserved.
//
// Unless otherwise stipulated in writing, any and all information contained
// herein regardless in any format shall remain the sole proprietary of
... |
#include "abb.h"
/*
ABB::ABB()
{
}
*/
/*
template <class DATO>
ABB<DATO>::~ABB()
{
Podar(raiz);
}
template <class DATO>
void ABB<DATO>::Insertar(DATO dat)
{
Nodo<DATO> *padre = NULL;
actual = raiz;
while(!Vacio(actual) && dat != actual->dato)
{
padre = actual;
... |
#include <cmath>
#include <iostream>
#include <fstream>
#include <cstdlib>
#include <time.h>
#include <vector>
#include <iomanip>
using namespace std;
int main()
{
time_t inicio;
char nomeArquivo[40] = { "./buste_quads.off" };
//char nomeArquivo[40] = { "./mf/Modelos/EsferaMuitosTriangulos.wrl" };
//char nomeArq... |
#include "System/Memory.h"
#include <QProcess>
namespace System {
int getMemory()
{
QProcess p;
p.start("awk", QStringList() << "/MemFree/ { print $2 }" << "/proc/meminfo");
p.waitForFinished();
int mem(QString::fromUtf8(p.readLine()).toInt());
p.close();
return mem;
}
} // System
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.