text stringlengths 8 6.88M |
|---|
/*
ID: stevenh6
TASK: zerosum
LANG: C++
*/
#include <fstream>
#include <iostream>
#include <string>
using namespace std;
ofstream fout ("zerosum.out");
ifstream fin ("zerosum.in");
int n;
int oset[10] = {0};
void check()
{
int sign = 1;
int r = 0;
int oper = 0;
for (int i = 1; i <= n - 1; ++i)
... |
/**
(
( )\ )
( )\ (()/( ( ) ( ( ( (
)((_) /(_)) ))\( /( )( ( )\ ( )\))(
((_)_ (_)) /((_)(_)|()\ )\ |(_) )\ )((_))\
/ _ \ | | (_))((_)_ ((_)_(_/((_)_(_/( (()(_)
| (_) | | |__/ -_) _` ... |
#pragma once
#include "baseview.hpp"
#include "mapview.hpp"
struct MainView : BaseView {
MainView(struct ViewStack* vs, struct City* c);
virtual void render_body(Graphics& g, render_box const& pos) override;
virtual void handle_keypress(KeyboardKey ks) override;
struct HelpView* hview;
struct UnitView* uv... |
#include <iostream>
#include <fstream>
using namespace std;
int a[100][100], n, m;
void bf(int start)
{
int vizitat[n + 1] = {0};
int prim, ultim; // prim si ultim reprezinta prima, respectiv ultima pozitie din coada
prim = ultim = 1; // la inceput coada este goala, deci prima pozitia este egala cu ultima... |
// Copyright 2012 Yandex
#include <cmath>
#include "ltr/density_estimators/non_linear_discriminant.h"
#include "ltr/utility/eigen_converters.h"
using ltr::NonLinearDiscriminant;
using ltr::utility::InitEigenMatrix;
using ltr::utility::InitEigenVector;
namespace ltr {
double NonLinearDiscriminant::estimate(const Ob... |
/*!
* \file mpredelegate.h
* \author Simon Coakley
* \date 2012
* \copyright Copyright (c) 2012 University of Sheffield
* \brief Header file for mpre delegate
*/
#ifndef MPREDELEGATE_H_
#define MPREDELEGATE_H_
#include <QItemDelegate>
#include <QModelIndex>
#include <QObject>
#include <QSize>
#include <QSpinBox>
... |
#include <ESP8266WiFi.h>
#include <WiFiClient.h>
#include <ESP8266WebServer.h>
#include <Wire.h>
#include <VL6180X.h>
char ssid[] = "FIT5140";
char pass[] = "fit5140password";
ESP8266WebServer server(80);
VL6180X sensor;
String webString = "";
uint8_t distance;
void setup(void)
{
Serial.begin(115200);
WiFi.... |
#include"conio.h"
#include"stdio.h"
void main(void)
{
int a,x=0;
clrscr();
printf("Enter value: ");
scanf("%d",&a);
for(int i=1; i<=a; i++){
x+=(a%i==0);
if(x>2)
break;
}
if(x==2)
printf("%d, is Prime No.",a);
else
printf("%d is Not Prime No.",a);
getch();
} |
#include <bits/stdc++.h>
#define loop(i,s,e) for(int i = s;i<=e;i++) //including end point
#define pb(a) push_back(a)
#define sqr(x) ((x)*(x))
#define CIN ios_base::sync_with_stdio(0); cin.tie(0);
#define ll long long
#define ull unsigned long long
#define SZ(a) int(a.size())
#define read() freopen("i... |
/* -*- 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.
*/
#ifndef __OP_RESOURCE_IMPL_H__
#define __OP_RESOURCE_IMPL_H__
#... |
#include "ManagerPull.h"
#include "../classes/AppBill.h"
ManagerPull::ManagerPull(string masterCS, string slaveCS) {
part_size = 100;
db_master.setCS(masterCS);
db_slave.setCS(slaveCS);
errors_count = 0;
//bandwidth_limit_mbits = app().conf.db_bandwidth_limit_mbits;
}
void ManagerPull::add(BasePu... |
//给定一棵二叉搜索树,请找出其中的第k小的结点。
//例如, (5,3,7,2,4,6,8) 中,按结点数值大小顺序第三小结点的值为4。
#include <iostream>
#include <vector>
#include "utils.h"
using namespace std;
class Solution {
public:
TreeNode* KthNode(TreeNode* pRoot, int k) {
if (pRoot == nullptr) return nullptr;
vector<int> res{};
__inOrder(pRoot, res);
if ((... |
/*
* This file contains all interrupt routines and their handling
*
* Creation date: 2019 06 16
* Author: Pascal Pfeiffer
*/
// includes
#include "interruptRoutines.h"
#include "PublicStructures.h"
#include "protocol.h"
#include "lidar.h"
#include "lineTracking.h"
#include "readSensors.h"
#include <HCSR04P.h>
#i... |
////////////////////////////////////////////////////////////////////////////////
#include "Mesh3d.h"
#include <cellogram/Mesh.h>
#include <cellogram/State.h>
#include <cellogram/remesh_adaptive.h>
#include <polyfem/State.hpp>
#include <polyfem/Mesh3D.hpp>
#include <polyfem/MeshUtils.hpp>
#include <igl/writeOBJ.h>
#incl... |
#include <opencv2/opencv.hpp>
#include <iostream>
using namespace cv;
int main(int argc, char const *argv[])
{
Mat img = imread(argv[1], -1);
if( img.empty() ) return -1;
auto & data = img.data;
for (uint i =0; i < img.cols * img.rows*3 ; i++)
{
std::cout << (int)(*(data + i)) << " ";
}
namedWindow("Exampl... |
#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 ... |
#include "Bool.hpp"
using namespace uipf;
// returns the value of the boolean
bool Bool::getContent() const {
return b_;
}
// sets the value of the boolean
/*
b new boolean value
*/
void Bool::setContent(bool b) {
b_ = b;
}
// returns the data type of this data object: in this case: BOOL
Type Bool::getType() cons... |
#include "Sphere.h"
Sphere::Sphere() {
radius = radius;
xOrigin = 0;
yOrigin = 0;
zOrigin = 0;
rgb.r = 0;
rgb.g = 0;
rgb.b = 0;
tag = "none";
}
Sphere::~Sphere() {
delete material;
}
void Sphere::setMaterial(Material* mat) {
material = mat;
};
Material* Sphere::getMaterial() {
return material;
}
void S... |
// -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=//
// Проверка корректности ввода логина и пароля
// V 1.0
// -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=//
#include <iostream>
using namespace std;
int main() {
bool flag;
cout << "Придумайте логин" << endl;
st... |
// KC Text Adventure Framework - (c) Rachel J. Morris, 2012 - 2013. zlib license. Moosader.com
#include "StateManager.h"
StateManager::StateManager()
{
m_state = luaL_newstate();
luaL_openlibs( m_state );
// luabind::open( m_state );
Init();
}
StateManager::~StateManager()
{
lua_close( m_state );
... |
#ifndef _GAME_STATE_H_
#define _GAME_STATE_H_
#include <SFML\System\Export.hpp>
#include <memory>
#include <RenderAttributes.h>
#include "Enums.h"
class TestApp;
class CAssetsDatabase;
struct SRenderAttributes;
class CTransition;
struct InputsInfo;
class CGameState
{
public:
CGameState( TestApp* pApp, CAssetsDataba... |
#pragma once
#include "Engine/graphics/SpringCamera.h"
class SpringCamera;
class GameCamera :public GameObject
{
public:
GameCamera();
~GameCamera();
void Update();
void normal();
void focus();
void SetTarget(CVector3 tar) {
m_target = tar;
}
void SetPosition(CVector3 pos) {
m_pos = pos;
}
private:
boo... |
/****************************************************************************
* *
* Author : lukasz.iwaszkiewicz@gmail.com *
* ~~~~~~~~ *
* Lice... |
/*
2. Add Two Numbers
Medium
7742
1986
Add to List
Share
You are given two non-empty linked lists representing two non-negative integers. The digits are stored in reverse order and each of their nodes contain a single digit. Add the two numbers and return it as a linked list.
You may assume the two numbers do not ... |
#include "threadmanager.h"
#include "ithread.h"
#include "receiver/receiver.h"
#include "port/serial.h"
#include <unistd.h>
#include <QThread>
#include <QMap>
#include <stdio.h>
ThreadManager::ThreadManager()
{
// usart2 = USART2::getInstance();
// usart2->initSerialPort(Serial::DATABITS_EIGHT, Serial::PARITY_... |
#include "LogComingProc.h"
#include "Logger.h"
#include "HallManager.h"
#include "Room.h"
#include "ErrorMsg.h"
#include "GameApp.h"
#include "MoneyAgent.h"
#include "RoundAgent.h"
#include "GameCmd.h"
#include "Protocol.h"
#include "ProcessManager.h"
#include "BaseClientHandler.h"
#include "ProtocolServerId.h"
#includ... |
//知识点: 简单数学推导, 暴力, 枚举
/*
分析题意:
- 通过 简单分析 和 观察样例 , 可以发现 :
相等的数列元素 作为 x_a,x_b,x_c,x_d 出现的次数相同
而n<=15000 , 所以 可以用桶直接 记录 每一种数 值出现的次数
输出时 直接输出 某数列元素对应数值 作为 x_a,x_b,x_c,x_d 出现的次数即可
- 对 题目给出 限制条件 进行转化:
- x_a<x_b<x_c<x_d ①
x_b-x_a=2(x_d-x_c) ②
x_b-x_a<(x_c-x_b)/3 ③
- 设 t = x_d-x_c
... |
#include "stdafx.h"
#include <stdio.h>
#include "QuoteAPI.h"
QuoteAPI::QuoteAPI(void)
{
}
QuoteAPI::~QuoteAPI(void)
{
}
void QuoteAPI::OnFrontConnected()
{
if(_fnOnFrontConnected)
{
_fnOnFrontConnected();
}
}
void QuoteAPI::OnFrontDisconnected(int nReason)
{
if(_fnOnFrontDisconnected)
{
_fnOnFrontDisconn... |
/* -*- Mode: c++; tab-width: 4; indent-tabs-mode: t; c-basic-offset: 4 -*-
**
** Copyright (C) 1995-2007 Opera Software ASA. All rights reserved.
**
** This file is part of the Opera web browser. It may not be distributed
** under any circumstances.
*/
#ifndef SBCS_DECODER_H
#define SBCS_DECODER_H
#ifdef ENCODINGS_... |
#pragma once
#ifndef CAMERA_H
#define CAMERA_H
#include "math\Mat4.h"
namespace NoHope
{
class Camera
{
public:
Camera();
~Camera();
/*void draw();*/
/*void update(float dt);*/
void setCameraPosition(float x,float y);
Mat4 cameraViewMatrix();
Mat4 view;
private:
/*float x,y;*/
Camera(Camera&... |
#include "Player.h"
#include "Game.h"
#include <QGraphicsItem>
extern Game * game;
Player::Player(QGraphicsItem *parent): QObject(), QGraphicsPixmapItem(parent)
{
QPixmap image(":/Images/plane.png");
setPixmap(image.scaled(QSize(70,70)));
}
Player::~Player()
{
}
void Player::keyPressEvent(QKeyEvent * event){
i... |
// Fill out your copyright notice in the Description page of Project Settings.
#pragma once
#include "GeneticAI.h"
#include "Blueprint/UserWidget.h"
#include "NeuralNetworkWidget.generated.h"
class USafeZone;
class UVerticalBox;
class UHorizontalBox;
class ANeuralNetworkManager;
UCLASS()
class GENETICAI_API UNeuralN... |
#define MAX_INT 1000000
#define MAX_N 400000
#include <stdio.h>
#include<iostream>
using namespace std;
long long int count=0;
int main(){
int quicksort(int *x,int *y,int lef, long long int righ);
int mergesort(int *L,long long int n);
//输入
long long int n;
scanf("%d",&n);
int x[MAX_N];
int y... |
/* -*- Mode: c++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*-
*
* Copyright (C) Opera Software ASA 2009 - 2011
*
* WebGL GLSL compiler -- parser.
*
* Inspired some by es_parser.
*/
#include "core/pch.h"
#ifdef CANVAS3D_SUPPORT
#include "modules/webgl/src/wgl_base.h"
#include "modules/webgl/src/wg... |
/*
* HashTable.h
*
* Created on: Aug 19, 2014
* Author: deforestg
*/
#include <iostream>
using namespace std;
#ifndef HASHTABLE_H_
#define HASHTABLE_H_
#define INITIAL_SIZE 10
#define MAXIMUM_LOAD_FACTOR 0.5f
template<typename Type>
struct bucket {
std::string key;
Type value;
};
template <typename Ty... |
#ifndef HERA_COMMON_HASH_COMBINE_H
#define HERA_COMMON_HASH_COMBINE_H
namespace hera {
template <class T>
inline void hash_combine(std::size_t& seed, const T& v)
{
std::hash<T> hasher;
seed ^= hasher(v) + 0x9e3779b9 + (seed << 6) + (seed >> 2);
}
}
#endif
|
#pragma once
#include <UtH/UtHEngine.hpp>
class Projectile : public uth::Component
{
public:
Projectile(uth::GameObject* target, float damage, float speed);
Projectile();
~Projectile();
void Init() override;
void Draw(uth::RenderTarget& target) override;
void Update(float delta) override;
uth::GameObjec... |
// Copyright 2019 Erik Teichmann <kontakt.teichmann@gmail.com>
#ifndef INCLUDE_SAM_OBSERVER_POSITION_OBSERVER_HPP_
#define INCLUDE_SAM_OBSERVER_POSITION_OBSERVER_HPP_
#include <vector>
namespace sam {
/*!
* \brief Observer for the position and the time.
*
* The observer saves the position and time of the system ... |
#ifndef _TRIANGLE_H
#define _TRIANGLE_H
#include "sjfwd.h"
#include "shape.h"
#include "point.h"
class triangle : public shape {
public:
point A;
point B;
point C;
triangle(point a, point b, point c, bool fl = false){
this->A = a;
this->B = b;
this->C = c;
this->fill = fl;
}
bool ... |
#include "test_precomp.hpp"
static const char* extraTestDataPath =
#ifdef WINRT
NULL;
#else
getenv("OPENCV_DNN_TEST_DATA_PATH");
#endif
CV_TEST_MAIN("",
extraTestDataPath ? (void)cvtest::addDataSearchPath(extraTestDataPath) : (void)0
)
namespace cvtest
{
using namespace cv;
using namespace cv::d... |
#include <iostream>
using namespace std;
int main() {
int v;
cin >> v;
cout << (v == 2 ? 2 : 1) << endl;
return 0;
}
|
//
// SizeLimitedDeque.h
// LostSignalTrackingNew
//
// Created by Andreas Müller on 26/08/2014.
//
//
#pragma once
#include <string>
using namespace std;
template <class T>
class SizeLimitedDeque
{
public:
// -----------------------------------------
SizeLimitedDeque()
{
maxSize = -1;
}
// ----... |
#include <cstdlib>
#include <iostream>
#include <string>
#include <vector>
#include <sstream> // manipulate string
#include <limits> // used to find min and max values of different data type
int main() {
// 1 - 18, 21, 50, > 65
std::string sAge = "0";
std::cout << "Enter your age: ";
getline(std::cin, sAge... |
#include "Viewer.h"
Viewer::Viewer() {
loginWidget = std::make_shared<LoginWidget>();
mainWidget = std::make_shared<MainWidget>();
connect(loginWidget.get(), SIGNAL(openMainWidget()),
mainWidget.get(), SLOT(afterLogin()));
}
void Viewer::runApp() {
auto controller = Controller::getInstance... |
#include <iostream>
#include <cstdio>
#include <algorithm>
#include <vector>
#include <functional>
#include <queue>
#include <string>
#include <cstring>
#include <numeric>
#include <cstdlib>
#include <cmath>
using namespace std;
typedef long long ll;
#define INF 10e10
#define rep(i,n) for(int i=0; i<n; i++)
#define r... |
#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... |
#include<iostream>
#include<cstdio>
#include<map>
#include<set>
#include<vector>
#include<stack>
#include<queue>
#include<string>
#include<cstring>
#include<sstream>
#include<algorithm>
#include<cmath>
#define INF 0x3f3f3f3f
#define eps 1e-8
#define pi acos(-1.0)
using namespace std;
typedef long long L... |
#include<iostream>
using namespace std;
bool isprime(int n)
{
if(n<=1)
return false;
for(int i=2;i<n;i++)
if(n%i==0)
return false;
return true;
}
bool isemirp(int n)
{
if(isprime(n)== false)
return false;
int rev=0;
while(n!=0)
{
int lastdigit=n%10;
rev= rev*10+lastdigit;
n=n/10;
... |
#include <iberbar/LuaCppApis/Utility.h>
#include <iberbar/LuaCppApis/Utility_Names.h>
#include <iberbar/Lua/LuaError.h>
#include <iberbar/Lua/LuaCppBuilder.h>
#include <iberbar/Lua/LuaCppInstantiateDef.h>
#include <iberbar/Utility/String.h>
#include <iberbar/Utility/FileHelper.h>
#include <filesystem>
namespace i... |
#pragma once
#include "role.hpp"
#include "db/message.hpp"
#include "db/connector.hpp"
#include "scene/log.hpp"
#include "scene/common_logic.hpp"
#include "scene/item_logic.hpp"
#include "scene/shop.hpp"
#include "scene/xinshou.hpp"
#include "scene/event.hpp"
#include "scene/quest.hpp"
#include "scene/player/role_logi... |
#pragma once
#include <iberbar/Utility/Ref.h>
#include <iberbar/Utility/Rect.h>
#include <iberbar/Utility/Clonable.h>
#include <vector>
namespace iberbar
{
class CTransform2D;
IBERBAR_UNKNOWN_PTR_DECLARE( CTransform2D );
class __iberbarUtilityApi__ CTransform2D
: public CRef, public IClonable
{
pro... |
/* -*- 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.
*/
#ifndef QUICK_BINDER_SELECTABLE_H
#define QUICK_BINDER_SELECTABL... |
#include "magic_wand_model_data.h"
// We need to keep the data array aligned on some architectures.
#ifdef __has_attribute
#define HAVE_ATTRIBUTE(x) __has_attribute(x)
#else
#define HAVE_ATTRIBUTE(x) 0
#endif
#if HAVE_ATTRIBUTE(aligned) || (defined(__GNUC__) && !defined(__clang__))
#define DATA_ALIGN_ATTRIBUTE... |
#include "GLSL.h"
GLSL::GLSL() : _numAttributes(0), _programId(0), _vertexShaderId(0), _fragmentShaderId(0) {
}
GLSL::~GLSL() {
}
void GLSL::compileShaders(const std::string& vertexShaderFilePath, const std::string& fragmentShaderFilePath){
_programId = glCreateProgram();
_vertexShaderId = glCreateShader(GL_VERTE... |
/****************************************************************************
* *
* Author : lukasz.iwaszkiewicz@gmail.com *
* ~~~~~~~~ *
* Lice... |
#ifndef SESSION_H
#define SESSION_H
#include <QList>
#include "SessionManager.h"
#include "NetManager.h"
#include "HostID.h"
#include "Packet.h"
class NetManager;
class Session
{
friend class SessionManager;
private:
unsigned int m_sessionKey;
NetManager * m_cnet;
QList<HostID> m_h... |
/******************************************************************************
* *
* Copyright 2018 Jan Henrik Weinstock *
* *
... |
/* -*- Mode: c++; tab-width: 4; 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.
*/
/** \file
* This file declares the UpdatableResource base class representing resource... |
#include "spliter.hpp"
class SpliterFactory {
public:
virtual ISpliter* CreateSpliter(std::string path, size_t count) = 0;
};
class BinarySpliterFactory : public SpliterFactory {
public:
ISpliter* CreateSpliter(std::string path, size_t count) {
return new BinarySpliter(path, count);
}
};
class PictureS... |
//Inclass Challenge 9.1: Create a custom Point class with a 2 parameter constructor and the methods: distance_to_origin(), printout(), distance(Point point2)
//Kartik Nagpal - kn8767 - 10/30/18
#include <iostream>
#include <random>
#include <cmath>
using std::cout;
using std::endl;
class Point{
private:
float x, ... |
#include "stdafx.h"
#include <stdio.h>
#include <stdlib.h>
#include <time.h>
#include <math.h>
#include <string.h>
#include <vector>
#include "backprop.h"
#define LAMBDA 1.0
#define ETA 0.1
#define SQR( x ) ( ( x ) * ( x ) )
void randomize( double * p, int n )
{
for ( int i = 0; i < n; i++ ) {
p[i] = ( double )r... |
//orgCode.cpp
#include "menu.h"
#include <iostream>
#include <iomanip>
#include <string>
#include <windows.h>
#include <time.h>
#include <stdlib.h>
#include <conio.h>
#include <vector>
#include <fstream>
#include <sstream>
#include <math.h>
#define ESYS "Employee System"
#define MSYS "Master System"
#define ETITLE "==... |
#pragma once
#include "SIngletonBase.h"
/*
ini 파일은
대단락
키
값으로 되어있음
*/
//struct tagIniData {
// const char* section;
// const char* key;
// const char* value;
//};
struct tagIniData {
char section[32];
char key[32];
char value[32];
};
class IniData : public SingletonBase<IniData>
{
private:
vector<tagIniData> _v... |
// Created on: 1994-06-01
// Created by: Christian CAILLET
// 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 ... |
#ifndef __CAMERA_H__
#define __CAMERA_H__
/*
Generic camera class by Nghia Ho
*/
class Camera
{
private:
float m_x, m_y, m_z; // Position
float m_lx, m_ly, m_lz; // Direction vector of where we are looking at
float m_yaw, m_pitch; // Various rotation angles
float m_strafe_lx, m_strafe_lz; // Always ... |
#include "SimplePgMatcher.h"
#include "copmem/CopMEMMatcher.h"
#include "../pseudogenome/persistence/SeparatedPseudoGenomePersistence.h"
#include "../utils/LzmaLib.h"
namespace PgTools {
SimplePgMatcher::SimplePgMatcher(const string &srcPg, uint32_t targetMatchLength,
uint32... |
#ifndef ZOO_H
#define ZOO_H
using namespace std;
class Zoo{
private:
int bank_balance;
Tiger * tigers;
SeaLion * sealions;
Bear * bears;
int tiger_count;
int sea_lion_count;
int bear_count;
bool attendance_boom = false;
int base_cost = 80;
... |
//知识点:二分答案,前缀和
/*
By:Luckyblock
题目要求:
给定 一数列a, 给定m个区间[li,ri], 给定一参数S
可任意选择 参数W的值
区间i的贡献 Yi = ∑(区间内>=W的数的数量) * ∑(区间内>=W的数的权值和)
总贡献 = abs(∑Yi - S);
求 令总贡献最小的 参数W的值
分析题意:
- 对于所求的 W, 发现如下性质:
当 W 单增时, wj大于等于W的 元素数量 单减, 总贡献Y单减
当 W 单减时, wj大于等于W的 元素数量 单增, 总贡献Y单增
发现 W 的取值 与Y呈 负相关, 则可以通过二分答案 枚举W;
... |
#ifndef TINKER_INTERFACE_HPP
#define TINKER_INTERFACE_HPP
#include <cstdint>
/* Here is the minimal c++ side Fortran interface to tinker (see tinker_interface.f95 for fortran side)
*
* Any Fortran subroutine should be called using only pointers, and the return type is always void
*
* In C++ they should be decla... |
/*
SettingsWnd.cpp
Source file for class SettingsWnd.
@author: Martin Terneborg.
*/
#include "SettingsWnd.h"
#include <CommCtrl.h>
#include "InitCtrls.h"
#define CONTROLTEXT_MAXREFRESHRATE L"Max refresh rate:"
#define CONTROLTEXT_SAMPLESIZE L"Sample size:"
#define CONTROLTEXT_SAVEANDEXIT L"Save... |
extern int qInitResources_skipRccGood();
int main(int, char**)
{
// Fails to link if the symbol is not present.
qInitResources_skipRccGood();
return 0;
}
|
// This file is part of HemeLB and is Copyright (C)
// the HemeLB team and/or their institutions, as detailed in the
// file AUTHORS. This software is provided under the terms of the
// license in the file LICENSE.
#include "extraction/PropertyActor.h"
namespace hemelb
{
namespace extraction
{
PropertyActor:... |
#include <string>
#include <cmath>
#include <fstream>
#include <iostream>
#include <sstream>
#include <list>
#include <algorithm>
#include <set>
#include <map>
#include <stack>
#include <queue>
#include <numeric>
#include <bitset>
#include <deque>
//#include <random>
#include <string.h>
#include <stdlib.h>
#include <ve... |
#include <iostream>
using namespace std;
class Circle
{
public:
float radius, area;
public:
void read();
void compute();
void display();
};
void Circle::read()
{
cout << "Enter the radius : ";
cin >> radius;
}
void Circle::compute()
{
area = 3.14 * radius * radi... |
//----------------------------------------------------------------
// Icon.cpp
//
// Copyright 2002-2004 Raven Software
//----------------------------------------------------------------
#include "../idlib/precompiled.h"
#pragma hdrstop
#include "Game_local.h"
#include "Icon.h"
/*
===============
rvIcon::rvIcon
====... |
#pragma once
#include <istream>
#include <Poco/SAX/SAXParser.h>
#include <Poco/XML/NamePool.h>
#include <Poco/DOM/Document.h>
namespace Poco {
namespace XML {
class XMLReader;
}
}
namespace BeeeOn {
class DenyDTDHandler;
/**
* The parser prevents parsing documents containing DTD definitions.
* The purpose is ... |
/*
* Ещё одна реализация шаблона посетителя, который проверяет типы данных переменных и методов
*/
#pragma once
#include "Visitor.h"
#include "Table.h"
#include <assert.h>
class CTypeChecker : public IVisitor
{
public:
CTypeChecker( CSymbolsTable::CTable *_table )
: table( _table ), currentClass( NULL ), currentMe... |
# include <iostream>
namespace std;
int main() {
//================================
for (int n=10; n>0; n--)
{
cout << n << ", ";
if (n==5)
{
cout << "aborted!";
break;
}
}
//================================
for (int n=5; n>0; n--) {
if (n==3)
cont... |
#pragma once
#ifdef _WINDOWS
#include <GL/glew.h>
#endif
#include <SDL.h>
#include <SDL_opengl.h>
#include <SDL_image.h>
#include "ShaderProgram.h"
#include "Entity.h"
class Bullet{
public:
Bullet(Entity* shooter);
float getPositionX();
float getPositionY();
void Draw(GLuint textureID, ShaderProgram... |
///////////////////////////////////
// Filename: InputClass.cpp
//////////////////////////////////
#include "InputClass.h"
InputClass::InputClass()
{
m_directInput = 0;
m_keyboard = 0;
m_mouse = 0;
}
InputClass::InputClass(const InputClass& other)
{
}
InputClass::~InputClass()
{
}
bool InputClass::Initialize(HI... |
#include <Arduino.h>
#include <FastLED.h>
#include "Gamma.h"
void Gamma::initPower(const float p) {
for (int i=0; i<256; i++) {
// Regular gamma function, gamma = 2.8
_lut[i] = powf((float)i/255, p) * 255 + 0.5;
}
}
void Gamma::initAntiLog(const float p) {
const float scaleBack = powf(2, p) - 1;
for ... |
#include "Chickens.h"
Chickens::Chickens()
{
}
Chickens::Chickens(string textureName) : Rect(textureName)
{
this->init();
pos = false;
this->health = 1;
nextChange = 0;
}
void Chickens::Update(GLfloat deltaTime)
{
}
Chickens::~Chickens()
{
}
|
#pragma once
#include <iosfwd>
#include <cmath>
#include "vector.h"
#include "vector2.h"
namespace sbg {
template<typename T>
struct Vector<3, T> {
static_assert(std::is_arithmetic<T>::value, "Vector must be aritmetic");
using MathType = typename std::conditional<std::is_floating_point<T>::value, T, double>::type;... |
//============================================================================
// Name : DBServer.cpp
// Author : Samuel
// Version :
// Copyright : Your copyright notice
// Description : Hello World in C++, Ansi-style
//============================================================================
#in... |
#pragma once
#include "../Engine/Core/Message.h"
namespace GameMessageType
{
enum
{
kDamage = hg::MessageType::kEngineMessageCount,
kDeath,
kFire,
kPlayerDeath,
kPowerUp,
kWin
};
}
enum DamageType
{
kDmgType_Generic,
kDmgType_ChargerBotMelee,
kDmgType_Bullet,
kDmgType_BossHeadButt
};
enum PowerUpTy... |
#include <bits/stdc++.h>
using namespace std;
#define MOD 1000000007
#define rep(i, n) for(int i = 0; i < (int)(n); i++)
#define rep1(i, n) for(int i = 1; i <= (int)(n); i++)
#define show(x) {for(auto i: x){cout << i << " ";} cout<<endl;}
#define showm(m) {for(auto i: m){cout << m.x << " ";} cout<<endl;}
typedef long l... |
#include<iostream>
using namespace std;
int main()
{
int n=0;
double s=0,t=0;
double a[54]={4,4,4,4,2,3,3,1.5,1.5,2,3,6,4,5,3,5,4,5,3,3,4,2,3,3,4,5,3,1,
4,3,4,3,4,4,2,2,3,2,4,1,1,1,1,1,1,1,1,1,1,1,1,1,1,3};
while(++n)
{
cout<<"\n\n---------------------"<<n<<"-------------------... |
//
// SupportVectorMachines.h
// FaceExpressionRecognition
//
// Created by Jianwei Xu on 30/04/2013.
// Copyright (c) 2013 Jianwei Xu. All rights reserved.
//
#ifndef __FaceExpressionRecognition__SupportVectorMachines__
#define __FaceExpressionRecognition__SupportVectorMachines__
#include <iostream>
#endif /* d... |
// ___________________________________________________________________________
// FILENAME Exec.cpp
// CREATED Mai 13 1998 DG[50]
//
// Running external programs from Opera (sync. and async)
// ___________________________________________________________________________
#include "core/pch.h"
#include "Exec.h"
#undef ... |
/**
* Copyright (c) 2007-2012, 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 ... |
int Solution::solve(vector<int> &A) {
int n = A.size();
vector<int> leftOdd(n, 0); //prefix odd sum 0 till i - 1
vector<int> leftEven(n, 0); // prefix even sum 0 till i - 1
vector<int> rightOdd(n, 0); // suffix even sum n - 1 till i + 1
vector<int> rightEven(n, 0); // suffix even sum n-1 till i + 1
... |
#include "hns-test.h"
#include "dns-proto.h"
#include <stdio.h>
#ifdef HAVE_UNISTD_H
#include <unistd.h>
#endif
#include <fcntl.h>
extern "C" {
// Remove command-line defines of package variables for the test project...
#undef PACKAGE_NAME
#undef PACKAGE_BUGREPORT
#undef PACKAGE_STRING
#undef PACKAGE_TARNAME
// ... ... |
#include "ros/ros.h"
#include "std_msgs/Float64.h"
#define FIRST_MAX 0.56
#define FIRST_MIN 0.54
#define SECOND_THRESHOLD 0.01
class param
{
public:
ros::NodeHandle nh;
double orientation_x;
double orientation_y;
double orientation_z;
double degree;
double degree2;
double vel;
double ... |
/* -*- Mode: c++; tab-width: 4; c-basic-offset: 4 -*-
*
* Copyright (C) 1995-2011 Opera Software AS. All rights reserved.
*
* This file is part of the Opera web browser.
* It may not be distributed under any circumstances.
*
*/
#include "core/pch.h"
#include "adjunct/quick/extensions/ExtensionSpeedDialHandle... |
/* -*- 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.
*/
#ifndef DEVICE_API_ORIENTATION_MANAGER_H
#define DEVICE_API_ORI... |
// Created on: 1999-06-25
// Created by: Sergey RUIN
// Copyright (c) 1999 Matra Datavision
// Copyright (c) 1999-2014 OPEN CASCADE SAS
//
// This file is part of Open CASCADE Technology software library.
//
// This library is free software; you can redistribute it and/or modify it under
// the terms of the GNU Lesser ... |
// Copyright 1998-2016 Epic Games, Inc. All Rights Reserved.
#include "FirstPersonProject.h"
#include "FirstPersonProjectGameMode.h"
#include "FirstPersonProjectHUD.h"
#include "FirstPersonProjectCharacter.h"
AFirstPersonProjectGameMode::AFirstPersonProjectGameMode()
: Super()
{
// set default pawn class ... |
#include"conio.h"
#include"stdio.h"
void main(void)
{
int a,b,c,pow=1;
clrscr();
printf("Enter number = ");
scanf("%d",&a);
printf("Enter power = ");
scanf("%d",&b);
for(c=1; c<=b; c++)
pow=pow*a;
printf("%d",pow);
getch();
} |
#ifndef REACTOR_REDIS_SERVER_H
#define REACTOR_REDIS_SERVER_H
#include "reactor/net/TcpServer.h"
namespace reactor {
class RedisServer {
public:
RedisServer(EventLoop *loop, InetAddress addr):
server_(loop, addr)
{
}
void start()
{ server_.start(); }
private:
net::TcpServer server_;
};
}
#endif
|
#include "miniTimer.h"
miniTimer::miniTimer(void)
{
}
miniTimer::~miniTimer(void)
{
}
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.