text stringlengths 8 6.88M |
|---|
class Solution {
public:
vector<int> singleNumber(vector<int>& nums) {
// [1,2,1,3,2,5] => diff=3^5='110', i.e., difference at 2nd and 3rd bit
// int diff = accumulate(nums.begin(), nums.end(), 0, bit_xor<int>());
int diff = 0;
for (int num : nums) diff ^= num;
// split '110'... |
#include "../../include/interactive_mid_protocols/ZeroKnowledge.hpp"
/************************************************/
/* ZKFromSigmaProver */
/************************************************/
ZKFromSigmaProver::ZKFromSigmaProver(shared_ptr<ChannelServer> channel,
shared_ptr<SigmaProver... |
#include "Jogador.h"
Jogador::Jogador()
{
velo = 3.0f;
vivo = true;
xPos = 100;
yPos = 350;
gRecursos.carregarAudio("tiroSom", "assets/Musicas/Laser.mp3");
somTiro.setAudio("tiroSom");
}
Jogador::~Jogador()
{
}
void Jogador::setSpriteSheets(string spritesheets)
{
spr.setSpriteSheet(spr... |
#include "pch.h"
#include "CppUnitTest.h"
#include "TowerDart.h"
#include "Game.h"
#include <memory>
using namespace Microsoft::VisualStudio::CppUnitTestFramework;
using namespace std;
using namespace Gdiplus;
/// red balloon filename
const std::wstring dartImageName = L"images/tower8.png";
/// red balloon id number... |
/*
Copyright (c) 2011 Andrew Wall
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, distribute, sub... |
#define CE_CJOIN_CPP
#include <windows.h>
#include <stdio.h>
#include <tchar.h>
#include <math.h>
#include "tjclanDEF.h"
#ifdef USE_PROSTONTALE //=========== ํ๋ฆฌ์คํด์์ค์ธ๊ฒฝ์ฐ
#include "sinbaram\\SinLinkHeader.h"
#include "HoBaram\\HoLinkHeader.h"
#include "Language\\language.h"
#include "HoBaram\\HoTextFile.h"
#endif
#i... |
/*find number of multiples of a in range l to r
ans=f(r)-f(l-1);
here f(n)=(n/a)+1;
if(n==-1) f(-1)=0;
*/
#include<bits/stdc++.h>
using namespace std;
int main()
{
long long l,r,a,ans=0;
cin>>l>>r>>a;
ans+=(r/a)+1;
l-=1;
if(l==-1)ans-=0;
else ans-=(l/a)+1;
cout<<ans<<"\n";
}
|
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <unistd.h>
#include <arpa/inet.h>
#include <sys/socket.h>
#include <sys/types.h>
#include <pthread.h>
#include "../headers/mode2.h"
#include "../headers/ec2.h"
#include "../headers/utility.h"
#define _DEBUG_ 1
struct context {
int fd, nodes, num;... |
#include <Rcpp.h>
using namespace Rcpp;
//' Removing the points outside the CCEP limits
//' This function ...
//'
//' @param x a numeric vector to order
//' @return A numeric vector with the order of the vector fields
//
//
// [[Rcpp::export]]
NumericMatrix limCCEP(NumericVector x, NumericVector y, NumericMatrix z,
... |
#include "string_utils.h"
#include <stdexcept>
namespace dwiz
{
std::pair<std::string, unsigned int> splitHostAndPort(std::string const& f_hostAndPort)
{
auto const colon_index = f_hostAndPort.find_last_of(':');
if (colon_index == std::string::npos)
{
throw std::runtime_error("Host name \"" + f_hos... |
/**
* Definition for binary tree
* struct TreeNode {
* int val;
* TreeNode *left;
* TreeNode *right;
* TreeNode(int x) : val(x), left(NULL), right(NULL) {}
* };
*/
class BSTIterator {
stack<TreeNode*> pool;
public:
BSTIterator(TreeNode *root) {
if (root == nullptr)
... |
/***************************************************************************
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<iostream>
using namespace std;
int main()
{
// an array with 4 rows and 4 columns.
int a[4][4] = {
{ 2, 4, 1, 3 },
{ 1, 3, 2, 4 },
{ 3, 2, 4, 1 },
{ 4, 1, 3, 2 }
};
for (int i = 0; i < 4; i++)
for (int j = 0; j < 4; j++) {
cout << "a[" << ... |
#ifndef MainCharacter_hpp
#define MainCharacter_hpp
#include <iostream>
#include "GameObject.hpp"
#include "Location.hpp"
#include <vector>
using namespace std;
class MainCharacter : public GameObject {
private:
bool up, upLock;
bool down, downLock;
bool left, leftLock;
bool right, rightLock;
... |
#include <bits/stdc++.h>
#define rep(i,n) for (int i = 0; i < (n); ++i)
using namespace std;
typedef long long ll;
typedef vector<int> vi;
typedef pair<int, int> ii;
typedef vector<vi> vvi;
typedef vector<ii> vii;
typedef vector<bool> vb;
typedef vector<vb> vvb;
typedef set<int> si;
typedef map<string, int> msi;
typede... |
#pragma once
#include <cryptopp/osrng.h>
#include <utility>
#include <cryptopp/eccrypto.h>
typedef CryptoPP::ECIES<CryptoPP::ECP>::PrivateKey PrivateKey;
typedef CryptoPP::ECIES<CryptoPP::ECP>::PublicKey PublicKey;
std::pair<std::uint64_t, PublicKey> getPublicKey(CryptoPP::AutoSeededRandomPool& rng);
PrivateKey getPr... |
#pragma once
#include "model/Sprite.hpp"
class Bomb : public Sprite
{
const int range;
const int damage;
bool hasDetonated, hasSpawned;
public:
Bomb(const Point& initPos, int range, int damage = 1);
~Bomb();
/**
* Trigger bomb, spawning Blast objects.
*/
void
explode();
... |
/*
Copyright (c) 2005-2023, University of Oxford.
All rights reserved.
University of Oxford means the Chancellor, Masters and Scholars of the
University of Oxford, having an administrative office at Wellington
Square, Oxford OX1 2JD, UK.
This file is part of Chaste.
Redistribution and use in source and binary forms... |
#include "Player.h"
#include "Bullet.h"
#include "Enemy.h"
#include "Platform.h"
#include "Break.h"
#include "Hole.h"
#include <QGraphicsScene>
#include <QDebug>
#include <QTimer>
#include <QBrush>
Player::Player()
{
setRect(0,0,20,20);
QBrush brush;
brush.setStyle(Qt::SolidPattern);
... |
/*
Copyright (C) 2011 by Ladislav Hrabcak
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, distrib... |
#ifndef SDK_COMPOINTER_HPP
#define SDK_COMPOINTER_HPP
template <typename T>
class COM
{
public:
COM() = default;
COM(T* pointer)
{
pointer_ = pointer;
}
COM(COM && other)
{
pointer_ = other.pointer_;
other.pointer_ = nullptr;
}
COM(const COM& other)
{
pointer_ = other.pointer_;
pointer_.AddRef... |
/*
========================================================================
Name : TMBtWriter.h
Author : DH
Copyright : All right is reserved!
Version :
E-Mail : dh.come@gmail.com
Description :
Copyright (c) 2009-2015 DH.
This material, including documentation and any relat... |
/*************************************************************
* > File Name : c1080_2.cpp
* > Author : Tony
* > Created Time : 2019/10/28 16:03:26
* > Algorithm :
**************************************************************/
#include <bits/stdc++.h>
using namespace std;
typedef ... |
#include<bits/stdc++.h>
using namespace std;
int main()
{
int n;
cin>>n;
n+=1;
int edges;
cin>>edges;
int arr[n][n];
int ar[n];
int prd[n];
for(int i=0;i<n;i++)
{
ar[i]=0;
prd[i]=0;
for(int j=0;j<n;j++)
{
arr[i][j]=0;
... |
// p317
// ๋นํธ๋ง์คํฌ ๊ธฐ๋ฒ ์ดํด ๋ชปํด์ ํจ์ค
#include <iostream>
using namespace std;
// const int INF = 987654321;
// const int MAX = 10000;
// int n;
// double dist[MAX][MAX];
const int INF = 987654321;
const int MAX = 10000;
int n, dist[MAX][MAX];
double cache[MAX][1<<MAX];
// ๋จ์ ๊ฒฝ๋ก์ ์ต์ ๊ธธ์ด๋ฅผ ๋ฐํ
// ๋์ ํ์ฌ ์์น (์ง๋ ๊ฒฝ๋ก์ ๋ง์ง๋ง ์์น), ๊ฐ ๋์๋ค... |
#include <iostream>
// #include <pair>
using namespace std;
int main(int argc, char *argv[])
{
// const char *name = "shibin";
pair<string, int> p("shibin", 19);
cout << p.first << " - " << p.second << endl;
pair<string, int> p2 = make_pair("shibin", 18);
cout << p2.first << " - " << p2.second <<... |
#include <nds.h>
#include "myapp.h"
MyApp *myapp;
int main(void)
{
irqEnable(IRQ_VBLANK);
myapp = new MyApp();
myapp->mainLoop();
return 0;
}
|
#ifndef HTTPD_H
#define HTTPD_H
/*
*****************************************************************************
* ___ _ _ _ _
* / _ \ __ _| |_| |__(_) |_ ___
* | (_) / _` | / / '_ \ | _(_-<
* \___/\__,_|_\_\_.__/_|\__/__/
* ... |
#include<iostream>
using namespace std;
// thisๆ้ๆฆๅฟต
// 1.่งฃๅณๅ็งฐๅฒ็ช
// 2.่ฟๅๅฏน่ฑกๆฌ่บซ็จ*this
class Person
{
public:
// 1.่งฃๅณๅ็งฐๅฒ็ช
Person(int age)
{
// thisๆ้ๆๅ่ขซ่ฐ็จ็ๆๅๅฝๆฐๆๅฑ็ๅฏน่ฑก
this->age = age;
}
// 2.่ฟๅๅฏน่ฑกๆฌ่บซ็จ*this
//่ฆ่ฟๅๅผ็จ&
Person &PersonaddPerson(Person &p)
{
this->age += p.ag... |
#include <iostream>
using namespace std;
extern "C" {
#define true 1
#define false 0
struct node{
int v;
struct node * pre;
};
struct node* NewNode(struct node * pre, int v){
struct node* nd = new node;
nd->v = v;
nd->pre = pre;
return nd;
}
struct Stack
{
struct node * top;
int size;
int length;
};
/*
*... |
#ifndef USER_INTERFACE_H
#define USER_INTERFACE_H
#include <vector>
#include <string>
#include "SimulatorLogic.h"
#include "Consola.h"
using namespace std;
class Command
{
private:
string name;
string arguments_description;
int countWords(const string &command) const;
public:
... |
#include "Drink.h"
#include "gtest/gtest.h"
TEST(Drink, DefaultCTor) {
Drink d;
EXPECT_EQ(0, d.getPrice());
EXPECT_EQ("", d.getName());
}
TEST(Drink, TwoParamCTor) {
Drink d(3.60, "White Russian");
EXPECT_EQ(3.60, d.getPrice());
EXPECT_EQ("White Russian", d.getName());
}
TEST(Drink, CopyCTor) {
Drink... |
//
// name.cpp
// earthQuakeProject
//
// Created by Allan Yong on 12-03-15.
// Copyright (c) 2012 __MyCompanyName__. All rights reserved.
//
#include "cinder/app/AppBasic.h"
#include "cinder/Rand.h"
#include "cinder/Vector.h"
#include "time.h"
#include "nameController.h"
extern Font mFont;
extern float widthNam... |
#include <iostream>
#include <cstdio>
#include <cstring>
#include <cstdlib>
#include <vector>
#include <string>
#include <sstream>
using namespace std;
#define MAX_LEN (5000)
#define MAX_SIZE (3000)
char line[MAX_LEN];
int pos[MAX_SIZE];
string val[MAX_SIZE];
int main(int argc, char **argv) {
int T;
... |
#include <cmath>
#include <iostream>
#include <list>
#include <map>
#include <numeric>
#include <queue>
#include <unordered_map>
#include <unordered_set>
#include <vector>
#include <set>
#include <stack>
#include <sstream>
#include <string>
using namespace std;
struct TreeNode
{
int val;
TreeNode* left;
Tr... |
#pragma once
#include "glad.h"
#include "glm/glm.hpp"
#include "Globals.h"
#include "NonCopyable.h"
#include <vector>
struct VertexArray;
struct VertexBuffer : private NonCopyable
{
VertexBuffer();
VertexBuffer(VertexBuffer&&) noexcept;
VertexBuffer& operator=(VertexBuffer&&) noexcept;
~VertexBuffer();
void bin... |
// print subsequences / subsets
void print_subsequences1(string s, string ans)
{
if (s=="")
{
cout << ans << " ";
return;
}
print_subsequences(s.substr(1), ans);
print_subsequences(s.substr(1), ans+s[0]);
}
void solve1()
{
string s;
cin >> s;
print_subsequences1(s, "... |
#include <iostream>
#include <Windows.h>
#include "Resource.h"
void GoToXY(int x, int y)
{
HANDLE hStdout = GetStdHandle(STD_OUTPUT_HANDLE);
COORD position = { (SHORT)x, (SHORT)y };
//Sets the position of the cursor in the console to the x and y values passed through in the method's arguments
SetConsoleCursorPosi... |
#include "SceneGraph.hpp"
// nonmember functions
void draw(DrawFn drawFn,
const Group & root,
const std::pair<std::shared_ptr<Camera>, glm::mat4> & camera)
{
auto lights = getLights(root);
auto drawables = getDrawables(root);
for (const auto & action : drawables)
{
drawFn(lights, ca... |
/***********************************************************************
created: Thu May 31 2012
author: Paul D Turner <paul@cegui.org.uk>
*************************************************************************/
/***************************************************************************
* Copyrigh... |
/*
* MutexLock.h
*
* Created on: Apr 22, 2014
* Author: wing
*/
#ifndef MUTEXLOCK_H_
#define MUTEXLOCK_H_
#include "noncopyable.h"
#include <pthread.h>
#include <stdexcept>
class Condition;
class MutexLock: public noncopyable {
friend class Condition;
public:
MutexLock();
~MutexLock();
void lock();... |
#ifndef LOGCOPIER_H
#define LOGCOPIER_H
#include <QThread>
#include <QDateTime>
#include <QFile>
#include <QByteArray>
#include <QSharedPointer>
#include "Network/NetworkSender.h"
#include "Log/LogFragment.h"
class LogCopier : public QThread
{
Q_OBJECT
public:
LogCopier(QString sourceFile, QString targetFile,
... |
#pragma once
#if __APPLE__
#include <TargetConditionals.h>
#endif
#include <locale.h>
#include <math.h>
#include <memory.h>
#include <stdlib.h>
#include <stdio.h>
#include <stdbool.h>
#include <stdarg.h>
#include <assert.h>
#include <string>
#include <vector>
#include <algorithm>
#include <thread>
#include <future>... |
๏ปฟ///ๅฎๆถๆฒ็บฟ็ชๅฃ
#ifndef REALTIMECURVES_H
#define REALTIMECURVES_H
#include "PostWidgetsAPI.h"
#include "moduleBase/graphWindowBase.h"
#include "PostCustomPlot.h"
#include <QStringList>
#include <QList>
#include <QVector>
#include <QHash>
class QTextStream;
namespace Ui
{
class RealTimeWindow;
}
namespace GUI
{
class Ma... |
/*
Copyright (c) 2005-2023, University of Oxford.
All rights reserved.
University of Oxford means the Chancellor, Masters and Scholars of the
University of Oxford, having an administrative office at Wellington
Square, Oxford OX1 2JD, UK.
This file is part of Chaste.
Redistribution and use in source and binary forms... |
//
// MiddleMan.cpp
// ReserveSystem
//
// Created by HeeCheol Kim on 27/11/2018.
// Copyright ยฉ 2018 HeeCheol Kim. All rights reserved.
//
#include "MiddleMan.h"
MiddleMan::MiddleMan () {
this->defaultPath = DEFAULT_PATH;
this->shoppingBasket = new ShoppingBasket();
}
// ์ํ ์ด๊ธฐ ๋ฑ๋ก
void MiddleMan::registS... |
#include<cstdio>
#include<iostream>
#include<algorithm>
#include<cstring>
using namespace std;
int main()
{ char weeks[8][5] = {"","MON","TUE","WED","THU","FRI","SAT","SUN"};
char a[60],b[60],c[60],d[60];
scanf("%s%s%s%s",a,b,c,d);
int alen = strlen(a);
int blen = strlen(b);
int clen = strlen(c... |
#ifndef UIRECOGNITIONSETTINGS_H
#define UIRECOGNITIONSETTINGS_H
//
#include <QDialog>
#include "ui_recognition_settings.h"
class FaceRecognizer;
class VideoInput;
class UIRecognizerLearning;
class UIRecognizerTest;
class UIGetValue;
//
class UIRecognitionSettings : public QDialog, public Ui::RecognitionSettingsDialog... |
#include "inc/app.hpp"
App::App() {
}
int App::run(int argc, char* argv[]) {
/* Parse command line arguments
* Get input and output filenames */
std::string ifname, ofname;
if(parseArgs(argc, argv, ifname, ofname) < 0) {
return -1;
}
std::cout << "Input: " << ifname << std::endl;
... |
class Solution {
public:
ListNode* swapPairs(ListNode* head) {
ListNode * dummy = new ListNode(-1, head), * pre = dummy, * cur = pre->next;
while (cur && cur->next) {
ListNode * next = cur->next;
cur->next = next->next;
next->next = pre->next;
pre->nex... |
//
// c64emu - C64 Emulator using SDL
// Copyright (C) 2006-2017 Michael Fink
//
/// \file EmulatorOptions.hpp Emulator command line options
//
#pragma once
// includes
#include <ulib/ProgramOptions.hpp>
/// options for command line application
class EmulatorOptions : public ProgramOptions
{
public:
/// ctor
Em... |
#include <iostream>
#include <fstream>
#include <stdlib.h>
#include <string>
using namespace std;
void getNext(int* pizza, int N, int M)
{
int i = M - 2;
while(pizza[i] == 0)
--i;
if(pizza[i + 1] == 0)
{
for(int j = i + 2; j < M; ++j)
{
pizza[i + 1] += pizza[j];
... |
#ifndef SPRITEMAN_H
#define SPRITEMAN_H
#include <vector>
#include <map>
using namespace std;
#include "Sprite.h"
#include "D3DVertex.h"
// Map type for "textures" (which are "images" in direct3d)
typedef map<int, Sprite*> /* as simply */ SpriteMap ;
typedef map<int, Sprite*>::iterator /* as simply */ Sp... |
#include "util.h"
#include <fstream>
/**
* Parses a server address file into a map from server number to address.
* See README for details about how this file should be formatted.
*/
std::unordered_map<int, std::string> parseClusterInfo(std::string serverFilePath) {
std::unordered_map<int, std::string> clusterI... |
#if 0
>>>>>>> ๅฆไฝไป
็จ้ๅฝๅๆ ๆไฝ้ๅบไธไธชๆ .cpp
#include<stack>
#include<iostream>
template<class T>
void sortStackByStack1(std::stack<T> st)
{
std::stack<T> help;
while (!st.empty())
{
T top = st.top();
st.pop();
if (help.empty())
help.push(top);
else
{
if (top <= help.top())
help.push(top);
else
{
... |
/**
* Copyright 2019 Eliza Wszola (eliza.wszola@inf.ethz.ch)
*
* 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 ... |
#include <vector>
#include <algorithm>
#include <iostream>
#include <boost/format.hpp>
#include "ndpiReader.h"
#include "global_vars_prefs.h"
#include "tools.h"
#include "nirs/NetworkMapWriter.h"
using std::vector;
NdpiReader::NdpiReader(std::string pcap_file)
: ndpi_struct(ndpi_init_detection_module()),
... |
/**********************************************************
* License: The MIT License
* https://www.github.com/doc97/TxtAdv/blob/master/LICENSE
**********************************************************/
#include "CtrlContentReader.h"
#include <fstream>
#include "StringUtil.h"
namespace txt
{
CtrlContentReader::Ctr... |
/*
Copyright (c) 2005-2023, University of Oxford.
All rights reserved.
University of Oxford means the Chancellor, Masters and Scholars of the
University of Oxford, having an administrative office at Wellington
Square, Oxford OX1 2JD, UK.
This file is part of Chaste.
Redistribution and use in source and binary forms... |
//
// Created by Terry on 15/9/11.
//
#ifndef AI_STRING_CONVERT_H
#define AI_STRING_CONVERT_H
#include <iostream>
#endif //AI_STRING_CONVERT_H
|
#include <iostream>
#include <fstream>
#include <vector>
#include <cassert>
#include <algorithm>
size_t relativeBase = 0;
enum Tile
{
Empty,
Wall,
Block,
Paddle
};
struct Point
{
int x;
int y;
Point(int x, int y)
:x(x), y(y)
{
}
Point()
... |
#include <bits/stdc++.h>
using namespace std;
#define MAX 100
int a[MAX];
int n, k;
bool dfs(int i, int s) {
if (s > k) return false;
if (i == n) return s == k;
if (dfs(i + 1, s)) return true;
if (dfs(i + 1, s + a[i])) return true;
return false;
}
int main() {
cin >> n >> k;
for ( int ... |
#ifndef __CLUCK2SESAME_PLATFORM_CLOCK_INC
#define __CLUCK2SESAME_PLATFORM_CLOCK_INC
#include "Platform.inc"
radix decimal
.module CLOCK
CLOCK_FLAG_TICKED equ 0
.externalVariable clockFlags
.externalVariable clockYearBcd
.externalVariable clockMonthBcd
.externalVariable clockDayBcd
.externalVariable clockH... |
#include "CLogicEntity.h"
#include "DescriptorList.h"
#include "CBaseEngine.h"
REGISTER_ENTITY(CLogicEntity)
|
/**
* Copyright 2016-2017 MICRORISC s.r.o.
*
* 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 applicab... |
#include "celular.h"
#include "plano.h"
#include "Erro.h"
void Celular::ColocarCreditos(double num, double val) {
/*
como usar o numero fornecido???
*/
if (this->_tipo_pln.get_nome() == "Pos pago")
throw Erro("Plano incompativel");
this->_tipo_pln.set_credito(val);
}
void Celular::FazL... |
/*
* Copyright (C) 2014-2016 Open Source Robotics Foundation
*
* 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... |
๏ปฟ#pragma once
#include "Common/MathHelper.h"
#include "SubmeshGeometry.h"
#include "BufferTypes.h"
#include <DirectXMath.h>
#include <DirectXCollision.h>
#include <unordered_map>
namespace GraphicsEngine
{
class D3DBase;
class MeshGeometry
{
public:
template<typename VertexType>
static DirectX::BoundingBox ... |
#pragma once
#include "./OPengine.h"
#include "Player.h"
#include "StaticEntity.h"
#include "DynamicAllocator.h"
class GameState : public OPgameState {
OPjavaScriptV8Compiled SCRIPT;
OPrendererForward rendererForward;
Player* player;
void Init(OPgameState* last);
OPint Update(OPtimer* time);
void Ren... |
// bfs
// ์ ์ ๋ฐํ์์๋ฌ
#include <iostream>
#include <queue>
using namespace std;
int visit[100001] = {0,};
int n, k;
int generate(){
queue<int> q;
visit[n]=1;
q.push(n);
while(!q.empty()){
int cur = q.front();
q.pop();
if(cur == k) {
cout<<visit[cur]-1<<endl;
}
if(cur>100001 || cur<1) ... |
//1124 - Celebrity jeopardy
//Dept. ICE, NSTU-11 Batch
#include<bits/stdc++.h>
using namespace std;
#define INF 1<<28
#define ll long long
#define SZ 100009
#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... |
#include <bits/stdc++.h>
using namespace std;
int findEquilibrium(int a[], int n) {
long long sumRight = 0, sumLeft = 0;
for (int i = 0; i < n; i++) sumRight += a[i];
for (int i = 0; i < n; i++) {
sumRight -= a[i];
if (sumLeft == sumRight) return i+1;
sumLeft += a[i];
... |
/*
* Copyright (C) 2014 Pavel Kirienko <pavel.kirienko@gmail.com>
*/
#pragma once
#include <uavcan_stm32/build_config.hpp>
#include <hal.h>
/**
* Debug output
*/
#ifndef UAVCAN_STM32_LOG
# if 0
# define UAVCAN_STM32_LOG(fmt, ...) lowsyslog("uavcan_stm32: " fmt "\n", ##__VA_ARGS__)
# else
# define UAVCAN_STM32... |
//
// SpriteBlur.cpp
// demo_ddz
//
// Created by ่ฐขๅฐๅก on 2018/2/11.
//
#include "SpriteBlur.hpp"
using namespace cocos2d;
SpriteBlur* SpriteBlur::create(const char *pszFileName) {
SpriteBlur* pRet = new (std::nothrow) SpriteBlur();
if (pRet) {
bool result = pRet->initWithFile("");
log("Test... |
// Copyright 2020-2021 Russ 'trdwll' Treadwell <trdwll.com>. All Rights Reserved.
#pragma once
#include "CoreMinimal.h"
#include "UObject/NoExportTypes.h"
#include "SteamStructs.h"
#include "SteamBridgeUtils.generated.h"
/**
*
*/
UCLASS()
class STEAMBRIDGE_API USteamBridgeUtils : public UObject
{
GENERATED_BODY()... |
#include <cstdio>
#include <iostream>
#include <vector>
using namespace std;
typedef long long ll;
vector<int> s;
void dfs(int pre, int left) {
if (left == 0 && s.size() > 1) {
for (int i = 0; i < s.size(); ++i) {
if (i)
cout << '+';
cout << s[i];
}
... |
//
// Created by Peter Chen on 5/29/16.
//
#ifndef CUBEWORLD_SECTOR_H
#define CUBEWORLD_SECTOR_H
class Sector {
};
#endif //CUBEWORLD_SECTOR_H
|
#pragma once
#include "western_date.h"
namespace lab2 {
class JulianDate : public WesternDate {
protected:
static const int JULIAN_DAY_ZERO_MJD_OFFSET = -678943; // MJD number of Julian 0000-01-01
// Utility functions
virtual inline bool is_leap_year() const override { return is_leap_year_util(year())... |
// tlocker.cpp -- generally useful POSIX Mutex control
// for critical code sections
//
// DM/Avisere 07/04
//
#include "tlocker.h"
// ---------------------------------------------------------------------
TLock::TLock(int lockType)
:THandle<TLockRep>(new TLockRep(lockType))
{}
TLock& TLock::operator=(TLock& a... |
//
// Created by lab on 26.04.18.
//
//#include "ns3/core-module.h"
//#include "ns3/network-module.h"
//#include "ns3/internet-module.h"
//#include "ns3/point-to-point-module.h"
//#include "ns3/applications-module.h"
//#include "ns3/csma-module.h"
//#include "ns3/internet-module.h"
//#include "ns3/wifi-module.h"
//
//... |
class Solution {
public:
int maxSubArray(vector<int>& nums) {
// int maxSub1 = nums[0],maxSub2 = nums[0];
// for (int i = 1; i<nums.size(); i++) {
// maxSub1 = maxSub1<0?nums[i]:maxSub1+nums[i];
// maxSub2 = max(maxSub2,maxSub1);
// }
// return maxSub2;
int maxSub1 = ... |
#include<conio.h>
#include<iostream.h>
#include<stdio.h>
siswa(float uts,float uas);//deklarasi fungsi
garis()//fungsi garis
{
printf("\n\t===============================\n");
}
main()
{
char nim[10],nama[20],ket[10],lagi;
float a,b,rata;
garis();
cout<<"\n\t oerhitungan nilai siswa"<<endl;
cout<<"\t";gar... |
/* ***********************************************************
* JLMD++ A C++ version of LJMD motived by LAMMPS.
*
* http://sites.google.com/site/akohlmey/software/ljmd
* and http://lammps.sandia.gov/
*
* Some routines are taken in whole or in part from LJMD
* or LAMMPS. This software is distributed under the
... |
//
// Created by wqy on 19-12-11.
//
#include "AssignmentAction.h"
using namespace esc;
/*AssignmentAction::AssignmentAction() {
this->lhs = NULL;
this->rhs = NULL;
}*/
void AssignmentAction::setLhs(esc::Attribute *_attribute) {
this->lhs = new AttributeTerm(_attribute);
}
void AssignmentAction::setRhs(... |
// $Id: LOCV.h,v 1.3 2013/02/12 18:56:15 david Exp $
#ifndef __PF2ASM_NODE_addressing_LOCV_H__
#define __PF2ASM_NODE_addressing_LOCV_H__
#include <cdk/nodes/Node.h>
#include "semantics/SemanticProcessor.h"
namespace pf2asm {
namespace node {
namespace addressing {
class LOCV: public cdk::node::Node {
... |
#pragma once
#include "western_date.h"
namespace lab2 {
class GregorianDate : public WesternDate {
protected:
static const int GREGORIAN_DAY_ZERO_MJD_OFFSET = -678941; // MJD number of Gregorian 0000-01-01
// Utility functions
static inline bool is_leap_year_util(const int year) {
return ((year ... |
//
// Role.h
// tower
//
// Created by wangpeng on 15/7/29.
//
//
#ifndef __tower__Role__
#define __tower__Role__
#include <stdio.h>
#include "cocos2d.h"
#include "Map1.h"
using namespace cocos2d;
enum dir { DOWN, LEFT, RIGHT, UP };
enum roleType
{
ROLE1,ROLE2
};
class Role : public cocos2d::Node
{
private... |
/*
* Brian R Taylor
* brian.taylor@bolderflight.com
*
* Copyright (c) 2021 Bolder Flight Systems Inc
*
* 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 ... |
#ifndef BSCHEDULER_KERNEL_KERNEL_BASE_HH
#define BSCHEDULER_KERNEL_KERNEL_BASE_HH
#include <bitset>
#include <cassert>
#include <chrono>
#ifndef NDEBUG
#include <unistdx/util/backtrace>
#endif
#include <bscheduler/kernel/exit_code.hh>
#include <bscheduler/kernel/kernel_flag.hh>
namespace bsc {
class kernel_base {... |
#ifndef GM2_FIELD_CORE_INCLUDE_SHIM_DATASET_HH_
#define GM2_FIELD_CORE_INCLUDE_SHIM_DATASET_HH_
/*===========================================================================*\
author: Matthias W. Smith
email: mwsmith2@uw.edu
file: shim_dataset.hh
about: A class meant to handle shimming data in a nice way, load a... |
#include<iostream>
#include<bits/stdc++.h>
using namespace std;
int main()
{
int array[5];
for(int i=0;i<5;i++){
cin>>array[i];
}
int minx=array[0];int maxx=array[0];
long long sum=array[0];
for(int i=1;i<5;i++){
minx=min(minx,array[i]);
maxx=max(maxx,array[i])... |
/* -*- mode: C++ -*-
* All right reserved, Sure_star Coop.
* @Technic Support: <sdk@isurestar.com>
* $Id$
*/
#ifndef _FRAME_LIB_H_
#define _FRAME_LIB_H_
#include <iostream>
#include <string>
#include "rfans_driver/RfansPacket.h"
using namespace std;
const static int REG_DEVICE_CTRL = (0x40);
co... |
#pragma once
//PageDownKey.h
#ifndef _PAGEDOWNKEY_H
#define _PAGEDOWNKEY_H
#include "KeyAction.h"
class PageDownKey :public KeyAction {
public:
PageDownKey(Form *form = 0);
PageDownKey(const PageDownKey& source);
~PageDownKey();
PageDownKey& operator=(const PageDownKey& source);
virtual void OnKeyDown(UINT nCha... |
#include<cstdio>
#include<algorithm>
#include<set>
using namespace std;
#define numof(array) (sizeof (array) / sizeof *(array))
const int MAX_WH = 200;
// memo array to be -1 for all beforehand
int mem[MAX_WH + 1][MAX_WH + 1];
int grundy(int w, int h){
if (mem[w][h] != -1) return mem[w][h];
set<int> s;
for ... |
๏ปฟ#include <iostream>
#include <gtest/gtest.h>
#include "hs_sfm/sfm_file_io/keyset_loader.hpp"
#include "hs_sfm/sfm_file_io/keyset_saver.hpp"
#include "hs_sfm/sfm_file_io/matches_loader.hpp"
#include "hs_sfm/sfm_file_io/matches_saver.hpp"
#include "hs_sfm/sfm_file_io/tracks_loader.hpp"
#include "hs_sfm/sfm_file_io/tra... |
#include <opencv2/opencv.hpp>
#include "Engine.h"
#include "client.h"
#include "system.h"
#include <thread>
#define Width 320
#define Height 640
#define BorderSize 100
Client *client;
System syst;
cv::Mat window; //ะะปะฐะฒะฝะพะต ะพะบะฝะพ
cv::Mat wroi; //ะะฑะปะฐััั ะฝะฐ ะณะปะฐะฒะฝะพะผ ะพะบะฝะต, ะณะดะต ะฑัะดะตั ะฝะฐั
ะพะดะธัััั ะธะทะพะฑัะฐะถะตะฝะธะต
cv::... |
#ifndef EXAMPLES_AUTOREG_AUTOREG_APP_HH
#define EXAMPLES_AUTOREG_AUTOREG_APP_HH
#include <algorithm>
#include <cmath>
#include <complex>
#include <fstream>
#include <functional>
#include <iostream>
#include <limits>
#include <numeric>
#include <ostream>
#include <sstream>
#include <stdexcept>
#include <valarray>
#de... |
/*
Based on LazerTagHost by Alex Faucher
https://github.com/afaucher/LazerTagHost
Based on IRremote by Ken Shirriff
http://arcfn.com
*/
#include <IRremote.h>
#include <FastLED.h>
// https://github.com/thomasfredericks/Bounce2
#include <Bounce2.h>
// ==============
// LED Indicators
// ==============
#de... |
// This file has been generated by Py++.
#ifndef ConstBaseIterator_45e2d4f27e29c3a5b74179f6cfabbc4c_hpp__pyplusplus_wrapper
#define ConstBaseIterator_45e2d4f27e29c3a5b74179f6cfabbc4c_hpp__pyplusplus_wrapper
void register_ConstBaseIterator_45e2d4f27e29c3a5b74179f6cfabbc4c_class();
#endif//ConstBaseIterator_45e2d4f27e... |
/*
* UnscentedKalmanFilter.h
*
* Created on: Apr 30, 2017
* Author: amehrpour
*/
#ifndef UNSCENTEDKALMANFILTER_H_
#define UNSCENTEDKALMANFILTER_H_
#include "../Eigen/Dense"
using Eigen::MatrixXd;
using Eigen::VectorXd;
class UnscentedKalmanFilter {
public:
UnscentedKalmanFilter();
virtual ~Unscented... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.