text stringlengths 8 6.88M |
|---|
#include<iostream>
#include<cstdio>
#include<map>
#include<set>
#include<vector>
#include<stack>
#include<queue>
#include<string>
#include<cstring>
#include<algorithm>
#include<cmath>
using namespace std;
int main()
{
int n,k,ans = 0;
scanf("%d",&n);
for (int i = 0;i < n; i++) {
scanf("%d",&k);
... |
#include <stdio.h>
#include <stdlib.h>
#include <vector>
#include <iostream>
#include <math.h>
using namespace std;
int h1(int c, int m){
return c%m;
}
int h2(int c, int m){
int f = floor(c/m);
if(c < m || f%m == 0){
return 1;
}
return f%m;
}
int doubleHashingInsert... |
/* -*- Mode: c++; tab-width: 4; indent-tabs-mode: t; c-basic-offset: 4; c-file-style:"stroustrup" -*-
**
** Copyright (C) 1995-2009 Opera Software AS. All rights reserved.
**
** This file is part of the Opera web browser.
** It may not be distributed under any circumstances.
**
** Espen Sand
*/
#ifndef _UNIX_OPVIEW_H... |
//
// Mail.cpp
//
// $Id: //poco/1.4/NetSSL_OpenSSL/samples/Mail/src/Mail.cpp#1 $
//
// This sample demonstrates the MailMessage and SecureSMTPClientSession classes.
//
// Copyright (c) 2005-2011, Applied Informatics Software Engineering GmbH.
// and Contributors.
//
// SPDX-License-Identifier: BSL-1.0
//
#include "_... |
#include <iostream>
#include <bs/ewma.hpp>
#include <bs/frame_range.hpp>
#include <bs/zivkovic_gmm.hpp>
#include <bs/utils.hpp>
#include <boost/make_shared.hpp>
#include <boost/program_options.hpp>
namespace po = boost::program_options;
#include <range/v3/front.hpp>
#include <range/v3/action/take.hpp>
#include <rang... |
/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
file Copyright.txt or https://cmake.org/licensing for details. */
#include "cmFileTimeCache.h"
#include <string>
#include <unordered_map>
#include <utility>
cmFileTimeCache::cmFileTimeCache() = default;
cmFileTimeCache::~cmFileTimeCach... |
#pragma once
#include <Tanker/AttachResult.hpp>
#include <Tanker/Network/SdkInfo.hpp>
#include <Tanker/Opener.hpp>
#include <Tanker/Session.hpp>
#include <Tanker/Status.hpp>
#include <Tanker/Streams/DecryptionStreamAdapter.hpp>
#include <Tanker/Streams/EncryptionStream.hpp>
#include <Tanker/Streams/InputSource.hpp>
#i... |
#include <math.h>
#include <chrono>
#include <stdio.h>
#include <tsc_x86.h>
using namespace std;
using namespace std::chrono;
// timer cribbed from
// https://gist.github.com/gongzhitaao/7062087
class Timer
{
public:
Timer() : beg_(clock_::now()) {}
void reset() { beg_ = clock_::now(); }
double elapsed() c... |
#include <bits/stdc++.h>
using namespace std;
int main()
{
int a,b,c=0,t,i,j,co;
char str[1005][100];
scanf("%d",&t);
while(t--){
scanf("%d",&a);
for(i=0;i<=a;i++){
scanf("%s",str[i]);
}
b=strlen(str[0]);
printf("Case %d:\n",++c);
for(j=0;j<a;j... |
#pragma once
#include <list>
#include "Logs.h"
#include "InitPath.h"
#include "GetFileInfo.h"
using namespace std;
class CKievPost
{
public:
CKievPost(void);
virtual ~CKievPost(void);
// Перемещение файлов в папку отправки на Киев
list<CString> SendPostToKiev();
private:
CInitPath *pPath;
CLogs *pLog;
CGetF... |
#include <iostream>
using namespace std;
int main(int argc, char const *argv[]) {
int a;
std::cin >> a;
switch (a) {
case a>10:std::cout << "greater" << '\n';
break;
case a<10:std::cout << "less" << '\n';
break;
default: std::cout << "equal" << '\n';
}
return 0;
}
|
#ifndef _SIMULATOR_H_
#define _SIMULATOR_H_
#include <stdio.h>
#include <stdlib.h>
#include <iostream>
#include <assert.h>
#include <random>
#include <map>
#include <vector>
#include "NanoTimer.h"
#include "Model.h"
#include "ModelWF.h"
#include "Event.h"
#include "EventList.h"
#include "Population.h"
#include "Prof... |
/* -*- Mode: c++; tab-width: 4; c-basic-offset: 4; c-file-style: "stroustrup" -*-
*
* Copyright (C) 2004-2007 Opera Software AS. All rights reserved.
*
* This file is part of the Opera web browser.
* It may not be distributed under any circumstances.
*
* Morten Stenshorne
*/
#include "core/pch.h"
#include "ua... |
#ifndef __IREPORTEDITORVIEW_H
#define __IREPORTEDITORVIEW_H
//-----------------------------------------------------------------------------
#include "_pch.h"
#include "ReportData.h"
namespace wh{
//-----------------------------------------------------------------------------
class IReportEditorView
{
public:
virtual ... |
#define BOOST_TEST_LOG_LEVEL test_suite
#define BOOST_TEST_MODULE test_main
#include <boost/test/unit_test.hpp>
#include <boost/mpl/assert.hpp>
#include "Handler.h"
#include "Writers.h"
using Commands = std::vector<std::string>;
BOOST_AUTO_TEST_SUITE(test_bulk)
BOOST_AUTO_TEST_CASE(example)
{
std::... |
// Created on: 1995-12-01
// Created by: EXPRESS->CDL V0.2 Translator
// Copyright (c) 1995-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 te... |
#include "StdAfx.h"
#include "Boon.h"
#include "../Bullet/BulletManager.h"
const float MOVE_SPEED = 500.0f;
Boon::Boon()
{
}
Boon::~Boon()
{
delete anime;
delete bulletAnime;
}
void Boon::Init()
{
anime = new Anime("data/boon/boon.xml");
bulletAnime = new Anime("data/boon/bullet.xml");
}
... |
#include "Composite.h"
Composite::Composite() {
}
Composite::~Composite() {
}
void Composite::Operation() {
std::vector<CompositeComponent*>::iterator comIter = comVec.begin();
for (; comIter != comVec.end(); ++comIter) {
(*comIter)->Operation();
}
}
void Composite::Add(CompositeComponent *com) {
comVec.push_b... |
#include <avr/pgmspace.h>
PROGMEM const char pumianFlash[] =
"111100111100,"
"111100111222,"
"111100111100,"
"111100221221,"
"111100111100,"
"111100111222,"
"111100111100,"
"111100221212,"
"211121212121,"
"212212212121,"
"000000000000,"
"2010201020110020,"
"2020201020201120,"
"2010201020110020,"
"2020102020101120,"
"... |
#include <uWS/uWS.h>
using namespace uWS;
int main() {
Hub h;
std::string response = "Hello!";
h.onMessage([](WebSocket<SERVER> *ws, char *message, size_t length, OpCode opCode) {
ws->send(message, length, opCode);
});
h.onHttpRequest([&](HttpResponse *res, HttpRequest req, char *data, si... |
/*! @file LogVol_PCBs.hh
@brief Defines mandatory user class LogVol_PCBs_Box.
@date August, 2015
@author Flechas (D. C. Flechas dcflechasg@unal.edu.co)
@version 2.0
In this header file, the 'physical' setup is defined: materials, geometries and positions.
This class defines the experimental hall used in... |
#include "robot.h"
namespace sge { namespace entity{
Robot::Robot(graphics::Sprite *sprite): GameObject(sprite){
init();
}
void Robot::init(){
//GameObject::init();
//WALKING_LEFT
m_Animation.push_back(graphics::Animation(0, false));
//WALKING_up
m_Animation.push_back(graphics::Animation(1, false))... |
// Login.cpp : 实现文件
//
#include "stdafx.h"
#include "Talk2Me.h"
#include "Login.h"
#include "afxdialogex.h"
// CLogin 对话框
IMPLEMENT_DYNAMIC(CLogin, CDialogEx)
CLogin::CLogin(CWnd* pParent /*=NULL*/)
: CDialogEx(CLogin::IDD, pParent)
, m_pwd(_T(""))
, m_userid(0)
{
}
CLogin::~CLogin()
{
}
void CLogin::DoDataE... |
// This file was generated based on /Users/r0xstation/18app/src/.uno/ux13/BottomBar.g.uno.
// WARNING: Changes might be lost if you edit this file directly.
#pragma once
#include <Fuse.Animations.IResize.h>
#include <Fuse.Binding.h>
#include <Fuse.Controls.Grid.h>
#include <Fuse.Drawing.ISurfaceDrawable.h>
#include <F... |
#include "stdafx.h"
#include "OutputListener.h"
#include "Console.h"
#include "NetworkLogic.h"
Console::Console()
{
}
Console::~Console()
{
}
void Console::update()
{
}
void Console::write(const ExitGames::Common::JString& str)
{
mpImp->write(str);
}
void Console::writeLine(const ExitGames::Common::JString& str)
... |
/*
UpdateThread.h
Header file for class UpdateThread
@author Martin Terneborg
*/
#ifndef UPDATE_THREAD_H
#define UPDATE_THREAD_H
#include "Thread.h"
#include <Windows.h>
#include <vector>
#include <memory>
#include "Settings.h"
#include "MonitorThread.h"
/*
Class represnting a thread used ... |
class M110_NVG_EP1;
class M110_NV_DZ: M110_NVG_EP1 {
displayName = $STR_DZ_WPN_M110_NV_NAME;
descriptionShort = $STR_DZ_WPN_M110_NV_DESC;
class OpticsModes
{
class HTWS
{
opticsID = 1;
useModelOptics = "true";
opticsZoomMin = 0.0293;
distanceZoomMin = 300;
opticsZoomMax = 0.0293;
distanceZoom... |
#include "Input.h"
#include "Game.h"
bool Input::keys[256];
void Input::input(ALLEGRO_EVENT *ev){
if(ev->type == ALLEGRO_EVENT_KEY_DOWN){
switch(ev->keyboard.keycode){
case ALLEGRO_KEY_Q:
Game::gameState = 0;
break;
case ALLEGRO_KEY_W:
Input::keys[0] = true;
break;
case ALLEGRO_KEY_S:
Input::k... |
#include <stdlib.h>
#include <math.h>
#include "attractor.h"
static double eval(double x, double y, const std::vector<double>& v)
{
double ret = 0.0;
for (unsigned x_deg = 0; x_deg <= MAP_DEGREE; x_deg++) {
for (unsigned y_deg = 0; y_deg <= x_deg; y_deg++) {
ret += v[x_deg * MAP_DEGREE + y_deg]
* pow(x, x_d... |
/* -*- Mode: c++; tab-width: 4; indent-tabs-mode: t; c-basic-offset: 4; coding: iso-8859-1 -*-
**
** Copyright (C) 1995-2006 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/util... |
//
// Created by Lee on 2019-04-23.
//
#ifndef UBP_CLIENT_CPP_VER_UPLOADVIEW_H
#define UBP_CLIENT_CPP_VER_UPLOADVIEW_H
#include "PhotoThumbnailForUpload.h"
#include <QWidget>
#include "PhotoManager.h"
class UploadView : public QWidget {
Q_OBJECT
public:
explicit UploadView(QWidget * parent = nullptr,
... |
#pragma once
#include "Keng/WindowSystem/IWindowListener.h"
#include "Keng/WindowSystem/IWindow.h"
#include "WinWrappers\WinWrappers.h"
#include "EverydayTools\UnusedVar.h"
#include "EverydayTools\Observable.h"
#include <algorithm>
#include <vector>
namespace keng::window_system
{
template<typename TChar>
cl... |
/* -*- Mode: c++; tab-width: 4; indent-tabs-mode: t; c-basic-offset: 4 -*-
**
** Copyright (C) 1995-2007 Opera Software AS. All rights reserved.
**
** This file is part of the Opera web browser. It may not be distributed
** under any circumstances.
**
** Per Hedbor
*/
#if !defined TABLE_DECOMPRESSOR_H && defined TAB... |
//---------------------------------------------------------------------------
/*可适合非同步连接的sock5代理服务器连接封装类
作者: Bluely
日期:2003.09.27
说明: 遵循 RFC 1982 标准,目前只实现sock5协议代码,UDP模式下没有测试过.
/*
步骤: smNEGOTIATION 协商版本和方法
客户端连到服务器后,然后就发送请求来协商版本和认证方法:
VER 版本: 0x5 (sock5)
NMETHODS NMETHODS字段包含了在METHODS字段中出现的方法标示的数目(以字节为单位)。
... |
#include "Engine.hpp"
#undef main
int main(int argc, const char* argv[]) {
Engine l_eng;
l_eng.RunConfigAndInitilize("config.lua");
return 0;
} |
/*
* Copyright (c) Meta Platforms, Inc. and affiliates.
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*/
#pragma once
#include <quic/state/StateData.h>
namespace quic {
/**
* Check whether the peer supports ACK_FREQUENCY and IMMED... |
#include <iostream>
using namespace std;
int main()
{
if (cout<<"hello")
{
}
}
|
/**
* Copyright (c) 2013, Timothy Stack
*
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
*
* * Redistributions of source code must retain the above copyright notice, this
* list of condi... |
#include <bits/stdc++.h>
using namespace std;
#define TESTC ""
#define PROBLEM "10037"
#define USE_CPPIO() ios_base::sync_with_stdio(0); cin.tie(0)
int main(int argc, char const *argv[])
{
#ifdef DBG
freopen("uva" PROBLEM TESTC ".in", "r", stdin);
freopen("uva" PROBLEM ".out", "w", stdout);
#endif
int CASE,nu... |
// Given a 2D board and a word, find if the word exists in the grid.
// The word can be constructed from letters of sequentially adjacent cell, where "adjacent" cells are those horizontally or vertically neighboring. The same letter cell may not be used more than once.
// For example,
// Given board =
// [
// ["AB... |
#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>
#include <vector>
#include <algorithm>
#include <fstream>
#include <queue>
#include <unordered_set>
#include <unordered_map>
#include <stack>
#include <cstdio>
#define INT_MIN (1<<31)
#define INT_MAX (~INT_MIN)
#define UNREACHABLE (INT_MAX>>2)
#define INF (1e300)
using namespace std;
ifstream fin("... |
#include <iostream>
#include <string>
#include <vector>
using namespace std;
class Person
{
public:
int m_a, m_b, m_c;
// 先定义的m_a, m_b, m_c,然后再分别赋值
// Person(int a, int b, int c)
// {
// m_a = a;
// m_b = b;
// m_c = c;
// }
// 使用初始化列表
// 先声明了m_a, m_b, m_c,再根据声明的顺... |
/**
* @author shaoDong
* @email scut_sd@163.com
* @create date 2018-09-20 19:40:04
* @modify date 2018-09-20 19:40:04
* @desc n 个非负整数的柱状图,能接多少水
* 输入:[0,1,0,2,1,0,1,3,2,1,2,1]
* 输出:6
*/
#include <iostream>
#include <vector>
using namespace std;
int main(int argc, char const *argv[])
{
int arr[] = {0,1,0,2,1... |
#ifndef TOKEN_H
#define TOKEN_H
#include <iostream>
using namespace std;
class Token
{
public:
Token(int num):type(num) {
//cout << "Token constructor called";
}
~Token() {
//cout << "Token destructor called";
}
void virtual print(ostream& outs = cout) const {}
double virtual getNum() { return 0; }
ch... |
#include<string>
#include<vector>
#include<stdlib.h>
#include<iostream>
using namespace std;
typedef struct BiNode
{
char data;
struct BiNode * lchild;
struct BiNode * rchild;
}BiNode, * BiTree;
void CreateBiTree(BiTree &t,string pre,string mid)
{
if(pre.length()==0)
... |
//
// Ray.cpp
// RayTracingPro
//
// Created by Ying Zhan on 10/24/15.
// Copyright (c) 2015 Ying Zhan. All rights reserved.
//
#include "Ray.h"
Ray::Ray() {
}
Ray::~Ray() {
}
void Ray::setSign(int sign) {
ray_sign = sign;
}
int Ray::getSign() {
return ray_sign;
}
void Ray::setEnergy(float en... |
#include "DrawTriangle.h"
void DrawTriangle::initBuffer()
{
glGenBuffers(1, &vbo); // 生成一个顶点缓冲对象 vbo 缓冲对象类型有很多 下一步设置为array类型
glGenVertexArrays(1, &vao); // 生成一个vao 用来保存顶点属性解释 我们一个程序可以有很多vao 代表不同的顶点属性解释方法 只需要绑定到相应的顶点上就可以对buffer做正确的解释
glBindVertexArray(vao); // 表示我们的程序的顶点属性应该按照它来解释 就是上面的glVertexAttribPointer这行。
glBi... |
#include <cstdio>
#include <fstream>
#include <iostream>
#include <sstream>
#include <conio.h>
#include "graphviewer.h"
#include "edgetype.h"
#include "SistemaDeEvacuacao.h"
#include "utils.h"
using namespace std;
#define NODES_FN "Nodes.txt"
#define ROADS_FN "Roads.txt"
#define NODES_TO_ROADS_FN "NodesToRoads.txt"
... |
#pragma once
extern "C" {
#include <gvc.h>
}
#include <vector>
#include <memory>
#include <set>
#include "recording_api.h"
class Situation;
class Transition;
/**
* This class represents a graph of Situations and Transitions and can create a visual representation of it.
*/
class SituationGraph {
public:
/**
* Builds... |
// Created on : Sat May 02 12:41:15 2020
// Created by: Irina KRYLOVA
// Generator: Express (EXPRESS -> CASCADE/XSTEP Translator) V3.0
// Copyright (c) Open CASCADE 2020
//
// This file is part of Open CASCADE Technology software library.
//
// This library is free software; you can redistribute it and/or modify it un... |
#include<iostream>
#include<algorithm>
#include<vector>
#include<unordered_set>
using namespace std;
class Solution {
public:
bool containsDuplicate(vector<int>& nums) {
//基本思想:哈希表,时间复杂度O(n)空间复杂度O(n)
unordered_set<int> dict;
for (auto num : nums)
{
if (dict.find(num) != dict.end())
return true;
dict.... |
#ifndef MAINWINDOW_H
#define MAINWINDOW_H
#pragma once
#include <QWidget>
#include <QApplication>
#include <QPushButton>
#include <QLabel>
class charStack
{
private:
int top=-1;
char Stack[300];
public:
void push(char elem);
char pop();
char showLast();
};
class intSta... |
#include <iostream>
#include <cstdio>
#include <math.h>
using namespace std;
int main(){
double A,B,C;
cin >> A >> B >> C;
double res1 = sqrt((B*B) - (xi4 * A * C));
if(res1 || A == 0){
cout << "Impossivel calcular"<<"\n";
}else{
double res2 = (-B + res1)/(2 * A);
double res3 = (-B - res1)/(2 * A);
cout <<... |
#include <cstdlib>
#include <cstring>
#include <cstdio>
#include <cmath>
#include "dct.h"
dct_trig_table dct_table_init(size_t size)
{
dct_trig_table table = (dct_trig_table)malloc(2*size*sizeof(double));
register double alpha = (PI/(double)size)*(PI/(double)size);
for(size_t k1 = 0; k1 < size; ++k1)
{... |
/* -*- 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 Patricia Aas (psmaas)
*/
#include "core/pch.h"
#ifdef... |
/* -*- Mode: c++; tab-width: 4; indent-tabs-mode: t; c-basic-offset: 4; c-file-style:"stroustrup" -*-
*
* Copyright (C) 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_TIME_INFO_H
#define OP_TIME_INFO... |
#include "LeagueEvent.h"
#include "cjson/cJSON.h"
/*
* Update the league event. Probably do some supporting champions voting here? TODO.
*/
void LeagueEvent::Update(PtrLeagueEvent newEvent, int timestamp) {
}
cJSON* LeagueEvent::CreateJSON() {
cJSON* newJson = cJSON_CreateObject();
cJSON_AddNumberToObject(newJs... |
#include <iostream>
#include <vector>
#include <algorithm>
int n, list[1000000], dp[1000000];
int main()
{
std::cin.sync_with_stdio(false);
std::cin.tie(NULL);
std::vector<int> buf;
std::cin >> n;
for(int i = 0; i < n; i++)
{
std::cin >> list[i];
}
buf.push_back(list[0]);... |
#include <map>
#include <assert.h>
#include "JFA.h"
using namespace std;
/*=================================================================================================
DEFINES
=================================================================================================*/
// Initial window dimensions
#defi... |
class Solution
{
public:
ListNode* addTwoNumbers(ListNode* l1, ListNode* l2)
{
// Create Head Node that will be returned in the end
ListNode* head = new ListNode();
// Create Node that always will be current
ListNode* current = head;
int addition = 0;
int val;
... |
#pragma once
#ifndef BALL_H
#define BALL_H
#include <SFML/Graphics.hpp>
#include "Collidable.h"
#define PI 3.14159265
class Ball {
private:
float x, y;
int radius;
int speed;
float direction;
int lastCollision;
sf::CircleShape image;
public:
Ball(int, int, float);
int getX();
int getY();
void setX(floa... |
#include "MatMath.h"
// constructors
MatMath::MatMath(void)
{
}
MatMath::~MatMath(void)
{
}
/*
vec3::vec3() {}
vec3::vec3(float a, float b, float c)
{
v[0] = a; v[1] = b; v[2] = c;
}
void vec3::normalize()
{
float magnitude = sqrt(v[0] * v[0] + v[1] * v[1] + v[2] * v[2]);
v[0] /= magnitude; v[1] /= magnitude; v... |
// Fill out your copyright notice in the Description page of Project Settings.
#pragma once
#include "CamProjectile.h"
#include "NewProjectile.generated.h"
/**
*
*/
UCLASS()
class CAM_API ANewProjectile : public ACamProjectile
{
GENERATED_BODY()
public:
ANewProjectile(const FObjectInitializer& ObjectInitialize... |
#include "gtest/gtest.h"
#include "print.h"
TEST(print, PrintConsole) {
std::stringstream is{};
PrintConsole print{is};
std::vector<std::string> cmd_pool{"first", "second", "third"};
print.print_cmd_pool(cmd_pool);
EXPECT_EQ(is.str(), "Bulk: first, second, third\n");
}
TEST(print, PrintFile) {
... |
#include <iostream>
#include <thread>
#include <mutex>
using namespace std;
mutex semaforo;
void imprimeCaractere(int n, char c){
semaforo.lock();
for(int i = 1; i<= n; i++){
cout << c;
}
cout << endl;
semaforo.unlock();
}
int main()
{
thread t1(imprimeCaractere, 50, '*');
thread... |
#include "../Objects.h"
Shape::Shape(gfx::Canvas* canvasToSet, std::initializer_list<Point> pointsToSet, int thicknessToSet, Color borderColorToSet)
: Primitive (canvasToSet, thicknessToSet, borderColorToSet)
{
_points.insert(_points.end(), pointsToSet.begin(), pointsToSet.end());
assert(_points.si... |
#include <iostream>
int binarySearch(int* array, int left, int rigth, int number) {
if (rigth >= left) {
int mid = left + (rigth - left) / 2;
if (array[mid] == number) {
return mid;
}
if (array[mid] > number) {
return binarySearch(array, left, mid -1, number)... |
/*
kamalsam
*/
#include<stdio.h>
#include<algorithm>
#include<iostream>
using namespace std;
int main()
{
int i,j,n,t;
scanf("%d",&t);
for(i=0;i<t;i++)
{
scanf("%d",&n);
int count,k,best;
long ent[n],exi[n];
for(j=0;j<n;j++)
scanf("%ld%ld",&ent[j],&exi[j]);
... |
// PileShuffleOptimization.cpp : Defines the entry point for the console application.
// Find optimal number of piles for pile shuffling to maximize probability of
// Two lands per pile
// Uses Hypergeometric distribution h(x; p, n, k) = [kCx][p-kCn-x]/[pCn]
// p: number of items in population
// k: Number of items in... |
//Global variables
const int ledPinR1 = 13;
const int ledPinG1 = 12;
const int ledPinR2 = 10;
const int ledPinY2 = 9;
const int ledPinG2 = 8;
const int buttonPin = 2;
int buttonState = 0;
int prevButtonState = HIGH;
void setup(){
//Setting all pins to input/output
pinMode(ledPinR1, OUTPUT);
pinMode(ledPinG1, O... |
#include<stdio.h>
#include<conio.h>
int main(){
int x=0,y=1,z=1;
printf("Enter a number :");
scanf("%d",&x);
while(y<=x){
z=z*y;
z<x;
y=y+1;
}
if(z==0){
printf("\nError");
}else
printf("\nThe factorial of %d = %d",x,z);
return 0;
getch();
}
|
#ifndef EXPENSE_CATEGORY_H
#define EXPENSE_CATEGORY_H
#include "base_entity.h"
#include "models/instance.h"
class ExpenseCategory : public BaseEntity
{
Q_OBJECT
Q_PROPERTY(Instance* instance READ getInstance WRITE setInstance NOTIFY propChanged)
Q_PROPERTY(QString name READ getName WRITE setName NOTIFY pr... |
#include<iostream>
#include<list>
#include<queue>
#include<map>
using namespace std;
//Adj List Implementation for generic Nodes
template<typename T>
class Graph{
//Array of Linked Lists of size V, V LL's are there
map<T,list<T> > adjList;
public:
Graph(){
}
... |
#include <cstdio>
#include <vector>
#include <algorithm>
using namespace std;
const int INF = 0xfffffff;
int graph[1010][1010];
bool visited[1010];
int n, m, k, con;
int deleteed;
void dfs(int node){
if(node == con) return;
visited[node] = true;
for(int i = 1; i <= n; i++){
if(!visited[i] && grap... |
#include "stdafx.h"
#include "RenderStates.h"
// Staitc Values
ID3D11RasterizerState* Jaraffe::RenderStates::m_WireframeRS = 0; // 와이어프레임 랜더링.
ID3D11RasterizerState* Jaraffe::RenderStates::m_SolidRS = 0; // 일단 고형체 랜더링.
void Jaraffe::RenderStates::InitAll(ID3D11Device * device)
{
//
// WireframeRS
//
D3D11_RASTERI... |
#pragma once
#include "bricks/config.h"
#if BRICKS_CONFIG_AUDIO_FFMPEG
#include "bricks/core/copypointer.h"
#include "bricks/collections/array.h"
namespace Bricks { namespace IO { class Stream; } }
extern "C" {
struct AVFormatContext;
struct AVStream;
struct AVCodec;
struct AVPacket;
struct AVFrame;
}
namesp... |
/***************************************************************************************************
vector3.h
Simple Vector3 class mainly destined to hide the ugliness of D3DXVECTOR3 while still being interchangeable
with it
by David Ramos
*****************************************************************************... |
#pragma once
#include "wrapper_glfw.h"
#include <glm/glm.hpp>
#include "terrain_object.h"
class terrain_loader {
public:
terrain_object *heightfield;
int octaves;
GLfloat perlin_scale, perlin_freq, land_size, sealevel;
terrain_loader();
}; |
#pragma once
#include "GlobalHeader.h"
#include <stdexcept> // std::logic_error
#include <span.h> // gsl::span
#include "Amount.h" // fa::Amount
namespace fa {
//! Enum for the different kinds of nutrients
enum class NutrientType { // TODO: have this contain all the different kinds of nutrients
Vitamin... |
#include "file_utils.h"
const char* getFileSystemContents() {
// Get the Current Working Directory
char *cwdBuffer = new char[512];
sprintf(cwdBuffer, "%s/%s", getcwd(cwdBuffer, 1024), "UDPClient/share/");
DIR *open = opendir(cwdBuffer);
struct stat filestat;
if (open == NULL) {
printf("%s%s\n", "ERRO... |
// $Id: bigint.cpp,v 1.76 2016-06-14 16:34:24-07 - - $
#include <cstdlib>
#include <exception>
#include <stack>
#include <stdexcept>
using namespace std;
#include "bigint.h"
#include "debug.h"
#include "relops.h"
bigint::bigint(long that) :
uvalue(that), is_negative(that < 0) {
DEBUGF('~', this << " -> " << ... |
#include "bvh.h"
#include <stdio.h>
//#ifndef PBRT_L1_CACHE_LINE_SIZE
//#define PBRT_L1_CACHE_LINE_SIZE 64
//#endif
// Feel free to ignore these structs entirely!
// They are here if you want to implement any of PBRT's
// methods for BVH construction.
//STAT_MEMORY_COUNTER("Memory/BVH tree", treeBytes);
//#define CHEC... |
#include<iostream>
#define max 10000
using namespace std;
int main(){
int a[max];int temp;
for(int i=0;i<max;i++)
a[i]=0;
int n;
cin>>n;
for(int i=0;i<n;i++)
cin>>a[i];
for(int i=1;i<n;i++){
for(int j=0;j<i;j++){
if(a[i]<a[j]){
te... |
//
// File: CLedBuf.cpp
// Author: Andy Shepherd
// email: seg7led@bytecode.co.uk
// License: Public Domain
//
#ifndef LEDBUF_H
#define LEDBUF_H
#include <arduino.h>
class CLEDBuf
{
#define CLEDBUF_NUMDIGITS 4
//#define CLEDBUF_BUFSIZE ((CLEDBUF_NUMDIGITS * 2) + 1)
public:
CLEDBuf();
void clear();
uint8_t addD... |
#ifndef __TEST_OPTIMAL_PARTITION_HPP__
#define __TEST_OPTIMAL_PARTITION_HPP__
#include <cmath>
#include <vector>
#include <algorithm>
#include <utility>
#include <numeric>
#include <iterator>
#include <atomic>
#include "threadpool.hpp"
#include "threadsafequeue.hpp"
#define UNUSED(expr) do { (void)(expr); } while (0... |
#include <stdio.h>
#include <math.h>
#include <string.h>
#include <ctype.h>
#include <stdlib.h>
#include <R.h>
#include <Rinternals.h>
#include <Rdefines.h>
#include "mat.h"
#include "nutil.h"
using namespace std;
bool Conslink(long nsam, double **DPtr, double **dend);
bool ConISS(long nsam, double **DPtr, double **d... |
#include <stdio.h>
#include<string.h>
using namespace std;
int n;
int a[500010],tmp[500010];
long long ans;
void mergsort(int l,int r)
{
if(l<r)
{
mergsort(l,(l+r)/2);
mergsort((l+r)/2+1,r);
int *a1=a+l-1;
int *a2=a+(l+r)/2;
int *a3=tmp+l-1;
int l1=1,l2=1,l3=0,c1=(l+r)/2-... |
#include "Label.h"
Label::Label(QString text, int x, int y, int textSize, int textWidth)
{
setFlags(QGraphicsItem::ItemIsMovable |QGraphicsItem::ItemIsSelectable);
this->setPos(x, y);
setSize(textSize);
setBold(true);
setDefaultTextColor(QColor(0, 0, 0));
setAlignment(Qt::AlignCenter);
//implicit function... |
// Copyright (c) 2020 The Orbit 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 "OrbitClientData/FunctionUtils.h"
#include <map>
#include "OrbitBase/Logging.h"
#include "absl/container/flat_hash_map.h"
#include "absl/strin... |
#include <iostream>
#include <fstream>
#include "vw.h"
#include "core/session/onnxruntime_cxx_api.h"
#include "core/graph/constants.h"
struct Input {
const char* name;
std::vector<int64_t> dims;
std::vector<uint32_t> values_int;
std::vector<float> values_float;
};
struct OrtTensorDimensions : std... |
/****************************************************************************
* *
* Author : lukasz.iwaszkiewicz@gmail.com *
* ~~~~~~~~ *
* Lice... |
#ifndef _FMT_MEM_VIEW_HPP_
#define _FMT_MEM_VIEW_HPP_
#include <cassert>
#include <cstdint>
#include <cstdlib>
namespace fmt {
template<typename T>
class mem_view {
public:
mem_view() : data_(nullptr), size_(0) {}
mem_view(T* data, uint32_t size)
: data_(data), size_(size) {
assert(size == 0 || (size ... |
#include "GameStart.h"
GameStart::GameStart() {
graphic = LoadGraph("graphic/particle.jpg");
alive = true;
flag = true;
size = 0;
pos_x = 0;
pos_y = 0;
}
void GameStart::start(int i) {
pos_x = rand() % WIN_WIDTH;
pos_y = rand() % WIN_HEIGHT;
size = 0.1 + 0.01 * i;
}
void GameStart::update() {
if (alive == ... |
../../lib/PageXML.cc |
#include "task.hh"
#include "buffer.hh"
#include "http/http_message.hh"
#include "uri/uri.hh"
#include "net.hh"
#include <iostream>
using namespace ten;
const size_t default_stacksize=4096*2;
static void do_get(uri u) {
netsock s(AF_INET, SOCK_STREAM);
u.normalize();
if (u.scheme != "http") return;
i... |
/*
* File: Enemey.h
* Author: mohammedheader
*
* Created on November 24, 2014, 4:32 PM
*/
#ifndef ENEMEY_H
#define ENEMEY_H
#include "cocos2d.h"
#include "Waypoint.h"
class HelloWorld;
class Enemy : public cocos2d::Node {
public:
static Enemy* create(HelloWorld* game);
virtual void update(float dt);
... |
//---------------------------------------------------------
//
// Project: dada
// Module: geometry
// File: Matrix3f.h
// Author: Viacheslav Pryshchepa
//
// Description: Nine-element square column aligned matrix
//
//---------------------------------------------------------
#ifndef DAD... |
#pragma once
#include <string>
#include <vector>
#include "l10n/Locale.h"
namespace BeeeOn {
class LocaleManager {
public:
typedef Poco::SharedPtr<LocaleManager> Ptr;
virtual ~LocaleManager();
virtual Locale parse(const std::string &input) = 0;
virtual Locale chooseBest(const std::vector<std::string> &input) ... |
/********************************************************************************
** Form generated from reading UI file 'viewer.ui'
**
** Created: Thu 6. Jun 09:09:27 2013
** by: Qt User Interface Compiler version 4.8.3
**
** WARNING! All changes made in this file will be lost when recompiling UI file!
**********... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.