text stringlengths 8 6.88M |
|---|
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
ll x[100001], y[100001], cnt[100001];
main()
{
ll n;
while(cin>>n)
{
ll i, home, away;
for(i=1; i<=n; i++)
{
cin>>x[i]>>y[i];
cnt[x[i]]++;
}
for(i=1; i<=n; i++)
{
... |
int Doifix (int day)
{
tempRead = digitalRead(dayDown);
if (dayDown < 0.2 )
{
day = day -1;
tone(9,500,500);
}
if (dayUp < 0.2 )
{
day = day + 1;
tone(9,500,500);
}
return day;
}
|
//
// Created by demon on 18-10-20.
//
#include <vector>
#include <iostream>
#include <math.h>
using namespace std;
/**
* number leetcode.125@array
* https://leetcode.com/problems/valid-palindrome/
* 对撞指针
*/
class Solution {
public:
bool isPalindrome(string s) {
int l = 0;
int r = s.size() -... |
/* -*- 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.
*
* @author Arjan van Leeuwen (arjanl)
*/
#ifndef MESSAGE_STORE_H
... |
#include "config.h"
config::config(/* args */)
{
for (auto file : CONFIG_FILE)
{
std::cout << "what" << file << std::endl;
}
}
config::~config()
{
}
|
/* -*- Mode: c++; tab-width: 4; indent-tabs-mode: t; c-basic-offset: 4 -*-
*
* 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.
*/
#ifndef OP_UPDATETOOLBAR_H
#define OP_UPDATETOOLBAR_H
#include "... |
#pragma once
#include "Renderer.h"
#include <iostream>
#include "Game.h"
class Window
{
public:
Window();
Window(Game* g);
~Window();
void CreateWindow(int width, int height, const char* title);
void Start();
private:
GLFWwindow* window;
Game* game;
Renderer* renderer;
float width;
float height;
... |
const int LED = 4, BUTTON = 12;
int state=0;
void setup()
{
pinMode(LED,OUTPUT);
pinMode(BUTTON,INPUT);
}
void loop()
{
if(digitalRead(BUTTON))
{
state = 1 - state;
digitalWrite(LED,state);
delay(500);
}
}
|
#include <iostream>
#include <string>
using std::cin;
using std::cout;
using std::endl;
using std::string;
int main() {
string s;
string res;
cin >> s;
for (char x : s) {
if (x == '0') res.push_back('0');
else if (x == '1') res.push_back('1');
else if (x == 'B' && r... |
import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.util.ArrayList;
import java.util.Iterator;
/* Количество букв
Ввести с клавиатуры 10 строчек и подсчитать в них количество различных букв (для 33 букв алфавита). Вывести результат на экран.
Пример вывода:
а 5
б 8
в 3
г 7
д 0
…
я 9
*/
public... |
/*
* Copyright (c) 2015 Samsung Electronics Co., Ltd All Rights Reserved
*
* 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
... |
/* BEGIN LICENSE */
/*****************************************************************************
* SKFind : the SK search engine
* Copyright (C) 1995-2005 IDM <skcontact @at@ idm .dot. fr>
* $Id: bucket.h,v 1.1.4.2 2005/02/21 14:22:44 krys Exp $
*
* Authors: Arnaud de Bossoreille de Ribou <debossoreille @at@ idm... |
/*
replay
Software Library
Copyright (c) 2010-2019 Marius Elvert
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, mod... |
#pragma once
#include <typeinfo>
namespace BeeeOn {
class Castable {
public:
template <typename T>
bool is()
{
return dynamic_cast<T *>(this) != nullptr;
}
template <typename T>
bool is() const
{
return dynamic_cast<const T *>(this) != nullptr;
}
template<typename C>
const C &cast() const
{
return... |
#include "StatsFile.hpp"
int main(int argc, char *argv[])
{
bool ret = false;
/* for benchmark */
clock_t start, finish;
double total_time;
start = clock();
// Parameter check.
if (argc < 2) {
fprintf(stderr, "Invalid parameter list!\nUsage: ./bin/top_k_freq 2701.txt\n");
... |
#include <iostream>
#include <fstream>
#include <sstream>
#include <cstdlib>
#include "Inventory.h"
using namespace std;
//University of Colorado, Boulder
//CSCI 2270 Final Project
//Prof. Rhonda Hoenigman
//Created by Channing J. Hurley on 04/23/16
//
//This program keeps track of an inventory of items in a grocery ... |
#ifndef _SLAB_ALLOCATOR_H_
#define _SLAB_ALLOCATOR_H_
#include <new>
#include <algorithm>
////////////////////////////////////////////////////////////
// A slab allocator allocate memory for many objects of the
// same time.
//
// When memory is needed for an object, it first see whether
// there are free objects in ... |
#include <iostream>
#include "polynomials.h"
using namespace std;
void Result::division(const Wx &w, const Px &p)
{
float *buffer1;
float *buffer2;
int zero=0;
resultHelper=w.degree-p.degree;
resultDegree=w.degree-p.degree;
int divisionHelper=w.degree;
int resultDegreeHelper=resultDegree;... |
#include <cstdio>
#include <vector>
#include <algorithm>
using namespace std;
const int MAXN = 10001;
const int INF = 0x3fffffff;
vector<int> adjacencyList[MAXN];
bool visited[MAXN];
bool inDeepest[MAXN];
int deepest = INF;
vector<int> deepestNode;
int startNode;
int n;
void dfs(int currentNode, int depth){
vi... |
//
// Created by fab on 28/04/2020.
//
#include <iostream>
#include "../../../headers/components/scripts/Avatar.hpp"
#include "../../../headers/utils/Physics.hpp"
#include "../../../headers/rendering/renderer/opengl/InputManager.hpp"
#include "../../../headers/rendering/helper/Time.hpp"
#include "../../../headers/util... |
#include <util/Logger.h>
#include <util/point.hpp>
#include <imageprocessing/ConnectedComponent.h>
#include <sopnet/segments/EndSegment.h>
#include <sopnet/segments/ContinuationSegment.h>
#include <sopnet/segments/BranchSegment.h>
#include "LinearCostFunction.h"
static logger::LogChannel linearcostfunctionlog("linearc... |
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
ll GCD(ll x, ll y){
if(x%y == 0) return y;
return GCD(y, x%y);
}
int main(){
ll n;
cin >> n;
vector<ll> v(n);
for(int i=0; i<n; i++) cin >> v[i];
if(n == 1){
cout << v[0] << endl;
return... |
#include <vector>
#include <ionir/const/const_name.h>
#include <ionir/construct/inst.h>
#include <ionir/test/bootstrap.h>
#include <ionir/test/const.h>
#include "pch.h"
using namespace ionir;
//TEST(ParserTest, ParseInt) {
// Parser parser = test::bootstrap::parser({
// Token(TokenKind::LiteralInteger, "5")... |
#include <iostream>
#include <list>
using std::list;
// Return the prime(real) Kth person to be killed
int kPrime(int N, int K);
int main() {
int N, K;
std::cout << "Enter N(people) and K(Kth killed):\n";
std::cin >> N >> K;
list<int> lst;
for (int i {1}; i <= N; i++) lst.push_back(i);
K = k... |
/*
* This file is part of OctoMap - An Efficient Probabilistic 3D Mapping
* Framework Based on Octrees
* http://octomap.github.io
*
* Copyright (c) 2009-2014, K.M. Wurm and A. Hornung, University of Freiburg
* All rights reserved. License for the viewer octovis: GNU GPL v2
* http://www.gnu.org/licenses/old-licen... |
//
// Created by Brady Bodily on 3/1/17.
//
#include "../Deck.h"
#include <set>
#include "DeckTester.hpp"
void DeckTester::testConstructor(int size, int num, int index, int testCase) {
printf("Test Case %u", testCase);
Deck testDeck(size, index, num);
if (testDeck.deck[1]->m_cardSize != size) {
p... |
/*
void setup_RMS()
{
char zbuf[] = { " " };
float Uzerolevel, Izerolevel;
uint16_t Ucntr, Icntr;
uint16_t Ucycles = 30;
Pset = 0;
PRINTLN(". RMS trying to calibrate...");
LD_printString_6x8("Calibrating...", 2, 7);
do
{
rmsCalibrated = false;
Uzerolevel = 0; Izerolevel = 0;
Ucntr = 0; Icntr = 0;
... |
// Created by: Eugeny MALTCHIKOV
// Created on: 2019-04-17
// Copyright (c) 2019 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 ... |
#include "Bureaucrat.hpp"
#include <iostream>
#include <string>
#include <exception>
int main()
{
try
{
Bureaucrat b1("B1", 4);
std::cout << b1;
b1.incremGrade();
std::cout << b1;
b1.incremGrade();
std::cout << b1;
b1.decremGrade();
std::cout << b1;
b1.decremGrade();
std::cout << b1;
b1.decrem... |
/**
* @file light.hpp
*
* Defines the light class.
*/
#ifndef BETELGEUSE_LIGHT_HPP
#define BETELGEUSE_LIGHT_HPP
#include <macs/macs.hpp>
namespace betelgeuse
{
class scene;
/**
* Light class. This defines a physically visible light instance.
*/
class light
{
public:
... |
/*Selection sort header.*/
#ifndef __CC_ALGO_SORTING_SELECTION_SORT__
#define __CC_ALGO_SORTING_SELECTION_SORT__
#include "cc/shared/generic_array.h"
namespace cc_algo_sorting {
void selection_sort(void* base, size_t member_count, size_t member_size,
cc_shared::CompareFuncType comparer);
} // c... |
//renderer.hpp
//Renderer... abstract base class for a class that handles low-level rendering.
//Created by Lewis Hosie
//15-11-11
#ifndef E_RENDERER
#define E_RENDERER
#include "world.hpp"
#include "realwindow.hpp"
#include "fvec3.hpp"
#include "texture.hpp"
enum { blendmode_normal, blendmode_multiply, blendmode_ad... |
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
int main()
{
int n;
cin >> n;
vector<int> a_tmp, a;
for (int i = 0; i < n; i++)
{
int tmp; cin >> tmp;
a_tmp.push_back(tmp);
a.push_back(tmp);
}
sort(a_tmp.begin(), a_tmp.end(), greater<int>());
... |
#pragma once
#include "iframeprocessor.h"
#include <memory>
#include "Point2D.h"
namespace cvf
{
class IFrameProcessor;
class ISingleFeatureTrackerCtrl;
};
namespace cvfn {
public ref class SingleFeatureTrackerCtrl : public IFrameProcessor
{
std::weak_ptr<cvf::ISingleFeatureTrackerCtrl> *mptrUnmanaged;
publi... |
#ifdef DEBUG
#define _GLIBCXX_DEBUG
#endif
#include <iostream>
#include <algorithm>
#include <cstdio>
#include <cstdlib>
#include <ctime>
#include <memory.h>
#include <cmath>
#include <string>
#include <cstring>
#include <queue>
#include <vector>
#include <set>
#include <deque>
#include <map>
#include <functional>
#inc... |
#define RFD_SERIAL Serial1
#define RFD_BAUD 38400 // This is the baud all of our RFDs communicate at. They can be changed to something else, but you have to make sure these always match up.
char receive_packet[100]; // Make sure the size of this array is larger than your largest data string will be. In this case, ... |
#include "ros/ros.h"
#include "sensor_msgs/Image.h"
#include "message_filters/subscriber.h"
#include "message_filters/synchronizer.h"
#include "message_filters/sync_policies/approximate_time.h"
class Img_Sync{
public:
Img_Sync(const char *Img1_topic, const char *Img2_topic)
{
Img1 = new message_filters::Subscri... |
#ifndef SEARCHCONTROLLER_HPP
#define SEARCHCONTROLLER_HPP
#include "Controller.hpp"
class SearchController : public Controller
{
Q_OBJECT
private:
static QList<QString> join(const QList<QString> &, const QList<QString> &);
public:
explicit SearchController(Model *m, View *v);
signals:
void searchResult(QLi... |
#pragma once
#include "utils/service_thread.hpp"
#include "config/options_ptts.hpp"
#include "config/utils.hpp"
#include <string>
#include <memory>
#include <mutex>
#include <condition_variable>
using namespace std;
namespace nora {
namespace common_resource {
class common_resourced {
... |
// API_04_WinMenu.cpp : 애플리케이션에 대한 진입점을 정의합니다.
//
#include "framework.h"
#include "API_04_WinMenu.h"
#define MAX_LOADSTRING 100
// 전역 변수:
HINSTANCE hInst; // 현재 인스턴스입니다.
WCHAR szTitle[MAX_LOADSTRING]; // 제목 표시줄 텍스트입니다.
WCHAR szWindowClass[MAX_LOADSTRING]; /... |
#pragma once
#include "OPENGL_Include.h"
#include "../mathlib.h"
#include <stdexcept>
#include <map>
#include "GpuProgram.h"
#include "PreDefine.h"
#include "ShaderProcessor.h"
using namespace HW;
using namespace std;
namespace GLSLShader {
enum GLSLShaderType {
VERTEX = GL_VERTEX_SHADER,
FRAGMENT = GL_FRAGMENT_... |
#include "Instruction.h"
#include <string>
using namespace CodeGeneration;
void CCodeGenerator::emit(IInstruction* instruction) {
_instructions.push_back( instruction );
}
TInstructionsList CCodeGenerator::generateCode( const IRTree::IStm* rootStatement ) {
munchStm( rootStatement );
return _instructions;
}
voi... |
#include "memory.h"
#include "time.h"
#include "omp.h"
#include <IL/ilut.h>
#include <IL/ilu.h>
#include "emmintrin.h"
#include "nmmintrin.h"
#include "defs.h"
#include "func.h"
int verifyImage();
int verifyImage()
{
// Általunk számolt kimeneti kép
ilInit(); iluInit();
ILboolean ret;
ILuint ilImg = 0;
ilG... |
// lab1.cpp : Defines the entry point for the console application.
//
//#include "stdafx.h"
#include "memory.h"
#include "time.h"
#include "omp.h"
#include <IL/ilut.h>
#include <IL/ilu.h>
#include "emmintrin.h"
#include "nmmintrin.h"
#include "defs.h"
#include "func.h"
void main()
{
//
//
ilInit(); iluIni... |
/* -*- 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.
*/
#include "core/pch.h"
#ifdef OPSTORAGE_SUPPORT
#include "modul... |
/* -*- Mode: c++; tab-width: 4; indent-tabs-mode: t; c-basic-offset: 4 -*-
**
** Copyright (C) 2011-2012 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/url/url2.h"
#include "mo... |
#include "ScriptMenu.hpp"
#include "Constants.hpp"
#include "MenuExampleScript.hpp"
#include "MenuTexture.hpp"
#include "Script.hpp"
#include "Util/Logger.hpp"
#include "Util/Paths.hpp"
#include "Util/UI.hpp"
#include <inc/main.h>
namespace {
// A few state variables for demoing the menu
bool checkBoxStatus ... |
/* -*- Mode: c++; tab-width: 4; indent-tabs-mode: t; c-basic-offset: 4 -*-
**
** Copyright (C) 1995-2010 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 "modules/logdoc/src/html5/standal... |
#include "Enemy.h"
#include "MyMath.h"
#include <iostream>
Enemy::Enemy()
{
moveto.SetZero();
behavior = GOTOWP;
idleprobability = 0;
myposition.SetZero();
arrived = false;
randprob = 0;
distance = 100;
idletimer = 20;
}
Enemy::~Enemy()
{
}
void Enemy::Init(Behavior behavior, Vector3 moveto, Vector3 mypositio... |
#include "abstractshader.h"
#include "shaderloader.h"
AbstractShader::AbstractShader(const std::string &vertexFile, const std::string &fragmentFile) :
_id(loadShader(vertexFile, fragmentFile))
{
useProgram();
}
AbstractShader::~AbstractShader()
{
glDeleteProgram(_id);
}
void AbstractShader::loadInt(GLuin... |
#include <bits/stdc++.h>
using namespace std;
#define MOD 1000000007
#define rep(i, n) for(int i = 0; i < (int)(n); i++)
#define show(x) for(auto i: x){cout << i << " ";}
#define showm(m) for(auto i: m){cout << m.x << " ";}
typedef long long ll;
typedef pair<int, int> P;
long mod = 1000000007;
/* C++の構造体 メンバがpublicなcla... |
#include <iostream>
#include <algorithm>
#include <vector>
#include <string>
#include <set>
#include <queue>
#include <map>
#include <math.h>
#define mp make_pair
#define ull unsigned long long
using namespace std;
struct point {
long long operator%(point &b) {
return x * b.y - y * b.x;
}
point(long long a, long ... |
/*------------------------------------------------------------------------------*/
/* Developed By: Sri Sagar Abhishek Yeluri */
/* Version : 1.0 */
/* Super Simple File Indexer ... |
#pragma once
#include <vector>
#include <Poco/SharedPtr.h>
#include <Poco/JSON/Object.h>
#include "gwmessage/GWRequest.h"
#include "model/DeviceDescription.h"
namespace BeeeOn {
/**
* @brief Represents a message sent by the gateway to the server after
* discovering a device consisting of a group of subdevices in... |
#include "MiniJavaCompiler.h"
#include "Canon.h"
using namespace MiniJavaCompiler;
CMiniJavaCompiler::CMiniJavaCompiler() : lastOccuredError( EC_NoError )
{
}
CMiniJavaCompiler::~CMiniJavaCompiler()
{
}
TErrorCode CMiniJavaCompiler::Compile( const std::string& sourceCodeFileName, const std::string& asmOutputFileNam... |
#include "queue.hpp"
Queue::Queue() : m_array(nullptr)
, m_size(0)
, m_front(0)
, m_rear(0) {}
Queue::Queue(const int size) : m_size(size)
, m_front(0)
, m_rear(0) {
m_array = new int[m_size];
}
Queue::Queue(co... |
#include <iostream>
#include <vector>
#include "tensorProd.h"
using namespace std;
int main()
{
SpMat A(2, 1);
SpMat B(2, 1);
SpMat C;
std::vector<T> tripletList;
//tripletList.reserve(1);
// A = |0>
tripletList.push_back(T(0,0,1));
A.setFromTriplets(tripletList.begin(), tripletList.end());
A.makeCompress... |
#ifndef ENTITY_H
#define ENTITY_H
#include <SFML\Graphics.hpp>
using namespace std;
class Entity
{
public:
int hp;
float attackSpeed, _projectileSpeed, _Speed; //object attackspeed, speed of projectiles, and movementspeed
Entity(); //Constructor
virtual ~Entity(); //Destructor
sf::Sprite _Sprite;
sf::Vector2i _S... |
/***************************************************************************/
/* */
/* Copyright (c) 2013-2022 Orbbec 3D Technology, Inc */
/* */
/* PROPRIET... |
#ifndef NMOS_ACTIVATION_MODE_H
#define NMOS_ACTIVATION_MODE_H
#include "nmos/string_enum.h"
namespace nmos
{
// Connection API activation mode
// See https://github.com/AMWA-TV/nmos-device-connection-management/blob/v1.0/APIs/schemas/v1.0-activation-schema.json
DEFINE_STRING_ENUM(activation_mode)
name... |
#include <fstream>
int main(int argc, char** argv)
{
std::ofstream fout("targetoutput.h");
if (!fout)
return 1;
fout << "#define TARGETOUTPUT_DEFINE\n";
fout.close();
return 0;
}
|
#include <Q53.h>
// 5.3-综合题02:设计一个算法,判断一个无向图是否为一颗树
int FirstNeighbor(GraphQ53 &G, int v)
{
if(G->adjList[v].firstEdge != nullptr)
{
if(!visits[G->adjList[v].firstEdge->adjvex])
return G->adjList[v].firstEdge->adjvex;
}
return -1;
}
int NextNeighbor(GraphQ53 &G, int v, int &w)
{
... |
/*
6 Channel Full bridge feather board example
This example reads a K-Type thermocouple on channel 0 and does
does cold junction compensation using the integrated temperature
sensor in the AD7794.
2 x 1 MOhm bias resistors are needed for this example to work correctly.
1 between the GND (or VEX-) terminal... |
#include <random>
#include <iostream>
#include <memory>
#include <functional>
void f(int n1, int n2, int n3, int const& n4, int n5) {
std::cout << n1 << " " << n2 << " " << n3 << " " << n4 << " " << n5 << "\n";
}
int g(int n1) {
return n1;
}
struct foo {
void print_sum(int n1, int n2) {
std::cou... |
#include "xr_net_util.h"
#include "xr_util.h"
namespace xr
{
int net_util_t::get_ip_addr(const char *nif, int af, std::string &ipaddr)
{
int ret_code = FAIL;
char ip[INET6_ADDRSTRLEN] = {0};
assert((af == AF_INET) || (af == AF_INET6));
// get a list of network interfaces
struct ifaddrs *ifaddr;
if (::getifaddrs... |
#include <iostream>
#include <tuple>
#include <array>
template<typename... Types>
struct foo {};
template<typename... Types1, template<typename...> typename T1,
typename... Types2, template<typename...> typename T2>
void
func(T1<Types1...> const& t1, T2<Types2...> t2) {
std::cout << sizeof...(Types1) << ... |
#ifndef PECERA_PTY_H
#define PECERA_PTY_H
#include <string>
#include <pthread.h>
#include <semaphore.h>
enum PtyInitResult {
SUCCESS,
ERROR_GET_USERS_SHELL,
ERROR_TCGETATTR,
ERROR_IOCTL_TIOCGWINSZ,
ERROR_OPENPT,
ERROR_GRANTPT,
ERROR_UNLOCKPT,
ERROR_PTSNAME,
ERROR_SET_NONBLOCK,
... |
#include<bits/stdc++.h>
using namespace std;
int main(){
int sum=0;
for(int i=1;i<1000;i++)
{
if(i%5==0 || i%3==0)
{
sum=sum+i;
}
}
cout<<sum;
}
|
//
// main.cpp
// Lab1Progr
//
// Created by Дмитрий Богомолов on 12.09.14.
// Copyright (c) 2014 Дмитрий Богомолов. All rights reserved.
//
#include <iostream>
#include "Task.h"
#include "Binary.h"
using namespace std;
int main(int argc, const char * argv[]) {
Task a = "51";
Task b = "21";
cout << a ... |
/* -*- 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"
#ifdef _NATIVE_... |
#include <iostream>
#include <string>
using namespace std;
int main() {
string str;
cin >> str;
int alphabet[26] = {0};
int len = str.length();
for (int i = 0; i < len; i++) {
if ('A' <= str[i] && str[i] <= 'Z') {
alphabet[str[i] - 'A']++;
} else if ('a' <= str[i] && str[i] <= 'z') {
alph... |
/*
Copyright (c) 2015, Vlad Mesco
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 conditions and the following dis... |
#include <iostream>
#include <vector>
#include "StrongDataTypes.h"
#include "Utils.h"
using namespace std;
using namespace utils;
template <typename CollectionType>
void MaxHeapify(std::vector<CollectionType>& collection) {
std::make_heap(begin(collection), end(collection));
}
int main() {
// simple integer ... |
// Created on: 1993-01-27
// Created by: Isabelle GRIGNON
// Copyright (c) 1993-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 G... |
/* -*- Mode: c++; tab-width: 4; indent-tabs-mode: t; c-basic-offset: 4; c-file-style:"stroustrup" -*-
**
** Copyright (C) 1995-2012 Opera Software ASA. All rights reserved.
**
** This file is part of the Opera web browser. It may not be distributed
** under any circumstances.
**
** Espen Sand
*/
#ifndef X11_WINDOW_D... |
#include "SimExamples/SimVertex.h"
IDirect3DVertexDeclaration9 *VertexPos::decl = 0;
IDirect3DVertexDeclaration9 *VertexPosClr::decl = 0;
IDirect3DVertexDeclaration9 *VertexPosN::decl = 0;
IDirect3DVertexDeclaration9 *VertexPosT::decl = 0;
IDirect3DVertexDeclaration9 *VertexPNT::decl = 0;
const DWORD VertexPos::FVF = ... |
#include <iostream>
#include <algorithm>
using namespace std;
#define REP(i,n) for (int i=0; i<n; i++)
int n,c,ans;
int main() {
string s;
cin >> n >> s;
c = 0;
for (int i=1; i<n; i++) {
if (s[i] == 'E') c++;
}
ans = c;
for (int i=1; i<n; i++) {
if (s[i] == 'E') c--;
if (s[i-1] == 'W') c++;... |
//知识点:二分答案,贪心
/*
By :Luckyblock
一些浅显的性质:
1. 对于每一珂子树上的军队 , 上跳到 根节点的 直接子节点更优.
2. 如果一珂子树上没有 军队,需要从其他子树来获得军队.
此时 , 支援军队到达该子树根部更优
3. 对于军队的转移 , 除了从根节点 向 根节点的直接子节点以外, 不会向下转移
4. 策略: 保证某珂子树上的叶节点都被控制的情况下 , 尽量将军队向其他子树转移.
一些不那么浅显的结论:
5. 假设每棵子树上都有军队 ,
那么只需要使军队上跳到 可以完全控制此子树叶节点的位置 :
- 二分答案枚举最长的时间 , 转移使用时间... |
/* -*- coding: utf-8 -*-
!@time: 2020/3/7 2:13
!@author: superMC @email: 18758266469@163.com
!@fileName: 0055_entry_point_of_a_ring_in_a_linked_list.cpp
*/
#include <environment.h>
using self_envs::ListNode;
class Solution {
public:
ListNode *EntryNodeOfLoop(ListNode *pHead) {
if (pHead == nullpt... |
#pragma once
#include "bibliotecas.h"
class Aluno{
public:
string nome;
Lista<double> nota;
Aluno(){
};
Aluno(string nome, Lista<double> nota){
this->nome=nome;
this->nota=nota;
}
void adiciona(string nome, Lista<double> nota){
this->nome=nome;
this->nota=... |
/******************************************************************************
* $Id$
*
* Project: libLAS - http://liblas.org - A BSD library for LAS format data.
* Purpose: LAS color class
* Author: Howard Butler, hobu.inc@gmail.com
*
***********************************************************************... |
/* ------------------------------------------------------------------
* Copyright (C) 1998-2009 PacketVideo
*
* 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.o... |
#pragma once
namespace arithmetic_parser
{
enum class BuiltinFunctionType
{
None = 0,
SignPlus,
SignMinus,
Addition,
Subtraction,
Multiplication,
Division,
Power,
Absolute,
Sinus,
Cosine,
Tangent,
Cotangent,
Arcsine,
Arccosine,
Arctangent,
Arccotangent,
NaturalLogarithm,... |
/* -*- Mode: c++; tab-width: 4; indent-tabs-mode: t; c-basic-offset: 4 -*-
*
* Copyright (C) 1995-2012 Opera Software ASA. All rights reserved.
*
* This file is part of the Opera web browser. It may not be distributed
* under any circumstances.
*/
#include "core/pch.h"
#include "adjunct/quick/controller/Custom... |
#ifndef MINESWEEPER_H
#define MINESWEEPER_H
#include <QMouseEvent>
#include <QWidget>
#include <QtGui>
#include <QTime>
#include <QPainter>
#include <stdlib.h>
#include <time.h>
#include <vector>
#include <string>
#include <QInputDialog>
#include <QMessageBox>
class mine
{
public:
mine(int nval = 9);
bool get... |
#pragma once
#include <queue>
#include <Poco/AtomicCounter.h>
#include <Poco/Event.h>
#include <Poco/Mutex.h>
#include <Poco/Timespan.h>
#include "loop/StoppableRunnable.h"
#include "util/AsyncExecutor.h"
#include "util/Loggable.h"
namespace BeeeOn {
class SequentialAsyncExecutor :
public StoppableRunnable,
publ... |
#ifndef wali_wpds_WRAPPER_GUARD
#define wali_wpds_WRAPPER_GUARD 1
/**
* @author Nicholas Kidd
*/
#include "wali/Common.hpp"
#include "wali/Countable.hpp"
#include "wali/SemElem.hpp"
#include "wali/MergeFn.hpp"
namespace wali
{
namespace wfa {
class ITrans;
}
namespace wpds
{
class Rule;
names... |
#include <fstream>
#include "rawDnaWriter.h"
rawDnaWriter::rawDnaWriter(const std::string& data)
{
m_data = data;
}
void rawDnaWriter::write(std::string data)const{
std::ofstream myfile;
myfile.open(m_data.c_str());
myfile << data;
myfile.close();
}
|
// KC Text Adventure Framework - (c) Rachel J. Morris, 2012 - 2013. zlib license. Moosader.com
#include "Mission.h"
#include "../IOUtils/Utils.h"
#include "../IOUtils/GameIO.h"
void Mission::Init(lua_State* state)
{
m_wMission.Init( state );
}
int Mission::DisplayMissionList()
{
std::vector<std::string> lstM... |
// Fill out your copyright notice in the Description page of Project Settings.
#pragma once
#include "CoreMinimal.h"
#include "GameFramework/Character.h"
#include "PlayerCharacter.generated.h"
class UAnimSequence;
UCLASS()
class FINALCOUNTDOWN_API APlayerCharacter : public ACharacter
{
GENERATED_BODY()
public:
... |
//Line Sensors
#define rightSensor 14
#define midSensor 15
#define leftSensor 16
//HBridgeL //dont use these unless with an hbridge
#define LAnalog 10
#define LIn1 7
#define LIn2 8
// HBridgeR //dont use these unless with an hbridge
#define RAnalog 9
#define RIn3 5
#define RIn4 6
//LEDs
#define ledRed ... |
/* -*- Mode: c++; tab-width: 4; indent-tabs-mode: t; c-basic-offset: 4 -*-
**
** Copyright (C) 2005-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.h"
#include "modules/display/webfont_manager.... |
#include <iostream>
#include <fstream>
using namespace std;
int main (int argc, char * argv[]){
ifstream dna_file (argv[1]);
char x;
string complement="";
while (dna_file.get(x)){
if(x=='A'){
complement+='T';
}if(x=='T'){
complement+='A';
}if (x=='C'){
complement+='G';
}if (x=='G'){
complement+... |
#include "storage/storagesystem.hpp"
#include "storage/storagejob.hpp"
#include "entities/entity.hpp"
#include "components/room.hpp"
#include "components/item.hpp"
#include "components/foodstuff.hpp"
#include "job/job.hpp"
#include "job/joblist.hpp"
#include "city.hpp"
#include <algorithm>
namespace storage {
St... |
#include <stdio.h>
#include <stdint.h>
#include <unistd.h>
#include <stdlib.h>
#include <openssl/aes.h>
#include <fcntl.h>
#include <sched.h>
#include <sys/mman.h>
#include "./cacheutils.h"
#include <map>
#include <vector>
#include <ctype.h>
#include <termios.h>
#include <sys/stat.h>
#include <sys/types.h>
# include <s... |
#include <stdio.h>
int main() {
int valor;
printf("Digite um valor entre 0 e 9: ");
scanf("%d", &valor);
if (valor < 0 || valor > 9) {
printf("Valor %d invalido.", valor);
}
else {
printf("Valor %d valido.", valor);
}
}
|
#include <iostream>
using namespace std;
class Tester {
private:
int x = 4;
public:
void modifier() const;
void modifier1();
};
void Tester::modifier() const {
cout << x << "\n";
}
void Tester::modifier1() {
x++;
}
int main() {
Tester t;
t.modifier();
t.modifier1();
t.modifier();
return 0;
}
|
#pragma once
#include <glm/glm.hpp>
#include "Window.hpp"
#include "Audio/Audio.hpp"
#include "Interaction/Events.hpp"
class Player {
public:
Player(Audio& audio, glm::vec4 dims);
void onUpdate();
void onEvent(Event& e);
void renderImGui();
void hide();
void show();
void setDims(glm::vec4 dims);
void setAu... |
// Hash.cc
#include <iostream>
#include <memory>
#include <vector>
#include <string>
#include "hash.h"
namespace expression{
HashContent::HashContent(std::string op, int val):
pImplement(new Implement(op, val)){}
HashContent::~HashContent(){}
HashContent::HashContent(const HashContent&) = defaul... |
// Pen2View.h: CPen2View 클래스의 인터페이스
//
#pragma once
class CPen2View : public CView
{
protected: // serialization에서만 만들어집니다.
CPen2View() noexcept;
DECLARE_DYNCREATE(CPen2View)
// 특성입니다.
public:
CPen2Doc* GetDocument() const;
// 작업입니다.
public:
// 재정의입니다.
public:
virtual void OnDraw(CDC* ... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.