text stringlengths 8 6.88M |
|---|
#ifndef PRIME_CPP
#define PRIME_CPP
#include <immintrin.h>
#include "config.h"
#define _XBEGIN_STARTED (~0u)
#define _XABORT_EXPLICIT (1 << 0)
#define _XABORT_RETRY (1 << 1)
#define _XABORT_CONFLICT (1 << 2)
#define _XABORT_CAPACITY (1 << 3)
#define _XABORT_DEBUG (1 << 4)
#define _XABORT_NESTED (1 << 5)
int ... |
// Fill out your copyright notice in the Description page of Project Settings.
#pragma once
#include "CoreMinimal.h"
#include "TP_ThirdPerson/TP_ThirdPersonCharacter.h"
#include "PatrollingGuard.generated.h"
/**
*
*/
UCLASS()
class SURVIVING_GROUNDS_API APatrollingGuard : public ATP_ThirdPersonCharacter
{
GENERA... |
/**
\file ellipseDetector.cpp
\author Débora Ferreira (dfsbora)
\author Gildo Rodrigues
\date LARC2018
\name ellipseDetector
*/
#include "ellipseDetector.hpp"
void EllipseDetector::run(cv::Mat topImg, cv::Mat greenFrame, PerceptionData *data)
{
cv::Mat src = topImg.clone();
//Canny ... |
#include <Logger.h>
namespace utils {
#if LOG_TO_FILE
static constexpr const char *s_log_filename = "CoNE3D.log";
#else
static constexpr const char *s_log_filename = "";
#endif
CLogger::CLogger() noexcept :
_log(s_log_filename)
{
std::ios_base::sync_with_stdio(false);
getStream().imbue( std::locale(std::l... |
/**
* \copyright
* (c) 2012 - 2015 E.S.R. Labs GmbH (http://www.esrlabs.com)
* All rights reserved.
*/
#ifndef GPSCONVERTER_H_
#define GPSCONVERTER_H_
#include "commonTypes.h"
#include "can/framemgmt/ICANFrameListener.h"
#include "can/filter/IntervalFilter.h"
namespace can
{
class CANFrame;
class ICANTransceiver... |
// PortScannerDlg.cpp: 实现文件
//
#include "stdafx.h"
#include "PortScanner.h"
#include "PortScannerDlg.h"
#include "afxdialogex.h"
#ifdef _DEBUG
#define new DEBUG_NEW
#endif
// 用于应用程序“关于”菜单项的 CAboutDlg 对话框
class CAboutDlg : public CDialogEx
{
public:
CAboutDlg();
// 对话框数据
#ifdef AFX_DESIGN_TIME
enum { IDD = IDD... |
#include "opencv2/imgproc/imgproc.hpp"
#include "opencv2/highgui/highgui.hpp"
#include <stdlib.h>
#include <stdio.h>
#include <iostream>
#include <time.h>
using namespace cv;
using namespace std;
int out_matrix[7][7];
int color_info = 0;
int no_of_branches = 0;
int no_of_branches2 = 0;
Point RobotMove(int board[6]... |
#ifndef BaseEngine_H
#define BaseEngine_H
class BaseEngine
{
public:
virtual ~BaseEngine() { }
};
#endif |
/* ***** BEGIN LICENSE BLOCK *****
* FW4SPL - Copyright (C) IRCAD, 2012-2013.
* Distributed under the terms of the GNU Lesser General Public License (LGPL) as
* published by the Free Software Foundation.
* ****** END LICENSE BLOCK ****** */
#ifndef _GDCMIO_DICOMSEGMENTREADER_HPP_
#define _GDCMIO_DICOMSEGMENTREADER... |
#include <iostream>
#include <vector>
#include <algorithm>
#include <string>
int main()
{
std::ios_base::sync_with_stdio(false);
std::cin.tie(0);
std::cout.tie(0);
int n, cnt{};
std::cin >> n;
int now = n;
do
{
if (now < 10)
{
now = now + now * 10;
... |
#pragma once
#include <QtWidgets/QMainWindow>
#include "ui_SimpleQtOGL.h"
class SimpleQtOGL : public QMainWindow
{
Q_OBJECT
public:
SimpleQtOGL(QWidget *parent = Q_NULLPTR);
private:
Ui::SimpleQtOGLClass ui;
};
|
//Motor Definitions
int E1 = 5; //M1 Speed Control
int E2 = 6; //M2 Speed Control
int M1 = 4; //M1 Direction Control
int M2 = 7; //M2 Direction Control
//DIRECTIONS
//STOP
void stop(void)
{
digitalWrite(E1, 0);
digitalWrite(M1, LOW);
digitalWrite(E2, 0);
digitalWrite(M2, LOW);
}
//ADVANCE
... |
/* -*- 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.
*
* Bazyli Zygan bazyl@opera.com
*/
#ifndef MAC_GADGET_ABOUT_DIALO... |
#include "KMeans.h"
#include <math.h>
#include <list>
#include <time.h>
#include <stdlib.h>
#include <stdio.h>
#include <memory.h>
#include <vector>
#include <iostream>
using namespace std;
KMeans::KMeans(DataContainer *pContainer, int clusterCount) {
_pContainer = pContainer;
_clusterCount = clusterCount;
_clust... |
#include <vector>
#include <string>
#include <iostream>
#include <fstream>
#include <sstream>
#include <list>
#include <algorithm>
#include <sstream>
#include <set>
#include <cmath>
#include <map>
#include <stack>
#include <queue>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <numeric>
#include <bits... |
#include <iostream>
using namespace std;
int main()
{
cout << "Introduce an integer representing the number of cents ";
int n_cents {0};
cin >> n_cents;
const int cents_in_dollar {100};
const int cents_in_quarter {25};
const int cents_in_dime {10};
const int cents_in_nickle {5};
const int cents_in_penny {1};... |
#include <tinyxml.h>
#include <chrono>
#include <exception>
#include <filesystem>
#include <gpiod.hpp>
#include <iostream>
#include <memory>
#include <sstream>
#include <string>
#include <tuple>
#include "rclcpp/rclcpp.hpp"
#include "std_msgs/msg/bool.hpp"
#define SAFETY_TIMEOUT 100ms
#define SAFETY_TIMEOUT_CHECK 10... |
#ifndef HTTPDOWNLOAD_H
#define HTTPDOWNLOAD_H
#include <QDialog>
#include <QNetworkAccessManager>
#include <QNetworkRequest>
#include <QNetworkReply>
#include <QUrl>
#include <QProgressDialog>
#include <QFile>
#include <QFileInfo>
#include <QDir>
#include <QMessageBox>
namespace Ui {
class HttpDownload;
}
class Http... |
#include "Server.h"
using namespace std;
/*******************************************************************************
* function name : Server *
* input : nothing. *
* output : nothing. *
* explanation : constructor of a Server. *
**************... |
// https://oj.leetcode.com/problems/rotate-image/
class Solution {
public:
void rotate(vector<vector<int> > &matrix) {
int size = static_cast<int>(matrix.size());
if (size < 2) {
return;
}
for (int i = 0; i < size / 2; i++) {
for (int j = i; j - i < ... |
/* -*- Mode: c++; tab-width: 4; indent-tabs-mode: t; c-basic-offset: 4; c-file-style:"stroustrup" -*-
**
** 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.
*/
#ifndef TESTSUITE_SELFTESTMEMORYCLEANU... |
#ifndef QT_STACKWIDGET_H
#define QT_STACKWIDGET_H
#include <QtWidgets/QMainWindow>
#include "ui_qt_stackwidget.h"
#include <QtGui>
#include <QtWidgets>
class QBaseWidget;
class Qt_Stackwidget : public QMainWindow
{
Q_OBJECT
public:
Qt_Stackwidget(QWidget *parent = 0);
~Qt_Stackwidget();
void cr... |
#include <iostream>
#include "bruch.h"
using namespace std;
int main()
{
Bruch a(2,4);
Bruch b(1,3);
cout << "a: " << a << endl;
cout << "b: " << b << endl;
Bruch c = a + b;
cout << "a + b: " << c << endl;
c = a - b;
cout << "a - b: " << c << endl;
c = a * b;
cout << "a * b... |
/* -*- Mode: c++; tab-width: 4; indent-tabs-mode: t; c-basic-offset: 4 -*-
*
* Copyright (C) 2000-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/dochand/fdelm.h"
#includ... |
#include <vector>
#include <string>
#include <iostream>
#include <fstream>
#include <sstream>
#include <list>
#include <algorithm>
#include <sstream>
#include <set>
#include <cmath>
#include <map>
#include <stack>
#include <queue>
#include <stdio.h>
#include <string.h>
#include <numeric>
#define INF (1<<28)
using nam... |
#ifndef __AFD_HPP__
#define __AFD_HPP__
#include <map>
#include <set>
#include <cstdio>
class AFD{
private:
std::map< int, std::map< char, int > > trans;
std::set< int > fin, est;
std::set< char > sim;
int ini;
bool _eval(const std::string &s, int estate, int p){
if(fin.count(estate) && s[p]==0)
return true... |
#include "FreeImage.h"
#include "glew.h"
#include "glut.h"
#define NUM_TEXTURE 1
unsigned int texObject[NUM_TEXTURE];
void LoadTexture(char* pFilename);
void display();
void reshape(GLsizei w, GLsizei h);
int main(int argc, char** argv)
{
glutInit(&argc, argv);
glutInitWindowSize(400, 400);
glutIni... |
#include<iostream>
#include<vector>
#include<algorithm>
#define FOR(i,n) for(i=0;i<n;i++)
using namespace std;
int l,r,n,m;
vector <vector<int>> land;
int liesin(int a)
{
if(a>=l&&a<=r)
return 1;
else return 0;
}
int grapevine()
{
int size,ans=0,prev;
vector<int>::iterator it;
for(int i=0;i<n;i+... |
#pragma once
//#include "stdafx.h"
#include <stdio.h>
#include <WinSock.h> //一定要包含这个,或者winsock2.h
#include <Windows.h>
#include <string>
#include "mysql.h"
class SqlTool
{
private:
public:
static MYSQL mysql;
static MYSQL_RES *res;
static MYSQL_ROW column;
static bool connectDB();
static void freeRes();
stati... |
/*
*Author: Ankit Goyal
*Date: 10/10/2012
*
* O(n) - Linear time maximum sum solution.
*
*/
#include<iostream>
#include<algorithm>
using namespace std;
int main(int argc, char **argv){
int list[9] = {10, -1, 5, 6, 20, -50, 100, -100, 4};
int current_maximum = 0, previous_maximum=0;
bool evaluating = fa... |
#pragma once
#include <iostream>
#include <vector>
#include "CarInsoles.hpp"
#include "SeatUpholstery.hpp"
#include "Bulbs.hpp"
#include "Product.hpp"
class Cart
{
public:
Cart() = default;
Cart(const std::vector<Product*>& products_in_cart);
Cart(const Cart& cart);
Cart& operator=(const Cart& cart);
~Cart();
... |
#ifndef _IO_ADAPTER_H_
#define _IO_ADAPTER_H_
#include <cstdio>
class FileOutputAdapter
{
private:
std::FILE *m_fout;
public:
FileOutputAdapter(FILE *f)
:m_fout(f) {
}
void operator() (int ch) {
std::fputc(ch, m_fout);
}
};
class NullOutputAdapter
{
private:
int m_count;
... |
/*矩形切割,适用于任意维数的矩形,具体是一某一矩形为基准,把其他矩形在各维进行
切割*/
#include<iostream>
#include<stdio.h>
#include<memory>
#define fo(i,u,d) for (long i=(u); i<=(d); ++i)
using namespace std;
const long maxn=200000;
const long maxd=2;//矩形维数
struct retan
{
double d1[maxd],d2[maxd];//d1,d2分别表示左上角和右下角的各维坐标
} p[2][maxn],pp;
l... |
#include <iostream>
#include <vector>
#include "matrix.hpp"
using namespace std;
bool Matrix::operator==(Matrix m2) {
if (dVec.size() == m2.dVec.size()
||dVec[1].size() == m2.dVec[1].size())
return false;
for (int i = 0; i < dVec.size(); i++)
{
for (int j = 0; j < dVec[i].size()... |
/*
* Copyright (c) 2015-2021 Morwenn
* SPDX-License-Identifier: MIT
*/
#ifndef CPPSORT_DETAIL_SORTING_NETWORK_SORT6_H_
#define CPPSORT_DETAIL_SORTING_NETWORK_SORT6_H_
namespace cppsort
{
namespace detail
{
template<>
struct sorting_network_sorter_impl<6u>
{
template<
typename RandomA... |
#include "Globals.h"
#include "Application.h"
#include "ModuleTextures.h"
#include "ModuleInput.h"
#include "ModuleParticles.h"
#include "ModuleRender.h"
#include "ModuleCollision.h"
#include "ModuleAudio.h"
#include "ModuleFadeToBlack.h"
#include "ModulePlayer.h"
#include "ModuleKatanaArrow.h"
#include "ModuleEnemies... |
#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... |
/* -*- Mode: c++; tab-width: 4; indent-tabs-mode: t; c-basic-offset: 4 -*-
*
* Copyright (C) 1995-2009 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/dom/src/domsuspendcall... |
/* XMRig
* Copyright 2010 Jeff Garzik <jgarzik@pobox.com>
* Copyright 2012-2014 pooler <pooler@litecoinpool.org>
* Copyright 2014 Lucas Jones <https://github.com/lucasjones>
* Copyright 2014-2016 Wolf9466 <https://github.com/OhGodAPet>
* Copyright 2016 Jay D Dee <jayddee246@gmail.com>
* C... |
#include "precompiled.h"
#include "console/console.h"
#include "settings/settings.h"
#include "settings/jssettings.h"
namespace settings
{
typedef stdext::hash_map<char*, Setting*, hash_char_ptr_traits> settings_hash_map;
bool standard_setter(char* name, void* value);
bool standard_getter(char* name, void* value);... |
#include <vector>
#include <string>
#include <iostream>
#include <fstream>
#include <sstream>
#include <list>
#include <algorithm>
#include <sstream>
#include <set>
#define INF (1<<20)
#define MAX 101
using namespace std;
class RotatedClock {
public:
string getEarliest(int hourHand, int minuteHand)
{
string ans;... |
#include "stdafx.h"
#include "Camera.h"
Camera::Camera()
{
}
Camera::~Camera()
{
}
void Camera::UpdateMatrix()
{
Vector2 LookAt = position + Vector2(0, 0, 1);
matView = Matrix::View(position, LookAt, up);
matProjection = Matrix::Ortho(0, WINSIZE_X, WINSIZE_Y, 0, 0, 1.0f);
matViewProjection = matView * matProj... |
#ifndef DEDVS_ENUMS_H
#define DEDVS_ENUMS_H
namespace dedvs
{
enum DEdvsStatus {
DEDVS_STATUS_OK = 0,
DEDVS_STATUS_ERROR = 1,
DEDVS_STATUS_BAD_PARAMETER = 2,
DEDVS_STATUS_DEVICE_ERROR = 3,
DEDVS_STATUS_STREAM_ERROR = 4,
DEDVS_STATUS_HW_ERROR = 5
};
enum Op... |
#include <iostream>
#include <string>
using namespace std;
#include "pbaf_protocol_service.h"
int main(int argc, char** args)
{
if(argc < 3)
{
cout << "Usage: connect_disconnect <host> <port>" << endl;
return 1;
}
pbaf_server serv;
serv.address = string(args[1]);
serv.port = atoi(args[2]);
pbaf_proto_con... |
#include <CQXYVals.h>
#include <CXYVals.h>
#include <QApplication>
#include <QPainter>
#include <QLabel>
#include <QHBoxLayout>
#include <QMouseEvent>
#include <QKeyEvent>
int
main(int argc, char **argv)
{
QApplication app(argc, argv);
for (int i = 1; i < argc; ++i) {
std::string arg(argv[i]);
if (arg =... |
#include "widget.h"
#include "ui_widget.h"
#include "mymodel.h"
#include "sampledata.h"
Widget::Widget(QWidget *parent) :
QWidget(parent),
ui(new Ui::Widget)
{
ui->setupUi(this);
model = new MyModel(this);
ui->widget->setModel(model);
}
Widget::~Widget()
{
delete ui;
}
void Widget::on_setTes... |
#include "IState.h"
#include "StateMenu.h"
#include "Flashcards.h"
#include "StateOptions.h"
#include "Window.h"
#include "StateManage.h"
#include "StateStart.h"
void changeState(IState *(&state))
{
if ( state->getStateMenu() )
{
//delete state;
state = new StateMenu();
}
else if ( state->getStateOptions() ... |
#include<fstream>
#include <iostream>
#include<conio.h>
#include<stdio.h>
using namespace std;
struct student
{
char name[50];
char lecturer[50];
int id;
char course[20];
int lvl;
char contact[10];
int marks;
char grade[4];
};
int main()
{
fstream fin;
fin.... |
#include "Calculate.h"
#include "Account.h"
#include "Menu.h"
#include "Draw.h"
#include <string>
//this function is old, no longer used
void Draw::DrawTable(Menu& menu, Account& newAccount, int page) {
printf("%-10s%-10s%-16s%-10s\n", "Year", "Deposit", "Interest", "Balance");
for (int i = 0; i < newAccount.Ge... |
#pragma once
#include "cow_resource.hpp"
struct SDL_Texture;
extern "C" void SDL_DestroyTexture(SDL_Texture*);
namespace SDL {
// C++ wrapper around SDL_Texture* using RAII ref counting.
struct Texture {
Texture() {}
explicit Texture(SDL_Texture* ptr) : res(ptr) {}
Texture(Texture&& t) : res(std::... |
/*
Copyright (c) 2014 Mircea Daniel Ispas
This file is part of "Push Game Engine" released under zlib license
For conditions of distribution and use, see copyright notice in Push.hpp
*/
#pragma once
#include "Core/Platform.hpp"
#ifdef PUSH_PLATFORM_IOS
#import <UIKit/UIKit.h>
#import <OpenGLES/EAGL.h>
#import <OpenG... |
#include <cstdio>
using namespace std;
enum TipoPeli{ t, m, a, i };
struct Fecha{
int dia;
int mes;
int anho;
};
struct Artista{
char nombre[10];
char apellidos[20];
Fecha fnac;
};
struct Pelicula{
int codigo;
char titulo[20];
TipoPeli genero;
Artista artistappal;
};
v... |
// 1006_5.cpp : 定义控制台应用程序的入口点。
/*环形染色问题
* RPG三种颜色每格涂一色,要求任何相邻的方格不能同色,
* 且首尾两格也不同色.求全部的满足要求的涂法
*/
#include<iostream>
using namespace std;
int main()
{
int n;
while (cin >> n && n != EOF)
{
if (n <= 0 || n > 50)
break;
long long s[60] = { 0,3,6,6 };
for (int i = 4; i < 60; i++)
{
s[i] = s[i - 1] + 2 *... |
#include "World.h"
#include "Player.h"
#include "Systems/InputSystem.h"
#include "Systems/PhysicsSystem.h"
#include "Systems/AnimationSystem.h"
#include "Systems/ActionStateSystem.h"
#include "Systems/CollisionSystem.h"
#include "Systems/CameraController.h"
#include "Systems/MatchSystem.h"
#include "Systems/NetworkSy... |
#include <iostream>
#include <string>
#include <algorithm>
using namespace std;
int stringToInt(string s) {
bool is_negative = false;
int acum = 0;
if (s[0] == '-') {
is_negative = true;
}
for (int i = is_negative? 1 : 0; i < s.length(); i++) {
acum = acum * 10 + s[i] - '0';
}
return is_negative... |
#include <iostream>
#include <fstream>
#include <string.h>
#include <stdio.h>
#include <stdlib.h>
#include <math.h>
#include <vector>
#include <algorithm>
#define pb push_back
using namespace std;
int nhang,ncot;
int s[111][111];
bool d[111][111];
struct toado{
int h,c;
};
toado huong[5] = {-1... |
#include <cmath>
#include <cstdio>
#include <vector>
#include <iostream>
#include <algorithm>
using namespace std;
// Author: Tatparya Shankar
int main()
{
// Get matrix elements;
int n;
int element;
int sum1 = 0;
int sum2 = 0;
cin >> n;
for( int i = 0; i < n; i++ )
{
for( int ... |
/***************************************************************************
* Sketch Name: Internet Connectivity (Arduino Yun)
* Description: This sketch illustrates how to connect Arduino Yun to internet
using WiFi
* Created On: October 10, 2015
* Author: Adeel Javed
* Book: Buildin... |
#include <iostream>
#include <string>
using namespace std;
class Solution {
public:
int minDistance(string word1, string word2) {
int DP[1000][1000] = {};
int N = word1.size(), M = word2.size();
for(int i=1;i<=N;i++) DP[i][0] = i;
for(int j=1;j<=M;j++) DP[0][j] = j;
for (int i=1;... |
#include "../include/drift_diffusion.h"
void Drift_diffusion::dipslacement_current_density(void)
{
int N = grid_scaled.N_points_scaled; // Number of points with boundaries
double dt_scaled = layers_params_scaled.device.dt_scaled;
vector<double> tmp_J_displ_scaled;
tmp_J_displ_scaled.resize(N);
vector<double> E_... |
#include<cstdio>
const int MAX=100010;
int a[MAX];
void sort(int l,int r)
{int i,j,mid,t;
i=l;j=r;
mid=a[(i+j)/2];
while(i<j)
{while(a[i]<mid) i++;
while(a[j]>mid) j--;
if (i<=j)
{t=a[i];
a[i]=a[j];
a[j]=t;
i++;j--;
}
}
if (i<r) sort(i,r);
if (j>l... |
//===========================================================================
/*
This file is part of the CHAI 3D visualization and haptics libraries.
Copyright (C) 2003-2004 by CHAI 3D. All rights reserved.
This library is free software; you can redistribute it and/or modify
it under the terms... |
/* -*- Mode: c++; tab-width: 4; indent-tabs-mode: t; c-basic-offset: 4 -*-
**
** Copyright (C) 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"
#ifdef CRYPTO_MASTER_PASSWORD_SUPPOR... |
/*****************************************************************************************************************
* File Name : FindFourElementsForGivenSum.h
* File Location : C:\Users\AVINASH\Desktop\CC++\Programming\src\sites\geeksforgeeks\arrays\page03\FindFourElementsForGivenSum.h
* Created on : Jan ... |
#pragma once
#include "Entities/Key/Key.h"
class PartOfGeneralAnswerOptionsKey;
class GeneralAnswerOptionsKey : public Key {
public:
// Методы возвращают ссылку на часть ключа,
// соответствующую переданному индексу
const PartOfGeneralAnswerOptionsKey &at(uint index) const;
const PartOfGeneralAnswerOptionsKey &... |
/*
* node_car_estimate.cpp
*
* This is the node to analyze and publish car states.
*
* Author: yubocheng@live.cn
*
* Copyright (c) 2019 Jimu
* All rights reserved.
*
*/
#include <node_car_estimate.h>
int main(int argc, char **argv)
{
ros::init(argc, argv, "car_state_publisher", ros::init_options::NoRoso... |
#include<bits/stdc++.h>
using namespace std;
#define maxn 100005
int dp[maxn];
int a[maxn];
int main(){
int T;
scanf("%d",&T);
for(int cas=1;cas<=T;cas++){
if(cas>1)
printf("\n");
int n;
scanf("%d",&n);
for(int i=0;i<n;i++)
scanf("%d",&a[... |
/* -*- Mode: c++; tab-width: 4; 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.
*
* Espen Sand
*/
#ifndef CUPS_HELPER_PRIVATE_H
#define CUPS_HELPER_PRIVATE_H
class De... |
/****************************************************************************
* *
* Author : lukasz.iwaszkiewicz@gmail.com *
* ~~~~~~~~ *
* Lice... |
/*快速幂取模 (a^b)%p*/
int quickpow(int a,int b,int p)
{
int ret=1;
a%=p;
while(b)
{
if(b&1) ret=(a*ret)%p;
a=(a*a)%p;
b>>=1;
}
return ret;
}
/*快速乘法取模 (a*b)%p*/
int quickmul(int a,int b,int p)
{
int ans=0;
while(b)
{
if(b&1) {b--;ans=(ans+a)%p;}
b>>=1;
a=(a+a)%p;
}
return ans;
}
|
//算法:数论/拓展欧几里得定理
/*
求解不定方程a*x+b*y==gcd(a,b);
解法推导:
∵a=[a/b]*b+a%b;
又∵欧几里得知:gcd(a,b)==gcd(b,a%b);
∴([a/b]*b+a%b)*x+b*y=gcd(a,b);
∴[a/b]*b*x+(a%b)*x+b*y=gcd(a,b);
∴b*([a/b]*x+y)+(a%b)*x=gcd(b,a%b);
看到这里,不难发现:
令:a'=b,x'=[a/b]*x+y,b'=a%b,y'=x;
整理后原式又变成了:a'*x'+b'*y'==gcd(a',b');
当然解虽然最小,可能是负数,
加b/gcd(a,b)再模上... |
/* -*- Mode: c++; tab-width: 4; indent-tabs-mode: t; c-basic-offset: 4 -*-
*
* Copyright (C) 1995-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"
#ifdef _PLUGIN_SUPPORT_
#include "modules... |
#include <iostream.h>
#include <conio.h>
void main() {
clrscr();
int a,b,i;
cout <<"\n\nEnter the starting range of loop: ";
cin >>a;
cout <<"\n\nEnter the Ending range of loop: ";
cin >>b;
for (i=a; i<=b; i++)
cout <<endl << i <<"\n";
getch();
} |
//---------------------------------------------------------
//
// Project: dada
// Module: geometry
// File: Transform3f.cpp
// Author: Viacheslav Pryshchepa
//
//---------------------------------------------------------
#include "dada/geometry/Transform3f.h"
#include "dada/geometry/Matrix... |
/*******************************************************************************
Based on segment-lcd-with-ht1622 from anxzhu (2016-2018)
Follow of MartyMacGyver / LCD_HT1622_16SegLcd work (https://github.com/MartyMacGyver/LCD_HT1622_16SegLcd)
This file is part of the HT1622 arduino library, and thus under the MIT... |
//hung.nguyen@student.tut.fi - student id: 272585
//sanghun.2.lee@student.tut.fi - student id: 272571
#ifndef SPLITTER_HH
#define SPLITTER_HH
#include <vector>
#include <string>
using namespace std;
vector<string> split(const string& stringToSplit_,char regex);
#endif // SPLITTER_HH
|
//===========================================================================
//! @file shadow_map.cpp
//! @brief シャドウマップ管理
//===========================================================================
//---------------------------------------------------------------------------
//! 初期化
//-----------------------------... |
/* -*- 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"
#if defined(_NA... |
#include "order.h"
Order::Order(int timestamp, char id, bool isBid, int price, int size)
{
this->timestamp = timestamp;
this->id = id;
this->isBid = isBid;
this->price = price;
this->size = size;
this->next = NULL;
this->prev = NULL;
this->parentLimit = NULL;
}
void Order::Append(Order... |
#include <iostream>;
#include <string>;
#include <conio.h>
#include <cassert>
using namespace std;
int search_1(int A[], int size, int key)
{
assert(size != NULL);
for (int i = 0; i < size; ++i)
{
if (A[i] == key)
{
return i;
}
}
return -1;
}
int search_2(int A[], int size, int key)
{
int i = 0;
wh... |
#include "akasztofa.h"
int Akasztofa::tipp(char c) {
if(hatra == 0) {
throw "Nem probalkozhat tobbszor.";
}
for (unsigned i = 0; i < feladvany.length(); i++) {
if(not allapot[i] and feladvany[i]==c) {
allapot[i] = true;
rejtve--;
}
}
hatra--;
return rejtve;
}
int Akasztofa::getHatr... |
/*
* LSST Data Management System
* Copyright 2014-2015 AURA/LSST.
*
* This product includes software developed by the
* LSST Project (http://www.lsst.org/).
*
* 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... |
/**
* IP implementing the reduce method of NumPy ufuncs for one-dimensional
* inputs (or flattened multi-dimensional inputs). Integer (i4) implementation.
*
* The reduction operator can be selected using the `args.reduce_op` parameter.
* It is also possible to do an additional unary or binary operation on each
* ... |
#ifndef LogServerConnect_H
#define LogServerConnect_H
#include "CDLSocketHandler.h"
#include "CDL_Timer_Handler.h"
#include "Packet.h"
#include "DLDecoder.h"
#define CMD_BACKSVR_HEART 0x0001 //MysqlServer
#define RECORD_GAME_START 0x0500 //游戏开始
#define RECORD_BET_CALL 0x0501 //跟注
#define RECORD_B... |
#include <chuffed/core/engine.h>
#include <chuffed/core/options.h>
#include <chuffed/core/sat.h>
#include <iostream>
Options so;
Options::Options()
: nof_solutions(1),
time_out(0),
rnd_seed(0),
verbosity(0),
print_sol(true),
restart_scale(1000000000),
restart_scale_override(true),
restart_bas... |
#include <iostream>
#include <cmath>
#include <cstdio>
#include <cstdlib>
#include "TFile.h"
#include "TTree.h"
#include "TH1.h"
#include "Nuclear_Info.h"
#include "fiducials.h"
using namespace std;
int main(int argc, char ** argv)
{
if (argc != 3)
{
cerr << "Wrong number of arguments. Instead try:\n"
<< " ... |
#include "General.h"
#include "Touchstone.h"
using namespace RsaToolbox;
#include <QDebug>
#include <QtTest>
#include <QDir>
class test_Touchstone : public QObject
{
Q_OBJECT
public:
test_Touchstone();
private:
QDir path;
private Q_SLOTS:
void init();
void cleanup();
void ports();
vo... |
#include <windows.h>
#include <d3dx9.h>
#include <d3d9.h>
#include <dinput.h>
LPDIRECT3D9 pD3d;
LPDIRECT3DDEVICE9 pD3Device;
LPDIRECT3DTEXTURE9 pTexture;
LPD3DXFONT m_pFont;//フォント(描画ブラシ)のオブジェクト
LPDIRECTINPUT8 pDinput;
LPDIRECTINPUTDEVICE8 pKeyDevice = NULL;//DirectInputデバイスオブジェクトのポインタ
D3DPRESENT_PARAMETERS D3dPresen... |
//
// Created by heyhey on 20/03/2018.
//
#ifndef PLDCOMP_STRUCTUREIF_H
#define PLDCOMP_STRUCTUREIF_H
#include <ostream>
#include "Condition.h"
#include "Bloc.h"
#include "Structure.h"
class StructureIF : public Structure {
public:
StructureIF();
StructureIF(Condition *condition, Bloc *bloc, Bloc *blocElse... |
#include "ListNode.h"
#include<iostream>
#include <cstdlib>
using namespace std;
template <class T>
class GenDLinkedList
{
public:
ListNode<T> *m_head;
ListNode<T> *m_tail;
int m_size;
// constructor
GenDLinkedList();
//destructor
~GenDLinkedList();
// member functions
void ins... |
#include <cstdlib>
#include "setint.h"
/**
* Default constructor - default to a list of capacity = 10
*/
SetInt::SetInt() : list_()
{
iterLoc_ = -1;
}
/**
* Destructor
*/
SetInt::~SetInt()
{
}
/**
* Returns the current number of items in the list
*/
int SetInt::size() const
{
return list_.size();
}
/*... |
#pragma once
#include "level.h"
using namespace std;
int random(int minN, int maxN) {
return minN + rand() % (maxN + 1 - minN);
}
int x_random(int x)
{
if (x < 87)
return random(x, x + 10);
if (x > 26)
return random(x, x - 10);
}
int LEVEL(int tmp)
{
srand((int)time(0)... |
// https://oj.leetcode.com/problems/max-points-on-a-line/
/*
* Take every point as a hub point and find points on
* lines that go through the given hub point. And then
* find the maximum among all possibilities.
*
* Note: Be careful when several points overlap.
*/
/**
* Definition for a point.
* struct Poin... |
//
// EnemyLBullet.h
//
// Created by Yajun Shi
//
#include "stdafx.h"
#include "Player.h"
#include "EnemyBullet.h"
#ifndef __ClientGame__EnemyLBullet__
#define __ClientGame__EnemyLBullet__
class EnemyLBullet : public EnemyBullet {
public:
EnemyLBullet(Enemy* enemy);
};
#endif /* defined(__ClientGame... |
//: C13:NewAndDelete.cpp
// Kod zrodlowy pochodzacy z ksiazki
// "Thinking in C++. Edycja polska"
// (c) Bruce Eckel 2000
// Informacje o prawie autorskim znajduja sie w pliku Copyright.txt
// Prosta demonstracja operatorow new i delete
#include "Tree.h"
using namespace std;
int main() {
Tree* t = new Tree... |
#ifndef TOKENIZER_H
#define TOKENIZER_H
#include <string.h>
#include <string>
#include <iostream>
using namespace std;
class Tokenizer
{
public:
Tokenizer(string fileName) {
fin.open(fileName.c_str());
token = NULL;
if (fin.is_open()) {
if (getline(fin,line)) {... |
//
// Created by Steven Yan on 10/02/2017.
//
#ifndef DAYSBETWEENDATES_CORE_H
#define DAYSBETWEENDATES_CORE_H
#endif //DAYSBETWEENDATES_CORE_H
#include<iostream>
int addition(int a[], int l) //This function adds the first l terms in the array a[]
{ //... |
/* -*- Mode: c++; tab-width: 4; c-basic-offset: 4 -*-
*
* Copyright (C) 1995-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/pi/OpUAComponentManager.h"
#include "platfor... |
#include <iostream>
#include <string.h>
using namespace std;
void combination(char str[],int n,int l)
{
int ctr=0;
char temp;
for(int i=l;i<n-1;++i)
{
for(int j=i+1;j<n;++j)
{
temp=str[i];
str[i]=str[j];
str[j]=temp;
combina... |
#pragma once
#include "base_trie_decl.hpp"
#include "iterator_base_decl.hpp"
#include <memory>
struct base_trie::trie_node final
{
trie_node() = default;
explicit trie_node(trie_node* parent_node_ptr);
template<class... Args>
void set_value(Args&& ...args);
bool operator==(trie_node const& rsh) c... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.