text stringlengths 8 6.88M |
|---|
/*
Copyright (c) 2005-2023, University of Oxford.
All rights reserved.
University of Oxford means the Chancellor, Masters and Scholars of the
University of Oxford, having an administrative office at Wellington
Square, Oxford OX1 2JD, UK.
This file is part of Chaste.
Redistribution and use in source and binary forms... |
# include <stdio.h>
# define WEIGHT_A 2
# define WEIGHT_B 3
# define WEIGHT_C 5
int main() {
float A, B, C, avg;
scanf("%f", &A);
scanf("%f", &B);
scanf("%f", &C);
avg = (A * WEIGHT_A + B * WEIGHT_B + C * WEIGHT_C) / (WEIGHT_A + WEIGHT_B + WEIGHT_C);
printf("MEDIA = %.1f\n", avg);
retur... |
#include <iostream>
#include <iomanip>
float y, x, l[6],t = 0.5; int n;
using namespace std;
int main()
{
setlocale(LC_CTYPE, "Russian");
for (n = 0; n <= 4;n++)
{
printf("Введите x%i: ", n); cin >> x;
l[n] = x;
}
cout << endl;
n = 0;
for (t; t <= 3; t+=0.5)
{
if (t > 2)
{
for (n; n <= 5; n++)
{... |
#include <type_traits>
#include <limits>
#include <gtest/gtest.h>
#include <libndgpp/type_traits/char_numeric_type.hpp>
TEST(unsigned_char_type, test)
{
using type = ndgpp::char_numeric_type<unsigned char>::type;
constexpr bool is_same = std::is_same<type, unsigned short>::value;
EXPECT_TRUE(is_same);
}
... |
// TrafficLightDetectionDlg.cpp : 实现文件
//
#include "stdafx.h"
#include "TrafficLightDetection.h"
#include "TrafficLightDetectionDlg.h"
#include "afxdialogex.h"
#include <atlconv.h>
#ifdef _DEBUG
#define new DEBUG_NEW
#endif
// 用于应用程序“关于”菜单项的 CAboutDlg 对话框
class CAboutDlg : public CDialogEx
{
public:
CAboutDlg();... |
/**
*
* @file MultipleFK.hpp
* @author Naoki Takahashi
*
**/
#pragma once
#include "ForwardProblemSolverBase.hpp"
#include <Tools/Math/Matrix.hpp>
#include "../Parameters.hpp"
#include "../ControlPointMap.hpp"
namespace Kinematics {
namespace ForwardProblemSolvers {
template <typename Scalar>
class... |
//
// Created by peer23peer on 5/22/20.
//
#ifndef GHERMENEUS_MACHINE_H
#define GHERMENEUS_MACHINE_H
#include <algorithm>
#include <execution>
#include <fstream>
#include <iostream>
#include <optional>
#include <string>
#include <string_view>
#include <vector>
#include <range/v3/distance.hpp>
#include <range/v3/rang... |
#pragma once
#ifndef GLSLPROGRAM_H
#define GLSLPROGRAM_H
#include <iostream>
#include <string>
#include <fstream>
#include <vector>
#include <map>
#include <glm/glm.hpp>
#include <glm/gtc/type_ptr.hpp>
#include <GL/glew.h>
namespace cg
{
namespace GLSLShader
{
enum GLSLShaderType
{
VERTEX = GL_VERTEX_SHAD... |
#pragma once
#include <tbb/parallel_for.h>
#include <tbb/blocked_range.h>
#include <tbb/mutex.h>
#include <bits/stdc++.h>
#include <algorithm>
#include "tbb/enumerable_thread_specific.h"
#include "types.h"
//This class groups the elements of the original array locally per Thread.
//The elements are stored in a Thread... |
//
// Created by Amelia Chady on 11/30/2018.
// Implementation of Utility files
//
#include <string>
#include "List.h"
#include "LinkedList.h"
#include "Util.h"
std::string trim(std::string stringToTrim){
if(stringToTrim.length()==0){
return stringToTrim;
}
while(stringToTrim.length()!=0 &&
... |
#include <glm/gtc/matrix_transform.hpp>
#include "Renderer.h"
#include "Model.h"
#include "Utility.h"
#include "HMDInput.h"
using namespace std;
using namespace glm;
/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * /
Renderer Private Functions
* * * * * * * * * * * * * * * * * * * * * * ... |
#ifndef MENU_CHICKFILA_DISPLAY
#define MENU_CHICKFILA_DISPLAY
#include "../composite/menu_component.hpp"
#include "../composite/menu_burger/header/menu_items_chickfila.hpp"
#include "../composite/menu_burger/header/menu_chickfila.hpp"
class menu_chickfilas_display
{
public:
void display_chickfilas_customer_favorit... |
#include<bits/stdc++.h>
using namespace std;
class Solution
{
public:
vector<vector<int>> subsets(vector<int> &nums)
{
vector<vector<int>> ans;
if (nums.empty())
return ans;
int n = pow(2, nums.size());
for (int i = 0; i < n; ++i)
{
vector<int> v;... |
#include "threshold.h"
#ifdef PTHREAD
/* c function and struct for pthread */
struct thread_data {
int id;
void *threshold;
};
void*
threadWorker(void *arg)
{
struct thread_data *task = (struct thread_data*) arg;
((Threshold *)task->threshold)->scheduleWork(task->id);
return NULL;
}
#endif
Threshold::Threshol... |
#pragma once
#include "../TCPServer.h"
#include "Parser.h"
#include "Response.h"
namespace
NAMESPACE http {
class HTTPServer {
public:
private:
TcpServer server_;
};
}
|
#include <graphics.h>
#define DELAY 10
int color = 2;
void lineBresenham_1(int x1, int y1, int x2, int y2)
{
int c2, c, Dx, Dy, x, y;
Dx = abs(x2 - x1);
Dy = abs(y2 - y1);
c = Dx - Dy;
c2 = 2 * c;
x = x1;
y = y1;
int x_unit = 1, y_unit = 1;
if (x2 - x1 < 0)
x_unit = -x_unit... |
#include <iostream>
#include <string>
#include <sstream>
#include <cstdlib>
std::string ver_string(int a, int b, int c) {
std::ostringstream t;
t << a << '.' << b << '.' << c;
return t.str();
}
std::string true_cxx =
#ifdef __clang__
"clang++";
#else
"g++";
#endif
std::string true_cxx_ver... |
#include "ItemLadderLR.h"
#include "Mario.h"
ItemLadderLR* ItemLadderLR::create(CCDictionary* dict)
{
ItemLadderLR* ret = new ItemLadderLR;
ret->init(dict);
ret->autorelease();
return ret;
}
bool ItemLadderLR::init(CCDictionary* dict)
{
Item::init();
_type = Item::IT_LadderLR;
setPositionByProperty(dict);
/... |
#pragma once
#include "ActionSingleTarget.h"
class FightingCharacter;
class Canvas;
class ActionDefend : public ActionSingleTarget
{
public:
ActionDefend(FightingCharacter *fc):
ActionSingleTarget(fc,NULL)
{
}
virtual void preproccess()
{
}
virtual void postExecute()
{
... |
#pragma once
#include <string>
#include <Windows.h>
template <typename T>
class Interface
{
public:
typedef void*(*CreateInterfaceFn)(const char*, int*);
static T* Get(const std::string& dllName, const std::string& fullName)
{
static T* intyface = nullptr;
if (intyface)
return intyface;
void* dll = nu... |
//! Bismillahi-Rahamanirahim.
/** ========================================**
** @Author: Md. Abu Farhad ( RUET, CSE'15)
** @Category:
/** ========================================**/
#include<bits/stdc++.h>
#include<stdio.h>
using namespace std;
#define ll long long
#define scl(n) scan... |
#include <bits/stdc++.h>
#include <cassert>
#define rep(i, N) for (int i = 0; i < (N); ++i)
#define rep2(i, a, b) for (ll i = a; i <= b; ++i)
#define rep3(i, a, b) for (ll i = a; i >= b; --i)
#define pb push_back
#define eb emplace_back
#define fi first
#define se second
#define all(c) begin(c), end(c)
#define ok() put... |
#include "test/helpers.h"
#include "test/net/helpers.h"
#include <sstream>
#include <algorithm>
using namespace std;
using namespace inexor::net;
bytes mkpkg(size_t size) {
bytes r(size);
rndcopy(&r[0], size);
return r;
}
bytes mcbytebuffer_encode(bytes &msg) {
stringstream ss; // TODO: Could do this quicke... |
/* Copyright (C)
* 2019 - Bhargav Dandamudi
*
* MIT License
*
* 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,... |
#ifndef _RAVE_UTILS_H__
#define _RAVE_UTILS_H__
#include <iostream>
#include <Eigen/Eigen>
using namespace Eigen;
#include <openrave-core.h>
namespace rave = OpenRAVE;
namespace rave_utils {
Matrix4d transform_from_to(rave::RobotBasePtr robot, const Matrix4d& mat_in_ref, std::string ref_link_name, std::string targ... |
#include <particle_structs.hpp>
#include "read_particles.hpp"
#include <stdlib.h>
#include <CSR.hpp>
#include <MemberTypes.h>
#include <MemberTypeLibraries.h>
#include <ppTypes.h>
#include <psMemberType.h>
#include "Distribute.h"
#ifdef PP_USE_CUDA
typedef Kokkos::CudaSpace DeviceSpace;
#else
typedef Kokkos::HostSpa... |
#define STRICT
#define ORBITER_MODULE
#include <windows.h>
#include <stdio.h>
#include <math.h>
#include <orbitersdk.h>
#include "CruiseMFD.h"
#include <oicominit.h>
int mode; // identifier for new MFD mode
double setpoint=10.; // m/s setpoint for cruise
bool active = false, init=false;
OICOM_PID pid=0, cruise... |
/***************************************************************************
Copyright (c) 2020 Philip Fortier
This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License
as published by the Free Software Foundation; either version 2
of the License, or... |
#include "GameWidget.h"
#include <QMouseEvent>
#include <QDebug>
#include <math.h>
#include "Model.h"
#include <QFont>
#include <QKeyEvent>
GameWidget::GameWidget(int width, int height, const Model* model, QWidget *parent) :
QWidget(parent), m_model(model)
{
this->resize(width, height);
m_leftCoordinateBo... |
#include<bits/stdc++.h>
using namespace std;
int a[1010], b[1010], dp[1010][15000];
int n, ans, len;
int main()
{
scanf("%d", &n);
for (int i = 1; i <= n; ++i)
scanf("%d %d", &a[i], &b[i]);
for (int i = 0; i <= 1000; ++i)
for (int j = 0; j <= 14000; ++j)
dp[i][j] = 1e9;
dp[0][5000] = 0;
for (int i = 1; i ... |
#ifndef CLIENT_MANAGER_H
#define CLIENT_MANAGER_H
#include <netinet/in.h>
#include <string>
class client_manager {
// FIXME:
public:
// TODO: WTF IS THIS???
// O_CLOEXEC (Since Linux 2.6.23)
// Enable the close-on-exec flag for the new file descriptor. Specifying this flag permits a... |
#include "Rate.h"
#include <iostream>
#include "EtcFunctions.h"
void Rate::set_const_rate(double v)
{
//if vector is null
if(r.empty()==true && r.empty()==true){
ts.push_back(1.0);
r.push_back(1.0);
}else{
std::vector<double>::iterator it;
for(it=r.begin();it!=r.end();it++)
*it=v;
}
}
void Rate::print... |
/*
* Space.cpp
*
* Created on: 30 Eyl 2019
* Author: keske
*/
#include "Space.h"
const Vehicle& Space::get_content() const {
if(is_empty()){
std::cout << "Empty space reached!!! Check code" << std::endl;
}
return *content;
}
Space::Space(const Vehicle &vec) :
empty(false), content(... |
#include <iostream>
using namespace std;
int StringToInt(const char *str);
int StringToIntCore(const char *str, bool minus); //字符串转整型核心函数
int StringToInt(const char *str)
{
int num;
if (str != NULL && *str != '\0') //str为空指针或空字符串返回零
{
//处理正负号
bool minus = false;
if (*str == '+')
... |
#pragma once
#include "CalendarComponent.h"
using namespace std;
class FullCalendarBuilder;
class CalendarInterface;
class DisplayableDay;
class DisplayableMonth;
class DisplayableYear;
class IncrementalBuilder;
class DisplayableEvent : public CalendarComponent{
friend class DisplayableDay;
friend class Displayabl... |
//
// fileReader.cpp
// EmbeddedLab_GPS-Decoder
//
// Created by Markus Heupel on 20.12.18.
// Copyright © 2018 Markus Heupel. All rights reserved.
//
#include <iostream>
#include "../includes/fileReader.hpp"
using namespace std;
int read(const char* filename, int* sumSignal){
FILE *fs;
char c;
char b... |
//
// Created by Nudzejma on 4/2/2018.
//
#include "Node.h"
Node::Node(const Node &node) {
adjacentNodes = {};
adjacentNodes = node.adjacentNodes;
visited = node.visited;
label = node.label;
}
Node::~Node() {
while(!this->adjacentNodes.empty()) {
removeAdjacentNode(this->adjacentNodes[thi... |
#include <stdio.h>
#include <stdlib.h>
#include <time.h>
#include <memory.h>
#include <captGenerator.h>
#include <captFontFile.h>
#include <captRLE.h>
#pragma pack(push, 1)
struct TGA_HEAD // TGA图像文件头
{
unsigned char IdentSize; // 标志域长度 00 无标志域
unsigned char ColorMapType; ... |
#include "GpuObject.h"
namespace revel
{
namespace renderer
{
GpuObject::GpuObject()
: m_Identifier(0)
{
}
GpuObject::~GpuObject()
{
}
u32
GpuObject::get_id() const
{
return m_Identifier;
}
bool
GpuObject::is_valid() const
{
return m_Identifier;
}
} // ::revel::renderer
} // ::revel
|
#ifndef __HISTORY_H__
#define __HISTORY_H__
#include <QDialog>
#include <trend.h>
class IoDev;
namespace Ui {
class History;
}
class RHistorySelect: public QDialog
{
Q_OBJECT
public:
RHistorySelect(IoDev &src,struct trendinfo *tp,QWidget *p=NULL);
~RHistorySelect() ;
QString& getNameTrend() {retur... |
#include <bits/stdc++.h>
using namespace std;
using ll = long long int;
void solve(){
int n;
cin >> n;
vector<int> cnt(2,0), v(n);
for(int &x : v) cin >> x, cnt[x & 1] ++;
int sim = 0;
for(int i = 0; i < n; i++){
for(int j = i + 1; j < n; j++) sim += abs(v[i] - v[j]) == 1;
}
if(... |
//
// DashedRoundRect.h
// SMFrameWork
//
// Created by KimSteve on 2016. 11. 14..
//
//
#ifndef DashedRoundRect_h
#define DashedRoundRect_h
#include <2d/CCSprite.h>
class DashedRoundRect : public cocos2d::Sprite
{
public:
DashedRoundRect();
virtual ~DashedRoundRect();
static DashedRoundRect* cr... |
#pragma once
namespace GraphicsEngine
{
class RenderTexture
{
public:
RenderTexture() = default;
RenderTexture(ID3D11Device* d3dDevice, UINT width, UINT height, DXGI_FORMAT format);
void SetRenderTargetView(ID3D11DeviceContext* deviceContext, ID3D11DepthStencilView* depthStencilView) const;
void ClearRend... |
#pragma once
#include "../pathfinding/obstruction-map.h"
#include "../graphics/GraphicsGrid.h"
class DisplayGrid : public sf::RectangleShape
{
typedef std::map<std::string, sf::Color> ColorIdMap;
static ColorIdMap GridColors; // pair of id and color - TODO change this
GridBool* obsMap;
sf::Color getTileColor(boo... |
#include<stdio.h>
#include<conio.h>
int main()
{
int i,j=10,n;
for(i=1;i<5;i++){
for(j,n=5;n>i;n--,j--){
printf("%d",j);
}
printf("\n");
}
getch();
}
|
/*
// Copyright 2007 Alexandros Panagopoulos
//
// This software is distributed under the terms of the GNU Lesser General Public Licence
//
// This file is part of Be3D library.
//
// Be3D is free software: you can redistribute it and/or modify
// it under the terms of the GNU Lesser General Public Licen... |
#include <catch.hpp>
#include <embr/datapump.hpp>
#include <embr/dataport.hpp>
#include <embr/observer.h>
#include "datapump-test.h"
using namespace embr;
struct synthetic_context
{
int value;
};
// Renamed from StatefulObserver because compiler picked it up as the same class as
// from observer-test --- seems... |
#include <iostream>
using namespace std;
typedef void (*PFT)(char, int);
void bar(char ch, int i)
{
cout << "bar " << ch << ' ' << i << endl;
return;
}
int main(int argc, char *argv[])
{
// 定义一个函数对象
PFT pft;
pft = bar; // 赋值
// 调用
pft('e', 91);
return 0;
} |
#ifndef FLOWINFO_H
#define FLOWINFO_H
#include <cstdint>
#include <string>
#include "ndpi_main.h"
#include "global_vars_prefs.h"
class FlowInfo {
const uint8_t MAX_EXTRA_PACKETS_TO_CHECK = 7;
private:
uint32_t hashval;
uint8_t protocol;
uint16_t vlan_id;
uint8_t ip_version;
uint32_t src_ip;
... |
#include <QCoreApplication>
#include <QTextStream>
#include <QDir>
#include <QFile>
#include <qhttpserver.hpp>
#include <qhttpserverresponse.hpp>
#include <qhttpserverrequest.hpp>
#include <resty/mux/Router.h>
#include <resty/mux/RouteMatch.h>
#include <iostream>
using namespace resty::mux;
int main(int argc, cha... |
//-----------------------------------------------------------------------------
// Perimeter Map Compiler
// Copyright (c) 2005, Don Reba
// All rights reserved.
//
// Redistribution and use in source and binary forms, with or without
// modification, are permitted provided that the following conditions are met:... |
#include<stdio.h>
#include<malloc.h>
#include<stdlib.h>
struct node{
int data;
struct node *left;
struct node *right;
};
bool isSumToNos(struct node *,int);
struct node *newnode(int data){
struct node *temp=(struct node *)malloc(sizeof(struct node ));
temp->data=data;
temp->left=NULL;
temp... |
//
// Created by Apple on 2021/6/9.
//
#include <vector>
// todo, 空间复杂度可以优化,为了利于后续思考,此处不写答案
using namespace std;
/**
* 一个机器人位于一个 m x n 网格的左上角 (起始点在下图中标记为“Start” )。
* 机器人每次只能向下或者向右移动一步。机器人试图达到网格的右下角(在下图中标记为“Finish”)。
* 现在考虑网格中有障碍物。那么从左上角到右下角将会有多少条不同的路径?
* 网格中的障碍物和空位置分别用 1 和 0 来表示。
*
* 分析:dp[i][j]表示从起点到[i, j]的路径... |
#include <bits/stdc++.h>
#define rep(i,n) for (int i = 0; i < (n); ++i)
#define ok() puts(ok?"Yes":"No");
#define chmax(x,y) x = max(x,y)
#define chmin(x,y) x = min(x,y)
using namespace std;
using ll = long long;
using vi = vector<int>;
using ii = pair<int, int>;
using vvi = vector<vi>;
using vii = vector<ii>;
using gt... |
#include <stdio.h>
int n;
int save[101];
const int num = 1000000007;
int func(int rest)
{
if(save[rest] != -1)
return save[rest];
save[rest] = (func(rest-1) + func(rest-2))%num;
return save[rest];
}
int main()
{
int c;
scanf("%d",&c);
for(int i=3;i<101;i++)
save[i] = -1;
save[1] =1;
save[2] =2;
wh... |
// Copyright (c) 2015, Baidu.com, Inc. All Rights Reserved
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
//
// Copyright (c) 2011 The LevelDB Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the ... |
#include <iostream>
#include <sstream>
#include <string>
using namespace std;
struct Node {
int data;
Node* left;
Node* right;
Node(int d, Node* l = nullptr, Node* r = nullptr): data(d), left(l), right(r) { }
};
string serialize(Node* node) {
if (node == nullptr) {
return "()... |
// scene.cpp : Defines the Scene object
//
#include "stdafx.h"
#include "scene.h"
#include <algorithm>
///////////////////////////////////////////////////////////
// Class CScene
CScene::CScene()
{
m_bOn = TRUE;
m_pRenderer = NULL;
m_pCamera = NULL;
m_nOrdinalOffset = 0;
}
CScene::~CScene()... |
/*
* cv_viewer.cpp
*
* Created on: Dec 5, 2018
* Author: ttw2xk
*/
#include "f1_datalogger/f1_datalogger.h"
//#include "image_logging/utils/screencapture_lite_utils.h"
#include <iostream>
#include <opencv2/highgui.hpp>
#include <opencv2/imgproc.hpp>
#include <sstream>
#include "f1_datalogger/udp_logging/co... |
#include "Controls.h"
#include <iostream>
void Controls::processInputKeyboard(GLFWwindow* window)
{
//generic part
//this is placeholder camera controls
if (glfwGetKey(window, GLFW_KEY_W) == GLFW_PRESS)
forward -= movementSpeed;
if (glfwGetKey(window, GLFW_KEY_S) == GLFW_PRESS)
... |
//
// Copyright Jason Rice 2016
// Distributed under the Boost Software License, Version 1.0.
// (See accompanying file LICENSE_1_0.txt or copy at
// http://www.boost.org/LICENSE_1_0.txt)
//
#ifndef NBDL_UTIL_BASE64_ENCODE_HPP
#define NBDL_UTIL_BASE64_ENCODE_HPP
#include <nbdl/concept/Container.hpp>
#include <array>
... |
#include "graphics\Singularity.Graphics.h"
namespace Singularity
{
namespace Graphics
{
class VertexPositionNormalTexture
{
private:
#pragma region Static Methods
static VertexDeclaration* GetVertexDeclaration();
#pragma endregion
public:
#pragma region Static Variables
... |
#include <APP_SHARED/app_main.h>
#include <APP_SHARED/fileutil.h>
#include <CORE/BASE/config.h>
#include <CORE/BASE/logging.h>
#include <CORE/VFS/vfs.h>
#include "font_parser.h"
#include <iostream>
#include <string>
using bmfont::FontDef;
using core::util::lexical_cast;
using core::util::files::XmlNode;
FISHY_APPLI... |
#include<iostream>
#include<string>
#include <fstream>
#include "Continent.h"
#include "Country.h"
#include "Map.h"
#include <sstream>
#include "MapEditorComponent.h"
using namespace std;
//This function is call when the user add a territory A to the list of adjacent territories of a territory B. This function
//will... |
/*************************************************************
* > File Name : P3388.cpp
* > Author : Tony
* > Created Time : 2019/09/01 13:46:31
* > Algorithm : Tarjan
**************************************************************/
#include <bits/stdc++.h>
using namespace std;
inl... |
#include "헤더.h"
int main() {
int v1 = 100;
int v2 = 200;
int rs = add(v1, v2);
printf("%d\n", rs);
Person p1;
p1.age = 22;
printf("p1.age : %d\n", p1.age);
//printf("%f\n",pow(2.0,10));
//printf("%f\n", sin(1));
//srand(time(0));
//printf("%d\n", rand() % 10);
return 0;
}
int add(int a, int b) {... |
#include "Activity.h"
#include "Utility.h"
Activity::Activity (int stages, int mean)
{
}
void Activity::gen_arr_times (int nums)
{
// generate an array of events and keep them
// in a vector
for (unsigned int i = 0;
i < nums;
i++)
{
Utility::instance ()->gen_erlang_time (this->ta... |
/**
* Definition for singly-linked list.
* struct ListNode {
* int val;
* ListNode *next;
* ListNode(int x) : val(x), next(NULL) {}
* };
*/
class Solution {
public:
ListNode* removeNthFromEnd(ListNode* head, int n) {
ListNode *p1 = head;
int k = 0;
while (head) {
k++;
... |
#include "ServerMessageHandler.hpp"
#include "../../generated/MessageAdapters.hpp"
#include "../Signals.hpp"
#include "../Constants.hpp"
#include "NetPlayerInfo.hpp"
#include "../components/PlayerComponent.hpp"
#include "../components/RenderComponent.hpp"
#include "../components/PositionComponent.hpp"
#include "../comp... |
#include<bits/stdc++.h>
using namespace std;
int count_ways(int n)
{
int dp[n+1];
dp[0]=dp[1]=1;
dp[2]=2;
for(int i=3;i<=n;i++)
{
dp[i]=dp[i-1]+dp[i-2];
}
return dp[n];
}
int main()
{
int n;
cin>>n;
cout<<count_ways(n)<<"\n";
}
|
#include "TShirt.h"
#include "YShirt.h"
#include "Storage.h"
#include <iostream>
int main(int argc, char *argv[])
{
std::shared_ptr<Component> component = std::make_shared<Storage>(
std::make_shared<Decorator>(
std::make_shared<TShirt>()));
std::cout << "[Product]: " << component->product... |
#ifndef ROSE_SEMANTICSMODULE_H
#define ROSE_SEMANTICSMODULE_H
#include <stdint.h>
#ifndef __STDC_FORMAT_MACROS
#define __STDC_FORMAT_MACROS
#endif
#include <inttypes.h>
static inline int numBytesInAsmType(SgAsmType* ty) {
switch (ty->variantT()) {
case V_SgAsmTypeByte: return 1;
case V_SgAsmTypeWord: retur... |
class Solution {
public:
/*
void rotate(vector<vector<int>>& matrix) {
int widSize = matrix.size(), lenSize = matrix[0].size();
int m = 0, n = 0, i = 0, temp,temp1,x,y;
int sizeMin = lenSize > widSize ? widSize : lenSize;
int widBase = lenSize > widSize ? 0 : widSize -lenSize;
... |
//
// RenderTexture.h
// cheetah
//
// Copyright (c) 2013 cafaxo. All rights reserved.
//
#ifndef cheetah_RenderTexture_h
#define cheetah_RenderTexture_h
#include "RenderTarget.h"
class Texture;
class RenderTexture : public RenderTarget {
public:
RenderTexture();
void attach(Texture &texture);
};
#... |
//! @file sound.h
//! @brief SoundControlクラスの宣言
/**
* LynxOPS
*
* Copyright (c) 2015 Nilpaca
*
* Licensed under the MIT License.
* https://github.com/Nilpaca/LynxOPS/blob/master/LICENSE
*/
//--------------------------------------------------------------------------------
//
// OpenXOPS
// Copyright (c) 2014-2... |
#pragma once
#include <GL\glew.h>
#include "shader.hpp"
#include "texture_2d.hpp"
#include "sprite.hpp"
class MouseEffect
{
private:
Shader* shader;
Texture2D* texture;
GLuint VAO;
GLuint VBO;
GLuint instanceVBO;
glm::mat4 model;
public:
MouseEffect(Shader* shader, Texture2D* texture);
~MouseEffect();
void... |
#include "il2cpp-config.h"
#include "C:\Users\nrewkows\Desktop\COMP776Final\LaparoHololensAppUnity\_build\Il2CppOutputProject\IL2CPP\libil2cpp\debugger\il2cpp-stubs.cpp"
|
#include<iostream>
using namespace std;
void permutation(string s, string ans){
if(s.length()==0){
cout<<ans<<endl;
return;
}
} |
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
void solve(){
ll a,b;
cin>>a>>b;
if(a==b) {
cout<<0<<" "<<0<<"\n";
return;
}
ll p=max(a,b),q=min(a,b);
ll x=p-q;
ll a1 =p/x*x,a2=q/x*x;
ll b1=a1+x,b2=a2+x;
/*ll ans1=LLONG_MAX,ans2=LLONG_MAX;
if(p-a1==q-a2) ans1=p-a1;
if(b1-p==b2-q)... |
#include <iostream>
#include <fstream>
#include <vector>
#include <cstdlib>
#include <string>
#include <string.h>
#include <list>
#include "rapidxml_utils.hpp"
#include "rapidxml.hpp"
#include "rapidxml_print.hpp"
using namespace std;
using namespace rapidxml;
class Status{
public:
string object;
string status;
S... |
//program demonstruje działanie funkcji glutMouseFunc()
//Wciskanie przycisków myszy powoduje zmianę kolorów trzech ścian kostki,
//Zwalnianie przycisków przywraca kolory początkowe
#include <windows.h>
#include "freeglut.h"
#include <math.h>
float fovy = 45.0, aspect = 1.0, near_ = 0.1, far_ = 10.0;/... |
// Qt3D documentation : http://doc.qt.io/qt-5/qt3d-basicshapes-cpp-main-cpp.html
#ifndef VISUALIZATION_H
#define VISUALIZATION_H
#include <Qt3DExtras>
#include <QWidget>
#include <QVBoxLayout>
#include "serial/packet.h"
#include "protocol/helper.h"
class Visualization : public QWidget {
Q_OBJECT
public:
exp... |
#include <iostream>
#include <time.h>
using namespace std;
int main(int argc, char *argv[])
{
int NUMnumbers = atoi(argv[1]);
int seed1 = atoi(argv[2]);
int seed2 = atoi(argv[3]);
int Pid = fork();
if (Pid == -1)
perror("fork failed");
if(Pid == 0) //Child
{
clock_t t = clock();
srand (seed... |
/**
* @file main.cpp
* @date 10.02.2019
* @author jspahl
*/
#include <chrono>
#include <iostream>
#include "autopas/autopasIncludes.h"
#include "autopas/containers/directSum/DirectSumTraversal.h"
#include "autopas/containers/linkedCells/traversals/C01CudaTraversal.h"
#include "autopas/pairwiseFunctors/LJFunctor.h"... |
#ifndef ZOMBIE_EVENT_H
# define ZOMBIE_EVENT_H
# include <iostream>
# include "Zombie.hpp"
class ZombieEvent {
public:
static std::string type;
static void setZombieType(std::string zType);
static Zombie* newZombie(std::string name);
static Zombie* randomChump(... |
#include <iostream>
#include <cstdio>
//#include <bits/stdc++.h>
#include <algorithm>
#define Inf 0x3f3f3f3f
#define NeInf 0xc0c0c0c0
using namespace std;
int locate[21],sequence2[21],len[21];
int main()
{
//freopen("..\\file\\input_ascii.txt","r",stdin);
//freopen("..\\file\\output.txt","w",stdout);
ios::s... |
// This file has been generated by Py++.
// Header file workaround.hpp
//
// Indexing-specific workarounds for compiler problems.
//
// Copyright (c) 2003 Raoul M. Gough
//
// Use, modification and distribution is subject to the Boost Software
// License, Version 1.0. (See accompanying file LICENSE_1_0.txt or copy
// ... |
int n,m;
vector<vector<int> > g;
vector<int> vis;
void dfs(int node, int comp)
{
//
// Debugging
cout << "NODE" << " " << node << " " << " COMP" << comp <<"\n";
//
vis[node]=comp;
for(auto v:g[node])
{
if(!vis[v])
{
dfs(v,comp);
}
}
}
void solv... |
#include "iostream"
#include "math.h"
#include "stdlib.h"
#include "time.h"
#include "unistd.h"
#include"su_trace_head.h"
#define PI 3.1415926
#define NX 400
#define NZ 400
#define PML 150
#include"model.h"
#include"fd.h"
using namespace std;
int main()
{
//---------------------------------... |
#ifndef PROJECT2_REPORT_H
#define PROJECT2_REPORT_H
#include <ostream>
class Report {
long double avgWaitingTime = 0;
unsigned long missedFlights = 0;
public:
Report(long double avgWaitingTime, unsigned long missedFlights);
friend std::ostream& operator<<(std::ostream& os, const Report& report);
};
... |
//
// Copyright (c) 2009 Rutger ter Borg
//
// Distributed under the Boost Software License, Version 1.0.
// (See accompanying file LICENSE_1_0.txt or copy at
// http://www.boost.org/LICENSE_1_0.txt)
//
#ifndef BOOST_NUMERIC_BINDINGS_BLAS_COPY_HPP
#define BOOST_NUMERIC_BINDINGS_BLAS_COPY_HPP
#include <boost/numeric/b... |
Chapter 3 : Example 4
#include "pch.h"
#include <iostream>
#include "gtest/gtest.h"
using namespace std;
std::ostringstream out;
void PrintVector()
{
std::vector<int> myVector;
for (int i = 0; i < myVector.size(); ++i)
{
out << myVector[i];
}
out << "\n\n";
}
std::string TestCase() {
PrintV... |
//
// Copyright Jason Rice 2016
// Distributed under the Boost Software License, Version 1.0.
// (See accompanying file LICENSE_1_0.txt or copy at
// http://www.boost.org/LICENSE_1_0.txt)
//
#ifndef NBDL_DEF_BUILDER_ENUMERATE_PROVIDERS_HPP
#define NBDL_DEF_BUILDER_ENUMERATE_PROVIDERS_HPP
#include <mpdef/list.hpp>
#inc... |
/*
给定一个由 n行数字组成的数字三角形如下图所示。试设计一个算法,计算出从三角形
的顶至底的一条路径(每一步可沿左斜线向下或右斜线向下),使该路径经过的数字总和最大。
输入格式:
输入有n+1行:
第 1 行是数字三角形的行数 n,1<=n<=100。
接下来 n行是数字三角形各行中的数字。所有数字在0..99 之间。
输出格式:
输出最大路径的值。
输入样例:
在这里给出一组输入。例如:
5
7
3 8
8 1 0
2 7 4 4
4 5 2 6 5
输出样例:
在这里给出相应的输出。例如:
30
*/
#include <iostream>
#include <algorithm>
using namespace st... |
// Copyright 2020 JD.com, Inc. Galileo Authors. 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
//
// Unless requ... |
//-----------------------------------------------
//
// This file is part of the Siv3D Engine.
//
// Copyright (c) 2008-2018 Ryo Suzuki
// Copyright (c) 2016-2018 OpenSiv3D Project
//
// Licensed under the MIT License.
//
//-----------------------------------------------
# include <Siv3D/Monitor.hpp>
# if defined(SIV... |
/*
* xDMS v1.3 - Portable DMS archive unpacker - Public Domain
* Written by Andre Rodrigues de la Rocha <adlroc@usa.net>
*
* CRC16 & CheckSum16 calculation functions
* CreateCRC was written (aparently) by Bjorn Stenberg
*
*/
#include "cdata.h"
#include "crc_csum.h"
USHORT dms_Calc... |
// This file has been generated by Py++.
#include "boost/python.hpp"
#include "generators/include/python_CEGUI.h"
#include "DefaultLogger.pypp.hpp"
namespace bp = boost::python;
struct DefaultLogger_wrapper : CEGUI::DefaultLogger, bp::wrapper< CEGUI::DefaultLogger > {
DefaultLogger_wrapper( )
: CEGUI::Defau... |
/* NO WARRANTY
*
* BECAUSE THE PROGRAM IS IN THE PUBLIC DOMAIN, THERE IS NO
* WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE
* LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE AUTHORS
* AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT
* WARRANTY OF ANY KIND, EITHER E... |
#pragma once
#include<SFML/Graphics.hpp>
using namespace sf;
/**
* \brief Klasa reprezentująca przeciwników.
*/
class Enemy
{
private:
Texture texture;
Sprite sprite;
float life = 1.0f;
bool dead = false;
public:
Enemy(float x, float y);
Sprite getSprite();
float right();
float left();
... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.