blob_id stringlengths 40 40 | directory_id stringlengths 40 40 | path stringlengths 2 247 | content_id stringlengths 40 40 | detected_licenses listlengths 0 57 | license_type stringclasses 2 values | repo_name stringlengths 4 111 | snapshot_id stringlengths 40 40 | revision_id stringlengths 40 40 | branch_name stringlengths 4 58 | visit_date timestamp[ns]date 2015-07-25 18:16:41 2023-09-06 10:45:08 | revision_date timestamp[ns]date 1970-01-14 14:03:36 2023-09-06 06:22:19 | committer_date timestamp[ns]date 1970-01-14 14:03:36 2023-09-06 06:22:19 | github_id int64 3.89k 689M ⌀ | star_events_count int64 0 209k | fork_events_count int64 0 110k | gha_license_id stringclasses 25 values | gha_event_created_at timestamp[ns]date 2012-06-07 00:51:45 2023-09-14 21:58:52 ⌀ | gha_created_at timestamp[ns]date 2008-03-27 23:40:48 2023-08-24 19:49:39 ⌀ | gha_language stringclasses 159 values | src_encoding stringclasses 34 values | language stringclasses 1 value | is_vendor bool 1 class | is_generated bool 2 classes | length_bytes int64 7 10.5M | extension stringclasses 111 values | filename stringlengths 1 195 | text stringlengths 7 10.5M |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
98f504b3e270532740a0eba27a4f6945050c4558 | e35d91399bc4be7ed5f5a1b6c59f0f5e066678c7 | /hash_algorithms/sha2.cpp | 57a24f756369670aa0404a2e8511d81732b30770 | [] | no_license | vcrom/Hashes | 3c8405cde2c3142587581330f1f5eea85640a93f | 524a73d1bb2b4058fe8c7d5812d1c2e857d65129 | refs/heads/master | 2020-12-02T11:33:36.279145 | 2017-10-24T23:02:01 | 2017-10-24T23:02:01 | 96,650,925 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 5,195 | cpp | sha2.cpp | #include "sha2.h"
#include "hash_utils.h"
#include <iomanip>
#include <iostream>
#include <sstream>
#include <algorithm>
//#define PRINT_Sha2_CONSUMED_DATA
//#define PRINT_Sha2_PROCESSED_DATA
using namespace hash_utils;
namespace
{
constexpr std::array<uint32_t, 64> k_values = {
0x428a2f98, 0x71374491, 0xb5c0fbcf, 0xe9b5dba5,
0x3956c25b, 0x59f111f1, 0x923f82a4, 0xab1c5ed5,
0xd807aa98, 0x12835b01, 0x243185be, 0x550c7dc3,
0x72be5d74, 0x80deb1fe, 0x9bdc06a7, 0xc19bf174,
0xe49b69c1, 0xefbe4786, 0x0fc19dc6, 0x240ca1cc,
0x2de92c6f, 0x4a7484aa, 0x5cb0a9dc, 0x76f988da,
0x983e5152, 0xa831c66d, 0xb00327c8, 0xbf597fc7,
0xc6e00bf3, 0xd5a79147, 0x06ca6351, 0x14292967,
0x27b70a85, 0x2e1b2138, 0x4d2c6dfc, 0x53380d13,
0x650a7354, 0x766a0abb, 0x81c2c92e, 0x92722c85,
0xa2bfe8a1, 0xa81a664b, 0xc24b8b70, 0xc76c51a3,
0xd192e819, 0xd6990624, 0xf40e3585, 0x106aa070,
0x19a4c116, 0x1e376c08, 0x2748774c, 0x34b0bcb5,
0x391c0cb3, 0x4ed8aa4a, 0x5b9cca4f, 0x682e6ff3,
0x748f82ee, 0x78a5636f, 0x84c87814, 0x8cc70208,
0x90befffa, 0xa4506ceb, 0xbef9a3f7, 0xc67178f2
};
constexpr size_t bytes_per_round = 64;
}
Sha2::Sha2() :
HashingAlgorithm(bytes_per_round)
{
reset();
}
void Sha2::reset()
{
HashingAlgorithm::reset();
h0_ = 0x6a09e667;
h1_ = 0xbb67ae85;
h2_ = 0x3c6ef372;
h3_ = 0xa54ff53a;
h4_ = 0x510e527f;
h5_ = 0x9b05688c;
h6_ = 0x1f83d9ab;
h7_ = 0x5be0cd19;
}
std::string Sha2::get_digest()
{
flush_end_of_message();
const auto digest = compute_digest();
reset();
return digest;
}
std::string Sha2::compute_digest()
{
std::stringbuf buffer;
std::ostream out (&buffer);
for(const auto& value : hash_)
out << std::setfill('0') << std::setw(8) << std::hex << value;
return buffer.str();
}
void Sha2::run_round(const uint32_t *data)
{
run_round(pre_process_data(*reinterpret_cast<const std::array<uint32_t, 16>*>(data)));
}
std::array<uint32_t, 64> Sha2::pre_process_data(const std::array<uint32_t, 16> &data)
{
#ifdef PRINT_Sha2_CONSUMED_DATA
for(const auto elem : data)
std::cout << std:: setfill('0') << std::setw(8) << std::hex << swap_uint32(elem) << " ";
std::cout << std::endl;
#endif // PRINT_Sha2_CONSUMED_DATA
std::array<uint32_t, 64> expanded_data;
for(size_t i = 0; i < data.size(); ++i)
expanded_data[i] = swap_endianness_uint32(data[i]);
for(size_t i = data.size(); i < expanded_data.size(); ++i)
{
const auto v0 = expanded_data[i - 15];
const auto s0 = right_rotate(v0, 7) ^ right_rotate(v0, 18) ^ (v0 >> 3);
const auto v1 = expanded_data[i - 2];
const auto s1 = right_rotate(v1, 17) ^ right_rotate(v1, 19) ^ (v1 >> 10);
expanded_data[i] = expanded_data[i - 16] + s0 + expanded_data[i - 7] + s1;
}
return expanded_data;
}
void Sha2::run_round(const std::array<uint32_t, 64> &data)
{
#ifdef PRINT_Sha2_PROCESSED_DATA
for(const auto elem : data)
std::cout << std:: setfill('0') << std::setw(8) << std::hex << elem << " ";
std::cout << std::endl;
#endif // PRINT_Sha2_PROCESSED_DATA
auto a = h0_;
auto b = h1_;
auto c = h2_;
auto d = h3_;
auto e = h4_;
auto f = h5_;
auto g = h6_;
auto h = h7_;
for(auto i = 0; i < 64; ++i)
sha2_operation_round(a, b, c, d, e, f, g, h, data[i], k_values[i]);
h0_ += a;
h1_ += b;
h2_ += c;
h3_ += d;
h4_ += e;
h5_ += f;
h6_ += g;
h7_ += h;
}
inline void Sha2::sha2_operation_round(uint32_t &a, uint32_t &b, uint32_t &c, uint32_t &d, uint32_t &e,
uint32_t &f, uint32_t &g, uint32_t &h,
uint32_t data, uint32_t k)
{
const auto s1 = right_rotate(e, 6) ^ right_rotate(e, 11) ^ right_rotate(e, 25);
const auto ch = (e & f) ^ ((~e) & g);
const auto tmp1 = h + s1 + ch + k +data;
const auto s0 = right_rotate(a, 2) ^ right_rotate(a, 13) ^ right_rotate(a, 22);
const auto maj = (a & b) ^ (a & c) ^ (b & c);
const auto tmp2 = s0 + maj;
h = g;
g = f;
f = e;
e = d + tmp1;
d = c;
c = b;
b = a;
a = tmp1 + tmp2;
}
void Sha2::flush_end_of_message()
{
if(buffer_.size() > 0)
{
buffer_.push_back(1 << 7);
const auto buffer_size = buffer_.size();
buffer_.resize(bytes_consumed_per_round_, 0);
// Check if there are enough bytes to embed the 64 bit message size
if(bytes_consumed_per_round_ - buffer_size < 8)
{
// If not, flush run a round with the vurrent remaining data
run_round(reinterpret_cast<const uint32_t*>(&buffer_[0]));
std::fill(buffer_.begin(), buffer_.begin()+buffer_size, 0);
}
}
else
{
buffer_.resize(bytes_consumed_per_round_, 0);
buffer_[0] = 1 << 7;
}
// Append the 64 bits message info at the end
auto offest_to_size_bits = buffer_.size() - 8;
*reinterpret_cast<uint64_t*>(&buffer_[offest_to_size_bits]) = swap_endianness_uint64(data_bytes_processed_*8);
run_round(reinterpret_cast<const uint32_t*>(&buffer_[0]));
buffer_.clear();
}
|
9539abc01abdd9c4ec2d1b5967ed985be249ac79 | 87b46c8731ea22cd5e25d4ccde3a93133803048e | /compress.cpp | e2250cd1cbbfe27f65c199a8482e17f011011cc9 | [] | no_license | xjvelazquez/Bit-Compression | 01f6c16b85b540e333f532d9d9cb98922788fd88 | 1ab63010cac5d3018697f168224e8e122b23f301 | refs/heads/master | 2020-03-17T16:00:12.172854 | 2018-05-26T01:18:29 | 2018-05-26T01:18:29 | null | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 1,501 | cpp | compress.cpp | #include "HCTree.h"
#include "HCNode.h"
#include "BitOutputStream.h"
#include <iostream>
#include <vector>
#include <fstream>
#include <string>
using namespace std;
int main(int argc, char* argv[]){
std::cout << "Argv 1: " << argv[1] << endl;
if (argv[1] == NULL || argv[2] == NULL){
std::cout << "No input/output file" << endl;
return 0;
}
std::ifstream input;
input.open(argv[1]);
unsigned char symb = input.get();
vector<int> freqs(256, 0);
HCTree* tree = new HCTree();
int counter = 0;
// Fills the frequency vector
while(input.good()){
if (symb != EOF){
//std::cout << "Filling the tree, get: " << symb << endl;
freqs[symb] = freqs[symb] + 1;
counter++;
symb = input.get();
}
}
input.close();
// Constructs the tree
tree->build(freqs);
// Opens outfile for encoding
std::ofstream ofs;
ofs.open(argv[2],ios::binary);
BitOutputStream bos(ofs);
// Puts in the counter before header.
//ofs << counter;
//ofs << endl;
// Creating the header
for (int index = 0; index < freqs.size(); index++){
ofs << freqs[index];
//bos.writeBit(freqs[index]);
ofs << endl;
}
input.open(argv[1],ios::binary);
symb = input.get();
while (input.good()){
cout << "peek: " << input.peek() << endl;
if (symb != EOF){
tree->encode(symb, bos);
symb = input.get();
}
else {break;}
}
if (bos.nbits != 8){
bos.flush();
}
input.close();
ofs.close();
delete tree;
}
|
46594dd90900846e3460b91e60bfd40e8d6da665 | e3e10d8861e6addf1fd352feee2f574deeb3d703 | /Ray_Tracing/TestScene.cpp | 3847e4dcf179105f62420de950b154c1fe5f6675 | [
"MIT"
] | permissive | jaxfrank/Ray-Tracer | 2040ec836a6a54cb0bd757dc606532b36f5999e0 | d700352197ca19039b45c7b4b9eeef0ec158ba25 | refs/heads/master | 2021-01-17T06:43:12.885871 | 2016-05-13T03:25:32 | 2016-05-13T03:25:32 | 57,099,998 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 3,784 | cpp | TestScene.cpp | #include "TestScene.h"
#include <iostream>
#include <glm\gtc\random.hpp>
#include <glm\glm.hpp>
#include <glm\gtx\rotate_vector.hpp>
#include "Camera.h"
#include "Window.h"
#include "Time.h"
#include "TriangleRenderer.h"
TestScene::TestScene(Window* window, std::string name):
Scene(window, name)
{}
TestScene::~TestScene() {
delete texture;
}
void TestScene::entry() {
camera = new Camera(60.0f);
srand((unsigned int)time(0));
texture = new sf::Image();
texture->loadFromFile("res/test.png");
for(int i = 0; i < 20; i++) {
Triangle* triangle = new Triangle();
glm::vec3 offset = glm::vec3(glm::diskRand(5.0f), glm::linearRand(-5.0f, 0.0f));
triangle->a = glm::vec3(0.0f, 1.0f, -5.0f) + glm::linearRand(glm::vec3(-1.0f, -1.0f, -1.0f), glm::vec3(1.0f, 1.0f, 1.0f)) + offset;
triangle->b = glm::vec3(-0.866f, -0.5f, -5.0f) + glm::linearRand(glm::vec3(-1.0f, -1.0f, -1.0f), glm::vec3(1.0f, 1.0f, 1.0f)) + offset;
triangle->c = glm::vec3(0.866f, -0.5f, -5.0f) + glm::linearRand(glm::vec3(-1.0f, -1.0f, -1.0f), glm::vec3(1.0f, 1.0f, 1.0f)) + offset;
std::array<glm::vec4, 3> colors;
glm::vec3 color = glm::sphericalRand(1.0f);
glm::abs(color);
colors[0] = glm::vec4(1.0f, 1.0f, 1.0f, 1.0f);
colors[1] = glm::vec4(1.0f, 1.0f, 1.0f, 1.0f);
colors[2] = glm::vec4(1.0f, 1.0f, 1.0f, 1.0f);
/*
colors[0] = glm::vec4(color*glm::linearRand(0.5f,1.0f), 1.0f);
colors[1] = glm::vec4(color*glm::linearRand(0.5f, 1.0f), 1.0f);
colors[2] = glm::vec4(color*glm::linearRand(0.5f, 1.0f), 1.0f);
*/
std::array<glm::vec2, 3> texCoords;
texCoords[0] = glm::vec2(0,0);
texCoords[1] = glm::vec2(1, 0);
texCoords[2] = glm::vec2(1, 1);
renderers.push_back(new TriangleRenderer(triangle, colors, texture, texCoords));
}
}
void TestScene::handleEvent(sf::Event e) {
switch(e.type) {
case sf::Event::KeyPressed:
switch(e.key.code) {
case sf::Keyboard::W:
camera->setPosition(camera->getPosition() + camera->getForward() * cameraMovementSpeed * Time::getDelta());
break;
case sf::Keyboard::A:
camera->setPosition(camera->getPosition() - glm::normalize(glm::cross(camera->getForward(), glm::vec3(0.0f, 1.0f, 0.0f))) * cameraMovementSpeed * Time::getDelta());
break;
case sf::Keyboard::S:
camera->setPosition(camera->getPosition() - camera->getForward() * cameraMovementSpeed * Time::getDelta());
break;
case sf::Keyboard::D:
camera->setPosition(camera->getPosition() + glm::normalize(glm::cross(camera->getForward(), glm::vec3(0.0f, 1.0f, 0.0f))) * cameraMovementSpeed * Time::getDelta());
break;
case sf::Keyboard::Escape:
window->setMouseCaptured(false);
break;
}
break;
case sf::Event::MouseButtonPressed:
switch(e.mouseButton.button) {
case sf::Mouse::Left:
window->setMouseCaptured(true);
break;
}
break;
}
}
void TestScene::update() {
if(window->isMouseCaptured()) {
float x = (float)(sf::Mouse::getPosition().x - window->getPosition().x) / (float)window->getWidth() * 2.0f - 1.0f;
float y = (float)(sf::Mouse::getPosition().y - window->getPosition().y) / (float)window->getHeight() * 2.0f - 1.0f;
camera->setForward(glm::normalize(glm::rotate(camera->getForward(), -glm::sin(x) * Time::getDelta() * 10.0f, glm::vec3(0.0f, 1.0f, 0.0f))));
camera->setForward(glm::normalize(glm::rotate(camera->getForward(), -glm::sin(y) * Time::getDelta() * 10.0f, camera->getRight())));
}
}
void TestScene::exit() {
} |
ec18d1ca1bf64df12a354b51c83284fa74c5b7cd | dc3b1b231ee872d5d4d2e2433ed8a2d8fb740307 | /chapter14/ex16_StrBlob.h | a39e4579ebc0cebe00bd38557a186fc167d7001c | [] | no_license | coder-e1adbc/CppPrimer | d2b62b49f20892c5e53a78de0c807b168373bfc6 | 33ffd4fc39f4bccf4e107aec2d8dc6ed4e9d7447 | refs/heads/master | 2021-01-17T08:54:23.438341 | 2016-08-13T03:21:08 | 2016-08-13T03:21:08 | 61,343,967 | 0 | 0 | null | 2016-06-29T14:37:16 | 2016-06-17T03:49:23 | C++ | UTF-8 | C++ | false | false | 2,318 | h | ex16_StrBlob.h | #ifndef STRBLOB_H
#define STRBLOB_H
#include <vector>
#include <string>
#include <memory>
#include <initializer_list>
#include <stdexcept>
class StrBlobPtr;
class ConstStrBlobPtr;
class StrBlob {
friend class StrBlobPtr;
friend class ConstStrBlobPtr;
friend bool operator==(const StrBlob &, const StrBlob &);
friend bool operator!=(const StrBlob &, const StrBlob &);
public:
using size_type = std::vector<std::string>::size_type;
StrBlob();
StrBlob(std::initializer_list<std::string>);
size_type size() const { return data->size(); }
bool empty() const { return data->empty(); }
void push_back(const std::string &s) { data->push_back(s); }
void pop_back();
std::string& front();
const std::string& front() const;
std::string& back();
const std::string& back() const;
StrBlobPtr begin();
StrBlobPtr end();
ConstStrBlobPtr cbegin() const;
ConstStrBlobPtr cend() const;
private:
std::shared_ptr<std::vector<std::string>> data;
void check(size_type, const std::string &) const;
};
class StrBlobPtr {
friend bool operator==(const StrBlobPtr &, const StrBlobPtr &);
friend bool operator!=(const StrBlobPtr &, const StrBlobPtr &);
public:
StrBlobPtr(): curr(0) { }
StrBlobPtr(StrBlob &a, size_t sz = 0): wptr(a.data), curr(sz) { }
std::string& deref() const;
StrBlobPtr& incr();
private:
std::weak_ptr<std::vector<std::string>> wptr;
size_t curr;
std::shared_ptr<std::vector<std::string>> check(size_t, const std::string &) const;
};
class ConstStrBlobPtr {
friend bool operator==(const ConstStrBlobPtr &, const ConstStrBlobPtr &);
friend bool operator!=(const ConstStrBlobPtr &, const ConstStrBlobPtr &);
public:
ConstStrBlobPtr(): curr(0) { }
ConstStrBlobPtr(const StrBlob &a, size_t sz = 0): wptr(a.data), curr(sz) { }
std::string& deref() const;
ConstStrBlobPtr& incr();
private:
std::weak_ptr<std::vector<std::string>> wptr;
size_t curr;
std::shared_ptr<std::vector<std::string>> check(size_t, const std::string &) const;
};
bool operator==(const StrBlob &, const StrBlob &);
bool operator!=(const StrBlob &, const StrBlob &);
bool operator==(const StrBlobPtr &, const StrBlobPtr &);
bool operator!=(const StrBlobPtr &, const StrBlobPtr &);
bool operator==(const ConstStrBlobPtr &, const ConstStrBlobPtr &);
bool operator!=(const ConstStrBlobPtr &, const ConstStrBlobPtr &);
#endif
|
7a91fc73e5ca63e380f3b4c934f3a86721aa14cb | 9559d029b7b74a2023f934e3988722770c7c8ca7 | /Source/TutDrome/Missle.h | ff382e079e20d887d42f908e47debc4c47c89d94 | [] | no_license | litar77/TutDrome | e87fcb9992c4426f28d7e8874504438ffce6a77a | 5ce5c71004229f841c1dcff60fc4af210d859c81 | refs/heads/main | 2023-03-11T05:18:49.311727 | 2021-02-24T05:25:03 | 2021-02-24T05:25:03 | 323,014,778 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 1,047 | h | Missle.h | // Fill out your copyright notice in the Description page of Project Settings.
#pragma once
#include "CoreMinimal.h"
#include "GameFramework/Actor.h"
#include "Missle.generated.h"
UCLASS()
class TUTDROME_API AMissle : public AActor
{
GENERATED_BODY()
public:
// Sets default values for this actor's properties
AMissle();
//UPROPERTY(VisibleAnywhere)
//class UBoxComponent * OutCollision;
UPROPERTY(VisibleAnywhere)
class UStaticMeshComponent * Mesh;
UPROPERTY(VisibleAnywhere)
class UProjectileMovementComponent * MovementComp;
UPROPERTY(EditAnywhere)
class UParticleSystem * FireParticle;
UPROPERTY(EditAnywhere)
class USoundBase * FireSound;
protected:
// Called when the game starts or when spawned
virtual void BeginPlay() override;
UFUNCTION()
void OverlapHandler(UPrimitiveComponent* OverlappedComponent, AActor* OtherActor, UPrimitiveComponent* OtherComp, int32 OtherBodyIndex, bool bFromSweep, const FHitResult & SweepResult);
public:
// Called every frame
virtual void Tick(float DeltaTime) override;
};
|
d4cfb0d274daeb4e67f69e17911da39f39e107f2 | b32b94b936f87d8b2fcc823040a4df43f6590614 | /Codechef/1.cpp | b9103bc1a92c9339272f81d8772b1989abf0eb64 | [] | no_license | nitish1402/OPC | e856e9d00664741f2f533706cd4c6702b9ff1759 | 98f2e8dfe78ca8b5bc09a92bcbed1a5d4304a71f | refs/heads/master | 2016-09-06T08:14:04.967108 | 2014-03-26T09:01:40 | 2014-03-26T09:01:40 | null | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 2,944 | cpp | 1.cpp | #include <cstdlib>
#include <stdio.h>
#include <cstring>
#include <complex>
#include <vector>
#include <cmath>
#include <ctime>
#include <iostream>
#include <numeric>
#include <algorithm>
#include <map>
#include <utility>
#include <set>
#include <stack>
#include <queue>
#include <iomanip>
#include <locale>
#include <sstream>
#include <string> // this should be already included in <sstream>
#define FOR(i,n) for(i=0;i<n;i++)
#define FORI(i,a,n) for(i=a;i<n;i++)
#define FORC(it,C) for(it=C.begin();it!=C.end();it++)
#define scanI(x) scanf("%d",&x)
#define scanD(x) scanf("%lf",&x)
#define print(x) printf("%d\n",x)
#define mod 1000000007
#define ll long long
using namespace std;
//2*a(n-1)+a(n-2).
void matpower(ll M[2][2],int n){
ll w,x,y,z,a,b,c,d;
int i,j,k;
ll temp[2][2];
ll temp1[2][2];
ll cur[2][2]={{2,1},{1,0}};
//long long j=1000000007;
if(n>1){
matpower(M,n/2);
FOR(i,2)
{
FOR(j,2)
{
temp[i][j]=0;
}
}
//M[1][1]=0;
FOR(i,2)
{
FOR(j,2)
{
FOR(k,2)
{
temp[i][j]=temp[i][j]+(M[i][k]*M[k][j]);
}
}
}
//w=MOD(MOD(MOD(M[0][0]*M[0][0])+MOD(M[0][1]*M[1][0]))+mod);
//x=MOD(MOD(MOD(M[0][0]*M[0][1])+MOD(M[0][1]*M[1][1]))+mod);
//y=MOD(MOD(MOD(M[1][0]*M[0][0])+MOD(M[1][1]*M[1][0]))+mod);
//z=MOD(MOD(MOD(M[1][0]*M[0][1])+MOD(M[1][1]*M[1][1]))+mod);
FOR(i,2)
{
FOR(j,2)
{
M[i][j]=temp[i][j];
}
}
//M[0][0]=w;
//M[0][1]=x;
//M[1][0]=y;
//M[1][1]=z;
if(n%2!=0){
//M[1][1]=0;
FOR(i,2)
{
FOR(j,2)
{
temp1[i][j]=0;
}
}
FOR(i,2)
{
FOR(j,2)
{
FOR(k,2)
{
temp1[i][j]=temp1[i][j]+M[i][k]*cur[k][j];
}
}
}
//a=MOD(MOD(MOD(M[0][0]*1)+MOD(M[0][1]*1))+mod);
//b=MOD(MOD(MOD(M[0][0]*1)+MOD(M[0][1]*0))+mod);
//c=MOD(MOD(MOD(M[1][0]*1)+MOD(M[1][1]*1))+mod);
//d=MOD(MOD(MOD(M[1][0]*0)+MOD(M[1][1]*0))+mod);
FOR(i,2)
{
FOR(j,2)
{
M[i][j]=temp1[i][j];
}
}
//M[0][0]=a;
//M[0][1]=b;
//M[1][0]=c;
//M[1][1]=d;
}
}
}
ll fib(ll M[2][2],int n){//function for computation
if(n==1) return 1;
else if(n==2) return 3;
else {
matpower(M,n-2);
//long long j=1000000007;
//std::cout<<M[0][0]<<" "<<M[0][1]<<std::endl;
//std::cout<<M[1][0]<<" "<<MOD(M[1][1]+mod)<<std::endl;
return M[0][0]*3+M[0][1]*1;
}
}
using namespace std;
int main()
{
int t;
ll ans,n;
scanI(t);
while(t--)
{
ll M[2][2]={{2,1},{1,0}};
cin>>n;
ans=fib(M,n);
cout<<ans<<endl;
}
return 0;
}
|
5598f13bf4d28f68946361a4f6bf780c7a57fe5e | 7dfe696720fdd5fc50320a5182ed0768095a080d | /Coursework/Week02/Chapter07/7-4-7_Summarize-Survey-Results/7-4-7_Summarize-Survey-Results.cpp | 217f7b0347fb8387088d471a04d4874c72dd14e9 | [] | no_license | BryantVail/Cpp_COP2224_70645_Fall2020 | 6a3d4de1ca2333228eefe04b4cd4ed511ee8994b | 3fbc6e8b16bec8d719381501b841ada015f0db74 | refs/heads/master | 2023-06-18T16:46:10.420362 | 2021-07-12T03:05:34 | 2021-07-12T03:05:34 | 293,118,010 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 1,065 | cpp | 7-4-7_Summarize-Survey-Results.cpp | // 7-4-7_Summarize-Survey-Results.cpp : This file contains the 'main' function. Program execution begins and ends there.
//
#include <iostream>
#include <iomanip>
#include <array>
using namespace std;
int main()
{
// array sizes
const size_t responseSize{ 20 };
const size_t frequencySize{ 6 };
// survey responses
const array<unsigned int, responseSize> responses{
1,2,5,4,3,5,2,1,3,1,4,3,3,3,2,3,3,2,2,5
};
// initialize frequency counters to 0
array<unsigned int, frequencySize> frequency{};
//foreach answer, select responses element and use that value as frequency
// subscript to determine element to increment
for (size_t answerIndex{ 0 }; answerIndex < responses.size(); ++answerIndex) {
++frequency[responses[answerIndex]];
}
cout << "Rating" << setw(12) << "Frequency" << endl;
//output each array element's value
for (size_t rating{ 1 }; rating < frequency.size(); ++rating) {
cout << setw(6) << rating << setw(12) << frequency[rating] << endl;
}
}
|
f91e32eda81b089d5e2b28179005ac8689e148a8 | 7ec6bbd1ff6600be1de4e8a41bcea38ba8fc7079 | /Math/source/omMatrix4D.cpp | bdb978d631e231799ecaab855957f0260b322a65 | [] | no_license | ruulaasz/Diablito | 6f51c8e2724ff3ff6ff63622ab6eeeddd2c6b922 | 92a1b9b0b89fbb4cdb2009acc85d4dff38c29d38 | refs/heads/master | 2021-01-22T23:10:26.286830 | 2017-06-08T03:56:47 | 2017-06-08T03:56:47 | 92,801,684 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 5,653 | cpp | omMatrix4D.cpp | //////////////////////////////////////////////////////////////////////////
/// //
// @file omMatrix4D.cpp //
// @Author Raul Portillo (ruulaasz_@hotmail.com) //
// @date 2015/17/10 //
// @brief Definition of omMatrix4D Class //
// @bug No known bugs. //
// //
//////////////////////////////////////////////////////////////////////////
#if PLATFORM == WINDOWS_MATH
#include "Omicron_WindowsMath.h" /*!< Funciones matematicas basicas optimisadas para Windows */
#endif
#include "Omicron_PlatformMath.h"
//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
// Definicion de la clase omMatrix4D //
/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
namespace OmicronSDK
{
//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
// Definicion de contructores y destructor //
/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
omMatrix4D::omMatrix4D()
{
Math::ResetMatrix(*this);
}
omMatrix4D::omMatrix4D(const omMatrix4D& _CopyObj)
{
*this = _CopyObj;
}
omMatrix4D::~omMatrix4D()
{
}
//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
// Sobrecarga de Operadores //
/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
omMatrix4D omMatrix4D::operator + (const omMatrix4D& _Matrix4x4)
{
omMatrix4D AditionMatrix;
for (int i = 0; i < 4; i++)
{
for (int j = 0; j < 4; j++)
{
AditionMatrix.Line[j][i] = Line[j][i] + (_Matrix4x4.Line[j][i]);
}
}
return AditionMatrix;
}
omMatrix4D omMatrix4D::operator - (const omMatrix4D& _Matrix4x4)
{
omMatrix4D SubtractionMatrix;
for (int i = 0; i < 4; i++)
{
for (int j = 0; j < 4; j++)
{
SubtractionMatrix.Line[j][i] = Line[j][i] - (_Matrix4x4.Line[j][i]);
}
}
return SubtractionMatrix;
}
omMatrix4D omMatrix4D::operator * (const omMatrix4D& _Matrix4x4)
{
omMatrix4D MultiplicationMatrix;
for (int i = 0; i < 4; i++)
{
for (int j = 0; j < 4; j++)
{
for (int k = 0; k < 4; k++)
{
MultiplicationMatrix.Line[i][j] += (Line[i][k] * _Matrix4x4.Line[k][j]);
}
}
}
return MultiplicationMatrix;
}
omVector4D omMatrix4D::operator * (omVector4D& _Vector4D)
{
omVector4D MultiplicatedVector;
for (int i = 0; i < 4; i++)
{
for (int j = 0; j < 4; j++)
{
MultiplicatedVector[i] += (Line[i][j] * _Vector4D[j]);
}
}
return MultiplicatedVector;
}
omMatrix4D omMatrix4D::operator * (float _Value)
{
omMatrix4D MultiplicatedMatrix;
for (int i = 0; i < 3; i++)
{
for (int j = 0; j < 3; j++)
{
MultiplicatedMatrix.Line[j][i] = Line[j][i] * _Value;
}
}
return MultiplicatedMatrix;
}
omMatrix4D& omMatrix4D::operator += (const omMatrix4D& _Matrix4x4)
{
omMatrix4D AditionMatrix;
for (int i = 0; i < 3; i++)
{
for (int j = 0; j < 3; j++)
{
AditionMatrix.Line[j][i] = Line[j][i] + (_Matrix4x4.Line[j][i]);
}
}
*this = AditionMatrix;
return *this;
}
omMatrix4D& omMatrix4D::operator -= (const omMatrix4D& _Matrix4x4)
{
omMatrix4D SubtractionMatrix;
for (int i = 0; i < 3; i++)
{
for (int j = 0; j < 3; j++)
{
SubtractionMatrix.Line[j][i] = Line[j][i] - (_Matrix4x4.Line[j][i]);
}
}
*this = SubtractionMatrix;
return *this;
}
omMatrix4D& omMatrix4D::operator *= (const omMatrix4D& _Matrix4x4)
{
omMatrix4D MultiplicationMatrix;
for (int i = 0; i < 4; i++)
{
for (int j = 0; j < 4; j++)
{
for (int k = 0; k < 4; k++)
{
MultiplicationMatrix.Line[i][j] += (Line[i][k] * _Matrix4x4.Line[k][j]);
}
}
}
*this = MultiplicationMatrix;
return *this;
}
bool omMatrix4D::operator == (const omMatrix4D& _Matrix4x4)
{
return (fMatrix[0] == _Matrix4x4.fMatrix[0] &&
fMatrix[1] == _Matrix4x4.fMatrix[1] &&
fMatrix[2] == _Matrix4x4.fMatrix[2] &&
fMatrix[3] == _Matrix4x4.fMatrix[3] &&
fMatrix[4] == _Matrix4x4.fMatrix[4] &&
fMatrix[5] == _Matrix4x4.fMatrix[5] &&
fMatrix[6] == _Matrix4x4.fMatrix[6] &&
fMatrix[7] == _Matrix4x4.fMatrix[7] &&
fMatrix[8] == _Matrix4x4.fMatrix[8] &&
fMatrix[9] == _Matrix4x4.fMatrix[9] &&
fMatrix[10] == _Matrix4x4.fMatrix[10] &&
fMatrix[11] == _Matrix4x4.fMatrix[11] &&
fMatrix[12] == _Matrix4x4.fMatrix[12] &&
fMatrix[13] == _Matrix4x4.fMatrix[13] &&
fMatrix[14] == _Matrix4x4.fMatrix[14] &&
fMatrix[15] == _Matrix4x4.fMatrix[15] ? true : false);
}
bool omMatrix4D::operator != (const omMatrix4D& _Matrix4x4)
{
return (fMatrix[0] != _Matrix4x4.fMatrix[0] ||
fMatrix[1] != _Matrix4x4.fMatrix[1] ||
fMatrix[2] != _Matrix4x4.fMatrix[2] ||
fMatrix[3] != _Matrix4x4.fMatrix[3] ||
fMatrix[4] != _Matrix4x4.fMatrix[4] ||
fMatrix[5] != _Matrix4x4.fMatrix[5] ||
fMatrix[6] != _Matrix4x4.fMatrix[6] ||
fMatrix[7] != _Matrix4x4.fMatrix[7] ||
fMatrix[8] != _Matrix4x4.fMatrix[8] ||
fMatrix[9] != _Matrix4x4.fMatrix[9] ||
fMatrix[10] != _Matrix4x4.fMatrix[10] ||
fMatrix[11] != _Matrix4x4.fMatrix[11] ||
fMatrix[12] != _Matrix4x4.fMatrix[12] ||
fMatrix[13] != _Matrix4x4.fMatrix[13] ||
fMatrix[14] != _Matrix4x4.fMatrix[14] ||
fMatrix[15] != _Matrix4x4.fMatrix[15] ? true : false);
}
} |
010a0a81d01dd7d0bb6faa0d2a4d09658ffa1d47 | d4d36e6dd3713eb2e1bde7b483f54bd63c6c7316 | /Source/BasementEvolve/BasementEvolve.cpp | c2136d4c38036949b244ce99ef677ae001c4d3af | [] | no_license | Ravenill/BasementEvolve | 218f1ac7f203993a1f62854dbf7f253a02c51c8a | 574dd10d46b11863146034b67de10fda4dc43dad | refs/heads/master | 2021-04-27T21:22:35.647223 | 2018-04-17T11:26:24 | 2018-04-17T11:26:24 | 122,383,641 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 258 | cpp | BasementEvolve.cpp | // Copyright 1998-2017 Epic Games, Inc. All Rights Reserved.
#include "BasementEvolve.h"
#include "Modules/ModuleManager.h"
IMPLEMENT_PRIMARY_GAME_MODULE( FDefaultGameModuleImpl, BasementEvolve, "BasementEvolve" );
DEFINE_LOG_CATEGORY(LogBasementEvolve)
|
e227ac946105d683e21b73964bd03bfdcb3b8bb2 | aa35ac84695af6132dc8f1e8de46bb6868f58ceb | /ZPH3D/H3DEngine/include/Utility/CommonCode/HippoUtil/camera/ModelViewCamera.h | a74e82e82e80d3d4a364e3ddba715575c670f4f9 | [] | no_license | spawn66336/H3DEngine_Demo | 0e93432b95d7de91492cac9b73bc5bd6e27151e7 | fb1fc076e646e35fcad84c3cde5b1e33c2d19935 | refs/heads/master | 2021-03-19T13:29:46.254202 | 2013-09-17T06:02:27 | 2013-09-17T06:02:27 | 12,609,723 | 1 | 0 | null | null | null | null | GB18030 | C++ | false | false | 2,424 | h | ModelViewCamera.h | /********************************************************************
created: 2011/12/23
created: 23:12:2011 23:59
filename: f:\TestHippo\TestHippo\HIPPO_FrameWork\camera\ModelViewCamera.h
file path: f:\TestHippo\TestHippo\HIPPO_FrameWork\camera
file base: ModelViewCamera
file ext: h
author: sssa2000
purpose: modelview相机,相机是在球面运动的,相机的最终位置由m_r决定,方位由m_roation决定
*********************************************************************/
#pragma once
#include "CameraBase.h"
#include "../HippoAppBase/Win32MsgUtil.h"
class ModelViewCamera:public CameraBase
{
public:
ModelViewCamera();
~ModelViewCamera();
//from base
const H3DVec3& GetPos();
const H3DVec3& GetViewAtDir();
const H3DVec3& GetUp();
void SetPos(const H3DVec3& pos);
void SetLookAtDir(const H3DVec3& at);
void SetLookAtPos(const H3DVec3& at);
int FrameUpdate(float fElapsedTime);
void LookAt(H3DI::IRender* pRender);
void SetWindow( int nWidth, int nHeigh);
void SetModelCenter( H3DVec3& vModelCenter ) { m_RoateCenter = vModelCenter; }
//!获取当前的旋转
const H3DQuat& GetRotation(){return m_roation;}
MouseKeyCallback GetMouseLeftDownCallback();
MouseKeyCallback GetMouseMoveCallback();
MouseKeyCallback GetMouseLeftUpCallback();
MouseWheelCallback GetMouseWheelCallback();
KeyCallback GetKeyDownCallback();
void SyncCamera(CameraBase* pCam);
void CalcVelocity(float fElapsedTime);
protected:
private:
int OnMouseLeftDown(HippoMouseEvent& e);
int OnMouseLeftUp(HippoMouseEvent& e);
int OnMouseMove(HippoMouseEvent& e);
int OnMouseWheel(HippoWheelEvent& w);
int OnKeyDown(unsigned int);
//!更新相机的坐标系即up、right、lookat
void UpdateCameraCoord();
int AnalysisKeyInput(float fElapsedTime);
int AnalysisMouseInput(float fElapsedTime);
//!将屏幕点转化到单位球上的点
H3DVec3 ConvertScreenPoint2SpherePoint(int x,int y);
//!窗口w
int m_nHalafWidth;
//!窗口h
int m_nHalafHeight;
//!相机的中心点
H3DVec3 m_RoateCenter;
//!相机所在球的半径,相机最终的位置由改变量决定
float m_r;
//!旋转的四元数
H3DQuat m_roation;
H3DQuat m_tmp_roation;
//!记录开始旋转的点
H3DVec3 m_BeginRoatePoint;
H3DVec3 m_Pos;
H3DVec3 m_ViewAtDir;
H3DVec3 m_UpDir;
float m_fDragTimer;
H3DVec3 m_vVelocityDrag;
H3DVec3 m_vVelocity;
H3DVec3 m_vDeltaVelocity;
bool m_bLeftHasDown;
}; |
bbb8417ada8f129cf436dea9c259931cac000f85 | 0cb85cd0c88a9b9f0cca4472742c2bf9febef2d8 | /CS AdminKit/development2/include/kca/bl/agentbusinesslogic.h | 7fc891dcfb80af9a3f3f8b1606eb51de0dc9218f | [] | no_license | seth1002/antivirus-1 | 9dfbadc68e16e51f141ac8b3bb283c1d25792572 | 3752a3b20e1a8390f0889f6192ee6b851e99e8a4 | refs/heads/master | 2020-07-15T00:30:19.131934 | 2016-07-21T13:59:11 | 2016-07-21T13:59:11 | null | 0 | 0 | null | null | null | null | WINDOWS-1251 | C++ | false | false | 7,413 | h | agentbusinesslogic.h | /*!
* (C) 2003 Kaspersky Lab
*
* \file AgentBusinessLogic.h
* \author Andrew Kazachkov
* \date 06.02.2003 13:36:41
* \brief
*
*/
#ifndef __AGENTBUSINESSLOGIC_H__bR49iSQI7uKcEdBS3DcmQ3
#define __AGENTBUSINESSLOGIC_H__bR49iSQI7uKcEdBS3DcmQ3
#include <kca/prcp/componentproxy.h>
#define KLBLAG_ERROR_BUSY L"KLBLAG_ERROR_BUSY"
#define KLBLAG_ERROR_INFO L"KLBLAG_ERROR_INFO"
#define KLBLAG_ERROR_MODULE L"KLBLAG_ERROR_MODULE";
#define KLBLAG_ERROR_CODE L"KLBLAG_ERROR_CODE";
#define KLBLAG_ERROR_SUBCODE L"KLBLAG_ERROR_SUBCODE";
#define KLBLAG_ERROR_MSG L"KLBLAG_ERROR_MSG";
#define KLBLAG_ERROR_FNAME L"KLBLAG_ERROR_FNAME";
#define KLBLAG_ERROR_LNUMBER L"KLBLAG_ERROR_LNUMBER";
#define KLBLAG_ERROR_LOCDATA L"KLBLAG_ERROR_LOCDATA"; //PARAMS_T
#define KLBLAG_ERROR_FORMATID L"KLBLAG_ERROR_FORMATID"; //INT_T
#define KLBLAG_ERROR_FORMAT L"KLBLAG_ERROR_FORMAT"; //STRING_T
#define KLBLAG_ERROR_FORMATARGS L"KLBLAG_ERROR_FORMATARGS"; //ARRAY_T|STRING_T
namespace KLBLAG
{
typedef std::vector<KLSTD::KLAdapt<KLSTD::CAutoPtr<KLPRCP::ComponentProxy> > > proxies_t;
/*!
\brief Имя компонента бизнес-логики. Данную переменную необходимо
определить в хранилище SS_PRODINFO в настройках продукта
(следует воспользоваться функцией KLPRSS_RegisterProduct).
*/
const wchar_t c_szwBusinessLogicName[]=L"KLBLAG_BL_COMPONENT";//STRING_T
/*!
\brief Имя компонента бизнеслогики, через который следует производить
запуск задач из хранилища задач.
Чтобы агент использовал данную функциональность, следует
определить данную переименную в хранилище SS_PRODINFO в
настройках продукта (следует воспользоваться функцией
KLPRSS_RegisterProduct).
*/
const wchar_t c_szwStartTasksThroushBL[]=L"KLBLAG_USE_BL";//STRING_T
/*!
\brief Местонахождение динамической библиотеки прокси для БЛ
Данная переменная определяется в секции
KLPRSS_COMPONENT_PRODUCT (Хранилище SS_PRODINFO). Следует
воспользоваться функцией KLPRSS_RegisterProduct.
*/
const wchar_t c_szwBusinessLogicProxyLocation[]=L"KLBLAG_BL_PROXY_LOCATION";//STRING_T
/*!
\brief Бизнес-логика может заявлять о своей готовности выполнять
задачи с помощью события, имя которого прописывается в секции
KLPRSS_COMPONENT_PRODUCT (Хранилище SS_PRODINFO) в переменной
c_szwEventReady, значение переменной -- имя события.
Если переменная не определена, то бизнес-логика считается
готовой выполнять задачи, если у нё стоит состояние RUNNING.
*/
const wchar_t c_szwEventReady[]=L"KLBLAG_EVENT_READY";//STRING_T
/*!
Публикация данного события означает старт продукта.
*/
const wchar_t c_szwEv_OnAppStart[]=L"KLBLAG_EV_ONAPPSTART";
//! Запустить означенную задачу
const wchar_t c_szwStartScheduledTask[]=L"KLBLAG_START_SCHEDULED_TASK";
/*! Параметры имеют следующую структуру.
c_szwServerProduct
c_szwServerVersion
c_szwServerComponent
c_szwServerInstance
c_szwClientProduct
c_szwClientVersion
c_szwClientComponent
c_szwClientInstance
c_szwServerTaskName
c_szwServerTaskParams
c_szwServerTaskTimeout
c_szwUser
c_szwDomain
c_szwPassword
*/
/*!
Результаты выполнения задачи имеют следующую структуру:
- в случае успеха
c_szwServerProduct - Имя продукта
c_szwServerVersion - Версия продукта
c_szwServerComponent - Имя компонента
c_szwServerInstance - Имя экземпляра компонента, на котором была запущена задача
c_szwServerTaskName - Имя типа запущенной задачи
с_szwTaskId - Идентификатор запущенной задачи
- в случае неудачи
c_szwErrorInfo -
c_szwErrorModule - Имя модуля, в котором произошла ошибка
c_szwErrorCode - Код ошибки
c_szwErrorMsg - Сообщение об ошибке
c_szwErrorFileName - Имя файла, в котором проиошла ошибка
c_szwErrorLineNumber - Строка, на которой произошла ошибка
*/
//!Информация о компоненте-сервере
const wchar_t c_szwServerProduct[]=L"KLBLAG_SERVER_PRODUCT";//< Имя продукта
const wchar_t c_szwServerVersion[]=L"KLBLAG_SERVER_VERSION";//< Версия продукта
const wchar_t c_szwServerComponent[]=L"KLBLAG_SERVER_COMPONENT";//< Имя компонента
const wchar_t c_szwServerInstance[]=L"KLBLAG_SERVER_INSTANCE";//< Идентификатор копии
//!Информация о компоненте-клиенте
const wchar_t c_szwClientProduct[]=L"KLBLAG_CLIENT_PRODUCT";//< Имя продукта
const wchar_t c_szwClientVersion[]=L"KLBLAG_CLIENT_VERSION";//< Версия продукта
const wchar_t c_szwClientComponent[]=L"KLBLAG_CLIENT_COMPONENT";//< Имя компонента
const wchar_t c_szwClientInstance[]=L"KLBLAG_CLIENT_INSTANCE";//< Идентификатор копии
//!Информация о задаче
const wchar_t c_szwServerTaskName[]=L"KLBLAG_SERVER_TASKNAME";//< Имя задачи
const wchar_t c_szwServerTaskParams[]=L"KLBLAG_SERVER_TASKPARAMS";//< Парамеры задачи
const wchar_t c_szwServerTaskTimeout[]=L"KLBLAG_SERVER_TASKTIMEOUT";//< Таймаут задачи
const wchar_t c_szwTaskId[]=L"KLBLAG_TASK_ID"; //< INT_T
//!Информация о пользователе, под коорым должна работать задача
const wchar_t c_szwUser[]=L"KLBLAG_TASK_USER"; //< STRING_T
const wchar_t c_szwDomain[]=L"KLBLAG_TASK_DOMAIN"; //< STRING_T
const wchar_t c_szwPassword[]=L"KLBLAG_TASK_PASSWORD"; //< STRING_T
//!Информация об ошибке
const wchar_t c_szwErrorInfo[]=KLBLAG_ERROR_INFO;
const wchar_t c_szwErrorModule[]=KLBLAG_ERROR_MODULE;
const wchar_t c_szwErrorCode[]=KLBLAG_ERROR_CODE;
const wchar_t c_szwErrorMsg[]=KLBLAG_ERROR_MSG;
const wchar_t c_szwErrorFileName[]=KLBLAG_ERROR_FNAME;
const wchar_t c_szwErrorLineNumber[]=KLBLAG_ERROR_LNUMBER;
} // namespace KLBLAG
#endif //__AGENTBUSINESSLOGIC_H__bR49iSQI7uKcEdBS3DcmQ3
// Local Variables:
// mode: C++
// End:
|
a5091683863afbad6cf8d184ab96188d5a8fcf93 | 98157b3124db71ca0ffe4e77060f25503aa7617f | /hackerrank/world-codesprint-5/longest-increasing-subsequence-arrays.cpp | ca7d61c50097244ec5a804488406c30c8dd7165a | [] | no_license | wiwitrifai/competitive-programming | c4130004cd32ae857a7a1e8d670484e236073741 | f4b0044182f1d9280841c01e7eca4ad882875bca | refs/heads/master | 2022-10-24T05:31:46.176752 | 2022-09-02T07:08:05 | 2022-09-02T07:08:35 | 59,357,984 | 37 | 4 | null | null | null | null | UTF-8 | C++ | false | false | 738 | cpp | longest-increasing-subsequence-arrays.cpp | #include <bits/stdc++.h>
using namespace std;
const int mod = 1e9 + 7;
const int N = 5e5 + 5;
long long inv[N];
long long powmod(long long b, long long p) {
long long ret = 1;
while(p) {
if(p&1)
ret = (ret * b) % mod;
b = (b * b) % mod;
p >>= 1;
}
return ret;
}
int main() {
for(int i = 1; i<N; i++)
inv[i] = powmod(i, mod-2);
int t;
scanf("%d", &t);
while(t--) {
int n, m;
scanf("%d%d", &m, &n);
long long mul = powmod(n, m-n), in = (inv[n] * (n-1)) % mod, ans = mul;
for(int i = 0; i<m-n; i++) {
mul = (mul * (n+i)) % mod;
mul = (mul * inv[i+1]) % mod;
mul = (mul * in) % mod;
ans = (ans + mul) % mod;
}
printf("%lld\n", ans);
}
return 0;
} |
cf3e5c7927d216c07ecf24244edd7a7e48452807 | 66deb611781cae17567efc4fd3717426d7df5e85 | /pcmanager/src/src_bksafe/beikesafe/bksafeprotectionnotifywnd.h | 4c5c811c73f203817f96bdda157709afe1ef82f3 | [
"Apache-2.0"
] | permissive | heguoxing98/knoss-pcmanager | 4671548e14b8b080f2d3a9f678327b06bf9660c9 | 283ca2e3b671caa85590b0f80da2440a3fab7205 | refs/heads/master | 2023-03-19T02:11:01.833194 | 2020-01-03T01:45:24 | 2020-01-03T01:45:24 | 504,422,245 | 1 | 0 | null | 2022-06-17T06:40:03 | 2022-06-17T06:40:02 | null | GB18030 | C++ | false | false | 11,735 | h | bksafeprotectionnotifywnd.h | #pragma once
#include <safemon\safemonitor.h>
#include <safemon\safetrayshell.h>
#include "trayruncommmon.h"
#include "kpfw/arpsetting_public.h"
#include "beikesafearpdlg.h"
#include "arpinstallcheck.h"
#include "runoptimize/restorerunitem.h" /* for CRestoreRunner */
typedef CWinTraits<WS_POPUP, 0> CBkSafeProtectionNotifyWndTraits;
#define BKSAFE_PROTECTION_NOTIFY_WND_CLASS L"{AA4D6C0D-4658-46a8-80FA-0CDB62B000AA}"
class CBkSafeProtectionNotifyWindow
: public CWindowImpl<CBkSafeProtectionNotifyWindow, ATL::CWindow, CBkSafeProtectionNotifyWndTraits>
{
public:
DECLARE_WND_CLASS_EX(BKSAFE_PROTECTION_NOTIFY_WND_CLASS, CS_HREDRAW | CS_VREDRAW, COLOR_WINDOW)
public:
CBkSafeProtectionNotifyWindow(BOOL bNoQuitSvc = FALSE)
: m_hWndNotify(NULL)
, m_uMsgNotifyChange(0)
, m_bUpdateCalled1(FALSE)
, m_bUpdateCalled2(FALSE)
, m_bNoQuitSvc(bNoQuitSvc)
{
m_bTrayAutorun1 = FALSE;
m_bTrayAutorun2 = FALSE;
::ZeroMemory(m_bMonitorOn, sizeof(m_bMonitorOn));
::ZeroMemory(m_bNetMonitorOn, sizeof(m_bNetMonitorOn));
m_bKWSEnable = FALSE;
m_bKArpRun = FALSE;
}
~CBkSafeProtectionNotifyWindow()
{
if (IsWindow())
DestroyWindow();
if (!m_bNoQuitSvc)
{
BOOL bAnyMonitorOn = FALSE;
BOOL _bAnyMonitorOn = FALSE;
for (int i = 0; i < ARRAYSIZE(m_bMonitorOn); i ++)
bAnyMonitorOn |= m_bMonitorOn[i];
for (int j = 0; j < ARRAYSIZE(m_bNetMonitorOn); j++)
_bAnyMonitorOn |= m_bNetMonitorOn[j];
if (!bAnyMonitorOn || !_bAnyMonitorOn)
{
SC_HANDLE hSCM = ::OpenSCManager(NULL, NULL, SC_MANAGER_ALL_ACCESS);
if (hSCM == NULL)
goto Exit0;
SC_HANDLE hService = ::OpenService(hSCM, L"KSafeSvc", SERVICE_STOP | SERVICE_QUERY_STATUS);
if (hService == NULL)
goto Exit0;
SERVICE_STATUS ss;
::ControlService(hService, SERVICE_CONTROL_STOP, &ss);
Exit0:
if (hService)
::CloseServiceHandle(hService);
if (hSCM)
::CloseServiceHandle(hSCM);
}
}
}
HWND Create(HWND hWndNotify, UINT uMsgNotifyChange)
{
HWND hWnd = __super::Create(NULL);
if (NULL == hWnd)
return NULL;
m_hWndNotify = hWndNotify;
m_uMsgNotifyChange = uMsgNotifyChange;
_ShellTray();
_Refresh1();
_Refresh2();
SetTimer(1, 1000, NULL);
SetTimer(2, 3000, NULL);
return hWnd;
}
HWND SetNotifyHwnd(HWND hNtoifyWnd)
{
HWND hWnd = m_hWndNotify;
m_hWndNotify = hNtoifyWnd;
return hWnd;
}
DWORD SetNotifyMsg(DWORD dwMsg)
{
DWORD msg = m_uMsgNotifyChange;
m_uMsgNotifyChange = dwMsg;
return msg;
}
void TurnSwitch(DWORD dwMonitorID)
{
BOOL bRun = m_MonitorShell.GetMonitorRun(dwMonitorID);
m_MonitorShell.SetMonitorRun(dwMonitorID, !bRun);
_Refresh1();
_Refresh2();
}
BOOL GetTurnStatus(DWORD dwMonitorID)
{
return m_MonitorShell.GetMonitorRun(dwMonitorID);
}
/**
* 设置开机启动tray
*/
void OnStartupRun()
{
CRestoreRunner* pLogRunner = new CRestoreRunner;
pLogRunner->DeleteItemFromLog(_T("KSafeTray"), KSRUN_TYPE_STARTUP, 590);
delete pLogRunner;
m_MonitorShell.SetAutorunTray(TRUE);
if (m_hWndNotify && ::IsWindow(m_hWndNotify))
::PostMessage(m_hWndNotify, MSG_SYSOPT_REFRESH_ITEMLIST, 0, 0); /* 刷新开机启动列表 */
}
void TurnOnAll()
{
_Module.Exam.SetAllMonitorRun();
CTrayRunCommon::GetPtr()->SetChange();
_Refresh1();
}
void _TurnOnAll()
{
_Module.Exam._SetAllMonitorRun();
CTrayRunCommon::GetPtr()->SetChange();
_Refresh2();
}
static BOOL NotifyTrayRestart()
{
HWND hWndDDE = ::FindWindow(BKSAFE_PROTECTION_NOTIFY_WND_CLASS, NULL);
if (NULL == hWndDDE)
return FALSE;
return ::PostMessage(hWndDDE, WM_APP, NULL, NULL);
}
int GetMonitorStatus()
{
DWORD dwMonitorIDList[] = {
SM_ID_RISK,
SM_ID_PROCESS,
SM_ID_UDISK,
SM_ID_LEAK,
};
int t = 0;
for ( int i = 0; i < ARRAYSIZE(dwMonitorIDList); i++ )
{
/*
if (TRUE == _Module.Exam.IsWin64())
{
if (SM_ID_PROCESS == dwMonitorIDList[i])
t++;
}
*/
if ( m_bMonitorOn[i] )
{
t++;
}
}
if ( t == ARRAYSIZE(dwMonitorIDList) )
{
return m_bTrayAutorun1 ? 0 : 1;
}
return (t == 0) ? 3 : 2;
}
int _GetMonitorStatus()
{
DWORD dwMonitorIDList[] = {
SM_ID_KWS,
SM_ID_KWS_SAFE_DOWN,
};
int t = 0;
for ( int i = 0; i < ARRAYSIZE(dwMonitorIDList); i++ )
{
/*
if (TRUE == _Module.Exam.IsWin64())
{
if (SM_ID_PROCESS == dwMonitorIDList[i])
t++;
}
*/
if ( m_bNetMonitorOn[i] )
{
t++;
}
}
if ( t == ARRAYSIZE(dwMonitorIDList) )
{
return m_bTrayAutorun2 ? 0 : 1;
}
return (t == 0) ? 3 : 2;
}
void ShellTray()
{
_ShellTray();
m_MonitorShell.CallUpdate(1);
m_MonitorShell.CallUpdate(2);
}
void TryOpenShell()
{
_ShellTray();
}
protected:
CSafeMonitorTrayShell m_MonitorShell;
HWND m_hWndNotify;
UINT m_uMsgNotifyChange;
BOOL m_bMonitorOn[4];
BOOL m_bNetMonitorOn[2];
BOOL m_bKWSEnable;
BOOL m_bKArpRun;
BOOL m_bTrayAutorun1;
BOOL m_bTrayAutorun2;
BOOL m_bUpdateCalled1;
BOOL m_bUpdateCalled2;
BOOL m_bNoQuitSvc;
void _ShellTray()
{
if (::IsWindow(m_MonitorShell.GetWnd()))
return;
CString strPath = _Module.GetAppDirPath(), strCmdLine;
strPath += L"KSafeTray.exe";
CBkCmdLine cmdLine;
// strCmdLine.Format(L"0x%08X", m_hWnd);
//
// cmdLine.SetParam(L"mainwnd", strCmdLine);
cmdLine.Execute(strPath, FALSE, FALSE);
}
void _Refresh1()
{
BOOL bAllMonitorOn = TRUE, bAllMonitorOnOld = TRUE;
BOOL bAnyMonitorOn = FALSE, bAnyMonitorOnOld = FALSE, bAnyMonitorSettingOn = FALSE;
BOOL bValue = FALSE;
DWORD dwMonitorIDList[] = {
SM_ID_RISK,
SM_ID_PROCESS,
SM_ID_UDISK,
SM_ID_LEAK,
};
for (int i = 0; i < ARRAYSIZE(dwMonitorIDList); i ++)
{
bAllMonitorOnOld &= m_bMonitorOn[i];
bAnyMonitorOnOld |= m_bMonitorOn[i];
}
BOOL bTrayRunning = ::IsWindow(m_MonitorShell.GetWnd());
if (bTrayRunning && !m_bUpdateCalled1)
{
m_MonitorShell.CallUpdate(1);
m_MonitorShell.CallUpdate(2);
m_bUpdateCalled1 = TRUE;
}
for (int i = 0; i < ARRAYSIZE(dwMonitorIDList); i ++)
{
bValue = m_MonitorShell.GetMonitorRun(dwMonitorIDList[i]);
bAnyMonitorSettingOn |= bValue;
bValue &= bTrayRunning;
bAllMonitorOn &= bValue;
bAnyMonitorOn |= bValue;
if (m_bMonitorOn[i] != bValue)
{
m_bMonitorOn[i] = bValue;
if (m_hWndNotify && ::IsWindow(m_hWndNotify))
::PostMessage(m_hWndNotify, m_uMsgNotifyChange, dwMonitorIDList[i], bValue);
}
}
BOOL bTrayAutorun = m_MonitorShell.GetAutorunTray();
BOOL bFlag = FALSE;
if (TRUE == _Module.Exam.IsWin64())
{
bFlag = 0 == _Module.Exam.IsSafeMonitorAllRun();
}
else
{
bFlag = bAllMonitorOn && !bAllMonitorOnOld;
}
if ( bFlag || bTrayAutorun != m_bTrayAutorun1 )
{
m_bTrayAutorun1 = bTrayAutorun;
if (m_hWndNotify && ::IsWindow(m_hWndNotify))
::PostMessage(m_hWndNotify, m_uMsgNotifyChange, SM_ID_INVAILD, TRUE);
}
if (bAnyMonitorOn != bAnyMonitorOnOld)
{
/*m_MonitorShell.SetAutorunTray(bAnyMonitorSettingOn);*/
CTrayRunCommon::GetPtr()->SetChange();
}
}
void _Refresh2()
{
BOOL bAllMonitorOn = TRUE, bAllMonitorOnOld = TRUE;
BOOL bAnyMonitorOn = FALSE, bAnyMonitorOnOld = FALSE, bAnyMonitorSettingOn = FALSE;
BOOL bValue = FALSE;
DWORD dwMonitorIDList[] = {
SM_ID_KWS_SAFE_DOWN,
SM_ID_KWS,
};
for (int i = 0; i < ARRAYSIZE(dwMonitorIDList); i ++)
{
bAllMonitorOnOld &= m_bNetMonitorOn[i];
bAnyMonitorOnOld |= m_bNetMonitorOn[i];
}
BOOL bTrayRunning = ::IsWindow(m_MonitorShell.GetWnd());
if (bTrayRunning && !m_bUpdateCalled2)
{
m_MonitorShell.CallUpdate(1);
m_MonitorShell.CallUpdate(2);
m_bUpdateCalled2 = TRUE;
}
for (int i = 0; i < ARRAYSIZE(dwMonitorIDList); i ++)
{
bValue = m_MonitorShell.GetMonitorRun(dwMonitorIDList[i]);
bAnyMonitorSettingOn |= bValue;
bValue &= bTrayRunning;
bAllMonitorOn &= bValue;
bAnyMonitorOn |= bValue;
if (m_bNetMonitorOn[i] != bValue)
{
m_bNetMonitorOn[i] = bValue;
if (m_hWndNotify && ::IsWindow(m_hWndNotify))
::PostMessage(m_hWndNotify, m_uMsgNotifyChange, dwMonitorIDList[i], bValue);
}
}
if (IskArpInstalled())
{
IArpFwSetting* Iprpsetting = CArpSetting::Instance().GetPtr();
if (NULL != Iprpsetting)
{
Iprpsetting->IsArpFwEnable(&bValue);
}
}
if (bValue != m_bKArpRun)
{
m_bKArpRun = bValue;
if (m_hWndNotify && ::IsWindow(m_hWndNotify))
::PostMessage(m_hWndNotify, m_uMsgNotifyChange, SM_ID_ARP, bValue);
}
BOOL bTrayAutorun = m_MonitorShell.GetAutorunTray();
BOOL bFlag = FALSE;
if (TRUE == _Module.Exam.IsWin64())
{
bFlag = 0 == _Module.Exam._IsSafeMonitorAllRun();
}
else
{
bFlag = bAllMonitorOn && !bAllMonitorOnOld;
}
if ( bFlag || bTrayAutorun != m_bTrayAutorun2 )
{
m_bTrayAutorun2 = bTrayAutorun;
if (m_hWndNotify && ::IsWindow(m_hWndNotify))
::PostMessage(m_hWndNotify, m_uMsgNotifyChange, SM_ID_INVAILD, TRUE);
}
if (bAnyMonitorOn != bAnyMonitorOnOld)
{
/*m_MonitorShell.SetAutorunTray(bAnyMonitorSettingOn);*/
CTrayRunCommon::GetPtr()->SetChange();
}
}
LRESULT OnApp(UINT /*uMsg*/, WPARAM wParam, LPARAM lParam)
{
_Refresh1();
_Refresh2();
return 0;
}
void OnTimer(UINT_PTR nIDEvent)
{
if (1 == nIDEvent)
{
_Refresh1();
_Refresh2();
return;
}
else if (2 == nIDEvent)
{
_ShellTray();
KillTimer(2);
}
SetMsgHandled(FALSE);
}
public:
BEGIN_MSG_MAP_EX(CBkSafeProtectionNotifyWindow)
MESSAGE_HANDLER_EX(WM_APP, OnApp)
MSG_WM_TIMER(OnTimer)
END_MSG_MAP()
}; |
48e1e158e8d4717e33cc683fe281e384b3344f02 | 4a2522dc08c4983d7a5e0630f8da08af0f2c44b1 | /src/interpreter/interpret_error.h | 545e81a1ca58aa734eb9464623bf95efa7c4d0f9 | [] | no_license | Microflame/Interpreter | 0e9d73bb1c90cf487872eab9093c3e9e616283e2 | 8056d73b2097de843be91ae725626cb9b4119ddc | refs/heads/master | 2023-04-04T10:05:36.627564 | 2021-11-24T22:09:46 | 2021-11-24T22:09:46 | 229,469,528 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 480 | h | interpret_error.h | #pragma once
#include <stdexcept>
#include "scanner/token.h"
namespace interpreter
{
class InterpretError: public std::exception
{
public:
InterpretError() = delete;
InterpretError(const scanner::Token& token, const std::string& message)
: token_(token),
message_(message)
{
}
const char* what() const noexcept override
{
return message_.c_str();
}
private:
const scanner::Token& token_;
std::string message_;
};
} // namespace interpreter
|
6897861e4977eb7c2c9e1c89e7a5c09a9e70d3d2 | b90fe31f1800fe9457b9cb933213b17228a85da8 | /LeetCode/189 Rotate Array/djuffin.cpp | 31d97766b8693d2d73f63e8206072371ccc0aae9 | [] | no_license | Djuffin/project-euler | f232ba329aa49f21d6b5f1d8be2ca9ef136e7212 | b8160c20f8f55c6a5ef745e8821ea0e1c5d74b6f | refs/heads/master | 2021-06-07T20:41:40.581422 | 2019-05-20T07:02:11 | 2019-05-20T07:02:11 | 328,948 | 1 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 672 | cpp | djuffin.cpp | class Solution {
int64_t gcd(int64_t a, int64_t b) {
if (b == 0) {
return a;
}
return gcd(b, a % b);
}
int64_t lcm(int64_t a, int64_t b) {
return a * b / gcd(a, b);
}
public:
void rotate(vector<int>& nums, int k) {
int n = nums.size();
k %= n;
if (k == 0) return;
int cycle_len = lcm(n, k) / k;
for (int i = 0; i < n / cycle_len; i++) {
int val = nums[i];
for (int j = i + k; j != i; j = (j + k) % n) {
swap(val, nums[j]);
}
nums[i] = val;
}
}
}; |
54acb8c80f000f86ad1a29c0a40daecda1285687 | 23d01d942c97a31e46529c4371e98aa0c757ecd1 | /apps/legacy/tg-xe/cxxhello.cpp | 7e94da3531c6906dce13d72b78a9345fddba0c17 | [
"BSD-2-Clause"
] | permissive | ModeladoFoundation/ocr-apps | f538bc31282f56d43a952610a8f4ec6bacd88e67 | c0179d63574e7bb01f940aceaa7fe1c85fea5902 | refs/heads/master | 2021-09-02T23:41:54.190248 | 2017-08-30T01:48:39 | 2017-08-30T01:49:30 | 116,198,341 | 1 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 598 | cpp | cxxhello.cpp | #include <iostream>
extern struct _reent * _REENT;
using namespace std;
class foo {
int m1;
float m2;
char * m3;
public:
foo( int a1, float a2, int a3 );
~foo();
float M2() { return m2; }
};
foo static_foo( 1, 1.0, 1 );
foo::foo( int a1, float a2, int a3 ) : m1(a1), m2(a2)
{
m3 = new char[a3];
}
foo::~foo( )
{
delete m3;
}
foo * blah()
{
return new foo( 10, 20, 100 );
}
int main( int argc, char **argv )
{
foo * f = blah();
std::cout << "Hello World!" << std::endl;
std::cout << "cplus output: " << f->M2() << std::endl;
return 0;
}
|
e2c314a34a93b2890f4066b26b11ac9567a13cd3 | b5d603a1251ba0dc24151ecb33a6d6d458e19890 | /Ejercicio 58 by Braulio.cpp | 3659a0d3b6e14c2a14b843c68e6176c897b74113 | [
"MIT"
] | permissive | Charlie-Ramirez-Animation-Studios-de-MX/Proyecto-Final | 9b1fcd002633e77ec4a8d50691cea3ced24f9e81 | 2f9b823dc1ba2a5276472b4c850f25e7b39b830d | refs/heads/master | 2020-09-10T23:26:16.430052 | 2020-05-02T21:50:08 | 2020-05-02T21:50:08 | 260,777,524 | 0 | 1 | null | null | null | null | UTF-8 | C++ | false | false | 351 | cpp | Ejercicio 58 by Braulio.cpp | #include <stdio.h>
#include <iostream>
using namespace std;
int i, n, sum, j;
int main(){
cout<<"Limite de numeros: "; cin>>n;
cout<<"\n";
for(i=1;i<=n;i++){
sum= 0;
for(j=1;j<=(i/2);j++){
if((i%j)==0){
sum+= j;
}
}
if(sum==i){
cout<<i<<" Es un numero perfecto"<<endl;
}
}
return 0;
}
|
96c0611ffa4c8286027ed179fac80ecae90d2108 | 01d8c5790aee06d3c661dbc81be5cd0655981608 | /SubComponents/Sum.cpp | fa45ffec3198dbd2af9b5005c5be8c48683f4dc0 | [] | no_license | SachsA/Nanotekspice | 7a8c019bf1b09f26a52164210566853bf434f2d3 | c237cb6f8c413fe3992d0ec146f188d3cd0b0d2d | refs/heads/master | 2020-03-15T20:25:55.003083 | 2019-12-02T16:27:56 | 2019-12-02T16:27:56 | 132,332,404 | 4 | 2 | null | null | null | null | UTF-8 | C++ | false | false | 1,956 | cpp | Sum.cpp | //
// EPITECH PROJECT, 2018
// Nano Tek Spice
// File description:
// Sum Cpp
//
#include "ErrorsPin.hpp"
#include "ErrorsLink.hpp"
#include "Sum.hpp"
Sum::Sum() : _name("none")
{
}
Sum::Sum(const std::string &value) : _name(value)
{
}
Sum::~Sum()
{
}
///////////////// SETTERS //////////////////
void Sum::setLink(std::size_t pin, nts::IComponent &other,
std::size_t otherPin)
{
if (pin == 0 || pin > _maxPin)
throw ErrorsLink(std::cerr, "The pin to link is out bounded");
pin--;
_links[pin].component = &other;
_links[pin].pin = otherPin;
}
///////////////// METHODS //////////////////
nts::Tristate Sum::calculateS(nts::Tristate in1, nts::Tristate in2,
nts::Tristate in3)
{
nts::Tristate ret;
ret = Xor::calculate(in1, in2);
ret = Xor::calculate(ret, in3);
return ret;
}
nts::Tristate Sum::calculateC(nts::Tristate in1, nts::Tristate in2,
nts::Tristate in3)
{
nts::Tristate step;
nts::Tristate ret;
step = Xor::calculate(in1, in2);
step = And::calculate(step, in3);
ret = And::calculate(in1, in2);
ret = Or::calculate(step, ret);
return ret;
}
nts::Tristate Sum::processCompute(size_t pin)
{
nts::Tristate in1 = _links[0].component->compute(_links[0].pin);
nts::Tristate in2 = _links[1].component->compute(_links[1].pin);
nts::Tristate in3 = _links[2].component->compute(_links[2].pin);
nts::Tristate ret;
if (pin == 3)
ret = Sum::calculateC(in1, in2, in3);
else
ret = Sum::calculateS(in1, in2, in3);
return ret;
}
nts::Tristate Sum::compute(std::size_t pin)
{
nts::Tristate ret;
if (pin == 0 || pin > _maxPin)
throw ErrorsPin(std::cerr, "The pin to compute is out bounded");
--pin;
if (pin == 3 || pin == 4) {
if (_links[0].component == nullptr ||
_links[1].component == nullptr ||
_links[2].component == nullptr)
throw ErrorsLink(std::cerr, "The pin to link is out bounded");
ret = this->processCompute(pin);
}
else
ret = nts::UNDEFINED;
return ret;
}
void Sum::dump() const
{
}
|
da92de0a9318dc567940c491e3e34c5a093d6acf | e23e36c6514daa68d14d040d55341f34a853ba8e | /Meet The Scout/FabricaObstaculo.cpp | 465e3786a2237edde14226a7ed5e745ca042a5ad | [] | no_license | adilcoelho/meet-the-scout | d42ca99d5359eecf9c69597e9f0a77ddac87274a | 81097f1833e632f2af8ea76c1fe77c3ab2156b79 | refs/heads/master | 2021-05-12T16:07:58.631249 | 2018-01-10T19:51:12 | 2018-01-10T19:51:12 | 117,001,610 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 145 | cpp | FabricaObstaculo.cpp | #include "stdafx.h"
#include "FabricaObstaculo.h"
FabricaObstaculo::FabricaObstaculo()
{
}
FabricaObstaculo::~FabricaObstaculo()
{
}
|
6482292eac3a4b7d3d1bc00337321d7aa5b88733 | 04feb1f6bd9c3a84bc6178be88fe41d63737fe77 | /DetAutomat/Automat.h | 43865d166fb050e84563d6019c2c61a5445e7ac4 | [] | no_license | Tyson44-rus/DetAutomat | a12fc26fb809ddbc0da97442aa34be4768f9a859 | 2c1a0a55d56ec949d4886908ac27a64bcd6cb6ef | refs/heads/master | 2022-12-31T14:21:58.203509 | 2020-10-20T10:48:00 | 2020-10-20T10:48:00 | 304,913,113 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 1,265 | h | Automat.h | #pragma once
#include <fstream>
#include <iostream>
#include <map>
#include <set>
#include <string>
#include <utility>
#include <vector>
using namespace std;
struct jump {
string Left;
string Center;
string Right;
};
class Automat {
public:
typedef string T_state;
typedef pair < T_state, string > T_state_and_symb;
typedef map < T_state_and_symb, T_state > T_state_transition_table;
typedef set < T_state > T_states;
typedef vector < T_state > T_states_v;
typedef vector < jump > T_state_transition_table_v;
T_state cur_state_;
T_state start_state_;
T_state_transition_table state_transition_table_;
T_state_transition_table_v state_transition_table_v_;
T_states final_states_;
T_states states_;
T_states Alphabet_;
T_states_v states_v_;
T_states_v Alphabet_v_;
T_states_v final_states_v_;
public:
Automat() {}
bool string_is_accepted(vector < string > buf);
void add_rule(T_state cur_state, string symb, T_state new_state);
void add_final_state(T_state state);
bool successfully_set_cur_state_for_symb(string symb);
bool cur_state_is_final();
void Check();
~Automat() {}
};
vector < string > Split(string s, char sep);
void removeS(string& s);
|
b31c5d5b4eb62ba74904e5cc12bfceb77a65b16f | 3aa9a68026ab10ced85dec559b6b4dfcb74ae251 | /leetCode/max-consecutive-ones/Accepted/9-21-2021, 8_25_34 PM/Solution.cpp | cc68616440206a3136a95d0a50fd1626a9bcc7c7 | [] | no_license | kushuu/competitive_programming_all | 10eee29c3ca0656a2ffa37b142df680c3a022f1b | 5edaec66d2179a012832698035bdfb0957dbd806 | refs/heads/master | 2023-08-17T15:09:48.492816 | 2021-10-04T20:09:37 | 2021-10-04T20:09:37 | 334,891,360 | 3 | 2 | null | null | null | null | UTF-8 | C++ | false | false | 383 | cpp | Solution.cpp | // https://leetcode.com/problems/max-consecutive-ones
class Solution {
public:
int findMaxConsecutiveOnes(vector<int>& nums) {
int ans = 0, temp = 0;
for(auto i : nums) {
if(i) temp++;
else {
ans = max(ans, temp);
temp = 0;
}
}
ans = max(ans, temp);
return ans;
}
}; |
0db449fb4805a37753d91a537c3e47644533ba4c | ebb42934ee5096c84e41bde9965d99c573e57557 | /main.cpp | f301417728be3e9a3c6b9d5f3f3f09d54587e132 | [] | no_license | anumehaagrawal/ZooZoo-animation-using-OpenGl | 162fe493e11cdbcf081231135512f8a2ce479219 | 6d8727ab8b203b7acde54287663844a73adad429 | refs/heads/master | 2020-03-10T04:02:06.199351 | 2018-04-17T19:33:08 | 2018-04-17T19:33:08 | 129,181,727 | 0 | 1 | null | null | null | null | UTF-8 | C++ | false | false | 12,394 | cpp | main.cpp | #include <stdio.h>
#include <stdlib.h>
#include <windows.h>
#include <math.h>
#include <GL/glut.h>
#define PI 3.1415927
int rightHandAngle = 180;
bool mouseLeftState = false;
bool mouseRightState = false;
int rightHandMove = 2;
int leftLegMove = 1; // If right mouse clicked, left leg will move by 1.
int rightLegMove = -1; // If right mouse clicked, right leg will move by 1.
int leftLegAngle = 90; // If right mouse clicked, this variable will be used to rotate left leg and it initialized to 90 degrees for first position of leg.
int rightLegAngle = 90; // If right mouse clicked, this variable will be used to rotate right leg and it initialized to 90 degrees for first position of leg.
float zMove = 0.0;
GLfloat x1,y11,x2,y2,x3,y3,x4,y4;
GLfloat vertices[]={0.8,0.8,0.2,-0.2,
0.9,0.9,0.9,0.9,
0.4,0.7,0.3,0.5,
0.5,0.5,0.5,0.5
};
GLfloat colours[]={1,0,0,
0,1,0,
1,0,0,
0,0,1
};
void draw_pixel(int x, int y) {
glBegin(GL_POINTS);
glVertex2i(x, y);
glEnd();
}
void hat(){
glEnableClientState(GL_VERTEX_ARRAY);
glEnableClientState(GL_COLOR_ARRAY);
glColor3f(0,0,0);
glMatrixMode(GL_POLYGON);
glLoadIdentity();
glTranslatef(0,-0.25,0);
glRotatef(40,0,0,1);
glVertexPointer(3,GL_FLOAT,0,vertices);
glColorPointer(3,GL_FLOAT,0,colours);
glColor3f(0,0,1);
glDrawArrays(GL_POLYGON,0,4);
glDisableClientState(GL_COLOR_ARRAY);
glDisableClientState(GL_VERTEX_ARRAY);
glEnd();
//glRotatef(-5,0,1,0);
}
void draw_cylinder(GLfloat radius,GLfloat height,GLubyte R,GLubyte G,GLubyte B)
{
GLfloat x = 0.0;
GLfloat y = 0.0;
GLfloat angle = 0.0;
GLfloat angle_stepsize = 0.1;
/** Draw the tube */
glColor3ub(R-40,G-40,B-40);
glBegin(GL_QUAD_STRIP);
angle = 0.0;
while( angle < 2*PI ) {
x = radius * cos(angle);
y = radius * sin(angle);
glVertex3f(x, y , height);
glVertex3f(x, y , 0.0);
angle = angle + angle_stepsize;
}
glVertex3f(radius, 0.0, height);
glVertex3f(radius, 0.0, 0.0);
glEnd();
/** Draw the circle on top of cylinder */
glColor3ub(R,G,B);
glBegin(GL_POLYGON);
angle = 0.0;
while( angle < 2*PI ) {
x = radius * cos(angle);
y = radius * sin(angle);
glVertex3f(x, y , height);
angle = angle + angle_stepsize;
}
glVertex3f(radius, 0.0, height);
glEnd();
}
void draw_line(int x1, int x2, int y1, int y2) {
int dx, dy, i, e;
int incx, incy, inc1, inc2;
int x,y;
dx = x2-x1;
dy = y2-y1;
if (dx < 0) dx = -dx;
if (dy < 0) dy = -dy;
incx = 1;
if (x2 < x1) incx = -1;
incy = 1;
if (y2 < y1) incy = -1;
x = x1; y = y1;
if (dx > dy) {
draw_pixel(x, y);
e = 2 * dy-dx;
inc1 = 2*(dy-dx);
inc2 = 2*dy;
for (i=0; i<dx; i++) {
if (e >= 0) {
y += incy;
e += inc1;
}
else
e += inc2;
x += incx;
draw_pixel(x, y);
}
} else {
draw_pixel(x, y);
e = 2*dx-dy;
inc1 = 2*(dx-dy);
inc2 = 2*dx;
for (i=0; i<dy; i++) {
if (e >= 0) {
x += incx;
e += inc1;
}
else
e += inc2;
y += incy;
draw_pixel(x, y);
}
}
}
void circledraw(double R , double x, double y){
y=y+R;
double P;
P=1-R;
while(y>x){
x++;
if(P<0){
P=P+2*x+3;
}
else{
y=y-1;
P=P+2*(x-y)+5;
}
glColor3f(0.2,0.3,1.0);
glBegin(GL_POINTS);
glVertex2d(x,y);
glVertex2d(-x,y);
glVertex2d(x,-y);
glVertex2d(y,x);
glVertex2d(-y,x);
glVertex2d(-x,-y);
glVertex2d(-y,-x);
glVertex2d(y,-x);
glEnd();
}
}
void display(){
glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
glPushMatrix(); //BODY
glColor3f(1.0, 1.0, 0.0);
glTranslatef(0.0, 221, zMove);
glRotatef(90, 1.0, 0.0, 0.0);
GLUquadricObj* body = gluNewQuadric();
gluQuadricDrawStyle(body, GLU_FILL);
draw_cylinder(120,300,120,0,0);
glPopMatrix();
glPushMatrix(); //LEFT UPPER ARM
glColor3f(0.07f, 0.545f, 0.341f);
glTranslatef(-80, 160, zMove);
glRotatef(-45, 0.0, 0.0, 1.0);
glRotatef(90, 1.0, 0.0, 0.0);
GLUquadricObj* leftUpperArm = gluNewQuadric();
gluQuadricDrawStyle(leftUpperArm, GLU_FILL);
draw_cylinder( 16,200, 0, 30, 30);
glPopMatrix();
glPushMatrix(); // LEFT UPPER ARM AND BODY CONNECTION
glColor3f(1.0, 0.0, 0.0);
glPushMatrix();
glTranslatef(-80.0, 160, zMove);
glutSolidSphere(16, 30, 30);
glPopMatrix();
glPushMatrix(); //LEFT LOWER ARM
glColor3f(1.0, 1.0, 0.0);
glTranslatef(-221.5, 19.5, zMove);
glRotatef(225, 0.0, 0.0, 1.0);
glRotatef(90, 1.0, 0.0, 0.0);
GLUquadricObj* leftLowerArm = gluNewQuadric();
gluQuadricDrawStyle(leftLowerArm, GLU_FILL);
draw_cylinder( 16, 200, 0, 200, 0);
glPopMatrix();
glPushMatrix(); // LEFT LOWER ARM AND LEFT UPPER ARM CONNECTION
glColor3f(1.0, 0.0, 0.0);
glPushMatrix();
glTranslatef(-221.5, 19.5, zMove);
glutSolidSphere(16, 30, 30);
glPopMatrix();
glPushMatrix(); //RIGHT UPPER ARM
glColor3f(0.180f, 0.545f, 0.341f);
glTranslatef(80, 160, zMove);
glRotatef(90, 0.0, 0.0, 1.0);
glRotatef(90, 1.0, 0.0, 0.0);
GLUquadricObj* rightUpperArm = gluNewQuadric();
gluQuadricDrawStyle(rightUpperArm, GLU_FILL);
draw_cylinder (16, 200 ,0,200,0);
glPopMatrix();
glPushMatrix(); // RIGHT UPPER ARM AND BODY CONNECTION
glColor3f(1.0, 0.0, 0.0);
glPushMatrix();
glTranslatef(80, 160, zMove);
glutSolidSphere(16, 30, 30);
glPopMatrix();
glPushMatrix(); //RIGHT LOWER ARM
glColor3f(1.0, 1.0, 0.0);
glTranslatef(280, 160, zMove);
glRotatef((GLfloat)rightHandAngle, 0.0, 0.0, 1.0);
glRotatef(90, 1.0, 0.0, 0.0);
GLUquadricObj* rightLowerArm = gluNewQuadric();
gluQuadricDrawStyle(rightLowerArm, GLU_FILL);
draw_cylinder( 16, 200,200,0 ,0);
glPopMatrix();
glPushMatrix(); // RIGHT LOWER ARM AND RIGHT UPPER ARM CONNECTION
glColor3f(1.0, 0.0, 0.0);
glPushMatrix();
glTranslatef(280, 160, zMove);
glutSolidSphere(16, 30, 30);
glPopMatrix();
glPushMatrix(); //LEFT LEG
glColor3f(0.180f, 0.545f, 0.341f);
glTranslatef(-35, -20, zMove);
glRotatef(-15, 0.0, 0.0, 1.0);
glRotatef((GLfloat)leftLegAngle, 1.0, 0.0, 0.0);
GLUquadricObj* leftLeg = gluNewQuadric();
gluQuadricDrawStyle(leftLeg, GLU_FILL);
draw_cylinder( 16, 400, 16,30, 30);
glPopMatrix();
glPushMatrix(); // LEFT LEG AND BODY CONNECTION
glColor3f(1.0, 0.0, 0.0);
glPushMatrix();
glTranslatef(-35, -20, zMove);
glutSolidSphere(16, 30, 30);
glPopMatrix();
glPushMatrix(); //RIGHT LEG
glColor3f(0.180f, 0.545f, 0.341f);
glTranslatef(35, -20, zMove);
glRotatef(15, 0.0, 0.0, 1.0);
glRotatef((GLfloat)rightLegAngle, 1.0, 0.0, 0.0);
GLUquadricObj* rightLeg = gluNewQuadric();
gluQuadricDrawStyle(rightLeg, GLU_FILL);
draw_cylinder(16, 400,16 , 30, 30);
glPopMatrix();
glPushMatrix(); // RIGHT LEG AND BODY CONNECTION
glColor3f(1.0, 0.0, 0.0);
glPushMatrix();
glTranslatef(35, -20, zMove);
glutSolidSphere(16, 30, 30);
glPopMatrix();
glPushMatrix(); //NECK
glColor3f(0.0, 0.0, 0.545);
glTranslatef(0.0, 251, zMove);
glRotatef(90, 1.0, 0.0, 0.0);
GLUquadricObj* neck = gluNewQuadric();
gluQuadricDrawStyle(neck, GLU_FILL);
draw_cylinder(20, 30,20, 30, 30);
glPopMatrix();
glPushMatrix(); // HEAD
glColor3f(1.0, 0.647, 0.0);
glPushMatrix();
glTranslatef(0.0, 350, zMove);
glutSolidSphere(100, 30, 30);
glPopMatrix();
glPushMatrix();
glColor3f(0.0,0.0,0.0);
glBegin(GL_TRIANGLES);
glColor3f(1.0,0.0,0.0);
glVertex2i(-680, 40);
glVertex2i(-540,120);
glVertex2i(-400,40);
glEnd();
glBegin(GL_QUADS);
glColor3f(0.0,1.0,0.0);
glVertex2i(-680,48);
glVertex2i(-400,48);
glVertex2i(-400,-400);
glVertex2i(-680,-400);
glEnd();
glBegin(GL_QUADS);
glColor3f(0.0,0.0,1.0);
glVertex2i(-610,-400);
glVertex2i(-610,-200);
glVertex2i(-470,-200);
glVertex2i(-470,-400);
glEnd();
//scanfill(-580,40,-300,40,-300,-300,-580,-300);
glPopMatrix();
glPushMatrix();
hat();
glPopMatrix();
if (mouseLeftState == true){ // If left mouse clicked right hand of object will shake its lower arm
if (rightHandAngle >= 225) { // If angle is greater than 225 incrementing degree will become decrement
rightHandMove = -rightHandMove;
}
else if (rightHandAngle <= 135){ // If angle is lower than 135 decrementing degree will become increment
rightHandMove = -rightHandMove;
}
rightHandAngle = (rightHandAngle + rightHandMove) % 360; // changing angle of right hand.
}
if (mouseRightState == true){ // If right mouse clicked the object will ve moved and legs' angles will be changed.
if (leftLegAngle > 110){
leftLegMove = -leftLegMove;
}
else if (leftLegAngle < 70){
leftLegMove = -leftLegMove;
}
leftLegAngle = (leftLegAngle + leftLegMove) % 360; // Changing angle of left leg
if (rightLegAngle > 110) {
rightLegMove = -rightLegMove;
}
else if (rightLegAngle < 70){
rightLegMove = -rightLegMove;
}
rightLegAngle = (rightLegAngle + rightLegMove) % 360; // Changing angle of right leg
zMove += 1.5f; // Moving object on the z-axis
}
glutSwapBuffers();
}
void keyboard(unsigned char key, int x, int y){
if (key == 27) // exit when user hits <esc>
exit(EXIT_SUCCESS);
}
void rotate(int key, int x, int y)
{
if (key == GLUT_KEY_LEFT){
glRotatef(-1, 0.0, 1.0, 0.0); // Rotates left by 1 degree
glutPostRedisplay();
}
if (key == GLUT_KEY_RIGHT){
glRotatef(1, 0.0, 1.0, 0.0); // Rotates right by 1 degree
glutPostRedisplay();
}
if (key == GLUT_KEY_UP){
glRotatef(1, 1.0, 0.0, 0.0); // Rotates up by 1 degree
glutPostRedisplay();
}
if (key == GLUT_KEY_DOWN){
glRotatef(-1, 1.0, 0.0, 0.0); // Rotates down by 1 degree
glutPostRedisplay();
}
}
void timer(int notUsed) // Timer is for animation. This function provides us to redisplay all objects by every 100 miliseconds
{
glutPostRedisplay();
glutTimerFunc(100, timer, 0);
}
int main(int argc, char *argv[]){
glutInit(&argc, argv);
glutInitDisplayMode(GLUT_DOUBLE | GLUT_RGB | GLUT_DEPTH);
glEnable(GL_DEPTH_TEST); // Hidden surface removal
glutInitWindowSize(1200, 700);
glutCreateWindow(argv[0]);
glClearColor(0.0, 1.0, 1.0, 0.0);
glMatrixMode(GL_PROJECTION);
glLoadIdentity();
glOrtho(-750.0, 750.0, -500.0, 500.0, -500.0, 500.0); // Changing the coordinate system.
glutDisplayFunc(display);
glutSpecialFunc(rotate);
glutKeyboardFunc(keyboard);
timer(0);
glutMainLoop();
return EXIT_SUCCESS;
}
|
d6a08f65bea3a45cb66bb3742dd4cf25e9775dcf | 498b3133fff9f502a81dd1a54dd977d276ed3167 | /src/InitialConditions.cpp | de5d0845466fc9e5851423bfcc6f3278d46f6c00 | [
"MIT"
] | permissive | danOSU/KTIso | 8b78fe3d39f14a802a3f14fade850d63c35a2c8b | bc65bbb4f03ed22b7a84e120a2079d3015e4a20a | refs/heads/master | 2021-08-29T05:15:31.168040 | 2021-03-20T21:57:43 | 2021-03-20T21:57:43 | null | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 15,618 | cpp | InitialConditions.cpp | #pragma once
#include <math.h>
#include <stdlib.h>
#include <fstream>
#include <string>
#include <vector>
#include <random>
#include "Parameter.h"
#define THETA_FUNCTION(X) ((float)X < (float)0 ? (float)0 : (float)1)
//this creates the initial F function, a function of spatial coordinates and momentum phip and velocity vz
//this function assumes F is initially isotropic in phi_p
void initializeDensity(float *energyDensity, float ***density, float **vz_quad, parameters params)
{
int ntot = params.ntot;
int nphip = params.nphip;
int nvz = params.nvz;
float dvz_2 = 2.0 / (float)(nvz - 1);
float b = 0.3; //width of distribution in v_z
float norm = sqrt(2.0 * M_PI) * b * erf( 1.0 / ( sqrt(2.0) * b) ); //normalization of gaussian on (-1, 1)
if (nvz > 1)
{
//check that v_z distn is normalized
/*
float check_norm = 0.0;
for (int ivz = 0; ivz < nvz; ivz++)
{
float vz = -1.0 + (float)ivz * dvz_2;
//float vz = vz_quad[ivz][0];
//float dvz = vz_quad[ivz][1];
check_norm += exp(-vz * vz / (2.0 * b * b)) / norm * dvz_2;
//check_norm += exp(-vz * vz / (2.0 * b * b)) / norm * dvz;
}
*/
//even function, integrated on even domain
//check_norm *= 2.0;
//std::cout << "Checking norm of v_z distribution : norm = " << check_norm << std::endl;
#pragma omp parallel for
for (int is = 0; is < ntot; is++)
{
float e0 = energyDensity[is];
for (int iphip = 0; iphip < nphip; iphip++)
{
//try intializing dependence on v_z by a flat distribution
//alternatively try gaussian or delta function ?
for (int ivz = 0; ivz < nvz; ivz++)
{
//density[is][iphip][ivz] = val;
float vz = -1.0 + (float)ivz * dvz_2;
//float vz = vz_quad[ivz][0];
//density[is][iphip][ivz] = e0 * exp(-vz * vz / 0.1); //this distribution is not normalized
//density[is][iphip][ivz] = e0 * exp(-vz * vz / (2.0 * b * b)) / norm; //gaussian in v_z (P_l/P_T != 1)
density[is][iphip][ivz] = e0 / 2.; //flat in v_z => PL/P_T = 1 Initially Isotropic Distribution
}
} //for (int iphip = 0; iphip < nphip; iphip++)
} //for (int is = 0; is < ntot; is++)
} //if (nvz > 1)
else
{
#pragma omp parallel for
for (int is = 0; is < ntot; is++)
{
float e0 = energyDensity[is];
for (int iphip = 0; iphip < nphip; iphip++)
{
//density[is][iphip][0] = e0;
density[is][iphip][0] = 2.0 * e0;
} //for (int iphip = 0; iphip < nphip; iphip++)
} //for (int is = 0; is < ntot; is++)
}
}
//this function assumes the initial energy density has already been read, and
//initializes the phi_p distribution following the files provided in initial_psi_profiles
//this function is only written for boost invariant mode !
void initializeDensity_color_domains(float *energyDensity, float ***density, float **vz_quad, parameters params)
{
int ntot = params.ntot;
int nphip = params.nphip;
float dphip = 2. * M_PI / params.nphip;
//get the momentum modulation phase velocity
float w_D = params.w_D;
float dx = params.dx;
float dy = params.dy;
int nx = params.nx;
int ny = params.ny;
std::ifstream blockFile;
blockFile.open("initial_psi_profiles/psi.dat");
float psi_p = 0.;
//now loop over all cells in each patch
for (int ix = 0; ix < nx; ix++)
{
for (int iy = 0; iy < ny; iy++)
{
int is = (ny) * ix + iy; //the column packed index spanning x, y
float e0 = energyDensity[is]; //get the value of the initial energy density
blockFile >> psi_p; //get the value of the color domain phase angle psi from file
for (int iphip = 0; iphip < nphip; iphip++)
{
float phi_p = iphip * dphip;
float angle_fct_N;
if (w_D == 0) angle_fct_N = 1. / (2. * M_PI);
else angle_fct_N = w_D / (2. * sin(M_PI*w_D)); // normalization of the angular function
float angle_fct = angle_fct_N * cos(w_D*(phi_p - psi_p)); // the normalized angular function
density[is][iphip][0] = 2.0 * e0 * angle_fct; // multiply the initial energy density by the phi_p angular fct., remember factor of two for boost-invar F(v_z) ~ delta(v_z)
} //for (int iphip = 0; iphip < nphip; iphip++)
}
}
}
//this creates the initial F function, a function of spatial coordinates and momentum phip and velocity vz
// assumes F is initially an anisotropic function of phi_p
void initializeDensityAniso(float *energyDensity, float ***density, float **vz_quad, parameters params)
{
int ntot = params.ntot;
int nphip = params.nphip;
int nvz = params.nvz;
float dvz_2 = 2.0 / (float)(nvz - 1);
float b = 0.3; //width of distribution in v_z
float norm = sqrt(2.0 * M_PI) * b * erf( 1.0 / ( sqrt(2.0) * b) ); //normalization of gaussian on (-1, 1)
if (nvz > 1)
{
//check that v_z distn is normalized
float check_norm = 0.0;
for (int ivz = 0; ivz < nvz; ivz++)
{
float vz = -1.0 + (float)ivz * dvz_2;
//float vz = vz_quad[ivz][0];
//float dvz = vz_quad[ivz][1];
check_norm += exp(-vz * vz / (2.0 * b * b)) / norm * dvz_2;
//check_norm += exp(-vz * vz / (2.0 * b * b)) / norm * dvz;
}
//even function, integrated on even domain
//check_norm *= 2.0;
std::cout << "Checking norm of v_z distribution : norm = " << check_norm << std::endl;
#pragma omp parallel for
for (int is = 0; is < ntot; is++)
{
float e0 = energyDensity[is];
for (int iphip = 0; iphip < nphip; iphip++)
{
//try intializing dependence on v_z by a flat distribution
//alternatively try gaussian or delta function ?
for (int ivz = 0; ivz < nvz; ivz++)
{
//density[is][iphip][ivz] = val;
float vz = -1.0 + (float)ivz * dvz_2;
//float vz = vz_quad[ivz][0];
//density[is][iphip][ivz] = e0 * exp(-vz * vz / 0.1); //this distribution is not normalized
density[is][iphip][ivz] = e0 * exp(-vz * vz / (2.0 * b * b)) / norm;
}
} //for (int iphip = 0; iphip < nphip; iphip++)
} //for (int is = 0; is < ntot; is++)
} //if (nvz > 1)
else
{
#pragma omp parallel for
for (int is = 0; is < ntot; is++)
{
float e0 = energyDensity[is];
for (int iphip = 0; iphip < nphip; iphip++)
{
float phip = float(iphip) * (2.0 * M_PI) / float(nphip);
//density[is][iphip][0] = e0;
density[is][iphip][0] = 4.0 * e0 * cos(phip) * cos(phip);
} //for (int iphip = 0; iphip < nphip; iphip++)
} //for (int is = 0; is < ntot; is++)
}
}
void initializeZero(float *density, parameters params)
{
int ntot = params.ntot;
for (int is = 0; is < ntot; is++)
{
density[is] = 0.0;
}
}
void initializeFlowZero(float **flowVelocity, parameters params)
{
int ntot = params.ntot;
for (int is = 0; is < ntot; is++)
{
flowVelocity[0][is] = 1.0;
flowVelocity[1][is] = 0.0;
flowVelocity[2][is] = 0.0;
flowVelocity[3][is] = 0.0;
}
}
void readFlowVelocityBlock(float **flowVelocity, parameters params)
{
int nx = params.nx;
int ny = params.ny;
int ntot = params.ntot;
//first read in the transverse flow profile
float temp = 0.0;
std::ifstream blockFile;
blockFile.open("initial_profiles/ux.dat");
if (blockFile.is_open())
{
for (int iy = 0; iy < ny; iy++)
{
for (int ix = 0; ix < nx; ix++)
{
blockFile >> temp;
int is = (ny) * ix + iy; //the column packed index spanning x, y
flowVelocity[1][is] = temp;
}
}
}
else
{
printf("Could not find initial profile in initial_profiles!");
}
blockFile.close();
blockFile.open("initial_profiles/uy.dat");
if (blockFile.is_open())
{
for (int iy = 0; iy < ny; iy++)
{
for (int ix = 0; ix < nx; ix++)
{
blockFile >> temp;
int is = (ny) * ix + iy; //the column packed index spanning x, y
flowVelocity[2][is] = temp;
}
}
}
else
{
printf("Could not find initial profile in initial_profiles!");
}
blockFile.close();
//now set u^eta to zero for boost invariance and u^t = 1 - (u^x*u^x + u^y*u^y)
for (int is = 0; is < ntot; is++)
{
float ux = flowVelocity[1][is];
float uy = flowVelocity[2][is];
flowVelocity[0][is] = 1.0 - (ux*ux + uy*uy);
flowVelocity[3][is] = 0.0;
}
}
void initializeGauss(float *density, float b, parameters params) // b is the variance ('spherically' symmetric)
{
int ntot = params.ntot;
int nx = params.nx;
int ny = params.ny;
float dx = params.dx;
float dy = params.dy;
float e0 = 500.0; //energy norm factor in fm^(-4) : roughly 500 MeV Temperature
for (int is = 0; is < ntot; is++)
{
int ix = is / (ny );
int iy = (is - (ny * ix));
//does it work for even number of points?
float x = (float)ix * dx - ((float)(nx-1)) / 2.0 * dx;
float y = (float)iy * dy - ((float)(ny-1)) / 2.0 * dy;
density[is] = e0 * exp( -(1.0 / b) * ( (x * x) + (y * y) ) );
}
}
void initializeEllipticalGauss(float *density, float bx, float by, parameters params) // bx is the x variance etc...
{
float hbarc = params.hbarc;
float regulate = 1.0e-20;
int ntot = params.ntot;
int nx = params.nx;
int ny = params.ny;
float dx = params.dx;
float dy = params.dy;
float T0_GeV = 0.8; //initial tempeature in GeV
float T0 = T0_GeV / hbarc; //initial temperature in fm^-1
float e0 = energyDensityFromTemperature(T0);
for (int is = 0; is < ntot; is++)
{
int ix = is / (ny);
int iy = (is - (ny * ix));
//does it work for even number of points?
float x = (float)ix * dx - ((float)(nx-1)) / 2.0 * dx;
float y = (float)iy * dy - ((float)(ny-1)) / 2.0 * dy;
density[is] = e0 * exp(-(1.0 / (2.0 * bx * bx)) * (x * x)) * exp(-(1.0 / (2.0 * by * by)) * (y * y)) + regulate;
}
}
void initializeMCGauss(float * density, float b, parameters params)
{
int ntot = params.ntot;
int nx = params.nx;
int ny = params.ny;
float dx = params.dx;
float dy = params.dy;
float e0 = 500.0; //energy norm factor in fm^(-4) : roughly 500 MeV Temperature
for (int is = 0; is < ntot; is++)
{
int ix = is / (ny);
int iy = (is - (ny * ix));
//does it work for even number of points?
float x = (float)ix * dx - ((float)(nx-1)) / 2.0 * dx;
float y = (float)iy * dy - ((float)(ny-1)) / 2.0 * dy;
density[is] = e0 * ( (float)rand() / RAND_MAX ) * exp( -(1.0 / b) * ((x * x) + (y * y) ) );
}
}
void initializeEllipticalMCGauss(float *density, float bx, float by, parameters params) // bx is the x variance etc...
{
int ntot = params.ntot;
int nx = params.nx;
int ny = params.ny;
float dx = params.dx;
float dy = params.dy;
float e0 = 500.0; //energy norm factor in fm^(-4) : roughly 500 MeV Temperature
for (int is = 0; is < ntot; is++)
{
int ix = is / (ny);
int iy = (is - (ny * ix));
//does it work for even number of points?
float x = (float)ix * dx - ((float)(nx-1)) / 2.0 * dx;
float y = (float)iy * dy - ((float)(ny-1)) / 2.0 * dy;
density[is] = e0 * ( (float)rand() / RAND_MAX) * exp(-(1.0 / bx) * (x * x)) * exp(-(1.0 / by) * (y * y)) ;
}
}
void readEnergyDensityBlock(float *density, parameters params)
{
float e_scale_factor = 1.;
//float lower_tolerance = 1.0e-3;
int nx = params.nx;
int ny = params.ny;
//first read in the transverse profile
float temp = 0.0;
std::ifstream blockFile;
blockFile.open("initial_profiles/e.dat");
if (blockFile.is_open())
{
//skip the eight line header
std::string line;
for (int l = 0; l < 8; l++) getline(blockFile, line);
for (int iy = 0; iy < ny; iy++)
{
for (int ix = 0; ix < nx; ix++)
{
blockFile >> temp;
int is = (ny) * ix + iy; //the column packed index spanning x, y
density[is] = temp * e_scale_factor;
}
}
}
else
{
printf("Could not find initial profile in initial_profiles!");
}
blockFile.close();
}
void initialize2Gaussians(float *density, float bx, float by, parameters params) // bx is the x variance etc...
{
int ntot = params.ntot;
int nx = params.nx;
int ny = params.ny;
float dx = params.dx;
float dy = params.dy;
float e0 = 500.0; //energy norm factor in fm^(-4) : roughly 500 MeV Temperature
for (int is = 0; is < ntot; is++)
{
int ix = is / (ny);
int iy = is - (ny * ix);
//does it work for even number of points?
float x = (float)ix * dx - ((float)(nx-1)) / 2.0 * dx;
float y = (float)iy * dy - ((float)(ny-1)) / 2.0 * dy;
float x1 = -1.0;
float y1 = 0.0;
float x2 = 1.0;
float y2 = 0.0;
density[is] = e0 * (exp(-(1.0 / bx) * ((x-x1) * (x-x1))) * exp(-(1.0 / by) * ((y-y1) * (y-y1)))
+ exp(-(1.0 / bx) * ((x-x2) * (x-x2))) * exp(-(1.0 / by) * ((y-y2) * (y-y2))) );
}
}
void initializeHomogeneous(float *density, parameters params) // bx is the x variance etc...
{
int ntot = params.ntot;
float e0 = 500.0; //energy norm factor in fm^(-4) : roughly 500 MeV Temperature
for (int is = 0; is < ntot; is++)
{
density[is] = e0;
}
}
int initializeEnergyDensity(float *energyDensity, std::vector<float> init_energy_density, parameters params)
{
float hbarc = params.hbarc;
//initialize energy density
//define a lower bound on energy density for all cells to regulate numerical noise in flow velocity in dilute regions
float lower_tolerance = 1.0e-7;
int option = params.ic_energy;
printf("setting initial conditions on energy density : ");
if (option == 1)
{
initializeEllipticalGauss(energyDensity, 1.0, 2.0, params);
printf("Smooth Oblate Gaussian \n");
}
else if (option == 2)
{
initializeEllipticalMCGauss(energyDensity, 0.5, 1.0, params);
printf("Fluctuating Oblate Gaussian \n");
}
else if (option == 3)
{
readEnergyDensityBlock(energyDensity, params);
printf("Reading from energy density file in initial_profiles/ \n");
}
else if (option == 5)
{
//read in initial energy density using the initiliaze_from_vector() function
//note that this is not safe - if one passes an empty vector it will not throw an error
//converting units of energy density from GeV / fm^3 to fm^(-4)
printf("Reading energy density from initial energy density vector\n");
//do a value copy
//try adding a small value everywhere to regulate problems with flow velocity in dilute regions
for (int i = 0; i < params.ntot; i++) energyDensity[i] = init_energy_density[i] / (float)hbarc + lower_tolerance;
}
else if (option == 6)
{
initializeHomogeneous(energyDensity, params);
printf("Initializing energy density uniform in transverse plane \n");
}
else if (option == 7)
{
initialize2Gaussians(energyDensity, 1.0, 1.0, params);
printf("Initializing energy density as two Guassians \n");
}
else
{
printf("Not a valid initial Condition... Goodbye\n");
return -1;
}
return 1;
}
int initializeFlow(float **flowVelocity, parameters params)
{
int option = params.ic_flow;
printf("setting initial conditions on flow velocity : ");
if (option == 1)
{
initializeFlowZero(flowVelocity, params);
printf("zero \n");
}
else if (option == 2)
{
readFlowVelocityBlock(flowVelocity, params);
printf("reading from initial_profiles \n");
}
else
{
printf("Not a valid initial Condition... Goodbye\n");
return -1;
}
return 1;
}
|
e36c2373ee634373eeaa8f711ec1e744ed4b26f9 | f92b42b1f183870d1685c1b8514d0be002fd79a7 | /OTHERS/Copa UCI 2008/AB.CPP | 4e5e23d02db15be4759481b02f2160e72d521189 | [] | no_license | reiniermujica/algorithms-and-contests | 7075f17b2d8e62c0bec5571bc394b5587552e8f2 | 7ce665cb26d7b97d99789a0704dd98fcfd3acf3c | refs/heads/master | 2020-03-21T11:43:42.073645 | 2018-07-27T21:19:43 | 2018-07-27T21:19:43 | 138,519,203 | 1 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 1,241 | cpp | AB.CPP | /*
Reinier Cesar Mujica
2/06/08
"Sequencia AB"
Copa UCI 2008 1ra Edicion
*/
#include <cstdio>
#include <vector>
#include <string>
using namespace std;
const int
MAXN = 30002;
int N, M, i, j;
int cont[2];
char C[MAXN];
vector < int > V;
int do_work( int start, int end ) {
if ( start > end) {
V.push_back( 4 );
return 0;
}
if ( C[start] != C[end] ) {
if ( C[start] == 'a' )
V.push_back( 1 );
else
V.push_back( 2 );
do_work( start + 1, end - 1 );
}
else {
cont[0] = 0; cont[1] = 0; int k = start + 1;
cont[C[start] - 'a']++;
V.push_back( 3 );
while ( cont[0] != cont[1] ) {
cont[C[k] - 'a']++;
k++;
}
do_work( start, k - 1 );
do_work( k, end );
}
}
int main() {
scanf( "%d\n", &M );
while ( M-- ) {
gets( C + 1 );
N = strlen( C + 1 );
for ( i = 1; i <= N; i++ )
cont[C[i] - 'a']++;
if ( cont[0] != cont[1] )
printf( "%d\n", 0 );
else {
do_work( 1, N );
printf( "1 %d\n", V.size() );
for ( i = 0; i < V.size(); i++ )
printf( "%d\n", V[i] );
}
}
fflush( stdout );
return 0;
}
|
1a7f7073d4b80bc70aa740763742ea4877ed155a | 16137a5967061c2f1d7d1ac5465949d9a343c3dc | /cpp_code/classtemplates/templps.cc | d3417fbebb0e7274606976f24c21144b92d72427 | [] | no_license | MIPT-ILab/cpp-lects-rus | 330f977b93f67771b118ad03ee7b38c3615deef3 | ba8412dbf4c8f3bee7c6344a89e0780ee1dd38f2 | refs/heads/master | 2022-07-28T07:36:59.831016 | 2022-07-20T08:34:26 | 2022-07-20T08:34:26 | 104,261,623 | 27 | 4 | null | 2021-02-04T21:39:23 | 2017-09-20T19:56:44 | TeX | UTF-8 | C++ | false | false | 850 | cc | templps.cc | #include <iostream>
#include <vector>
using std::cout;
using std::endl;
using std::vector;
template <typename T> struct X {
void print() { cout << "X<T>" << endl; }
};
/*
template <typename T> struct X<vector<T>> {
void print() { cout << "X<vector<T>>" << endl; }
};
*/
template <template<class> typename C>
struct X<C<int>> {
void print() { cout << "X<C<int>>" << endl; }
};
template <typename T> struct Y {};
template <template<class> typename C, typename U>
struct Z {
void print() { cout << "Z<C<?>, U>" << endl; }
};
template <typename U>
struct Z<X, U> {
void print() { cout << "Z<X<?>, U" << endl; }
};
int
main () {
X<int> a;
X<vector<int>> b;
X<X<int>> c;
Z<Y, int> d;
Z<X, int> e;
a.print();
b.print();
c.print();
d.print();
e.print();
}
|
128c2db8ee10a43a6ecb3fa6063ef54b5191c431 | 24464093cb411f7fdd5524e261c07e8af06e1fda | /gymnasie_arbete/shaders.h | da2c5ca434c2e6a83ab941696928720343f64781 | [] | no_license | itggot-lukas-lonnbro/gymnasie_arbete | 3cbe9f04bd492058d1ad46ef0f1ab702ffebbc64 | 707c76c5e77a5c1eb31dacac86097eaf1005a0e3 | refs/heads/master | 2021-05-11T07:24:54.224598 | 2018-01-18T18:01:14 | 2018-01-18T18:01:14 | 118,018,691 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 456 | h | shaders.h | #pragma once
#include <string>
#include <GL\glew.h>
class shaders
{
public:
shaders();
~shaders();
void init(const std::string& vertexName, const std::string& fragmentName);
void useShader();
void unUseShader();
void setFloat(const std::string&, float);
void setFloat3f(const std::string &name, float value[]);
void setMat4(const std::string&, GLfloat*);
void setBool(const std::string&, GLboolean);
unsigned int shaderProgram;
private:
};
|
4a8cc5c88d289307fc8fb9f566e4755d4d0d191f | d4806c7b9b492f3886a93af61937168b880fd1d1 | /headers/CConnection.h | 54afeb57a21510f9ea25db05406c941638d4b575 | [] | no_license | darkSasori/CPQ | 4a2c7cdb114a5d832107c9a1c2a962866aaf3976 | efae49a86ecb07857bd8b40c512ae645f80d7bd0 | refs/heads/master | 2020-12-24T16:14:53.936818 | 2011-07-04T07:25:50 | 2011-07-04T07:25:50 | 1,994,064 | 2 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 612 | h | CConnection.h | #ifndef __CCONNECTION_H__
#define __CCONNECTION_H__
#include "../headers/Headers.h"
#include "../headers/CExceptionConnection.h"
#include "../headers/CResult.h"
#include "../headers/CSingleton.h"
#include "../headers/CLogger.h"
class CResult;
class CConnection : public CSingleton<CConnection>
{
private:
PGconn *m_pgConn;
string m_sConn;
vector<string> m_vQuerys;
public:
CConnection();
virtual ~CConnection();
ConnStatusType Connect(string str);
void Finish();
CResult Query(string sql);
string getLastError();
void StartTransiction();
void Rollback();
void Commit();
};
#endif
|
faf2354516b9dcdc578e927b68917a67a39a45e9 | f83ef53177180ebfeb5a3e230aa29794f52ce1fc | /ACE/ACE_wrappers/TAO/TAO_IDL/be_include/be_visitor_union/discriminant_cs.h | 3391c92ed242cac43fed2c271d86bbf57187c7a4 | [
"LicenseRef-scancode-unknown-license-reference",
"Apache-2.0",
"LicenseRef-scancode-proprietary-license",
"LicenseRef-scancode-sun-iiop"
] | permissive | msrLi/portingSources | fe7528b3fd08eed4a1b41383c88ee5c09c2294ef | 57d561730ab27804a3172b33807f2bffbc9e52ae | refs/heads/master | 2021-07-08T01:22:29.604203 | 2019-07-10T13:07:06 | 2019-07-10T13:07:06 | 196,183,165 | 2 | 1 | Apache-2.0 | 2020-10-13T14:30:53 | 2019-07-10T10:16:46 | null | UTF-8 | C++ | false | false | 1,078 | h | discriminant_cs.h | /* -*- c++ -*- */
//=============================================================================
/**
* @file discriminant_cs.h
*
* Visitor for the Union class.
* This one generates code for the discriminant of the Union in the client
* stubs.
*
* @author Aniruddha Gokhale
*/
//=============================================================================
#ifndef _BE_VISITOR_UNION_DISCRIMINANT_CS_H_
#define _BE_VISITOR_UNION_DISCRIMINANT_CS_H_
/**
* @class be_visitor_union_discriminant_cs
*
* @brief be_visitor_union_discriminant_cs
*
* This is a concrete visitor to generate the client stubs for union
* discriminant
*/
class be_visitor_union_discriminant_cs : public be_visitor_decl
{
public:
/// constructor
be_visitor_union_discriminant_cs (be_visitor_context *ctx);
/// destructor
~be_visitor_union_discriminant_cs (void);
/// visit an enum. Required to generate the typecode for an enum definition
/// appearing side the union
virtual int visit_enum (be_enum *node);
};
#endif /* _BE_VISITOR_UNION_DISCRIMINANT_CS_H_ */
|
ebe59801e814e69582c8a493c085c818028dddc6 | 2394a2a559a11ad5f234365f9854e7f30d0eff3e | /Codeforces/364B.cpp | e2ef2a593155ac142936cd779bd7407d32b6af1a | [] | no_license | mahadi18/ProblemSolving | a35d77fa7f468c03772ac68af5be4d9fc0beb11a | 88a12f67054304e75cf361d73d17f86d9b0764db | refs/heads/master | 2020-12-24T10:54:52.201323 | 2016-11-07T21:22:07 | 2016-11-07T21:22:07 | 73,121,708 | 1 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 1,393 | cpp | 364B.cpp | #include<bits/stdc++.h>
using namespace std;
typedef long long ll;
int main()
{
ll n, m, r=0, c=0;
cin>>n>>m;
ll row[n+5], col[n+5];
ll tot = n*n, bad;
memset(row, 0, sizeof(row));
memset(col, 0, sizeof(col));
for(ll i=1; i<=m; i++)
{
//cout<<endl;
ll x, y;
cin>>x>>y;
if(row[x]==0 && col[y]==0)
{
//cout<<"ager total = "<<tot<<endl;
bad = n+n-1-r-c;
//cout<<"bad = "<<bad<<endl;
tot -= bad;
//cout<<"total = "<<tot<<endl;
r++;
c++;
row[x]=1;
col[y]=1;
cout<<tot<<" ";
}
else if(row[x]==0 && col[y]==1)
{
//cout<<"ager total = "<<tot<<endl;
bad = n-1-c+1;
//cout<<"bad = "<<bad<<endl;
tot-=bad;
//cout<<"total = "<<tot<<endl;
r++;
row[x]=1;
cout<<tot<<" ";
}
else if(row[x]==1 && col[y]==0)
{
//cout<<"ager total = "<<tot<<endl;
bad = n-1-r+1;
//cout<<"bad = "<<bad<<endl;
tot-=bad;
//cout<<"total = "<<tot<<endl;
c++;
col[y]=1;
cout<<tot<<" ";
}
else
{
cout<<tot<<" ";
}
}
cout<<endl;
return 0;
}
|
5e844bdd4f27a31c555a0b8f534992f419649bd5 | 831ec03d2c55693fe95dd4dcbcbebb7c4853dea9 | /glfw03_lines/Program.cpp | 1240994f257643c062d43034c409f41d0d7000c5 | [] | no_license | FrankEndriss/opengltest | f0f4842e6be849c9da876c0d1e3fd8fb669ba39a | e038c625514b140042e181402980c4cf8508cad9 | refs/heads/master | 2021-09-01T15:03:07.219661 | 2017-12-27T15:37:18 | 2017-12-27T15:37:18 | 112,651,243 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 4,113 | cpp | Program.cpp | /*
* Program.cpp
*/
#include "Program.h"
#include <cstring>
#include <malloc.h>
#include "Shader.h"
#include <iostream>
using namespace std;
#include "logging.h"
Program::Program() {
program=glCreateProgram();
fShader=NULL;
vShader=NULL;
uniforms=0;
}
Program::~Program() {
if(fShader)
delete fShader;
if(vShader)
delete vShader;
glDeleteProgram(program);
for(int i=0; i<uniformCount; i++)
free(uniforms[i].name);
free(uniforms);
}
const static char* pathPostfixF=".f.glsl";
const static char* pathPostfixV=".v.glsl";
const int pathPostfixLen=strlen(pathPostfixF);
/** Helper function for loadAndCompileShaderSet(char*) */
static GLuint dumpAndCleanupShader(Shader** shader, char* path, GLuint result) {
(*shader)->dumpCompileInfo();
delete *shader;
*shader=NULL;
free(path);
return result;
}
GLuint Program::loadAndCompileShaderSet(const char* pathPrefix) {
const int pathPrefixLen=strlen(pathPrefix);
char* path=(char*)malloc(pathPrefixLen+pathPostfixLen+1);
cout<<"will create fragment Shader()"<<endl;
// compile the fragment shader
fShader=new Shader(GL_FRAGMENT_SHADER);
cout<<"did create fragment Shader()"<<endl;
path[0]='\0'; // empty string
strncat(path, pathPrefix, pathPrefixLen);
strncat(path, pathPostfixF, pathPostfixLen);
cout<<"will Shader()->compileFile("<<path<<")"<<endl;
GLuint res=fShader->compileFile(path);
if(!res) { // compilation failed
cout<<"Shader()->compileFile("<<path<<") failed"<<endl;
return dumpAndCleanupShader(&fShader, path, res);
}
cout<<"Shader()->compileFile("<<path<<") succeeded"<<endl;
// compile the vertex shader
cout<<"will create vertex Shader()"<<endl;
vShader=new Shader(GL_VERTEX_SHADER);
cout<<"did create vertex Shader()"<<endl;
path[0]='\0'; // empty string
strncat(path, pathPrefix, pathPrefixLen);
strncat(path, pathPostfixV, pathPostfixLen);
cout<<"will Shader()->compileFile("<<path<<")"<<endl;
res=vShader->compileFile(path);
if(!res) { // compilation failed
cout<<"Shader()->compileFile("<<path<<") failed"<<endl;
return dumpAndCleanupShader(&vShader, path, res);
}
cout<<"Shader()->compileFile("<<path<<") succeeded"<<endl;
free(path);
glAttachShader(program, vShader->shader);
glAttachShader(program, fShader->shader);
return res;
}
GLint Program::link(GLint* attribLocations, const char* attribNames[], int count) {
for(int i=0; i<count; i++)
glBindAttribLocation(program, attribLocations[i], attribNames[i]);
glLinkProgram(program);
GLint ret;
glGetProgramiv(program, GL_LINK_STATUS, &ret);
cout << "link status: "<<ret<<endl;
if(!ret) { // dump linker info
GLint infoLen=0;
glGetProgramiv(program, GL_INFO_LOG_LENGTH, &infoLen);
if(infoLen>1) {
char* infoLog=(char*)malloc(sizeof(char)*infoLen);
glGetProgramInfoLog(program, infoLen, NULL, infoLog);
cout<<"Error linking program"<<endl<<infoLog<<endl;
}
}
return ret;
}
GLint Program::uniformLocation(const char* name) {
if(uniformCount==-1) { // need to initialize uniform table
glGetProgramiv(program, GL_ACTIVE_UNIFORMS, &uniformCount);
if(uniformCount<1)
return -1;
GLint maxNameLen;
glGetProgramiv(program, GL_ACTIVE_UNIFORM_MAX_LENGTH, &maxNameLen);
uniforms=(tag_uniform*)malloc(sizeof(tag_uniform)*uniformCount);
for(int i=0; i<uniformCount; i++) {
uniforms[i].name=(char*)malloc(maxNameLen);
glGetActiveUniform(program, i, maxNameLen, NULL, &uniforms[i].size, &uniforms[i].type, uniforms[i].name);
uniforms[i].location=glGetUniformLocation(program, uniforms[i].name);
INFO << "uniform location for "<<uniforms[i].name<<"="<<uniforms[i].location;
}
}
// query the uniform table
for(int i=0; i<uniformCount; i++)
if(string(name).compare(uniforms[i].name)==0)
return uniforms[i].location;
ERROR << "uniform location for "<<name<<" unknown!!!";
return -1; // doesnt exist
}
void Program::use() {
glUseProgram(program);
}
void Program::bindAttribLocation(int loc, const char* attrib) {
glBindAttribLocation(program, loc, attrib);
}
GLint Program::getAttribLocation(const char* attrib) {
return glGetAttribLocation(program, attrib);
}
|
32aa89c985c0de365c1c85d806003105d0c5f293 | 97c3bd28c4c91b09d6adcc101999b939ac13882f | /vao.hpp | 3909beaabab31f3eed089a1988cbf5c5af7af0fd | [] | no_license | vvoland/Tank | 102bbc8655042f3e9e66179b97b6bda436ae5bb6 | 607ad0bf232a582ec63bf8ac08edde8927a666c0 | refs/heads/master | 2022-11-23T01:06:29.039386 | 2020-05-19T20:00:03 | 2020-07-22T11:25:48 | 166,100,903 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 721 | hpp | vao.hpp | #pragma once
#include <string>
#include <GL/glew.h>
#include <vector>
#include <memory>
class Vbo;
class Vao
{
public:
Vao();
Vao(Vao&& other) noexcept;
Vao(const Vao& other) = delete;
Vao& operator=(Vao&& vbo) noexcept;
~Vao();
void bind() const;
GLuint id() const;
GLuint IndicesCount;
void setAttribute(int location, std::shared_ptr<Vbo> vbo, int elementSize, GLenum dataType = GL_FLOAT);
void bindVbo(std::shared_ptr<Vbo> vbo);
void enableAttributes() const;
void disableAttributes() const;
private:
GLuint Id;
std::vector<int> Locations;
std::vector<std::shared_ptr<Vbo>> Vbos;
};
|
b6c35fbd151a7256ce393c0f23e296d27dd47a22 | 501ae38f729138a3ceba91abd10721dd9029fc7c | /BalancedBinaryTree.cpp | 8cb07168423b209235885dd90e22fb33597e81eb | [] | no_license | shreyansh-sawarn/Data-Structures-And-Algorithms | 6d0e6f5ef4a0ddd8caede69e423333d9ba2c6163 | 88d7857849871d6b855940b30a5fc469ac99daf6 | refs/heads/master | 2023-01-02T02:45:08.190503 | 2020-10-24T17:00:47 | 2020-10-24T17:00:47 | 151,791,268 | 4 | 5 | null | 2020-10-17T07:26:52 | 2018-10-06T00:27:56 | C++ | UTF-8 | C++ | false | false | 1,165 | cpp | BalancedBinaryTree.cpp | // Checking if a binary tree is height balanced in C++
#include <iostream>
using namespace std;
#define bool int
class node {
public:
int item;
node *left;
node *right;
};
// Create anew node
node *newNode(int item) {
node *Node = new node();
Node->item = item;
Node->left = NULL;
Node->right = NULL;
return (Node);
}
// Check height balance
bool checkHeightBalance(node *root, int *height) {
// Check for emptiness
int leftHeight = 0, rightHeight = 0;
int l = 0, r = 0;
if (root == NULL) {
*height = 0;
return 1;
}
l = checkHeightBalance(root->left, &leftHeight);
r = checkHeightBalance(root->right, &rightHeight);
*height = (leftHeight > rightHeight ? leftHeight : rightHeight) + 1;
if ((leftHeight - rightHeight >= 2) || (rightHeight - leftHeight >= 2))
return 0;
else
return l && r;
}
int main() {
int height = 0;
node *root = newNode(1);
root->left = newNode(2);
root->right = newNode(3);
root->left->left = newNode(4);
root->left->right = newNode(5);
if (checkHeightBalance(root, &height))
cout << "The tree is balanced";
else
cout << "The tree is not balanced";
}
|
9a852800bdac5d15ced3df15fff3a2ba70556675 | 76171660651f1c680d5b5a380c07635de5b2367c | /SH6_43_msh3/0.6/p | e259160cbcc8f005dcc59ad5ab87ea9cf0fd95f5 | [] | no_license | lisegaAM/SH_Paper1 | 3cd0cac0d95cc60d296268e65e2dd6fed4cc6127 | 12ceadba5c58c563ccac236b965b4b917ac47551 | refs/heads/master | 2021-04-27T19:44:19.527187 | 2018-02-21T16:16:50 | 2018-02-21T16:16:50 | 122,360,661 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 83,632 | p | /*--------------------------------*- C++ -*----------------------------------*\
| ========= | |
| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox |
| \\ / O peration | Version: 3.0.x |
| \\ / A nd | Web: www.OpenFOAM.org |
| \\/ M anipulation | |
\*---------------------------------------------------------------------------*/
FoamFile
{
version 2.0;
format ascii;
class volScalarField;
location "0.6";
object p;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
dimensions [1 -1 -2 0 0 0 0];
internalField nonuniform List<scalar>
6900
(
2.02234e+07
2.02239e+07
2.02245e+07
2.02251e+07
2.02255e+07
2.02259e+07
2.02262e+07
2.02264e+07
2.02266e+07
2.02268e+07
2.02268e+07
2.02269e+07
2.02268e+07
2.02267e+07
2.02266e+07
2.02263e+07
2.02261e+07
2.02257e+07
2.02254e+07
2.02249e+07
2.02244e+07
2.02238e+07
2.02232e+07
2.02225e+07
2.02218e+07
2.0221e+07
2.02202e+07
2.02193e+07
2.02183e+07
2.02173e+07
2.02163e+07
2.02151e+07
2.0214e+07
2.02127e+07
2.02115e+07
2.02101e+07
2.02088e+07
2.02073e+07
2.02058e+07
2.02043e+07
2.02027e+07
2.02011e+07
2.01994e+07
2.01977e+07
2.01959e+07
2.01941e+07
2.01922e+07
2.01903e+07
2.01883e+07
2.01863e+07
2.01843e+07
2.01822e+07
2.018e+07
2.01779e+07
2.01756e+07
2.01734e+07
2.01711e+07
2.01687e+07
2.01663e+07
2.01639e+07
2.01614e+07
2.01589e+07
2.01564e+07
2.01538e+07
2.01511e+07
2.01485e+07
2.01458e+07
2.0143e+07
2.01403e+07
2.01375e+07
2.01346e+07
2.01317e+07
2.01288e+07
2.01259e+07
2.01229e+07
2.01199e+07
2.01168e+07
2.01137e+07
2.01106e+07
2.01075e+07
2.01043e+07
2.01011e+07
2.00979e+07
2.00946e+07
2.00913e+07
2.0088e+07
2.00847e+07
2.00813e+07
2.00779e+07
2.00745e+07
2.00711e+07
2.00676e+07
2.00641e+07
2.00606e+07
2.00571e+07
2.00535e+07
2.005e+07
2.00464e+07
2.00428e+07
2.00392e+07
2.00356e+07
2.00319e+07
2.00283e+07
2.00246e+07
2.0021e+07
2.00173e+07
2.00136e+07
2.00099e+07
2.00062e+07
2.00025e+07
1.99988e+07
1.9995e+07
1.99913e+07
1.99876e+07
1.99839e+07
1.99801e+07
1.99764e+07
1.99726e+07
1.99689e+07
1.99652e+07
1.99614e+07
1.99577e+07
1.99539e+07
1.99502e+07
1.99464e+07
1.99427e+07
1.99389e+07
1.99352e+07
1.99314e+07
1.99277e+07
1.9924e+07
1.99202e+07
1.99165e+07
1.99127e+07
1.9909e+07
1.99053e+07
1.99016e+07
1.98979e+07
1.98942e+07
1.98905e+07
1.98868e+07
1.98831e+07
1.98795e+07
1.98758e+07
1.98722e+07
1.98686e+07
1.9865e+07
1.98615e+07
1.98579e+07
1.98544e+07
1.98509e+07
1.98474e+07
1.9844e+07
1.98406e+07
1.98372e+07
1.98338e+07
1.98304e+07
1.98271e+07
1.98238e+07
1.98205e+07
1.98173e+07
1.98141e+07
1.98109e+07
1.98077e+07
1.98046e+07
1.98014e+07
1.97983e+07
1.97952e+07
1.97922e+07
1.97891e+07
1.97861e+07
1.97831e+07
1.97802e+07
1.97772e+07
1.97743e+07
1.97714e+07
1.97686e+07
1.97657e+07
1.97629e+07
1.97602e+07
1.97574e+07
1.97547e+07
1.9752e+07
1.97494e+07
1.97468e+07
1.97442e+07
1.97416e+07
1.97391e+07
1.97366e+07
1.97341e+07
1.97316e+07
1.97292e+07
1.97268e+07
1.97244e+07
1.97221e+07
1.97198e+07
1.97175e+07
1.97152e+07
1.9713e+07
1.97108e+07
2.02234e+07
2.02239e+07
2.02245e+07
2.02251e+07
2.02255e+07
2.02259e+07
2.02262e+07
2.02264e+07
2.02266e+07
2.02268e+07
2.02268e+07
2.02269e+07
2.02268e+07
2.02267e+07
2.02266e+07
2.02263e+07
2.02261e+07
2.02257e+07
2.02254e+07
2.02249e+07
2.02244e+07
2.02238e+07
2.02232e+07
2.02225e+07
2.02218e+07
2.0221e+07
2.02202e+07
2.02193e+07
2.02183e+07
2.02173e+07
2.02163e+07
2.02151e+07
2.0214e+07
2.02127e+07
2.02115e+07
2.02101e+07
2.02088e+07
2.02073e+07
2.02058e+07
2.02043e+07
2.02027e+07
2.02011e+07
2.01994e+07
2.01977e+07
2.01959e+07
2.01941e+07
2.01922e+07
2.01903e+07
2.01883e+07
2.01863e+07
2.01843e+07
2.01822e+07
2.018e+07
2.01779e+07
2.01756e+07
2.01734e+07
2.01711e+07
2.01687e+07
2.01663e+07
2.01639e+07
2.01614e+07
2.01589e+07
2.01564e+07
2.01538e+07
2.01511e+07
2.01485e+07
2.01458e+07
2.0143e+07
2.01403e+07
2.01375e+07
2.01346e+07
2.01317e+07
2.01288e+07
2.01259e+07
2.01229e+07
2.01199e+07
2.01168e+07
2.01137e+07
2.01106e+07
2.01075e+07
2.01043e+07
2.01011e+07
2.00979e+07
2.00946e+07
2.00913e+07
2.0088e+07
2.00847e+07
2.00813e+07
2.00779e+07
2.00745e+07
2.00711e+07
2.00676e+07
2.00641e+07
2.00606e+07
2.00571e+07
2.00535e+07
2.005e+07
2.00464e+07
2.00428e+07
2.00392e+07
2.00356e+07
2.00319e+07
2.00283e+07
2.00246e+07
2.0021e+07
2.00173e+07
2.00136e+07
2.00099e+07
2.00062e+07
2.00025e+07
1.99988e+07
1.9995e+07
1.99913e+07
1.99876e+07
1.99839e+07
1.99801e+07
1.99764e+07
1.99726e+07
1.99689e+07
1.99652e+07
1.99614e+07
1.99577e+07
1.99539e+07
1.99502e+07
1.99464e+07
1.99427e+07
1.99389e+07
1.99352e+07
1.99314e+07
1.99277e+07
1.9924e+07
1.99202e+07
1.99165e+07
1.99127e+07
1.9909e+07
1.99053e+07
1.99016e+07
1.98979e+07
1.98942e+07
1.98905e+07
1.98868e+07
1.98831e+07
1.98795e+07
1.98758e+07
1.98722e+07
1.98686e+07
1.9865e+07
1.98615e+07
1.98579e+07
1.98544e+07
1.98509e+07
1.98474e+07
1.9844e+07
1.98406e+07
1.98372e+07
1.98338e+07
1.98304e+07
1.98271e+07
1.98238e+07
1.98205e+07
1.98173e+07
1.98141e+07
1.98109e+07
1.98077e+07
1.98046e+07
1.98014e+07
1.97983e+07
1.97952e+07
1.97922e+07
1.97891e+07
1.97861e+07
1.97831e+07
1.97802e+07
1.97772e+07
1.97743e+07
1.97714e+07
1.97686e+07
1.97657e+07
1.97629e+07
1.97602e+07
1.97574e+07
1.97547e+07
1.9752e+07
1.97494e+07
1.97468e+07
1.97442e+07
1.97416e+07
1.97391e+07
1.97366e+07
1.97341e+07
1.97316e+07
1.97292e+07
1.97268e+07
1.97244e+07
1.97221e+07
1.97198e+07
1.97175e+07
1.97152e+07
1.9713e+07
1.97108e+07
2.02234e+07
2.02239e+07
2.02245e+07
2.02251e+07
2.02255e+07
2.02259e+07
2.02262e+07
2.02264e+07
2.02266e+07
2.02268e+07
2.02268e+07
2.02269e+07
2.02268e+07
2.02267e+07
2.02266e+07
2.02263e+07
2.02261e+07
2.02257e+07
2.02254e+07
2.02249e+07
2.02244e+07
2.02238e+07
2.02232e+07
2.02225e+07
2.02218e+07
2.0221e+07
2.02202e+07
2.02193e+07
2.02183e+07
2.02173e+07
2.02163e+07
2.02151e+07
2.0214e+07
2.02127e+07
2.02115e+07
2.02101e+07
2.02088e+07
2.02073e+07
2.02058e+07
2.02043e+07
2.02027e+07
2.02011e+07
2.01994e+07
2.01977e+07
2.01959e+07
2.01941e+07
2.01922e+07
2.01903e+07
2.01883e+07
2.01863e+07
2.01843e+07
2.01822e+07
2.018e+07
2.01779e+07
2.01756e+07
2.01734e+07
2.01711e+07
2.01687e+07
2.01663e+07
2.01639e+07
2.01614e+07
2.01589e+07
2.01564e+07
2.01538e+07
2.01511e+07
2.01485e+07
2.01458e+07
2.0143e+07
2.01403e+07
2.01375e+07
2.01346e+07
2.01317e+07
2.01288e+07
2.01259e+07
2.01229e+07
2.01199e+07
2.01168e+07
2.01137e+07
2.01106e+07
2.01075e+07
2.01043e+07
2.01011e+07
2.00979e+07
2.00946e+07
2.00913e+07
2.0088e+07
2.00847e+07
2.00813e+07
2.00779e+07
2.00745e+07
2.00711e+07
2.00676e+07
2.00641e+07
2.00606e+07
2.00571e+07
2.00535e+07
2.005e+07
2.00464e+07
2.00428e+07
2.00392e+07
2.00356e+07
2.00319e+07
2.00283e+07
2.00246e+07
2.0021e+07
2.00173e+07
2.00136e+07
2.00099e+07
2.00062e+07
2.00025e+07
1.99988e+07
1.9995e+07
1.99913e+07
1.99876e+07
1.99839e+07
1.99801e+07
1.99764e+07
1.99726e+07
1.99689e+07
1.99652e+07
1.99614e+07
1.99577e+07
1.99539e+07
1.99502e+07
1.99464e+07
1.99427e+07
1.99389e+07
1.99352e+07
1.99314e+07
1.99277e+07
1.9924e+07
1.99202e+07
1.99165e+07
1.99127e+07
1.9909e+07
1.99053e+07
1.99016e+07
1.98979e+07
1.98942e+07
1.98905e+07
1.98868e+07
1.98831e+07
1.98795e+07
1.98758e+07
1.98722e+07
1.98686e+07
1.9865e+07
1.98615e+07
1.98579e+07
1.98544e+07
1.98509e+07
1.98474e+07
1.9844e+07
1.98406e+07
1.98372e+07
1.98338e+07
1.98304e+07
1.98271e+07
1.98238e+07
1.98205e+07
1.98173e+07
1.98141e+07
1.98109e+07
1.98077e+07
1.98046e+07
1.98014e+07
1.97983e+07
1.97952e+07
1.97922e+07
1.97891e+07
1.97861e+07
1.97831e+07
1.97802e+07
1.97772e+07
1.97743e+07
1.97714e+07
1.97686e+07
1.97657e+07
1.97629e+07
1.97602e+07
1.97574e+07
1.97547e+07
1.9752e+07
1.97494e+07
1.97468e+07
1.97442e+07
1.97416e+07
1.97391e+07
1.97366e+07
1.97341e+07
1.97316e+07
1.97292e+07
1.97268e+07
1.97244e+07
1.97221e+07
1.97198e+07
1.97175e+07
1.97152e+07
1.9713e+07
1.97108e+07
2.02234e+07
2.02239e+07
2.02245e+07
2.02251e+07
2.02255e+07
2.02259e+07
2.02262e+07
2.02264e+07
2.02266e+07
2.02268e+07
2.02268e+07
2.02269e+07
2.02268e+07
2.02267e+07
2.02266e+07
2.02263e+07
2.02261e+07
2.02257e+07
2.02254e+07
2.02249e+07
2.02244e+07
2.02238e+07
2.02232e+07
2.02225e+07
2.02218e+07
2.0221e+07
2.02202e+07
2.02193e+07
2.02183e+07
2.02173e+07
2.02163e+07
2.02151e+07
2.0214e+07
2.02127e+07
2.02115e+07
2.02101e+07
2.02088e+07
2.02073e+07
2.02058e+07
2.02043e+07
2.02027e+07
2.02011e+07
2.01994e+07
2.01977e+07
2.01959e+07
2.01941e+07
2.01922e+07
2.01903e+07
2.01883e+07
2.01863e+07
2.01843e+07
2.01822e+07
2.018e+07
2.01779e+07
2.01756e+07
2.01734e+07
2.01711e+07
2.01687e+07
2.01663e+07
2.01639e+07
2.01614e+07
2.01589e+07
2.01564e+07
2.01538e+07
2.01511e+07
2.01485e+07
2.01458e+07
2.0143e+07
2.01403e+07
2.01375e+07
2.01346e+07
2.01317e+07
2.01288e+07
2.01259e+07
2.01229e+07
2.01199e+07
2.01168e+07
2.01137e+07
2.01106e+07
2.01075e+07
2.01043e+07
2.01011e+07
2.00979e+07
2.00946e+07
2.00913e+07
2.0088e+07
2.00847e+07
2.00813e+07
2.00779e+07
2.00745e+07
2.00711e+07
2.00676e+07
2.00641e+07
2.00606e+07
2.00571e+07
2.00535e+07
2.005e+07
2.00464e+07
2.00428e+07
2.00392e+07
2.00356e+07
2.00319e+07
2.00283e+07
2.00246e+07
2.0021e+07
2.00173e+07
2.00136e+07
2.00099e+07
2.00062e+07
2.00025e+07
1.99988e+07
1.9995e+07
1.99913e+07
1.99876e+07
1.99839e+07
1.99801e+07
1.99764e+07
1.99726e+07
1.99689e+07
1.99652e+07
1.99614e+07
1.99577e+07
1.99539e+07
1.99502e+07
1.99464e+07
1.99427e+07
1.99389e+07
1.99352e+07
1.99314e+07
1.99277e+07
1.9924e+07
1.99202e+07
1.99165e+07
1.99127e+07
1.9909e+07
1.99053e+07
1.99016e+07
1.98979e+07
1.98942e+07
1.98905e+07
1.98868e+07
1.98831e+07
1.98795e+07
1.98758e+07
1.98722e+07
1.98686e+07
1.9865e+07
1.98615e+07
1.98579e+07
1.98544e+07
1.98509e+07
1.98474e+07
1.9844e+07
1.98406e+07
1.98372e+07
1.98338e+07
1.98304e+07
1.98271e+07
1.98238e+07
1.98205e+07
1.98173e+07
1.98141e+07
1.98109e+07
1.98077e+07
1.98046e+07
1.98014e+07
1.97983e+07
1.97952e+07
1.97922e+07
1.97891e+07
1.97861e+07
1.97831e+07
1.97802e+07
1.97772e+07
1.97743e+07
1.97714e+07
1.97686e+07
1.97657e+07
1.97629e+07
1.97602e+07
1.97574e+07
1.97547e+07
1.9752e+07
1.97494e+07
1.97468e+07
1.97442e+07
1.97416e+07
1.97391e+07
1.97366e+07
1.97341e+07
1.97316e+07
1.97292e+07
1.97268e+07
1.97244e+07
1.97221e+07
1.97198e+07
1.97175e+07
1.97152e+07
1.9713e+07
1.97107e+07
2.02234e+07
2.02239e+07
2.02245e+07
2.02251e+07
2.02255e+07
2.02259e+07
2.02262e+07
2.02264e+07
2.02266e+07
2.02268e+07
2.02268e+07
2.02269e+07
2.02268e+07
2.02267e+07
2.02266e+07
2.02263e+07
2.02261e+07
2.02257e+07
2.02254e+07
2.02249e+07
2.02244e+07
2.02238e+07
2.02232e+07
2.02225e+07
2.02218e+07
2.0221e+07
2.02202e+07
2.02193e+07
2.02183e+07
2.02173e+07
2.02163e+07
2.02151e+07
2.0214e+07
2.02127e+07
2.02115e+07
2.02101e+07
2.02088e+07
2.02073e+07
2.02058e+07
2.02043e+07
2.02027e+07
2.02011e+07
2.01994e+07
2.01977e+07
2.01959e+07
2.01941e+07
2.01922e+07
2.01903e+07
2.01883e+07
2.01863e+07
2.01843e+07
2.01822e+07
2.018e+07
2.01779e+07
2.01756e+07
2.01734e+07
2.01711e+07
2.01687e+07
2.01663e+07
2.01639e+07
2.01614e+07
2.01589e+07
2.01564e+07
2.01538e+07
2.01511e+07
2.01485e+07
2.01458e+07
2.0143e+07
2.01403e+07
2.01375e+07
2.01346e+07
2.01317e+07
2.01288e+07
2.01259e+07
2.01229e+07
2.01199e+07
2.01168e+07
2.01137e+07
2.01106e+07
2.01075e+07
2.01043e+07
2.01011e+07
2.00979e+07
2.00946e+07
2.00913e+07
2.0088e+07
2.00847e+07
2.00813e+07
2.00779e+07
2.00745e+07
2.00711e+07
2.00676e+07
2.00641e+07
2.00606e+07
2.00571e+07
2.00535e+07
2.005e+07
2.00464e+07
2.00428e+07
2.00392e+07
2.00356e+07
2.00319e+07
2.00283e+07
2.00246e+07
2.0021e+07
2.00173e+07
2.00136e+07
2.00099e+07
2.00062e+07
2.00025e+07
1.99988e+07
1.9995e+07
1.99913e+07
1.99876e+07
1.99839e+07
1.99801e+07
1.99764e+07
1.99726e+07
1.99689e+07
1.99652e+07
1.99614e+07
1.99577e+07
1.99539e+07
1.99502e+07
1.99464e+07
1.99427e+07
1.99389e+07
1.99352e+07
1.99314e+07
1.99277e+07
1.9924e+07
1.99202e+07
1.99165e+07
1.99127e+07
1.9909e+07
1.99053e+07
1.99016e+07
1.98979e+07
1.98942e+07
1.98905e+07
1.98868e+07
1.98831e+07
1.98795e+07
1.98758e+07
1.98722e+07
1.98686e+07
1.9865e+07
1.98615e+07
1.98579e+07
1.98544e+07
1.98509e+07
1.98474e+07
1.9844e+07
1.98406e+07
1.98372e+07
1.98338e+07
1.98304e+07
1.98271e+07
1.98238e+07
1.98205e+07
1.98173e+07
1.98141e+07
1.98109e+07
1.98077e+07
1.98046e+07
1.98014e+07
1.97983e+07
1.97952e+07
1.97922e+07
1.97891e+07
1.97861e+07
1.97831e+07
1.97802e+07
1.97772e+07
1.97743e+07
1.97714e+07
1.97686e+07
1.97657e+07
1.97629e+07
1.97602e+07
1.97574e+07
1.97547e+07
1.9752e+07
1.97494e+07
1.97468e+07
1.97442e+07
1.97416e+07
1.97391e+07
1.97366e+07
1.97341e+07
1.97316e+07
1.97292e+07
1.97268e+07
1.97244e+07
1.97221e+07
1.97198e+07
1.97175e+07
1.97152e+07
1.9713e+07
1.97107e+07
1.97098e+07
1.97094e+07
1.97089e+07
1.97085e+07
1.97081e+07
1.97077e+07
1.97072e+07
1.97068e+07
1.97064e+07
1.9706e+07
1.97057e+07
1.97055e+07
1.97051e+07
1.97046e+07
1.97039e+07
1.97034e+07
1.97029e+07
1.97024e+07
1.97019e+07
1.97013e+07
1.97097e+07
1.97093e+07
1.97089e+07
1.97084e+07
1.9708e+07
1.97076e+07
1.97072e+07
1.97068e+07
1.97064e+07
1.9706e+07
1.97057e+07
1.97054e+07
1.9705e+07
1.97044e+07
1.97037e+07
1.97032e+07
1.97028e+07
1.97023e+07
1.97018e+07
1.97013e+07
1.97095e+07
1.97091e+07
1.97086e+07
1.97082e+07
1.97078e+07
1.97074e+07
1.97069e+07
1.97065e+07
1.9706e+07
1.97055e+07
1.9705e+07
1.97046e+07
1.97041e+07
1.97037e+07
1.97032e+07
1.97027e+07
1.97023e+07
1.97018e+07
1.97013e+07
1.97008e+07
1.97091e+07
1.97087e+07
1.97084e+07
1.9708e+07
1.97076e+07
1.97071e+07
1.97067e+07
1.97063e+07
1.97058e+07
1.97054e+07
1.9705e+07
1.97045e+07
1.97041e+07
1.97036e+07
1.97032e+07
1.97028e+07
1.97023e+07
1.97019e+07
1.97015e+07
1.97011e+07
1.9709e+07
1.97085e+07
1.97081e+07
1.97077e+07
1.97073e+07
1.97068e+07
1.97064e+07
1.9706e+07
1.97055e+07
1.97051e+07
1.97046e+07
1.97042e+07
1.97037e+07
1.97032e+07
1.97028e+07
1.97024e+07
1.97019e+07
1.97015e+07
1.97011e+07
1.97007e+07
1.97005e+07
1.9699e+07
1.96967e+07
1.96948e+07
1.96934e+07
1.96929e+07
1.96911e+07
1.96886e+07
1.96871e+07
1.96873e+07
1.96847e+07
1.96822e+07
1.96812e+07
1.96819e+07
1.96818e+07
1.96767e+07
1.96746e+07
1.96739e+07
1.96733e+07
1.9676e+07
1.96739e+07
1.96681e+07
1.96666e+07
1.96662e+07
1.96658e+07
1.96686e+07
1.9669e+07
1.96611e+07
1.96584e+07
1.96584e+07
1.96584e+07
1.96629e+07
1.96664e+07
1.96616e+07
1.96523e+07
1.96491e+07
1.96479e+07
1.96469e+07
1.96459e+07
1.9645e+07
1.96447e+07
1.9645e+07
1.96447e+07
1.96464e+07
1.96499e+07
1.96533e+07
1.96472e+07
1.96383e+07
1.96357e+07
1.96348e+07
1.9634e+07
1.96331e+07
1.96323e+07
1.96314e+07
1.96305e+07
1.96296e+07
1.96287e+07
1.96279e+07
1.96271e+07
1.96262e+07
1.96255e+07
1.96247e+07
1.9624e+07
1.96232e+07
1.96225e+07
1.96218e+07
1.96211e+07
1.96205e+07
1.96198e+07
1.96191e+07
1.96184e+07
1.96178e+07
1.96171e+07
1.96165e+07
1.96158e+07
1.96152e+07
1.96146e+07
1.96139e+07
1.96133e+07
1.96127e+07
1.96122e+07
1.96116e+07
1.96111e+07
1.96105e+07
1.961e+07
1.96095e+07
1.9609e+07
1.96086e+07
1.96081e+07
1.96077e+07
1.96073e+07
1.9607e+07
1.96068e+07
1.96068e+07
1.96069e+07
1.96069e+07
1.96078e+07
1.96084e+07
1.96078e+07
1.96058e+07
1.9604e+07
1.96035e+07
1.96034e+07
1.96033e+07
1.96032e+07
1.96031e+07
1.9603e+07
1.96029e+07
1.96027e+07
1.96026e+07
1.96024e+07
1.96023e+07
1.96022e+07
1.9602e+07
1.96019e+07
1.96018e+07
1.96017e+07
1.96016e+07
1.96014e+07
1.96013e+07
1.96011e+07
1.9601e+07
1.96008e+07
1.96006e+07
1.96004e+07
1.96003e+07
1.96001e+07
1.96e+07
1.95999e+07
1.95998e+07
1.95997e+07
1.95996e+07
1.95995e+07
1.95994e+07
1.95993e+07
1.95993e+07
1.95992e+07
1.95992e+07
1.95991e+07
1.95991e+07
1.95991e+07
1.95991e+07
1.9599e+07
1.9599e+07
1.9599e+07
1.9599e+07
1.9599e+07
1.9599e+07
1.95991e+07
1.95991e+07
1.95991e+07
1.95991e+07
1.95991e+07
1.95992e+07
1.95992e+07
1.95993e+07
1.95993e+07
1.95993e+07
1.95994e+07
1.95994e+07
1.95995e+07
1.95996e+07
1.95996e+07
1.95997e+07
1.95998e+07
1.95999e+07
1.96e+07
1.96e+07
1.96001e+07
1.96002e+07
1.96003e+07
1.96005e+07
1.96006e+07
1.96007e+07
1.96008e+07
1.96009e+07
1.9601e+07
1.96012e+07
1.96013e+07
1.96014e+07
1.96016e+07
1.96017e+07
1.96018e+07
1.9602e+07
1.96021e+07
1.96023e+07
1.96024e+07
1.96026e+07
1.96027e+07
1.96028e+07
1.9603e+07
1.96031e+07
1.96033e+07
1.96034e+07
1.96035e+07
1.96037e+07
1.96038e+07
1.9604e+07
1.96041e+07
1.96043e+07
1.97004e+07
1.9699e+07
1.96967e+07
1.96948e+07
1.96934e+07
1.96929e+07
1.96911e+07
1.96886e+07
1.96871e+07
1.96873e+07
1.96847e+07
1.96823e+07
1.96812e+07
1.96819e+07
1.96818e+07
1.96767e+07
1.96746e+07
1.96739e+07
1.96733e+07
1.96759e+07
1.96739e+07
1.96682e+07
1.96666e+07
1.96662e+07
1.96657e+07
1.96685e+07
1.96689e+07
1.96611e+07
1.96584e+07
1.96584e+07
1.96583e+07
1.96628e+07
1.96662e+07
1.96615e+07
1.96524e+07
1.96491e+07
1.96479e+07
1.96469e+07
1.96458e+07
1.9645e+07
1.96446e+07
1.9645e+07
1.96447e+07
1.96464e+07
1.96499e+07
1.96531e+07
1.96472e+07
1.96384e+07
1.96357e+07
1.96348e+07
1.9634e+07
1.96331e+07
1.96323e+07
1.96314e+07
1.96305e+07
1.96296e+07
1.96287e+07
1.96279e+07
1.96271e+07
1.96262e+07
1.96255e+07
1.96247e+07
1.9624e+07
1.96232e+07
1.96225e+07
1.96218e+07
1.96211e+07
1.96205e+07
1.96198e+07
1.96191e+07
1.96184e+07
1.96178e+07
1.96171e+07
1.96165e+07
1.96158e+07
1.96152e+07
1.96146e+07
1.96139e+07
1.96133e+07
1.96127e+07
1.96122e+07
1.96116e+07
1.96111e+07
1.96105e+07
1.961e+07
1.96095e+07
1.9609e+07
1.96086e+07
1.96081e+07
1.96077e+07
1.96073e+07
1.9607e+07
1.96068e+07
1.96068e+07
1.96068e+07
1.96069e+07
1.96078e+07
1.96084e+07
1.96078e+07
1.96058e+07
1.9604e+07
1.96035e+07
1.96034e+07
1.96033e+07
1.96032e+07
1.96031e+07
1.9603e+07
1.96029e+07
1.96027e+07
1.96026e+07
1.96024e+07
1.96023e+07
1.96022e+07
1.9602e+07
1.96019e+07
1.96018e+07
1.96017e+07
1.96016e+07
1.96014e+07
1.96013e+07
1.96011e+07
1.9601e+07
1.96008e+07
1.96006e+07
1.96004e+07
1.96003e+07
1.96001e+07
1.96e+07
1.95999e+07
1.95998e+07
1.95997e+07
1.95996e+07
1.95995e+07
1.95994e+07
1.95993e+07
1.95993e+07
1.95992e+07
1.95992e+07
1.95991e+07
1.95991e+07
1.95991e+07
1.95991e+07
1.9599e+07
1.9599e+07
1.9599e+07
1.9599e+07
1.9599e+07
1.9599e+07
1.95991e+07
1.95991e+07
1.95991e+07
1.95991e+07
1.95991e+07
1.95992e+07
1.95992e+07
1.95993e+07
1.95993e+07
1.95993e+07
1.95994e+07
1.95994e+07
1.95995e+07
1.95996e+07
1.95996e+07
1.95997e+07
1.95998e+07
1.95999e+07
1.96e+07
1.96e+07
1.96001e+07
1.96002e+07
1.96003e+07
1.96005e+07
1.96006e+07
1.96007e+07
1.96008e+07
1.96009e+07
1.9601e+07
1.96012e+07
1.96013e+07
1.96014e+07
1.96016e+07
1.96017e+07
1.96018e+07
1.9602e+07
1.96021e+07
1.96023e+07
1.96024e+07
1.96026e+07
1.96027e+07
1.96028e+07
1.9603e+07
1.96031e+07
1.96033e+07
1.96034e+07
1.96035e+07
1.96037e+07
1.96038e+07
1.9604e+07
1.96041e+07
1.96043e+07
1.96995e+07
1.96979e+07
1.96963e+07
1.96947e+07
1.96932e+07
1.96915e+07
1.96898e+07
1.96882e+07
1.96868e+07
1.96851e+07
1.96834e+07
1.96819e+07
1.96807e+07
1.96792e+07
1.96771e+07
1.96755e+07
1.96743e+07
1.96734e+07
1.96722e+07
1.96703e+07
1.96682e+07
1.96668e+07
1.9666e+07
1.96654e+07
1.96644e+07
1.96626e+07
1.96602e+07
1.96585e+07
1.96577e+07
1.96575e+07
1.96567e+07
1.96548e+07
1.9652e+07
1.96495e+07
1.96489e+07
1.96482e+07
1.96475e+07
1.96467e+07
1.96459e+07
1.9645e+07
1.96445e+07
1.96443e+07
1.96436e+07
1.96423e+07
1.96406e+07
1.96379e+07
1.9636e+07
1.96352e+07
1.96348e+07
1.96344e+07
1.96338e+07
1.9633e+07
1.96322e+07
1.96314e+07
1.96305e+07
1.96296e+07
1.96287e+07
1.96279e+07
1.96271e+07
1.96263e+07
1.96255e+07
1.96247e+07
1.9624e+07
1.96232e+07
1.96225e+07
1.96218e+07
1.96211e+07
1.96205e+07
1.96198e+07
1.96191e+07
1.96184e+07
1.96178e+07
1.96171e+07
1.96165e+07
1.96158e+07
1.96152e+07
1.96146e+07
1.9614e+07
1.96134e+07
1.96128e+07
1.96122e+07
1.96116e+07
1.96111e+07
1.96106e+07
1.96101e+07
1.96096e+07
1.96091e+07
1.96087e+07
1.96083e+07
1.96079e+07
1.96075e+07
1.96072e+07
1.9607e+07
1.96068e+07
1.96068e+07
1.96066e+07
1.96061e+07
1.96053e+07
1.96045e+07
1.96039e+07
1.96036e+07
1.96035e+07
1.96034e+07
1.96034e+07
1.96033e+07
1.96032e+07
1.96031e+07
1.9603e+07
1.96028e+07
1.96026e+07
1.96025e+07
1.96023e+07
1.96022e+07
1.96021e+07
1.96019e+07
1.96018e+07
1.96017e+07
1.96015e+07
1.96014e+07
1.96013e+07
1.96011e+07
1.96009e+07
1.96008e+07
1.96006e+07
1.96004e+07
1.96003e+07
1.96001e+07
1.96e+07
1.95999e+07
1.95998e+07
1.95997e+07
1.95996e+07
1.95995e+07
1.95994e+07
1.95993e+07
1.95993e+07
1.95992e+07
1.95992e+07
1.95991e+07
1.95991e+07
1.95991e+07
1.95991e+07
1.9599e+07
1.9599e+07
1.9599e+07
1.9599e+07
1.9599e+07
1.9599e+07
1.95991e+07
1.95991e+07
1.95991e+07
1.95991e+07
1.95991e+07
1.95992e+07
1.95992e+07
1.95993e+07
1.95993e+07
1.95993e+07
1.95994e+07
1.95994e+07
1.95995e+07
1.95996e+07
1.95996e+07
1.95997e+07
1.95998e+07
1.95999e+07
1.96e+07
1.96e+07
1.96001e+07
1.96002e+07
1.96003e+07
1.96005e+07
1.96006e+07
1.96007e+07
1.96008e+07
1.96009e+07
1.9601e+07
1.96012e+07
1.96013e+07
1.96014e+07
1.96016e+07
1.96017e+07
1.96018e+07
1.9602e+07
1.96021e+07
1.96023e+07
1.96024e+07
1.96026e+07
1.96027e+07
1.96028e+07
1.9603e+07
1.96031e+07
1.96033e+07
1.96034e+07
1.96035e+07
1.96037e+07
1.96038e+07
1.9604e+07
1.96041e+07
1.96042e+07
1.96997e+07
1.96978e+07
1.96961e+07
1.96944e+07
1.96928e+07
1.96911e+07
1.96893e+07
1.96877e+07
1.96862e+07
1.96846e+07
1.9683e+07
1.96816e+07
1.96803e+07
1.96787e+07
1.9677e+07
1.96755e+07
1.96744e+07
1.96732e+07
1.96718e+07
1.967e+07
1.96683e+07
1.96671e+07
1.96664e+07
1.96653e+07
1.96639e+07
1.96621e+07
1.96603e+07
1.96587e+07
1.96582e+07
1.96574e+07
1.9656e+07
1.96541e+07
1.96519e+07
1.96497e+07
1.96487e+07
1.96481e+07
1.96475e+07
1.96468e+07
1.96462e+07
1.96457e+07
1.96452e+07
1.96445e+07
1.96434e+07
1.96419e+07
1.964e+07
1.96382e+07
1.9636e+07
1.96351e+07
1.96347e+07
1.96341e+07
1.96334e+07
1.96326e+07
1.96318e+07
1.9631e+07
1.96302e+07
1.96294e+07
1.96285e+07
1.96277e+07
1.96269e+07
1.96262e+07
1.96254e+07
1.96247e+07
1.9624e+07
1.96232e+07
1.96225e+07
1.96218e+07
1.96212e+07
1.96205e+07
1.96198e+07
1.96191e+07
1.96185e+07
1.96178e+07
1.96171e+07
1.96165e+07
1.96158e+07
1.96152e+07
1.96146e+07
1.9614e+07
1.96134e+07
1.96128e+07
1.96122e+07
1.96117e+07
1.96112e+07
1.96107e+07
1.96102e+07
1.96097e+07
1.96093e+07
1.96089e+07
1.96085e+07
1.96081e+07
1.96078e+07
1.96076e+07
1.96074e+07
1.96072e+07
1.9607e+07
1.96066e+07
1.96061e+07
1.96055e+07
1.96047e+07
1.96041e+07
1.96037e+07
1.96036e+07
1.96036e+07
1.96035e+07
1.96034e+07
1.96033e+07
1.96032e+07
1.9603e+07
1.96028e+07
1.96026e+07
1.96025e+07
1.96023e+07
1.96022e+07
1.96021e+07
1.9602e+07
1.96018e+07
1.96017e+07
1.96016e+07
1.96014e+07
1.96013e+07
1.96011e+07
1.96009e+07
1.96008e+07
1.96006e+07
1.96004e+07
1.96003e+07
1.96001e+07
1.96e+07
1.95999e+07
1.95998e+07
1.95997e+07
1.95996e+07
1.95995e+07
1.95994e+07
1.95993e+07
1.95993e+07
1.95992e+07
1.95992e+07
1.95991e+07
1.95991e+07
1.95991e+07
1.95991e+07
1.9599e+07
1.9599e+07
1.9599e+07
1.9599e+07
1.9599e+07
1.9599e+07
1.95991e+07
1.95991e+07
1.95991e+07
1.95991e+07
1.95991e+07
1.95992e+07
1.95992e+07
1.95993e+07
1.95993e+07
1.95993e+07
1.95994e+07
1.95994e+07
1.95995e+07
1.95996e+07
1.95996e+07
1.95997e+07
1.95998e+07
1.95999e+07
1.96e+07
1.96e+07
1.96001e+07
1.96002e+07
1.96003e+07
1.96005e+07
1.96006e+07
1.96007e+07
1.96008e+07
1.96009e+07
1.9601e+07
1.96012e+07
1.96013e+07
1.96014e+07
1.96016e+07
1.96017e+07
1.96018e+07
1.9602e+07
1.96021e+07
1.96023e+07
1.96024e+07
1.96026e+07
1.96027e+07
1.96028e+07
1.9603e+07
1.96031e+07
1.96033e+07
1.96034e+07
1.96035e+07
1.96037e+07
1.96038e+07
1.9604e+07
1.96041e+07
1.96042e+07
1.96996e+07
1.96978e+07
1.96961e+07
1.96944e+07
1.96928e+07
1.96911e+07
1.96893e+07
1.96877e+07
1.96862e+07
1.96846e+07
1.9683e+07
1.96816e+07
1.96803e+07
1.96787e+07
1.9677e+07
1.96755e+07
1.96744e+07
1.96732e+07
1.96718e+07
1.96699e+07
1.96683e+07
1.96671e+07
1.96664e+07
1.96653e+07
1.96639e+07
1.96621e+07
1.96603e+07
1.96587e+07
1.96582e+07
1.96574e+07
1.9656e+07
1.96541e+07
1.96519e+07
1.96497e+07
1.96487e+07
1.96481e+07
1.96475e+07
1.96468e+07
1.96462e+07
1.96457e+07
1.96452e+07
1.96445e+07
1.96434e+07
1.96419e+07
1.964e+07
1.96381e+07
1.9636e+07
1.96351e+07
1.96347e+07
1.96341e+07
1.96334e+07
1.96326e+07
1.96318e+07
1.9631e+07
1.96302e+07
1.96294e+07
1.96285e+07
1.96277e+07
1.96269e+07
1.96262e+07
1.96254e+07
1.96247e+07
1.9624e+07
1.96232e+07
1.96225e+07
1.96218e+07
1.96212e+07
1.96205e+07
1.96198e+07
1.96191e+07
1.96185e+07
1.96178e+07
1.96171e+07
1.96165e+07
1.96158e+07
1.96152e+07
1.96146e+07
1.9614e+07
1.96134e+07
1.96128e+07
1.96122e+07
1.96117e+07
1.96112e+07
1.96107e+07
1.96102e+07
1.96097e+07
1.96093e+07
1.96088e+07
1.96085e+07
1.96081e+07
1.96078e+07
1.96076e+07
1.96074e+07
1.96072e+07
1.9607e+07
1.96066e+07
1.96061e+07
1.96055e+07
1.96047e+07
1.96041e+07
1.96037e+07
1.96036e+07
1.96036e+07
1.96035e+07
1.96034e+07
1.96033e+07
1.96032e+07
1.9603e+07
1.96028e+07
1.96026e+07
1.96025e+07
1.96023e+07
1.96022e+07
1.96021e+07
1.9602e+07
1.96018e+07
1.96017e+07
1.96016e+07
1.96014e+07
1.96013e+07
1.96011e+07
1.96009e+07
1.96008e+07
1.96006e+07
1.96004e+07
1.96003e+07
1.96001e+07
1.96e+07
1.95999e+07
1.95998e+07
1.95997e+07
1.95996e+07
1.95995e+07
1.95994e+07
1.95993e+07
1.95993e+07
1.95992e+07
1.95992e+07
1.95991e+07
1.95991e+07
1.95991e+07
1.95991e+07
1.9599e+07
1.9599e+07
1.9599e+07
1.9599e+07
1.9599e+07
1.9599e+07
1.95991e+07
1.95991e+07
1.95991e+07
1.95991e+07
1.95991e+07
1.95992e+07
1.95992e+07
1.95993e+07
1.95993e+07
1.95993e+07
1.95994e+07
1.95994e+07
1.95995e+07
1.95996e+07
1.95996e+07
1.95997e+07
1.95998e+07
1.95999e+07
1.96e+07
1.96e+07
1.96001e+07
1.96002e+07
1.96003e+07
1.96005e+07
1.96006e+07
1.96007e+07
1.96008e+07
1.96009e+07
1.9601e+07
1.96012e+07
1.96013e+07
1.96014e+07
1.96016e+07
1.96017e+07
1.96018e+07
1.9602e+07
1.96021e+07
1.96023e+07
1.96024e+07
1.96026e+07
1.96027e+07
1.96028e+07
1.9603e+07
1.96031e+07
1.96033e+07
1.96034e+07
1.96035e+07
1.96037e+07
1.96038e+07
1.9604e+07
1.96041e+07
1.96042e+07
1.96043e+07
1.96044e+07
1.96044e+07
1.96044e+07
1.96044e+07
1.96045e+07
1.96045e+07
1.96045e+07
1.96045e+07
1.96045e+07
1.96046e+07
1.96046e+07
1.96046e+07
1.96046e+07
1.96046e+07
1.96047e+07
1.96047e+07
1.96047e+07
1.96047e+07
1.96047e+07
1.96043e+07
1.96044e+07
1.96044e+07
1.96044e+07
1.96045e+07
1.96045e+07
1.96045e+07
1.96045e+07
1.96045e+07
1.96046e+07
1.96046e+07
1.96046e+07
1.96046e+07
1.96047e+07
1.96047e+07
1.96047e+07
1.96047e+07
1.96047e+07
1.96048e+07
1.96048e+07
1.96043e+07
1.96044e+07
1.96044e+07
1.96044e+07
1.96045e+07
1.96045e+07
1.96045e+07
1.96046e+07
1.96046e+07
1.96046e+07
1.96046e+07
1.96047e+07
1.96047e+07
1.96047e+07
1.96047e+07
1.96048e+07
1.96048e+07
1.96048e+07
1.96048e+07
1.96048e+07
1.96043e+07
1.96044e+07
1.96044e+07
1.96045e+07
1.96045e+07
1.96046e+07
1.96046e+07
1.96046e+07
1.96047e+07
1.96047e+07
1.96047e+07
1.96048e+07
1.96048e+07
1.96049e+07
1.96049e+07
1.9605e+07
1.96051e+07
1.96052e+07
1.96051e+07
1.9605e+07
1.96044e+07
1.96044e+07
1.96044e+07
1.96045e+07
1.96045e+07
1.96046e+07
1.96046e+07
1.96046e+07
1.96047e+07
1.96047e+07
1.96047e+07
1.96048e+07
1.96048e+07
1.96049e+07
1.96049e+07
1.9605e+07
1.96051e+07
1.96052e+07
1.96052e+07
1.96051e+07
1.96048e+07
1.9605e+07
1.96051e+07
1.96052e+07
1.96053e+07
1.96054e+07
1.96056e+07
1.96057e+07
1.96057e+07
1.96058e+07
1.9606e+07
1.96061e+07
1.96061e+07
1.96062e+07
1.96065e+07
1.96068e+07
1.96068e+07
1.96067e+07
1.96068e+07
1.96071e+07
1.96075e+07
1.96076e+07
1.96075e+07
1.96075e+07
1.96077e+07
1.9608e+07
1.96083e+07
1.96085e+07
1.96085e+07
1.96083e+07
1.96084e+07
1.96087e+07
1.96091e+07
1.96093e+07
1.96095e+07
1.96096e+07
1.96095e+07
1.96095e+07
1.96093e+07
1.96091e+07
1.96087e+07
1.96082e+07
1.96073e+07
1.96072e+07
1.96077e+07
1.96082e+07
1.96086e+07
1.96089e+07
1.96091e+07
1.96094e+07
1.96096e+07
1.96098e+07
1.961e+07
1.96102e+07
1.96104e+07
1.96106e+07
1.96108e+07
1.9611e+07
1.96111e+07
1.96113e+07
1.96115e+07
1.96117e+07
1.96119e+07
1.96121e+07
1.96123e+07
1.96125e+07
1.96128e+07
1.9613e+07
1.96131e+07
1.96134e+07
1.96139e+07
1.96144e+07
1.96149e+07
1.96154e+07
1.96158e+07
1.9616e+07
1.96161e+07
1.96161e+07
1.96161e+07
1.9616e+07
1.96158e+07
1.96157e+07
1.96152e+07
1.96147e+07
1.96148e+07
1.96153e+07
1.96157e+07
1.96161e+07
1.96165e+07
1.96168e+07
1.96171e+07
1.96175e+07
1.96179e+07
1.96182e+07
1.96184e+07
1.96186e+07
1.96187e+07
1.9619e+07
1.96191e+07
1.96191e+07
1.96048e+07
1.9605e+07
1.96051e+07
1.96052e+07
1.96053e+07
1.96054e+07
1.96056e+07
1.96057e+07
1.96057e+07
1.96058e+07
1.9606e+07
1.96061e+07
1.96061e+07
1.96062e+07
1.96065e+07
1.96068e+07
1.96068e+07
1.96067e+07
1.96068e+07
1.96072e+07
1.96075e+07
1.96076e+07
1.96075e+07
1.96075e+07
1.96077e+07
1.9608e+07
1.96083e+07
1.96085e+07
1.96085e+07
1.96083e+07
1.96084e+07
1.96087e+07
1.96091e+07
1.96093e+07
1.96095e+07
1.96096e+07
1.96095e+07
1.96095e+07
1.96093e+07
1.96091e+07
1.96088e+07
1.96082e+07
1.96073e+07
1.96072e+07
1.96077e+07
1.96082e+07
1.96086e+07
1.96089e+07
1.96091e+07
1.96094e+07
1.96096e+07
1.96098e+07
1.961e+07
1.96102e+07
1.96104e+07
1.96106e+07
1.96108e+07
1.9611e+07
1.96111e+07
1.96113e+07
1.96115e+07
1.96117e+07
1.96119e+07
1.96121e+07
1.96123e+07
1.96125e+07
1.96128e+07
1.9613e+07
1.96131e+07
1.96134e+07
1.96139e+07
1.96144e+07
1.96149e+07
1.96154e+07
1.96158e+07
1.9616e+07
1.96161e+07
1.96161e+07
1.96161e+07
1.9616e+07
1.96158e+07
1.96157e+07
1.96152e+07
1.96147e+07
1.96148e+07
1.96153e+07
1.96157e+07
1.96161e+07
1.96165e+07
1.96168e+07
1.96172e+07
1.96175e+07
1.96179e+07
1.96182e+07
1.96184e+07
1.96186e+07
1.96187e+07
1.9619e+07
1.96191e+07
1.96191e+07
1.96049e+07
1.96051e+07
1.96052e+07
1.96053e+07
1.96054e+07
1.96055e+07
1.96057e+07
1.96059e+07
1.96059e+07
1.96059e+07
1.96061e+07
1.96064e+07
1.96064e+07
1.96063e+07
1.96065e+07
1.96068e+07
1.9607e+07
1.96069e+07
1.96069e+07
1.9607e+07
1.96075e+07
1.96077e+07
1.96078e+07
1.96076e+07
1.96076e+07
1.96079e+07
1.96083e+07
1.96086e+07
1.96087e+07
1.96086e+07
1.96084e+07
1.96086e+07
1.9609e+07
1.96094e+07
1.96096e+07
1.96098e+07
1.96099e+07
1.961e+07
1.96099e+07
1.96098e+07
1.96092e+07
1.96079e+07
1.9607e+07
1.96071e+07
1.96077e+07
1.96084e+07
1.96091e+07
1.96095e+07
1.96099e+07
1.96101e+07
1.96103e+07
1.96104e+07
1.96106e+07
1.96107e+07
1.96109e+07
1.9611e+07
1.96112e+07
1.96113e+07
1.96115e+07
1.96116e+07
1.96118e+07
1.96119e+07
1.96121e+07
1.96122e+07
1.96124e+07
1.96125e+07
1.96127e+07
1.96127e+07
1.96129e+07
1.96131e+07
1.96134e+07
1.96137e+07
1.96141e+07
1.96148e+07
1.96155e+07
1.9616e+07
1.96162e+07
1.96163e+07
1.96164e+07
1.96164e+07
1.96162e+07
1.96156e+07
1.9615e+07
1.96146e+07
1.96147e+07
1.96151e+07
1.96156e+07
1.9616e+07
1.96163e+07
1.96167e+07
1.9617e+07
1.96173e+07
1.96177e+07
1.96181e+07
1.96184e+07
1.96187e+07
1.96189e+07
1.9619e+07
1.96192e+07
1.96193e+07
1.96049e+07
1.96052e+07
1.96055e+07
1.96058e+07
1.96056e+07
1.96056e+07
1.96058e+07
1.96063e+07
1.96067e+07
1.96061e+07
1.96062e+07
1.96066e+07
1.96076e+07
1.96069e+07
1.96067e+07
1.9607e+07
1.96077e+07
1.96083e+07
1.96074e+07
1.96072e+07
1.96075e+07
1.96079e+07
1.96089e+07
1.96087e+07
1.96079e+07
1.9608e+07
1.96084e+07
1.96088e+07
1.96097e+07
1.961e+07
1.96091e+07
1.96087e+07
1.96091e+07
1.96096e+07
1.96099e+07
1.961e+07
1.96103e+07
1.96107e+07
1.96116e+07
1.96134e+07
1.96172e+07
1.96208e+07
1.96182e+07
1.96106e+07
1.96086e+07
1.9609e+07
1.96094e+07
1.96097e+07
1.96099e+07
1.96101e+07
1.96103e+07
1.96104e+07
1.96106e+07
1.96107e+07
1.96109e+07
1.9611e+07
1.96112e+07
1.96113e+07
1.96115e+07
1.96116e+07
1.96118e+07
1.96119e+07
1.96121e+07
1.96122e+07
1.96124e+07
1.96126e+07
1.96131e+07
1.96146e+07
1.96133e+07
1.96129e+07
1.9613e+07
1.96133e+07
1.96137e+07
1.96147e+07
1.96157e+07
1.96164e+07
1.96165e+07
1.96168e+07
1.96172e+07
1.9618e+07
1.96193e+07
1.96213e+07
1.96221e+07
1.96194e+07
1.96158e+07
1.96153e+07
1.96156e+07
1.96159e+07
1.96162e+07
1.96165e+07
1.96169e+07
1.96172e+07
1.96176e+07
1.9618e+07
1.96183e+07
1.96185e+07
1.96188e+07
1.96189e+07
1.96191e+07
1.96192e+07
1.96049e+07
1.96052e+07
1.96055e+07
1.96058e+07
1.96056e+07
1.96056e+07
1.96058e+07
1.96063e+07
1.96068e+07
1.96061e+07
1.96062e+07
1.96066e+07
1.96077e+07
1.96069e+07
1.96066e+07
1.9607e+07
1.96077e+07
1.96083e+07
1.96074e+07
1.96071e+07
1.96075e+07
1.9608e+07
1.96089e+07
1.96087e+07
1.96079e+07
1.9608e+07
1.96084e+07
1.96088e+07
1.96097e+07
1.961e+07
1.96091e+07
1.96087e+07
1.96091e+07
1.96096e+07
1.96099e+07
1.961e+07
1.96103e+07
1.96107e+07
1.96115e+07
1.96134e+07
1.96172e+07
1.9621e+07
1.96182e+07
1.96105e+07
1.96086e+07
1.9609e+07
1.96094e+07
1.96097e+07
1.96099e+07
1.96101e+07
1.96103e+07
1.96104e+07
1.96106e+07
1.96107e+07
1.96109e+07
1.9611e+07
1.96112e+07
1.96113e+07
1.96115e+07
1.96116e+07
1.96118e+07
1.96119e+07
1.96121e+07
1.96122e+07
1.96124e+07
1.96126e+07
1.96131e+07
1.96146e+07
1.96133e+07
1.9613e+07
1.96131e+07
1.96133e+07
1.96138e+07
1.96147e+07
1.96157e+07
1.96164e+07
1.96165e+07
1.96168e+07
1.96172e+07
1.9618e+07
1.96193e+07
1.96213e+07
1.96221e+07
1.96194e+07
1.96158e+07
1.96153e+07
1.96156e+07
1.9616e+07
1.96163e+07
1.96166e+07
1.96169e+07
1.96172e+07
1.96176e+07
1.9618e+07
1.96183e+07
1.96185e+07
1.96188e+07
1.96189e+07
1.96191e+07
1.96192e+07
1.96184e+07
1.96182e+07
1.96183e+07
1.96185e+07
1.96188e+07
1.96191e+07
1.96194e+07
1.96197e+07
1.96198e+07
1.96198e+07
1.96198e+07
1.962e+07
1.96202e+07
1.96203e+07
1.96203e+07
1.96204e+07
1.96204e+07
1.96205e+07
1.96205e+07
1.96206e+07
1.96185e+07
1.96184e+07
1.96185e+07
1.96187e+07
1.9619e+07
1.96192e+07
1.96195e+07
1.96197e+07
1.96198e+07
1.96197e+07
1.96198e+07
1.96201e+07
1.96202e+07
1.96203e+07
1.96203e+07
1.96204e+07
1.96204e+07
1.96205e+07
1.96205e+07
1.96206e+07
1.96194e+07
1.96195e+07
1.96196e+07
1.96197e+07
1.96199e+07
1.962e+07
1.96201e+07
1.96202e+07
1.96203e+07
1.96204e+07
1.96205e+07
1.96205e+07
1.96206e+07
1.96206e+07
1.96206e+07
1.96207e+07
1.96207e+07
1.96208e+07
1.96209e+07
1.96209e+07
1.96191e+07
1.9619e+07
1.96188e+07
1.96188e+07
1.96188e+07
1.9619e+07
1.96191e+07
1.96192e+07
1.96193e+07
1.96193e+07
1.96195e+07
1.96196e+07
1.96197e+07
1.96197e+07
1.96198e+07
1.96198e+07
1.96199e+07
1.962e+07
1.96202e+07
1.96205e+07
1.96194e+07
1.96195e+07
1.96194e+07
1.96193e+07
1.96193e+07
1.96195e+07
1.96196e+07
1.96197e+07
1.96197e+07
1.96198e+07
1.96199e+07
1.962e+07
1.96201e+07
1.96201e+07
1.96202e+07
1.96202e+07
1.96203e+07
1.96204e+07
1.96205e+07
1.96207e+07
1.96209e+07
1.96211e+07
1.96212e+07
1.96212e+07
1.96213e+07
1.96214e+07
1.96214e+07
1.96214e+07
1.96214e+07
1.96215e+07
1.96216e+07
1.96215e+07
1.96215e+07
1.96217e+07
1.96218e+07
1.96219e+07
1.96218e+07
1.96217e+07
1.96217e+07
1.96218e+07
1.9622e+07
1.96221e+07
1.96221e+07
1.9622e+07
1.96218e+07
1.96217e+07
1.96218e+07
1.9622e+07
1.96222e+07
1.96223e+07
1.96223e+07
1.96222e+07
1.96221e+07
1.96219e+07
1.96218e+07
1.96216e+07
1.96213e+07
1.9621e+07
1.96206e+07
1.962e+07
1.96189e+07
1.96186e+07
1.96189e+07
1.96192e+07
1.96194e+07
1.96195e+07
1.96197e+07
1.96199e+07
1.96203e+07
1.96207e+07
1.9621e+07
1.9621e+07
1.96205e+07
1.96199e+07
1.96197e+07
1.96202e+07
1.96207e+07
1.96211e+07
1.96215e+07
1.96217e+07
1.96217e+07
1.96216e+07
1.96213e+07
1.9621e+07
1.96209e+07
1.9621e+07
1.96211e+07
1.96212e+07
1.96212e+07
1.96211e+07
1.96209e+07
1.96206e+07
1.96203e+07
1.96199e+07
1.96195e+07
1.96189e+07
1.96186e+07
1.96187e+07
1.96189e+07
1.96192e+07
1.96195e+07
1.96197e+07
1.962e+07
1.96203e+07
1.96205e+07
1.96205e+07
1.96205e+07
1.96206e+07
1.96207e+07
1.96207e+07
1.96208e+07
1.96209e+07
1.96211e+07
1.96212e+07
1.96212e+07
1.96213e+07
1.96213e+07
1.96214e+07
1.96214e+07
1.96214e+07
1.96214e+07
1.96214e+07
1.96214e+07
1.96213e+07
1.96213e+07
1.96213e+07
1.96212e+07
1.96212e+07
1.96212e+07
1.96211e+07
1.96211e+07
1.96211e+07
1.96211e+07
1.9621e+07
1.9621e+07
1.9621e+07
1.9621e+07
1.9621e+07
1.96209e+07
1.96209e+07
1.96209e+07
1.96209e+07
1.96209e+07
1.96209e+07
1.96209e+07
1.96209e+07
1.96209e+07
1.96209e+07
1.96209e+07
1.96209e+07
1.96209e+07
1.96209e+07
1.96209e+07
1.96209e+07
1.96209e+07
1.9621e+07
1.9621e+07
1.9621e+07
1.9621e+07
1.96211e+07
1.96211e+07
1.96211e+07
1.96212e+07
1.96212e+07
1.96213e+07
1.96213e+07
1.96214e+07
1.96214e+07
1.96215e+07
1.96215e+07
1.96216e+07
1.96217e+07
1.96217e+07
1.96218e+07
1.96219e+07
1.9622e+07
1.9622e+07
1.96221e+07
1.96222e+07
1.96223e+07
1.96223e+07
1.96224e+07
1.96225e+07
1.96226e+07
1.96226e+07
1.96227e+07
1.96228e+07
1.96229e+07
1.96229e+07
1.9623e+07
1.96231e+07
1.96232e+07
1.96233e+07
1.96233e+07
1.96234e+07
1.96235e+07
1.96236e+07
1.96236e+07
1.96237e+07
1.96238e+07
1.96239e+07
1.96239e+07
1.9624e+07
1.96241e+07
1.96242e+07
1.96243e+07
1.96244e+07
1.96244e+07
1.96245e+07
1.96246e+07
1.96247e+07
1.96248e+07
1.96249e+07
1.9625e+07
1.9625e+07
1.96251e+07
1.96252e+07
1.96253e+07
1.96254e+07
1.96255e+07
1.96209e+07
1.96211e+07
1.96212e+07
1.96212e+07
1.96213e+07
1.96214e+07
1.96214e+07
1.96214e+07
1.96214e+07
1.96215e+07
1.96216e+07
1.96215e+07
1.96215e+07
1.96217e+07
1.96218e+07
1.96219e+07
1.96218e+07
1.96217e+07
1.96217e+07
1.96218e+07
1.9622e+07
1.96221e+07
1.96221e+07
1.9622e+07
1.96218e+07
1.96217e+07
1.96218e+07
1.9622e+07
1.96222e+07
1.96223e+07
1.96222e+07
1.96222e+07
1.96221e+07
1.96219e+07
1.96218e+07
1.96216e+07
1.96213e+07
1.9621e+07
1.96207e+07
1.962e+07
1.96189e+07
1.96186e+07
1.96189e+07
1.96192e+07
1.96194e+07
1.96195e+07
1.96197e+07
1.96199e+07
1.96203e+07
1.96207e+07
1.9621e+07
1.9621e+07
1.96205e+07
1.96199e+07
1.96198e+07
1.96202e+07
1.96207e+07
1.96212e+07
1.96215e+07
1.96217e+07
1.96217e+07
1.96215e+07
1.96213e+07
1.9621e+07
1.96209e+07
1.9621e+07
1.96211e+07
1.96212e+07
1.96212e+07
1.96211e+07
1.96209e+07
1.96206e+07
1.96203e+07
1.96199e+07
1.96195e+07
1.96189e+07
1.96186e+07
1.96187e+07
1.96189e+07
1.96192e+07
1.96195e+07
1.96198e+07
1.962e+07
1.96203e+07
1.96205e+07
1.96205e+07
1.96205e+07
1.96206e+07
1.96207e+07
1.96207e+07
1.96208e+07
1.96209e+07
1.96211e+07
1.96212e+07
1.96212e+07
1.96213e+07
1.96213e+07
1.96214e+07
1.96214e+07
1.96214e+07
1.96214e+07
1.96214e+07
1.96214e+07
1.96213e+07
1.96213e+07
1.96213e+07
1.96212e+07
1.96212e+07
1.96212e+07
1.96211e+07
1.96211e+07
1.96211e+07
1.96211e+07
1.9621e+07
1.9621e+07
1.9621e+07
1.9621e+07
1.9621e+07
1.96209e+07
1.96209e+07
1.96209e+07
1.96209e+07
1.96209e+07
1.96209e+07
1.96209e+07
1.96209e+07
1.96209e+07
1.96209e+07
1.96209e+07
1.96209e+07
1.96209e+07
1.96209e+07
1.96209e+07
1.96209e+07
1.96209e+07
1.9621e+07
1.9621e+07
1.9621e+07
1.9621e+07
1.96211e+07
1.96211e+07
1.96211e+07
1.96212e+07
1.96212e+07
1.96213e+07
1.96213e+07
1.96214e+07
1.96214e+07
1.96215e+07
1.96215e+07
1.96216e+07
1.96217e+07
1.96217e+07
1.96218e+07
1.96219e+07
1.9622e+07
1.9622e+07
1.96221e+07
1.96222e+07
1.96223e+07
1.96223e+07
1.96224e+07
1.96225e+07
1.96226e+07
1.96226e+07
1.96227e+07
1.96228e+07
1.96229e+07
1.96229e+07
1.9623e+07
1.96231e+07
1.96232e+07
1.96233e+07
1.96233e+07
1.96234e+07
1.96235e+07
1.96236e+07
1.96236e+07
1.96237e+07
1.96238e+07
1.96239e+07
1.96239e+07
1.9624e+07
1.96241e+07
1.96242e+07
1.96243e+07
1.96244e+07
1.96244e+07
1.96245e+07
1.96246e+07
1.96247e+07
1.96248e+07
1.96249e+07
1.9625e+07
1.9625e+07
1.96251e+07
1.96252e+07
1.96253e+07
1.96254e+07
1.96255e+07
1.96211e+07
1.96213e+07
1.96213e+07
1.96214e+07
1.96214e+07
1.96215e+07
1.96216e+07
1.96215e+07
1.96215e+07
1.96216e+07
1.96218e+07
1.96217e+07
1.96216e+07
1.96217e+07
1.96218e+07
1.96219e+07
1.9622e+07
1.96218e+07
1.96217e+07
1.96218e+07
1.96219e+07
1.96221e+07
1.96222e+07
1.96222e+07
1.9622e+07
1.96218e+07
1.96218e+07
1.9622e+07
1.96222e+07
1.96223e+07
1.96224e+07
1.96224e+07
1.96224e+07
1.96223e+07
1.96222e+07
1.96221e+07
1.96219e+07
1.96216e+07
1.96209e+07
1.96196e+07
1.96186e+07
1.96185e+07
1.96188e+07
1.96193e+07
1.96198e+07
1.962e+07
1.96202e+07
1.96202e+07
1.96202e+07
1.96204e+07
1.96211e+07
1.96216e+07
1.96204e+07
1.96194e+07
1.96193e+07
1.96196e+07
1.96201e+07
1.96206e+07
1.96213e+07
1.96217e+07
1.96217e+07
1.96217e+07
1.96215e+07
1.96212e+07
1.96209e+07
1.9621e+07
1.96211e+07
1.96212e+07
1.96212e+07
1.96212e+07
1.96211e+07
1.96209e+07
1.96206e+07
1.962e+07
1.96193e+07
1.96187e+07
1.96184e+07
1.96185e+07
1.96187e+07
1.9619e+07
1.96193e+07
1.96196e+07
1.96199e+07
1.96202e+07
1.96204e+07
1.96206e+07
1.96206e+07
1.96206e+07
1.96207e+07
1.96207e+07
1.96208e+07
1.96209e+07
1.9621e+07
1.96211e+07
1.96212e+07
1.96213e+07
1.96213e+07
1.96214e+07
1.96214e+07
1.96214e+07
1.96214e+07
1.96214e+07
1.96214e+07
1.96213e+07
1.96213e+07
1.96213e+07
1.96212e+07
1.96212e+07
1.96212e+07
1.96211e+07
1.96211e+07
1.96211e+07
1.96211e+07
1.9621e+07
1.9621e+07
1.9621e+07
1.9621e+07
1.9621e+07
1.96209e+07
1.96209e+07
1.96209e+07
1.96209e+07
1.96209e+07
1.96209e+07
1.96209e+07
1.96209e+07
1.96209e+07
1.96209e+07
1.96209e+07
1.96209e+07
1.96209e+07
1.96209e+07
1.96209e+07
1.96209e+07
1.96209e+07
1.9621e+07
1.9621e+07
1.9621e+07
1.9621e+07
1.96211e+07
1.96211e+07
1.96211e+07
1.96212e+07
1.96212e+07
1.96213e+07
1.96213e+07
1.96214e+07
1.96214e+07
1.96215e+07
1.96215e+07
1.96216e+07
1.96217e+07
1.96217e+07
1.96218e+07
1.96219e+07
1.9622e+07
1.9622e+07
1.96221e+07
1.96222e+07
1.96223e+07
1.96223e+07
1.96224e+07
1.96225e+07
1.96226e+07
1.96226e+07
1.96227e+07
1.96228e+07
1.96229e+07
1.96229e+07
1.9623e+07
1.96231e+07
1.96232e+07
1.96233e+07
1.96233e+07
1.96234e+07
1.96235e+07
1.96236e+07
1.96236e+07
1.96237e+07
1.96238e+07
1.96239e+07
1.96239e+07
1.9624e+07
1.96241e+07
1.96242e+07
1.96243e+07
1.96244e+07
1.96244e+07
1.96245e+07
1.96246e+07
1.96247e+07
1.96248e+07
1.96249e+07
1.9625e+07
1.9625e+07
1.96251e+07
1.96252e+07
1.96253e+07
1.96254e+07
1.96255e+07
1.96209e+07
1.96213e+07
1.96215e+07
1.96215e+07
1.96215e+07
1.96216e+07
1.96219e+07
1.96221e+07
1.96216e+07
1.96217e+07
1.96219e+07
1.96225e+07
1.96221e+07
1.96218e+07
1.96219e+07
1.9622e+07
1.96225e+07
1.96225e+07
1.9622e+07
1.96218e+07
1.96219e+07
1.96222e+07
1.96224e+07
1.96227e+07
1.96227e+07
1.96222e+07
1.96219e+07
1.9622e+07
1.96222e+07
1.96225e+07
1.96225e+07
1.96225e+07
1.96225e+07
1.96225e+07
1.96225e+07
1.96227e+07
1.96233e+07
1.96247e+07
1.96279e+07
1.96314e+07
1.96293e+07
1.96221e+07
1.96197e+07
1.96198e+07
1.96201e+07
1.96202e+07
1.96203e+07
1.96203e+07
1.96203e+07
1.96206e+07
1.96215e+07
1.96228e+07
1.96303e+07
1.96279e+07
1.96212e+07
1.96195e+07
1.96198e+07
1.96206e+07
1.96216e+07
1.96221e+07
1.96221e+07
1.96221e+07
1.96223e+07
1.96224e+07
1.96215e+07
1.96211e+07
1.96211e+07
1.96212e+07
1.96214e+07
1.96215e+07
1.96217e+07
1.9622e+07
1.96227e+07
1.96239e+07
1.96247e+07
1.96235e+07
1.96204e+07
1.96187e+07
1.96188e+07
1.9619e+07
1.96193e+07
1.96195e+07
1.96198e+07
1.96201e+07
1.96203e+07
1.96204e+07
1.96205e+07
1.96206e+07
1.96206e+07
1.96207e+07
1.96208e+07
1.96209e+07
1.9621e+07
1.96211e+07
1.96212e+07
1.96213e+07
1.96213e+07
1.96214e+07
1.96215e+07
1.96215e+07
1.96214e+07
1.96214e+07
1.96214e+07
1.96213e+07
1.96213e+07
1.96213e+07
1.96212e+07
1.96212e+07
1.96212e+07
1.96211e+07
1.96211e+07
1.96211e+07
1.96211e+07
1.9621e+07
1.9621e+07
1.9621e+07
1.9621e+07
1.9621e+07
1.96209e+07
1.96209e+07
1.96209e+07
1.96209e+07
1.96209e+07
1.96209e+07
1.96209e+07
1.96209e+07
1.96209e+07
1.96209e+07
1.96209e+07
1.96209e+07
1.96209e+07
1.96209e+07
1.96209e+07
1.96209e+07
1.96209e+07
1.9621e+07
1.9621e+07
1.9621e+07
1.9621e+07
1.96211e+07
1.96211e+07
1.96211e+07
1.96212e+07
1.96212e+07
1.96213e+07
1.96213e+07
1.96214e+07
1.96214e+07
1.96215e+07
1.96215e+07
1.96216e+07
1.96217e+07
1.96217e+07
1.96218e+07
1.96219e+07
1.9622e+07
1.9622e+07
1.96221e+07
1.96222e+07
1.96223e+07
1.96223e+07
1.96224e+07
1.96225e+07
1.96226e+07
1.96226e+07
1.96227e+07
1.96228e+07
1.96229e+07
1.96229e+07
1.9623e+07
1.96231e+07
1.96232e+07
1.96233e+07
1.96233e+07
1.96234e+07
1.96235e+07
1.96236e+07
1.96236e+07
1.96237e+07
1.96238e+07
1.96239e+07
1.96239e+07
1.9624e+07
1.96241e+07
1.96242e+07
1.96243e+07
1.96244e+07
1.96244e+07
1.96245e+07
1.96246e+07
1.96247e+07
1.96248e+07
1.96249e+07
1.9625e+07
1.9625e+07
1.96251e+07
1.96252e+07
1.96253e+07
1.96254e+07
1.96255e+07
1.9621e+07
1.96213e+07
1.96215e+07
1.96215e+07
1.96215e+07
1.96216e+07
1.96219e+07
1.96221e+07
1.96216e+07
1.96217e+07
1.96219e+07
1.96225e+07
1.9622e+07
1.96218e+07
1.96219e+07
1.96221e+07
1.96225e+07
1.96226e+07
1.9622e+07
1.96218e+07
1.96219e+07
1.96222e+07
1.96224e+07
1.96227e+07
1.96227e+07
1.96222e+07
1.96219e+07
1.9622e+07
1.96223e+07
1.96225e+07
1.96225e+07
1.96225e+07
1.96225e+07
1.96225e+07
1.96225e+07
1.96227e+07
1.96233e+07
1.96247e+07
1.96279e+07
1.96315e+07
1.96294e+07
1.9622e+07
1.96197e+07
1.96198e+07
1.96201e+07
1.96202e+07
1.96203e+07
1.96203e+07
1.96203e+07
1.96206e+07
1.96216e+07
1.96228e+07
1.96305e+07
1.9628e+07
1.96212e+07
1.96195e+07
1.96199e+07
1.96206e+07
1.96216e+07
1.96222e+07
1.96221e+07
1.96221e+07
1.96223e+07
1.96225e+07
1.96215e+07
1.96211e+07
1.96211e+07
1.96213e+07
1.96214e+07
1.96215e+07
1.96217e+07
1.9622e+07
1.96227e+07
1.96239e+07
1.96248e+07
1.96236e+07
1.96204e+07
1.96187e+07
1.96188e+07
1.9619e+07
1.96193e+07
1.96195e+07
1.96198e+07
1.96201e+07
1.96203e+07
1.96205e+07
1.96205e+07
1.96206e+07
1.96206e+07
1.96207e+07
1.96208e+07
1.96209e+07
1.9621e+07
1.96211e+07
1.96212e+07
1.96213e+07
1.96214e+07
1.96214e+07
1.96215e+07
1.96215e+07
1.96214e+07
1.96214e+07
1.96214e+07
1.96213e+07
1.96213e+07
1.96213e+07
1.96212e+07
1.96212e+07
1.96212e+07
1.96211e+07
1.96211e+07
1.96211e+07
1.96211e+07
1.9621e+07
1.9621e+07
1.9621e+07
1.9621e+07
1.9621e+07
1.96209e+07
1.96209e+07
1.96209e+07
1.96209e+07
1.96209e+07
1.96209e+07
1.96209e+07
1.96209e+07
1.96209e+07
1.96209e+07
1.96209e+07
1.96209e+07
1.96209e+07
1.96209e+07
1.96209e+07
1.96209e+07
1.96209e+07
1.9621e+07
1.9621e+07
1.9621e+07
1.9621e+07
1.96211e+07
1.96211e+07
1.96211e+07
1.96212e+07
1.96212e+07
1.96213e+07
1.96213e+07
1.96214e+07
1.96214e+07
1.96215e+07
1.96215e+07
1.96216e+07
1.96217e+07
1.96217e+07
1.96218e+07
1.96219e+07
1.9622e+07
1.9622e+07
1.96221e+07
1.96222e+07
1.96223e+07
1.96223e+07
1.96224e+07
1.96225e+07
1.96226e+07
1.96226e+07
1.96227e+07
1.96228e+07
1.96229e+07
1.96229e+07
1.9623e+07
1.96231e+07
1.96232e+07
1.96233e+07
1.96233e+07
1.96234e+07
1.96235e+07
1.96236e+07
1.96236e+07
1.96237e+07
1.96238e+07
1.96239e+07
1.96239e+07
1.9624e+07
1.96241e+07
1.96242e+07
1.96243e+07
1.96244e+07
1.96244e+07
1.96245e+07
1.96246e+07
1.96247e+07
1.96248e+07
1.96249e+07
1.9625e+07
1.9625e+07
1.96251e+07
1.96252e+07
1.96253e+07
1.96254e+07
1.96255e+07
1.96256e+07
1.96256e+07
1.96256e+07
1.96256e+07
1.96257e+07
1.96257e+07
1.96257e+07
1.96257e+07
1.96258e+07
1.96258e+07
1.96258e+07
1.96258e+07
1.96258e+07
1.96258e+07
1.96259e+07
1.96259e+07
1.96259e+07
1.9626e+07
1.9626e+07
1.9626e+07
1.96256e+07
1.96256e+07
1.96256e+07
1.96256e+07
1.96257e+07
1.96257e+07
1.96257e+07
1.96257e+07
1.96258e+07
1.96258e+07
1.96258e+07
1.96258e+07
1.96258e+07
1.96258e+07
1.96259e+07
1.96259e+07
1.96259e+07
1.9626e+07
1.9626e+07
1.9626e+07
1.96256e+07
1.96256e+07
1.96256e+07
1.96256e+07
1.96256e+07
1.96257e+07
1.96257e+07
1.96257e+07
1.96257e+07
1.96257e+07
1.96258e+07
1.96258e+07
1.96258e+07
1.96258e+07
1.96259e+07
1.96259e+07
1.96259e+07
1.96259e+07
1.96259e+07
1.9626e+07
1.96256e+07
1.96256e+07
1.96256e+07
1.96256e+07
1.96256e+07
1.96257e+07
1.96257e+07
1.96257e+07
1.96257e+07
1.96257e+07
1.96257e+07
1.96258e+07
1.96258e+07
1.96258e+07
1.96258e+07
1.96259e+07
1.96259e+07
1.96259e+07
1.96259e+07
1.96259e+07
1.96256e+07
1.96256e+07
1.96256e+07
1.96256e+07
1.96256e+07
1.96257e+07
1.96257e+07
1.96257e+07
1.96257e+07
1.96257e+07
1.96257e+07
1.96258e+07
1.96258e+07
1.96258e+07
1.96258e+07
1.96258e+07
1.96259e+07
1.96259e+07
1.96259e+07
1.96259e+07
1.9626e+07
1.96261e+07
1.96262e+07
1.96264e+07
1.96267e+07
1.96268e+07
1.96265e+07
1.96266e+07
1.96267e+07
1.96268e+07
1.96271e+07
1.96275e+07
1.96271e+07
1.96268e+07
1.96269e+07
1.96271e+07
1.96276e+07
1.96271e+07
1.96271e+07
1.96271e+07
1.96274e+07
1.96278e+07
1.96274e+07
1.96272e+07
1.96272e+07
1.96274e+07
1.96276e+07
1.96277e+07
1.96279e+07
1.9628e+07
1.96281e+07
1.96283e+07
1.96282e+07
1.96274e+07
1.9627e+07
1.96275e+07
1.9628e+07
1.96283e+07
1.96283e+07
1.96284e+07
1.96286e+07
1.96288e+07
1.96293e+07
1.96291e+07
1.96275e+07
1.96261e+07
1.96264e+07
1.96272e+07
1.96277e+07
1.9628e+07
1.9628e+07
1.96279e+07
1.9628e+07
1.96282e+07
1.96285e+07
1.96286e+07
1.96285e+07
1.96282e+07
1.96278e+07
1.96277e+07
1.96278e+07
1.96281e+07
1.96282e+07
1.96284e+07
1.96286e+07
1.96287e+07
1.96288e+07
1.96288e+07
1.96287e+07
1.96287e+07
1.96287e+07
1.96286e+07
1.96286e+07
1.96286e+07
1.96285e+07
1.96285e+07
1.96285e+07
1.96284e+07
1.96284e+07
1.96283e+07
1.96283e+07
1.96283e+07
1.96282e+07
1.96282e+07
1.96281e+07
1.96281e+07
1.9628e+07
1.9628e+07
1.96279e+07
1.96279e+07
1.96278e+07
1.96278e+07
1.96277e+07
1.96277e+07
1.96276e+07
1.96276e+07
1.96275e+07
1.96275e+07
1.96274e+07
1.96273e+07
1.96273e+07
1.96272e+07
1.96272e+07
1.96271e+07
1.96271e+07
1.9627e+07
1.96269e+07
1.96269e+07
1.96268e+07
1.96268e+07
1.96267e+07
1.96266e+07
1.96266e+07
1.96265e+07
1.96264e+07
1.96264e+07
1.96263e+07
1.96262e+07
1.96262e+07
1.96261e+07
1.9626e+07
1.9626e+07
1.96259e+07
1.96258e+07
1.96258e+07
1.96257e+07
1.96256e+07
1.96255e+07
1.96255e+07
1.96254e+07
1.96253e+07
1.96252e+07
1.96252e+07
1.96251e+07
1.9625e+07
1.96249e+07
1.96249e+07
1.96248e+07
1.96247e+07
1.96246e+07
1.96246e+07
1.96245e+07
1.96244e+07
1.96243e+07
1.96242e+07
1.96242e+07
1.96241e+07
1.9624e+07
1.96239e+07
1.96238e+07
1.96238e+07
1.96237e+07
1.96236e+07
1.96235e+07
1.96234e+07
1.96233e+07
1.96233e+07
1.96232e+07
1.96231e+07
1.9623e+07
1.96229e+07
1.96228e+07
1.96227e+07
1.96227e+07
1.96226e+07
1.96225e+07
1.96224e+07
1.96223e+07
1.96222e+07
1.96221e+07
1.9622e+07
1.9622e+07
1.96219e+07
1.96218e+07
1.96217e+07
1.96216e+07
1.96215e+07
1.96214e+07
1.96213e+07
1.96212e+07
1.96211e+07
1.9621e+07
1.96209e+07
1.96208e+07
1.96207e+07
1.96206e+07
1.96205e+07
1.96204e+07
1.96203e+07
1.96202e+07
1.96201e+07
1.962e+07
1.96199e+07
1.96198e+07
1.96197e+07
1.96196e+07
1.96194e+07
1.96193e+07
1.96192e+07
1.96191e+07
1.9619e+07
1.96189e+07
1.96187e+07
1.96186e+07
1.96185e+07
1.96184e+07
1.96182e+07
1.96181e+07
1.9618e+07
1.96179e+07
1.96177e+07
1.96176e+07
1.96175e+07
1.96174e+07
1.96172e+07
1.96171e+07
1.9617e+07
1.96168e+07
1.96167e+07
1.96166e+07
1.96164e+07
1.96163e+07
1.96162e+07
1.9616e+07
1.96159e+07
1.96158e+07
1.96156e+07
1.96155e+07
1.96154e+07
1.96152e+07
1.96151e+07
1.9615e+07
1.96149e+07
1.96147e+07
1.96146e+07
1.96145e+07
1.96143e+07
1.96142e+07
1.96141e+07
1.96139e+07
1.96138e+07
1.96137e+07
1.96135e+07
1.96134e+07
1.96133e+07
1.96131e+07
1.9613e+07
1.96128e+07
1.96127e+07
1.96126e+07
1.96124e+07
1.96123e+07
1.96121e+07
1.9612e+07
1.96118e+07
1.96117e+07
1.96115e+07
1.96113e+07
1.96112e+07
1.9611e+07
1.96109e+07
1.96107e+07
1.96105e+07
1.96104e+07
1.96102e+07
1.961e+07
1.96098e+07
1.96097e+07
1.96095e+07
1.96093e+07
1.96091e+07
1.96089e+07
1.96087e+07
1.96086e+07
1.96084e+07
1.96082e+07
1.9608e+07
1.96078e+07
1.96076e+07
1.96074e+07
1.96072e+07
1.9607e+07
1.96068e+07
1.96066e+07
1.96064e+07
1.96062e+07
1.9606e+07
1.96058e+07
1.96056e+07
1.96054e+07
1.96051e+07
1.96049e+07
1.96047e+07
1.96045e+07
1.96043e+07
1.9604e+07
1.96038e+07
1.96036e+07
1.96033e+07
1.96031e+07
1.96029e+07
1.96026e+07
1.96024e+07
1.96021e+07
1.96018e+07
1.96016e+07
1.96013e+07
1.96011e+07
1.96008e+07
1.96005e+07
1.96002e+07
1.95999e+07
1.95997e+07
1.95994e+07
1.95991e+07
1.95988e+07
1.95984e+07
1.95981e+07
1.95978e+07
1.95975e+07
1.95972e+07
1.95968e+07
1.95965e+07
1.95961e+07
1.95958e+07
1.95954e+07
1.95951e+07
1.95947e+07
1.95943e+07
1.9594e+07
1.95936e+07
1.95932e+07
1.95928e+07
1.95924e+07
1.9592e+07
1.95916e+07
1.95911e+07
1.95907e+07
1.95903e+07
1.95898e+07
1.95894e+07
1.95889e+07
1.95885e+07
1.9588e+07
1.95875e+07
1.95871e+07
1.95866e+07
1.95861e+07
1.95856e+07
1.95851e+07
1.95846e+07
1.95841e+07
1.95836e+07
1.9583e+07
1.95825e+07
1.9582e+07
1.95814e+07
1.95809e+07
1.95803e+07
1.95798e+07
1.95792e+07
1.95787e+07
1.95781e+07
1.95775e+07
1.9577e+07
1.95764e+07
1.95758e+07
1.95752e+07
1.95746e+07
1.9574e+07
1.95734e+07
1.95728e+07
1.95723e+07
1.95717e+07
1.95711e+07
1.95705e+07
1.95699e+07
1.95692e+07
1.95686e+07
1.9568e+07
1.95674e+07
1.95668e+07
1.95662e+07
1.95656e+07
1.9565e+07
1.95644e+07
1.95638e+07
1.95632e+07
1.95626e+07
1.9562e+07
1.95614e+07
1.95608e+07
1.95602e+07
1.95596e+07
1.9559e+07
1.95584e+07
1.95578e+07
1.95572e+07
1.95566e+07
1.95561e+07
1.95555e+07
1.95549e+07
1.95543e+07
1.95538e+07
1.95532e+07
1.95526e+07
1.95521e+07
1.95515e+07
1.95509e+07
1.95504e+07
1.95498e+07
1.95493e+07
1.95488e+07
1.95482e+07
1.95477e+07
1.95472e+07
1.95467e+07
1.95461e+07
1.95456e+07
1.95451e+07
1.95446e+07
1.95441e+07
1.95436e+07
1.95432e+07
1.95427e+07
1.95422e+07
1.95417e+07
1.95413e+07
1.95408e+07
1.95404e+07
1.95399e+07
1.95395e+07
1.95391e+07
1.95386e+07
1.95382e+07
1.95378e+07
1.95374e+07
1.95369e+07
1.95365e+07
1.95361e+07
1.95357e+07
1.95354e+07
1.9535e+07
1.95346e+07
1.95342e+07
1.95338e+07
1.95334e+07
1.95331e+07
1.95327e+07
1.95323e+07
1.9532e+07
1.95316e+07
1.95313e+07
1.95309e+07
1.95306e+07
1.95302e+07
1.95299e+07
1.95296e+07
1.95292e+07
1.95289e+07
1.95285e+07
1.95282e+07
1.95279e+07
1.95275e+07
1.95272e+07
1.95269e+07
1.95266e+07
1.95262e+07
1.95259e+07
1.95256e+07
1.95253e+07
1.95249e+07
1.95246e+07
1.95243e+07
1.9524e+07
1.95237e+07
1.95233e+07
1.9523e+07
1.95227e+07
1.95224e+07
1.9522e+07
1.95217e+07
1.95214e+07
1.95211e+07
1.95207e+07
1.95204e+07
1.95201e+07
1.95198e+07
1.95194e+07
1.95191e+07
1.95188e+07
1.95184e+07
1.95181e+07
1.95177e+07
1.95174e+07
1.9517e+07
1.95167e+07
1.95163e+07
1.9516e+07
1.95156e+07
1.95153e+07
1.95149e+07
1.95145e+07
1.95142e+07
1.95138e+07
1.95134e+07
1.9513e+07
1.95126e+07
1.95123e+07
1.95119e+07
1.95115e+07
1.95111e+07
1.95107e+07
1.95103e+07
1.95098e+07
1.95094e+07
1.9509e+07
1.95086e+07
1.95081e+07
1.95077e+07
1.95073e+07
1.95068e+07
1.95064e+07
1.95059e+07
1.95055e+07
1.9505e+07
1.95045e+07
1.95041e+07
1.95036e+07
1.95031e+07
1.95026e+07
1.95021e+07
1.95016e+07
1.95011e+07
1.95006e+07
1.95001e+07
1.94996e+07
1.94991e+07
1.94985e+07
1.9498e+07
1.94975e+07
1.94969e+07
1.94964e+07
1.94958e+07
1.94953e+07
1.94947e+07
1.94942e+07
1.94936e+07
1.9493e+07
1.94924e+07
1.94919e+07
1.94913e+07
1.94907e+07
1.94901e+07
1.94895e+07
1.94889e+07
1.94883e+07
1.94877e+07
1.94871e+07
1.94865e+07
1.94859e+07
1.94853e+07
1.94847e+07
1.94841e+07
1.94835e+07
1.94829e+07
1.94823e+07
1.94816e+07
1.9481e+07
1.94804e+07
1.94798e+07
1.94792e+07
1.94786e+07
1.94779e+07
1.94773e+07
1.94767e+07
1.94761e+07
1.94755e+07
1.94749e+07
1.94742e+07
1.94736e+07
1.9473e+07
1.94724e+07
1.94718e+07
1.94711e+07
1.94705e+07
1.94699e+07
1.94693e+07
1.94687e+07
1.94681e+07
1.94674e+07
1.94668e+07
1.94662e+07
1.94656e+07
1.9465e+07
1.94644e+07
1.94638e+07
1.94631e+07
1.94625e+07
1.94619e+07
1.9626e+07
1.96261e+07
1.96262e+07
1.96264e+07
1.96267e+07
1.96268e+07
1.96265e+07
1.96266e+07
1.96267e+07
1.96268e+07
1.96271e+07
1.96275e+07
1.96271e+07
1.96268e+07
1.96269e+07
1.96271e+07
1.96276e+07
1.96271e+07
1.96271e+07
1.96271e+07
1.96274e+07
1.96278e+07
1.96274e+07
1.96272e+07
1.96272e+07
1.96274e+07
1.96276e+07
1.96277e+07
1.96279e+07
1.9628e+07
1.96281e+07
1.96283e+07
1.96282e+07
1.96274e+07
1.9627e+07
1.96275e+07
1.9628e+07
1.96283e+07
1.96282e+07
1.96284e+07
1.96286e+07
1.96288e+07
1.96293e+07
1.96291e+07
1.96275e+07
1.96261e+07
1.96264e+07
1.96272e+07
1.96277e+07
1.96279e+07
1.9628e+07
1.96279e+07
1.9628e+07
1.96282e+07
1.96285e+07
1.96286e+07
1.96285e+07
1.96282e+07
1.96278e+07
1.96277e+07
1.96278e+07
1.96281e+07
1.96282e+07
1.96284e+07
1.96286e+07
1.96287e+07
1.96288e+07
1.96288e+07
1.96287e+07
1.96287e+07
1.96287e+07
1.96286e+07
1.96286e+07
1.96286e+07
1.96285e+07
1.96285e+07
1.96285e+07
1.96284e+07
1.96284e+07
1.96283e+07
1.96283e+07
1.96283e+07
1.96282e+07
1.96282e+07
1.96281e+07
1.96281e+07
1.9628e+07
1.9628e+07
1.96279e+07
1.96279e+07
1.96278e+07
1.96278e+07
1.96277e+07
1.96277e+07
1.96276e+07
1.96276e+07
1.96275e+07
1.96275e+07
1.96274e+07
1.96273e+07
1.96273e+07
1.96272e+07
1.96272e+07
1.96271e+07
1.96271e+07
1.9627e+07
1.96269e+07
1.96269e+07
1.96268e+07
1.96268e+07
1.96267e+07
1.96266e+07
1.96266e+07
1.96265e+07
1.96264e+07
1.96264e+07
1.96263e+07
1.96262e+07
1.96262e+07
1.96261e+07
1.9626e+07
1.9626e+07
1.96259e+07
1.96258e+07
1.96258e+07
1.96257e+07
1.96256e+07
1.96255e+07
1.96255e+07
1.96254e+07
1.96253e+07
1.96252e+07
1.96252e+07
1.96251e+07
1.9625e+07
1.96249e+07
1.96249e+07
1.96248e+07
1.96247e+07
1.96246e+07
1.96246e+07
1.96245e+07
1.96244e+07
1.96243e+07
1.96242e+07
1.96242e+07
1.96241e+07
1.9624e+07
1.96239e+07
1.96238e+07
1.96238e+07
1.96237e+07
1.96236e+07
1.96235e+07
1.96234e+07
1.96233e+07
1.96233e+07
1.96232e+07
1.96231e+07
1.9623e+07
1.96229e+07
1.96228e+07
1.96227e+07
1.96227e+07
1.96226e+07
1.96225e+07
1.96224e+07
1.96223e+07
1.96222e+07
1.96221e+07
1.9622e+07
1.9622e+07
1.96219e+07
1.96218e+07
1.96217e+07
1.96216e+07
1.96215e+07
1.96214e+07
1.96213e+07
1.96212e+07
1.96211e+07
1.9621e+07
1.96209e+07
1.96208e+07
1.96207e+07
1.96206e+07
1.96205e+07
1.96204e+07
1.96203e+07
1.96202e+07
1.96201e+07
1.962e+07
1.96199e+07
1.96198e+07
1.96197e+07
1.96196e+07
1.96194e+07
1.96193e+07
1.96192e+07
1.96191e+07
1.9619e+07
1.96189e+07
1.96187e+07
1.96186e+07
1.96185e+07
1.96184e+07
1.96182e+07
1.96181e+07
1.9618e+07
1.96179e+07
1.96177e+07
1.96176e+07
1.96175e+07
1.96174e+07
1.96172e+07
1.96171e+07
1.9617e+07
1.96168e+07
1.96167e+07
1.96166e+07
1.96164e+07
1.96163e+07
1.96162e+07
1.9616e+07
1.96159e+07
1.96158e+07
1.96156e+07
1.96155e+07
1.96154e+07
1.96152e+07
1.96151e+07
1.9615e+07
1.96149e+07
1.96147e+07
1.96146e+07
1.96145e+07
1.96143e+07
1.96142e+07
1.96141e+07
1.96139e+07
1.96138e+07
1.96137e+07
1.96135e+07
1.96134e+07
1.96133e+07
1.96131e+07
1.9613e+07
1.96128e+07
1.96127e+07
1.96126e+07
1.96124e+07
1.96123e+07
1.96121e+07
1.9612e+07
1.96118e+07
1.96117e+07
1.96115e+07
1.96113e+07
1.96112e+07
1.9611e+07
1.96109e+07
1.96107e+07
1.96105e+07
1.96104e+07
1.96102e+07
1.961e+07
1.96098e+07
1.96097e+07
1.96095e+07
1.96093e+07
1.96091e+07
1.96089e+07
1.96087e+07
1.96086e+07
1.96084e+07
1.96082e+07
1.9608e+07
1.96078e+07
1.96076e+07
1.96074e+07
1.96072e+07
1.9607e+07
1.96068e+07
1.96066e+07
1.96064e+07
1.96062e+07
1.9606e+07
1.96058e+07
1.96056e+07
1.96054e+07
1.96051e+07
1.96049e+07
1.96047e+07
1.96045e+07
1.96043e+07
1.9604e+07
1.96038e+07
1.96036e+07
1.96033e+07
1.96031e+07
1.96029e+07
1.96026e+07
1.96024e+07
1.96021e+07
1.96018e+07
1.96016e+07
1.96013e+07
1.96011e+07
1.96008e+07
1.96005e+07
1.96002e+07
1.95999e+07
1.95997e+07
1.95994e+07
1.95991e+07
1.95988e+07
1.95984e+07
1.95981e+07
1.95978e+07
1.95975e+07
1.95972e+07
1.95968e+07
1.95965e+07
1.95961e+07
1.95958e+07
1.95954e+07
1.95951e+07
1.95947e+07
1.95943e+07
1.9594e+07
1.95936e+07
1.95932e+07
1.95928e+07
1.95924e+07
1.9592e+07
1.95916e+07
1.95911e+07
1.95907e+07
1.95903e+07
1.95898e+07
1.95894e+07
1.95889e+07
1.95885e+07
1.9588e+07
1.95875e+07
1.95871e+07
1.95866e+07
1.95861e+07
1.95856e+07
1.95851e+07
1.95846e+07
1.95841e+07
1.95836e+07
1.9583e+07
1.95825e+07
1.9582e+07
1.95814e+07
1.95809e+07
1.95803e+07
1.95798e+07
1.95792e+07
1.95787e+07
1.95781e+07
1.95775e+07
1.9577e+07
1.95764e+07
1.95758e+07
1.95752e+07
1.95746e+07
1.9574e+07
1.95734e+07
1.95728e+07
1.95723e+07
1.95717e+07
1.95711e+07
1.95705e+07
1.95699e+07
1.95692e+07
1.95686e+07
1.9568e+07
1.95674e+07
1.95668e+07
1.95662e+07
1.95656e+07
1.9565e+07
1.95644e+07
1.95638e+07
1.95632e+07
1.95626e+07
1.9562e+07
1.95614e+07
1.95608e+07
1.95602e+07
1.95596e+07
1.9559e+07
1.95584e+07
1.95578e+07
1.95572e+07
1.95566e+07
1.95561e+07
1.95555e+07
1.95549e+07
1.95543e+07
1.95538e+07
1.95532e+07
1.95526e+07
1.95521e+07
1.95515e+07
1.95509e+07
1.95504e+07
1.95498e+07
1.95493e+07
1.95488e+07
1.95482e+07
1.95477e+07
1.95472e+07
1.95467e+07
1.95461e+07
1.95456e+07
1.95451e+07
1.95446e+07
1.95441e+07
1.95436e+07
1.95432e+07
1.95427e+07
1.95422e+07
1.95417e+07
1.95413e+07
1.95408e+07
1.95404e+07
1.95399e+07
1.95395e+07
1.95391e+07
1.95386e+07
1.95382e+07
1.95378e+07
1.95374e+07
1.95369e+07
1.95365e+07
1.95361e+07
1.95357e+07
1.95354e+07
1.9535e+07
1.95346e+07
1.95342e+07
1.95338e+07
1.95334e+07
1.95331e+07
1.95327e+07
1.95323e+07
1.9532e+07
1.95316e+07
1.95313e+07
1.95309e+07
1.95306e+07
1.95302e+07
1.95299e+07
1.95296e+07
1.95292e+07
1.95289e+07
1.95285e+07
1.95282e+07
1.95279e+07
1.95275e+07
1.95272e+07
1.95269e+07
1.95266e+07
1.95262e+07
1.95259e+07
1.95256e+07
1.95253e+07
1.95249e+07
1.95246e+07
1.95243e+07
1.9524e+07
1.95237e+07
1.95233e+07
1.9523e+07
1.95227e+07
1.95224e+07
1.9522e+07
1.95217e+07
1.95214e+07
1.95211e+07
1.95207e+07
1.95204e+07
1.95201e+07
1.95198e+07
1.95194e+07
1.95191e+07
1.95188e+07
1.95184e+07
1.95181e+07
1.95177e+07
1.95174e+07
1.9517e+07
1.95167e+07
1.95163e+07
1.9516e+07
1.95156e+07
1.95153e+07
1.95149e+07
1.95145e+07
1.95142e+07
1.95138e+07
1.95134e+07
1.9513e+07
1.95126e+07
1.95123e+07
1.95119e+07
1.95115e+07
1.95111e+07
1.95107e+07
1.95103e+07
1.95098e+07
1.95094e+07
1.9509e+07
1.95086e+07
1.95081e+07
1.95077e+07
1.95073e+07
1.95068e+07
1.95064e+07
1.95059e+07
1.95055e+07
1.9505e+07
1.95045e+07
1.95041e+07
1.95036e+07
1.95031e+07
1.95026e+07
1.95021e+07
1.95016e+07
1.95011e+07
1.95006e+07
1.95001e+07
1.94996e+07
1.94991e+07
1.94985e+07
1.9498e+07
1.94975e+07
1.94969e+07
1.94964e+07
1.94958e+07
1.94953e+07
1.94947e+07
1.94942e+07
1.94936e+07
1.9493e+07
1.94924e+07
1.94919e+07
1.94913e+07
1.94907e+07
1.94901e+07
1.94895e+07
1.94889e+07
1.94883e+07
1.94877e+07
1.94871e+07
1.94865e+07
1.94859e+07
1.94853e+07
1.94847e+07
1.94841e+07
1.94835e+07
1.94829e+07
1.94823e+07
1.94816e+07
1.9481e+07
1.94804e+07
1.94798e+07
1.94792e+07
1.94786e+07
1.94779e+07
1.94773e+07
1.94767e+07
1.94761e+07
1.94755e+07
1.94749e+07
1.94742e+07
1.94736e+07
1.9473e+07
1.94724e+07
1.94718e+07
1.94711e+07
1.94705e+07
1.94699e+07
1.94693e+07
1.94687e+07
1.94681e+07
1.94674e+07
1.94668e+07
1.94662e+07
1.94656e+07
1.9465e+07
1.94644e+07
1.94638e+07
1.94631e+07
1.94625e+07
1.94619e+07
1.9626e+07
1.96261e+07
1.96262e+07
1.96263e+07
1.96264e+07
1.96264e+07
1.96264e+07
1.96265e+07
1.96267e+07
1.96268e+07
1.96268e+07
1.96268e+07
1.96266e+07
1.96267e+07
1.96269e+07
1.9627e+07
1.9627e+07
1.96269e+07
1.9627e+07
1.96272e+07
1.96272e+07
1.96271e+07
1.9627e+07
1.96271e+07
1.96272e+07
1.96274e+07
1.96275e+07
1.96276e+07
1.96276e+07
1.96276e+07
1.96275e+07
1.96273e+07
1.96269e+07
1.96268e+07
1.9627e+07
1.96275e+07
1.96279e+07
1.96281e+07
1.96281e+07
1.9628e+07
1.96278e+07
1.96275e+07
1.96271e+07
1.96265e+07
1.96261e+07
1.96261e+07
1.96265e+07
1.96271e+07
1.96276e+07
1.96278e+07
1.96279e+07
1.96279e+07
1.96278e+07
1.96279e+07
1.96281e+07
1.96282e+07
1.9628e+07
1.96278e+07
1.96277e+07
1.96277e+07
1.96279e+07
1.96281e+07
1.96282e+07
1.96284e+07
1.96286e+07
1.96287e+07
1.96287e+07
1.96287e+07
1.96287e+07
1.96287e+07
1.96287e+07
1.96286e+07
1.96286e+07
1.96286e+07
1.96285e+07
1.96285e+07
1.96285e+07
1.96284e+07
1.96284e+07
1.96283e+07
1.96283e+07
1.96283e+07
1.96282e+07
1.96282e+07
1.96281e+07
1.96281e+07
1.9628e+07
1.9628e+07
1.96279e+07
1.96279e+07
1.96278e+07
1.96278e+07
1.96277e+07
1.96277e+07
1.96276e+07
1.96276e+07
1.96275e+07
1.96275e+07
1.96274e+07
1.96273e+07
1.96273e+07
1.96272e+07
1.96272e+07
1.96271e+07
1.96271e+07
1.9627e+07
1.96269e+07
1.96269e+07
1.96268e+07
1.96268e+07
1.96267e+07
1.96266e+07
1.96266e+07
1.96265e+07
1.96264e+07
1.96264e+07
1.96263e+07
1.96262e+07
1.96262e+07
1.96261e+07
1.9626e+07
1.9626e+07
1.96259e+07
1.96258e+07
1.96258e+07
1.96257e+07
1.96256e+07
1.96255e+07
1.96255e+07
1.96254e+07
1.96253e+07
1.96252e+07
1.96252e+07
1.96251e+07
1.9625e+07
1.96249e+07
1.96249e+07
1.96248e+07
1.96247e+07
1.96246e+07
1.96246e+07
1.96245e+07
1.96244e+07
1.96243e+07
1.96242e+07
1.96242e+07
1.96241e+07
1.9624e+07
1.96239e+07
1.96238e+07
1.96238e+07
1.96237e+07
1.96236e+07
1.96235e+07
1.96234e+07
1.96233e+07
1.96233e+07
1.96232e+07
1.96231e+07
1.9623e+07
1.96229e+07
1.96228e+07
1.96227e+07
1.96227e+07
1.96226e+07
1.96225e+07
1.96224e+07
1.96223e+07
1.96222e+07
1.96221e+07
1.9622e+07
1.9622e+07
1.96219e+07
1.96218e+07
1.96217e+07
1.96216e+07
1.96215e+07
1.96214e+07
1.96213e+07
1.96212e+07
1.96211e+07
1.9621e+07
1.96209e+07
1.96208e+07
1.96207e+07
1.96206e+07
1.96205e+07
1.96204e+07
1.96203e+07
1.96202e+07
1.96201e+07
1.962e+07
1.96199e+07
1.96198e+07
1.96197e+07
1.96196e+07
1.96194e+07
1.96193e+07
1.96192e+07
1.96191e+07
1.9619e+07
1.96189e+07
1.96187e+07
1.96186e+07
1.96185e+07
1.96184e+07
1.96182e+07
1.96181e+07
1.9618e+07
1.96179e+07
1.96177e+07
1.96176e+07
1.96175e+07
1.96174e+07
1.96172e+07
1.96171e+07
1.9617e+07
1.96168e+07
1.96167e+07
1.96166e+07
1.96164e+07
1.96163e+07
1.96162e+07
1.9616e+07
1.96159e+07
1.96158e+07
1.96156e+07
1.96155e+07
1.96154e+07
1.96152e+07
1.96151e+07
1.9615e+07
1.96149e+07
1.96147e+07
1.96146e+07
1.96145e+07
1.96143e+07
1.96142e+07
1.96141e+07
1.96139e+07
1.96138e+07
1.96137e+07
1.96135e+07
1.96134e+07
1.96133e+07
1.96131e+07
1.9613e+07
1.96128e+07
1.96127e+07
1.96126e+07
1.96124e+07
1.96123e+07
1.96121e+07
1.9612e+07
1.96118e+07
1.96117e+07
1.96115e+07
1.96113e+07
1.96112e+07
1.9611e+07
1.96109e+07
1.96107e+07
1.96105e+07
1.96104e+07
1.96102e+07
1.961e+07
1.96098e+07
1.96097e+07
1.96095e+07
1.96093e+07
1.96091e+07
1.96089e+07
1.96087e+07
1.96086e+07
1.96084e+07
1.96082e+07
1.9608e+07
1.96078e+07
1.96076e+07
1.96074e+07
1.96072e+07
1.9607e+07
1.96068e+07
1.96066e+07
1.96064e+07
1.96062e+07
1.9606e+07
1.96058e+07
1.96056e+07
1.96054e+07
1.96051e+07
1.96049e+07
1.96047e+07
1.96045e+07
1.96043e+07
1.9604e+07
1.96038e+07
1.96036e+07
1.96033e+07
1.96031e+07
1.96029e+07
1.96026e+07
1.96024e+07
1.96021e+07
1.96018e+07
1.96016e+07
1.96013e+07
1.96011e+07
1.96008e+07
1.96005e+07
1.96002e+07
1.95999e+07
1.95997e+07
1.95994e+07
1.95991e+07
1.95988e+07
1.95984e+07
1.95981e+07
1.95978e+07
1.95975e+07
1.95972e+07
1.95968e+07
1.95965e+07
1.95961e+07
1.95958e+07
1.95954e+07
1.95951e+07
1.95947e+07
1.95943e+07
1.9594e+07
1.95936e+07
1.95932e+07
1.95928e+07
1.95924e+07
1.9592e+07
1.95916e+07
1.95911e+07
1.95907e+07
1.95903e+07
1.95898e+07
1.95894e+07
1.95889e+07
1.95885e+07
1.9588e+07
1.95875e+07
1.95871e+07
1.95866e+07
1.95861e+07
1.95856e+07
1.95851e+07
1.95846e+07
1.95841e+07
1.95836e+07
1.9583e+07
1.95825e+07
1.9582e+07
1.95814e+07
1.95809e+07
1.95803e+07
1.95798e+07
1.95792e+07
1.95787e+07
1.95781e+07
1.95775e+07
1.9577e+07
1.95764e+07
1.95758e+07
1.95752e+07
1.95746e+07
1.9574e+07
1.95734e+07
1.95728e+07
1.95723e+07
1.95717e+07
1.95711e+07
1.95705e+07
1.95699e+07
1.95692e+07
1.95686e+07
1.9568e+07
1.95674e+07
1.95668e+07
1.95662e+07
1.95656e+07
1.9565e+07
1.95644e+07
1.95638e+07
1.95632e+07
1.95626e+07
1.9562e+07
1.95614e+07
1.95608e+07
1.95602e+07
1.95596e+07
1.9559e+07
1.95584e+07
1.95578e+07
1.95572e+07
1.95566e+07
1.95561e+07
1.95555e+07
1.95549e+07
1.95543e+07
1.95538e+07
1.95532e+07
1.95526e+07
1.95521e+07
1.95515e+07
1.95509e+07
1.95504e+07
1.95498e+07
1.95493e+07
1.95488e+07
1.95482e+07
1.95477e+07
1.95472e+07
1.95467e+07
1.95461e+07
1.95456e+07
1.95451e+07
1.95446e+07
1.95441e+07
1.95436e+07
1.95432e+07
1.95427e+07
1.95422e+07
1.95417e+07
1.95413e+07
1.95408e+07
1.95404e+07
1.95399e+07
1.95395e+07
1.95391e+07
1.95386e+07
1.95382e+07
1.95378e+07
1.95374e+07
1.95369e+07
1.95365e+07
1.95361e+07
1.95357e+07
1.95354e+07
1.9535e+07
1.95346e+07
1.95342e+07
1.95338e+07
1.95334e+07
1.95331e+07
1.95327e+07
1.95323e+07
1.9532e+07
1.95316e+07
1.95313e+07
1.95309e+07
1.95306e+07
1.95302e+07
1.95299e+07
1.95296e+07
1.95292e+07
1.95289e+07
1.95285e+07
1.95282e+07
1.95279e+07
1.95275e+07
1.95272e+07
1.95269e+07
1.95266e+07
1.95262e+07
1.95259e+07
1.95256e+07
1.95253e+07
1.95249e+07
1.95246e+07
1.95243e+07
1.9524e+07
1.95237e+07
1.95233e+07
1.9523e+07
1.95227e+07
1.95224e+07
1.9522e+07
1.95217e+07
1.95214e+07
1.95211e+07
1.95207e+07
1.95204e+07
1.95201e+07
1.95198e+07
1.95194e+07
1.95191e+07
1.95188e+07
1.95184e+07
1.95181e+07
1.95177e+07
1.95174e+07
1.9517e+07
1.95167e+07
1.95163e+07
1.9516e+07
1.95156e+07
1.95153e+07
1.95149e+07
1.95145e+07
1.95142e+07
1.95138e+07
1.95134e+07
1.9513e+07
1.95126e+07
1.95123e+07
1.95119e+07
1.95115e+07
1.95111e+07
1.95107e+07
1.95103e+07
1.95098e+07
1.95094e+07
1.9509e+07
1.95086e+07
1.95081e+07
1.95077e+07
1.95073e+07
1.95068e+07
1.95064e+07
1.95059e+07
1.95055e+07
1.9505e+07
1.95045e+07
1.95041e+07
1.95036e+07
1.95031e+07
1.95026e+07
1.95021e+07
1.95016e+07
1.95011e+07
1.95006e+07
1.95001e+07
1.94996e+07
1.94991e+07
1.94985e+07
1.9498e+07
1.94975e+07
1.94969e+07
1.94964e+07
1.94958e+07
1.94953e+07
1.94947e+07
1.94942e+07
1.94936e+07
1.9493e+07
1.94924e+07
1.94919e+07
1.94913e+07
1.94907e+07
1.94901e+07
1.94895e+07
1.94889e+07
1.94883e+07
1.94877e+07
1.94871e+07
1.94865e+07
1.94859e+07
1.94853e+07
1.94847e+07
1.94841e+07
1.94835e+07
1.94829e+07
1.94823e+07
1.94816e+07
1.9481e+07
1.94804e+07
1.94798e+07
1.94792e+07
1.94786e+07
1.94779e+07
1.94773e+07
1.94767e+07
1.94761e+07
1.94755e+07
1.94749e+07
1.94742e+07
1.94736e+07
1.9473e+07
1.94724e+07
1.94718e+07
1.94711e+07
1.94705e+07
1.94699e+07
1.94693e+07
1.94687e+07
1.94681e+07
1.94674e+07
1.94668e+07
1.94662e+07
1.94656e+07
1.9465e+07
1.94644e+07
1.94638e+07
1.94631e+07
1.94625e+07
1.94619e+07
1.9626e+07
1.96261e+07
1.96262e+07
1.96262e+07
1.96263e+07
1.96263e+07
1.96264e+07
1.96265e+07
1.96266e+07
1.96267e+07
1.96267e+07
1.96266e+07
1.96266e+07
1.96267e+07
1.96269e+07
1.96269e+07
1.96268e+07
1.96268e+07
1.9627e+07
1.96271e+07
1.96271e+07
1.9627e+07
1.96269e+07
1.9627e+07
1.96272e+07
1.96274e+07
1.96275e+07
1.96275e+07
1.96275e+07
1.96275e+07
1.96273e+07
1.96271e+07
1.9627e+07
1.96269e+07
1.96271e+07
1.96275e+07
1.96278e+07
1.96278e+07
1.96278e+07
1.96276e+07
1.96274e+07
1.96272e+07
1.96269e+07
1.96267e+07
1.96263e+07
1.96263e+07
1.96266e+07
1.96271e+07
1.96275e+07
1.96277e+07
1.96278e+07
1.96277e+07
1.96278e+07
1.9628e+07
1.96282e+07
1.96282e+07
1.96279e+07
1.96278e+07
1.96277e+07
1.96278e+07
1.96279e+07
1.96281e+07
1.96283e+07
1.96284e+07
1.96286e+07
1.96287e+07
1.96287e+07
1.96287e+07
1.96287e+07
1.96287e+07
1.96287e+07
1.96286e+07
1.96286e+07
1.96286e+07
1.96285e+07
1.96285e+07
1.96285e+07
1.96284e+07
1.96284e+07
1.96283e+07
1.96283e+07
1.96283e+07
1.96282e+07
1.96282e+07
1.96281e+07
1.96281e+07
1.9628e+07
1.9628e+07
1.96279e+07
1.96279e+07
1.96278e+07
1.96278e+07
1.96277e+07
1.96277e+07
1.96276e+07
1.96276e+07
1.96275e+07
1.96275e+07
1.96274e+07
1.96273e+07
1.96273e+07
1.96272e+07
1.96272e+07
1.96271e+07
1.96271e+07
1.9627e+07
1.96269e+07
1.96269e+07
1.96268e+07
1.96268e+07
1.96267e+07
1.96266e+07
1.96266e+07
1.96265e+07
1.96264e+07
1.96264e+07
1.96263e+07
1.96262e+07
1.96262e+07
1.96261e+07
1.9626e+07
1.9626e+07
1.96259e+07
1.96258e+07
1.96258e+07
1.96257e+07
1.96256e+07
1.96255e+07
1.96255e+07
1.96254e+07
1.96253e+07
1.96252e+07
1.96252e+07
1.96251e+07
1.9625e+07
1.96249e+07
1.96249e+07
1.96248e+07
1.96247e+07
1.96246e+07
1.96246e+07
1.96245e+07
1.96244e+07
1.96243e+07
1.96242e+07
1.96242e+07
1.96241e+07
1.9624e+07
1.96239e+07
1.96238e+07
1.96238e+07
1.96237e+07
1.96236e+07
1.96235e+07
1.96234e+07
1.96233e+07
1.96233e+07
1.96232e+07
1.96231e+07
1.9623e+07
1.96229e+07
1.96228e+07
1.96227e+07
1.96227e+07
1.96226e+07
1.96225e+07
1.96224e+07
1.96223e+07
1.96222e+07
1.96221e+07
1.9622e+07
1.9622e+07
1.96219e+07
1.96218e+07
1.96217e+07
1.96216e+07
1.96215e+07
1.96214e+07
1.96213e+07
1.96212e+07
1.96211e+07
1.9621e+07
1.96209e+07
1.96208e+07
1.96207e+07
1.96206e+07
1.96205e+07
1.96204e+07
1.96203e+07
1.96202e+07
1.96201e+07
1.962e+07
1.96199e+07
1.96198e+07
1.96197e+07
1.96196e+07
1.96194e+07
1.96193e+07
1.96192e+07
1.96191e+07
1.9619e+07
1.96189e+07
1.96187e+07
1.96186e+07
1.96185e+07
1.96184e+07
1.96182e+07
1.96181e+07
1.9618e+07
1.96179e+07
1.96177e+07
1.96176e+07
1.96175e+07
1.96174e+07
1.96172e+07
1.96171e+07
1.9617e+07
1.96168e+07
1.96167e+07
1.96166e+07
1.96164e+07
1.96163e+07
1.96162e+07
1.9616e+07
1.96159e+07
1.96158e+07
1.96156e+07
1.96155e+07
1.96154e+07
1.96152e+07
1.96151e+07
1.9615e+07
1.96149e+07
1.96147e+07
1.96146e+07
1.96145e+07
1.96143e+07
1.96142e+07
1.96141e+07
1.96139e+07
1.96138e+07
1.96137e+07
1.96135e+07
1.96134e+07
1.96133e+07
1.96131e+07
1.9613e+07
1.96128e+07
1.96127e+07
1.96126e+07
1.96124e+07
1.96123e+07
1.96121e+07
1.9612e+07
1.96118e+07
1.96117e+07
1.96115e+07
1.96113e+07
1.96112e+07
1.9611e+07
1.96109e+07
1.96107e+07
1.96105e+07
1.96104e+07
1.96102e+07
1.961e+07
1.96098e+07
1.96097e+07
1.96095e+07
1.96093e+07
1.96091e+07
1.96089e+07
1.96087e+07
1.96086e+07
1.96084e+07
1.96082e+07
1.9608e+07
1.96078e+07
1.96076e+07
1.96074e+07
1.96072e+07
1.9607e+07
1.96068e+07
1.96066e+07
1.96064e+07
1.96062e+07
1.9606e+07
1.96058e+07
1.96056e+07
1.96054e+07
1.96051e+07
1.96049e+07
1.96047e+07
1.96045e+07
1.96043e+07
1.9604e+07
1.96038e+07
1.96036e+07
1.96033e+07
1.96031e+07
1.96029e+07
1.96026e+07
1.96024e+07
1.96021e+07
1.96018e+07
1.96016e+07
1.96013e+07
1.96011e+07
1.96008e+07
1.96005e+07
1.96002e+07
1.95999e+07
1.95997e+07
1.95994e+07
1.95991e+07
1.95988e+07
1.95984e+07
1.95981e+07
1.95978e+07
1.95975e+07
1.95972e+07
1.95968e+07
1.95965e+07
1.95961e+07
1.95958e+07
1.95954e+07
1.95951e+07
1.95947e+07
1.95943e+07
1.9594e+07
1.95936e+07
1.95932e+07
1.95928e+07
1.95924e+07
1.9592e+07
1.95916e+07
1.95911e+07
1.95907e+07
1.95903e+07
1.95898e+07
1.95894e+07
1.95889e+07
1.95885e+07
1.9588e+07
1.95875e+07
1.95871e+07
1.95866e+07
1.95861e+07
1.95856e+07
1.95851e+07
1.95846e+07
1.95841e+07
1.95836e+07
1.9583e+07
1.95825e+07
1.9582e+07
1.95814e+07
1.95809e+07
1.95803e+07
1.95798e+07
1.95792e+07
1.95787e+07
1.95781e+07
1.95775e+07
1.9577e+07
1.95764e+07
1.95758e+07
1.95752e+07
1.95746e+07
1.9574e+07
1.95734e+07
1.95728e+07
1.95723e+07
1.95717e+07
1.95711e+07
1.95705e+07
1.95699e+07
1.95692e+07
1.95686e+07
1.9568e+07
1.95674e+07
1.95668e+07
1.95662e+07
1.95656e+07
1.9565e+07
1.95644e+07
1.95638e+07
1.95632e+07
1.95626e+07
1.9562e+07
1.95614e+07
1.95608e+07
1.95602e+07
1.95596e+07
1.9559e+07
1.95584e+07
1.95578e+07
1.95572e+07
1.95566e+07
1.95561e+07
1.95555e+07
1.95549e+07
1.95543e+07
1.95538e+07
1.95532e+07
1.95526e+07
1.95521e+07
1.95515e+07
1.95509e+07
1.95504e+07
1.95498e+07
1.95493e+07
1.95488e+07
1.95482e+07
1.95477e+07
1.95472e+07
1.95467e+07
1.95461e+07
1.95456e+07
1.95451e+07
1.95446e+07
1.95441e+07
1.95436e+07
1.95432e+07
1.95427e+07
1.95422e+07
1.95417e+07
1.95413e+07
1.95408e+07
1.95404e+07
1.95399e+07
1.95395e+07
1.95391e+07
1.95386e+07
1.95382e+07
1.95378e+07
1.95374e+07
1.95369e+07
1.95365e+07
1.95361e+07
1.95357e+07
1.95354e+07
1.9535e+07
1.95346e+07
1.95342e+07
1.95338e+07
1.95334e+07
1.95331e+07
1.95327e+07
1.95323e+07
1.9532e+07
1.95316e+07
1.95313e+07
1.95309e+07
1.95306e+07
1.95302e+07
1.95299e+07
1.95296e+07
1.95292e+07
1.95289e+07
1.95285e+07
1.95282e+07
1.95279e+07
1.95275e+07
1.95272e+07
1.95269e+07
1.95266e+07
1.95262e+07
1.95259e+07
1.95256e+07
1.95253e+07
1.95249e+07
1.95246e+07
1.95243e+07
1.9524e+07
1.95237e+07
1.95233e+07
1.9523e+07
1.95227e+07
1.95224e+07
1.9522e+07
1.95217e+07
1.95214e+07
1.95211e+07
1.95207e+07
1.95204e+07
1.95201e+07
1.95198e+07
1.95194e+07
1.95191e+07
1.95188e+07
1.95184e+07
1.95181e+07
1.95177e+07
1.95174e+07
1.9517e+07
1.95167e+07
1.95163e+07
1.9516e+07
1.95156e+07
1.95153e+07
1.95149e+07
1.95145e+07
1.95142e+07
1.95138e+07
1.95134e+07
1.9513e+07
1.95126e+07
1.95123e+07
1.95119e+07
1.95115e+07
1.95111e+07
1.95107e+07
1.95103e+07
1.95098e+07
1.95094e+07
1.9509e+07
1.95086e+07
1.95081e+07
1.95077e+07
1.95073e+07
1.95068e+07
1.95064e+07
1.95059e+07
1.95055e+07
1.9505e+07
1.95045e+07
1.95041e+07
1.95036e+07
1.95031e+07
1.95026e+07
1.95021e+07
1.95016e+07
1.95011e+07
1.95006e+07
1.95001e+07
1.94996e+07
1.94991e+07
1.94985e+07
1.9498e+07
1.94975e+07
1.94969e+07
1.94964e+07
1.94958e+07
1.94953e+07
1.94947e+07
1.94942e+07
1.94936e+07
1.9493e+07
1.94924e+07
1.94919e+07
1.94913e+07
1.94907e+07
1.94901e+07
1.94895e+07
1.94889e+07
1.94883e+07
1.94877e+07
1.94871e+07
1.94865e+07
1.94859e+07
1.94853e+07
1.94847e+07
1.94841e+07
1.94835e+07
1.94829e+07
1.94823e+07
1.94816e+07
1.9481e+07
1.94804e+07
1.94798e+07
1.94792e+07
1.94786e+07
1.94779e+07
1.94773e+07
1.94767e+07
1.94761e+07
1.94755e+07
1.94749e+07
1.94742e+07
1.94736e+07
1.9473e+07
1.94724e+07
1.94718e+07
1.94711e+07
1.94705e+07
1.94699e+07
1.94693e+07
1.94687e+07
1.94681e+07
1.94674e+07
1.94668e+07
1.94662e+07
1.94656e+07
1.9465e+07
1.94644e+07
1.94638e+07
1.94631e+07
1.94625e+07
1.94619e+07
1.9626e+07
1.96261e+07
1.96262e+07
1.96262e+07
1.96263e+07
1.96263e+07
1.96264e+07
1.96265e+07
1.96266e+07
1.96267e+07
1.96267e+07
1.96266e+07
1.96266e+07
1.96267e+07
1.96269e+07
1.96269e+07
1.96268e+07
1.96268e+07
1.9627e+07
1.96271e+07
1.96271e+07
1.9627e+07
1.96269e+07
1.9627e+07
1.96272e+07
1.96274e+07
1.96275e+07
1.96275e+07
1.96275e+07
1.96275e+07
1.96273e+07
1.96271e+07
1.9627e+07
1.96269e+07
1.96271e+07
1.96275e+07
1.96278e+07
1.96278e+07
1.96278e+07
1.96276e+07
1.96274e+07
1.96271e+07
1.96269e+07
1.96267e+07
1.96263e+07
1.96263e+07
1.96266e+07
1.96271e+07
1.96275e+07
1.96277e+07
1.96278e+07
1.96277e+07
1.96278e+07
1.9628e+07
1.96282e+07
1.96282e+07
1.96279e+07
1.96278e+07
1.96277e+07
1.96278e+07
1.96279e+07
1.96281e+07
1.96283e+07
1.96284e+07
1.96286e+07
1.96287e+07
1.96287e+07
1.96287e+07
1.96287e+07
1.96287e+07
1.96287e+07
1.96286e+07
1.96286e+07
1.96286e+07
1.96285e+07
1.96285e+07
1.96285e+07
1.96284e+07
1.96284e+07
1.96283e+07
1.96283e+07
1.96283e+07
1.96282e+07
1.96282e+07
1.96281e+07
1.96281e+07
1.9628e+07
1.9628e+07
1.96279e+07
1.96279e+07
1.96278e+07
1.96278e+07
1.96277e+07
1.96277e+07
1.96276e+07
1.96276e+07
1.96275e+07
1.96275e+07
1.96274e+07
1.96273e+07
1.96273e+07
1.96272e+07
1.96272e+07
1.96271e+07
1.96271e+07
1.9627e+07
1.96269e+07
1.96269e+07
1.96268e+07
1.96268e+07
1.96267e+07
1.96266e+07
1.96266e+07
1.96265e+07
1.96264e+07
1.96264e+07
1.96263e+07
1.96262e+07
1.96262e+07
1.96261e+07
1.9626e+07
1.9626e+07
1.96259e+07
1.96258e+07
1.96258e+07
1.96257e+07
1.96256e+07
1.96255e+07
1.96255e+07
1.96254e+07
1.96253e+07
1.96252e+07
1.96252e+07
1.96251e+07
1.9625e+07
1.96249e+07
1.96249e+07
1.96248e+07
1.96247e+07
1.96246e+07
1.96246e+07
1.96245e+07
1.96244e+07
1.96243e+07
1.96242e+07
1.96242e+07
1.96241e+07
1.9624e+07
1.96239e+07
1.96238e+07
1.96238e+07
1.96237e+07
1.96236e+07
1.96235e+07
1.96234e+07
1.96233e+07
1.96233e+07
1.96232e+07
1.96231e+07
1.9623e+07
1.96229e+07
1.96228e+07
1.96227e+07
1.96227e+07
1.96226e+07
1.96225e+07
1.96224e+07
1.96223e+07
1.96222e+07
1.96221e+07
1.9622e+07
1.9622e+07
1.96219e+07
1.96218e+07
1.96217e+07
1.96216e+07
1.96215e+07
1.96214e+07
1.96213e+07
1.96212e+07
1.96211e+07
1.9621e+07
1.96209e+07
1.96208e+07
1.96207e+07
1.96206e+07
1.96205e+07
1.96204e+07
1.96203e+07
1.96202e+07
1.96201e+07
1.962e+07
1.96199e+07
1.96198e+07
1.96197e+07
1.96196e+07
1.96194e+07
1.96193e+07
1.96192e+07
1.96191e+07
1.9619e+07
1.96189e+07
1.96187e+07
1.96186e+07
1.96185e+07
1.96184e+07
1.96182e+07
1.96181e+07
1.9618e+07
1.96179e+07
1.96177e+07
1.96176e+07
1.96175e+07
1.96174e+07
1.96172e+07
1.96171e+07
1.9617e+07
1.96168e+07
1.96167e+07
1.96166e+07
1.96164e+07
1.96163e+07
1.96162e+07
1.9616e+07
1.96159e+07
1.96158e+07
1.96156e+07
1.96155e+07
1.96154e+07
1.96152e+07
1.96151e+07
1.9615e+07
1.96149e+07
1.96147e+07
1.96146e+07
1.96145e+07
1.96143e+07
1.96142e+07
1.96141e+07
1.96139e+07
1.96138e+07
1.96137e+07
1.96135e+07
1.96134e+07
1.96133e+07
1.96131e+07
1.9613e+07
1.96128e+07
1.96127e+07
1.96126e+07
1.96124e+07
1.96123e+07
1.96121e+07
1.9612e+07
1.96118e+07
1.96117e+07
1.96115e+07
1.96113e+07
1.96112e+07
1.9611e+07
1.96109e+07
1.96107e+07
1.96105e+07
1.96104e+07
1.96102e+07
1.961e+07
1.96098e+07
1.96097e+07
1.96095e+07
1.96093e+07
1.96091e+07
1.96089e+07
1.96087e+07
1.96086e+07
1.96084e+07
1.96082e+07
1.9608e+07
1.96078e+07
1.96076e+07
1.96074e+07
1.96072e+07
1.9607e+07
1.96068e+07
1.96066e+07
1.96064e+07
1.96062e+07
1.9606e+07
1.96058e+07
1.96056e+07
1.96054e+07
1.96051e+07
1.96049e+07
1.96047e+07
1.96045e+07
1.96043e+07
1.9604e+07
1.96038e+07
1.96036e+07
1.96033e+07
1.96031e+07
1.96029e+07
1.96026e+07
1.96024e+07
1.96021e+07
1.96018e+07
1.96016e+07
1.96013e+07
1.96011e+07
1.96008e+07
1.96005e+07
1.96002e+07
1.95999e+07
1.95997e+07
1.95994e+07
1.95991e+07
1.95988e+07
1.95984e+07
1.95981e+07
1.95978e+07
1.95975e+07
1.95972e+07
1.95968e+07
1.95965e+07
1.95961e+07
1.95958e+07
1.95954e+07
1.95951e+07
1.95947e+07
1.95943e+07
1.9594e+07
1.95936e+07
1.95932e+07
1.95928e+07
1.95924e+07
1.9592e+07
1.95916e+07
1.95911e+07
1.95907e+07
1.95903e+07
1.95898e+07
1.95894e+07
1.95889e+07
1.95885e+07
1.9588e+07
1.95875e+07
1.95871e+07
1.95866e+07
1.95861e+07
1.95856e+07
1.95851e+07
1.95846e+07
1.95841e+07
1.95836e+07
1.9583e+07
1.95825e+07
1.9582e+07
1.95814e+07
1.95809e+07
1.95803e+07
1.95798e+07
1.95792e+07
1.95787e+07
1.95781e+07
1.95775e+07
1.9577e+07
1.95764e+07
1.95758e+07
1.95752e+07
1.95746e+07
1.9574e+07
1.95734e+07
1.95728e+07
1.95723e+07
1.95717e+07
1.95711e+07
1.95705e+07
1.95699e+07
1.95692e+07
1.95686e+07
1.9568e+07
1.95674e+07
1.95668e+07
1.95662e+07
1.95656e+07
1.9565e+07
1.95644e+07
1.95638e+07
1.95632e+07
1.95626e+07
1.9562e+07
1.95614e+07
1.95608e+07
1.95602e+07
1.95596e+07
1.9559e+07
1.95584e+07
1.95578e+07
1.95572e+07
1.95566e+07
1.95561e+07
1.95555e+07
1.95549e+07
1.95543e+07
1.95538e+07
1.95532e+07
1.95526e+07
1.95521e+07
1.95515e+07
1.95509e+07
1.95504e+07
1.95498e+07
1.95493e+07
1.95488e+07
1.95482e+07
1.95477e+07
1.95472e+07
1.95467e+07
1.95461e+07
1.95456e+07
1.95451e+07
1.95446e+07
1.95441e+07
1.95436e+07
1.95432e+07
1.95427e+07
1.95422e+07
1.95417e+07
1.95413e+07
1.95408e+07
1.95404e+07
1.95399e+07
1.95395e+07
1.95391e+07
1.95386e+07
1.95382e+07
1.95378e+07
1.95374e+07
1.95369e+07
1.95365e+07
1.95361e+07
1.95357e+07
1.95354e+07
1.9535e+07
1.95346e+07
1.95342e+07
1.95338e+07
1.95334e+07
1.95331e+07
1.95327e+07
1.95323e+07
1.9532e+07
1.95316e+07
1.95313e+07
1.95309e+07
1.95306e+07
1.95302e+07
1.95299e+07
1.95296e+07
1.95292e+07
1.95289e+07
1.95285e+07
1.95282e+07
1.95279e+07
1.95275e+07
1.95272e+07
1.95269e+07
1.95266e+07
1.95262e+07
1.95259e+07
1.95256e+07
1.95253e+07
1.95249e+07
1.95246e+07
1.95243e+07
1.9524e+07
1.95237e+07
1.95233e+07
1.9523e+07
1.95227e+07
1.95224e+07
1.9522e+07
1.95217e+07
1.95214e+07
1.95211e+07
1.95207e+07
1.95204e+07
1.95201e+07
1.95198e+07
1.95194e+07
1.95191e+07
1.95188e+07
1.95184e+07
1.95181e+07
1.95177e+07
1.95174e+07
1.9517e+07
1.95167e+07
1.95163e+07
1.9516e+07
1.95156e+07
1.95153e+07
1.95149e+07
1.95145e+07
1.95142e+07
1.95138e+07
1.95134e+07
1.9513e+07
1.95126e+07
1.95123e+07
1.95119e+07
1.95115e+07
1.95111e+07
1.95107e+07
1.95103e+07
1.95098e+07
1.95094e+07
1.9509e+07
1.95086e+07
1.95081e+07
1.95077e+07
1.95073e+07
1.95068e+07
1.95064e+07
1.95059e+07
1.95055e+07
1.9505e+07
1.95045e+07
1.95041e+07
1.95036e+07
1.95031e+07
1.95026e+07
1.95021e+07
1.95016e+07
1.95011e+07
1.95006e+07
1.95001e+07
1.94996e+07
1.94991e+07
1.94985e+07
1.9498e+07
1.94975e+07
1.94969e+07
1.94964e+07
1.94958e+07
1.94953e+07
1.94947e+07
1.94942e+07
1.94936e+07
1.9493e+07
1.94924e+07
1.94919e+07
1.94913e+07
1.94907e+07
1.94901e+07
1.94895e+07
1.94889e+07
1.94883e+07
1.94877e+07
1.94871e+07
1.94865e+07
1.94859e+07
1.94853e+07
1.94847e+07
1.94841e+07
1.94835e+07
1.94829e+07
1.94823e+07
1.94816e+07
1.9481e+07
1.94804e+07
1.94798e+07
1.94792e+07
1.94786e+07
1.94779e+07
1.94773e+07
1.94767e+07
1.94761e+07
1.94755e+07
1.94749e+07
1.94742e+07
1.94736e+07
1.9473e+07
1.94724e+07
1.94718e+07
1.94711e+07
1.94705e+07
1.94699e+07
1.94693e+07
1.94687e+07
1.94681e+07
1.94674e+07
1.94668e+07
1.94662e+07
1.94656e+07
1.9465e+07
1.94644e+07
1.94638e+07
1.94631e+07
1.94625e+07
1.94619e+07
)
;
boundaryField
{
inlet
{
type zeroGradient;
}
outlet
{
type uniformTotalPressure;
rho none;
psi none;
gamma 1.4364;
pressure tableFile;
pressureCoeffs
{
fileName "$FOAM_RUN/SH5_43mps_MFR_newBC/outlet0.2_42.7mps_fromCapture.dat";
}
value nonuniform List<scalar> 5(1.94616e+07 1.94616e+07 1.94616e+07 1.94616e+07 1.94616e+07);
}
sides
{
type empty;
}
walls
{
type zeroGradient;
}
}
// ************************************************************************* //
| |
99a96696a56c2cde8671ae6e622d20e4ea43818d | 21202e11fc8de460cf602fbb5bedc760ea147dec | /src/MusicFrame.cpp | 50e9f81b13fa0a8091090c27eeb4b2747c600305 | [] | no_license | the-iron-ryan/Dance-LED-Setup | 59f9894363b023e11bd77e79a7c2281449046908 | 98d75b705751ef2b6b470fb046c890b040c88d7d | refs/heads/master | 2020-08-06T08:19:09.431444 | 2020-04-17T06:41:15 | 2020-04-17T06:41:15 | 212,904,772 | 0 | 1 | null | null | null | null | UTF-8 | C++ | false | false | 1,221 | cpp | MusicFrame.cpp | #include "MusicFrame.h"
MusicFrame::MusicFrame(long tick):
creationTick(tick),
creationTime(millis())
{
// Cycle reset pin
digitalWrite(MusicFrame::RESET_PIN, HIGH);
digitalWrite(MusicFrame::RESET_PIN, LOW);
for(int band = 0; band < MusicFrame::NUM_CHANNELS; band++)
{
digitalWrite(MusicFrame::STROBE_PIN, LOW); // strobe pin on the shield - kicks the IC up to the next band
delayMicroseconds(50); // Delay for allow voltage to adjust
// Update channel entries using left/right inputs
channels[band] = max(analogRead(MusicFrame::AUDIO1_PIN), // left
analogRead(MusicFrame::AUDIO2_PIN)); // right
// Reset the strobe pin to high volt
digitalWrite(MusicFrame::STROBE_PIN, HIGH);
}
energyLevel = 0;
for (int i = 0; i < MusicFrame::NUM_CHANNELS; i++)
energyLevel += channels[i];
}
void MusicFrame::log() const
{
Serial.print(creationTick);
Serial.print(',');
Serial.print(creationTime);
for (int i = 0; i < G_NUM_CHANNELS; i++)
{
Serial.print(',');
Serial.print(channels[i]);
}
Serial.print("\t || \t");
Serial.println(this->energyLevel);
} |
8c0e08707d6f1482354c8047cc6bed707a68003b | 6337f084a414c60836c6a5c735e8d38a27b7af6d | /CS3-0.4/CS3/CS3/3.Comm/Comm.cpp | 801b8407c0323ebef0146f34248b2f8b052ff2ca | [] | no_license | banzhiyan007/CS3_Command | bd987b6ec5f360a8e589adf8aa9d00a10eb01342 | 82d24ed799d8a7efbf9a08c349795b180f812d47 | refs/heads/master | 2021-07-19T13:15:27.209143 | 2017-10-24T05:07:09 | 2017-10-24T05:07:09 | 108,078,709 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 1,250 | cpp | Comm.cpp | #include <mbed.h>
#include "comm.h"
#define FIFO_RX_COMM_SIZE 1024
#define FIFO_TX_COMM_SIZE 512
COMM *comm;
Fifo *fifo_tx_comm;
Fifo *fifo_rx_comm;
REG_BUFFER(FIFO_TX_COMM,fifo_tx_comm,"RX");
REG_BUFFER(FIFO_RX_COMM,fifo_rx_comm,"TX");
VAR_REG_U32(OS_INFO_SEND,OS_INFO_SEND,0,"OS_INFO_SEND");
extern Thread *os_info_thread;
extern void (*os_info_task_write)(char *,int);
extern int os_info_send_info;
static void thread_comm(const void *p)
{
uint8_t data[128];
int len;
while(1)
{
if(os_info_send_info)
{
os_info(os_info_task_write);
os_info_send_info=0;
OS_INFO_SEND=1;
}
if(comm->active_channel!=COMM::CHANNEL_NULL)
{
if(comm->active_timer.read_ms()>3000)
{
comm->active_channel=COMM::CHANNEL_NULL;
fifo_tx_comm=comm->fifo_tx;
}
}
if(comm->active_channel!=COMM::CHANNEL_NULL)
{
while((len=comm->fifo_tx->read(data,sizeof(data)))>0)
{
comm->tx(data,len);
}
}
wait_ms(1);
}
}
COMM::COMM()
{
tx=NULL;
fifo_rx=new Fifo(FIFO_RX_COMM_SIZE);
fifo_tx=new Fifo(FIFO_TX_COMM_SIZE);
fifo_rx_comm=fifo_rx;
fifo_tx_comm=fifo_tx;
os_info_thread=new Thread("Comm Tx",thread_comm,NULL,osPriorityLow,768);
}
static void init_comm(void)
{
comm=new COMM;
}
INIT_CALL("3",init_comm);
|
8e416b766e72c0e6aac3410d96f3c91f67a4f18c | b58a98748d8874ec3e70280a27a26df458940a39 | /dbms/include/DB/DataStreams/JSONEachRowRowOutputStream.h | 6ca1b33563f53bceec5c71c0fbe1912d192fd6a1 | [
"Apache-2.0"
] | permissive | Har01d/ClickHouse | b11eb072e15065dd2c4b9c3a8cbcf982982469c9 | 5081d192eece26611b1acac37658c07ec2d9d553 | refs/heads/master | 2021-01-22T20:34:51.876304 | 2016-08-17T03:24:26 | 2016-08-17T03:24:26 | 65,872,059 | 3 | 1 | null | 2016-08-17T03:24:26 | 2016-08-17T03:12:40 | C++ | UTF-8 | C++ | false | false | 778 | h | JSONEachRowRowOutputStream.h | #pragma once
#include <DB/Core/Block.h>
#include <DB/IO/WriteBuffer.h>
#include <DB/DataStreams/IRowOutputStream.h>
namespace DB
{
/** Поток для вывода данных в формате JSON, по объекту на каждую строчку.
* Не валидирует UTF-8.
*/
class JSONEachRowRowOutputStream : public IRowOutputStream
{
public:
JSONEachRowRowOutputStream(WriteBuffer & ostr_, const Block & sample);
void writeField(const IColumn & column, const IDataType & type, size_t row_num) override;
void writeFieldDelimiter() override;
void writeRowStartDelimiter() override;
void writeRowEndDelimiter() override;
void flush() override
{
ostr.next();
}
private:
WriteBuffer & ostr;
size_t field_number = 0;
Names fields;
};
}
|
4324b80a7191696b35eb00bd468040ced4d7f138 | af1e9266459d033fffc77dbfa9b6b05951fb9436 | /ETv2/Payload.cpp | 7df8761a2aeac658009d1f7ca41299719016f0cc | [] | no_license | Team-Firebugs/icarus | 81b966c92bf96e298c65c4cff9abd10fedb75d62 | 1567e1e45a3cca174c79151bee4680742d4aaf6c | refs/heads/master | 2021-05-26T22:40:36.666307 | 2013-06-09T08:48:19 | 2013-06-09T08:48:19 | null | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 3,688 | cpp | Payload.cpp | /*
Copyright (C) 2013 George Nicolaou <george[at]preaver.[dot]com>
Copyright (C) 2013 Glafkos Charalambous <glafkos[at]gmail.[dot]com>
This file is part of Exploitation Toolkit Icarus (ETI) Library.
Exploitation Toolkit Icarus (ETI) Library 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 3 of the License,
or (at your option) any later version.
Exploitation Toolkit Icarus (ETI) Library is distributed in the hope that it
will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with Exploitation Toolkit Icarus (ETI) Library.
If not, see <http://www.gnu.org/licenses/>.
*/
#include "Payload.h"
#include <stdlib.h>
Payload::Payload(void)
{
this->lpsPayload = NULL;
}
Payload::~Payload(void)
{
}
char * Payload::get_payload( void )
{
return NULL;
}
BOOL Payload::append_addresses_payload( int nSize, vector<Address *> * vAddresses )
{
PAYLOAD_ELEMENT * lpsPayloadElement = NULL;
if( ( lpsPayloadElement = (PAYLOAD_ELEMENT *)calloc( 1,
sizeof( PAYLOAD_ELEMENT ) ) ) == NULL ) {
dprintflvl( 1, "Unable to allocate space for payload" );
return FALSE;
}
lpsPayloadElement->nSize = nSize;
lpsPayloadElement->eType = PAYLOAD_ADDRESS_MULTIPLE;
lpsPayloadElement->u.vPayloadAddresses = vAddresses;
ll_push_back( lpsPayloadElement );
}
BOOL Payload::append_payload( PAYLOAD_ELEMENT_TYPE eType, int nSize,
unsigned char * lpucContents, unsigned char * lpucRestrictedChars )
{
PAYLOAD_ELEMENT * lpsPayloadElement = NULL;
if( ( lpsPayloadElement = (PAYLOAD_ELEMENT *)calloc( 1,
sizeof( PAYLOAD_ELEMENT ) ) ) == NULL ) {
dprintflvl( 1, "Unable to allocate space for payload" );
return FALSE;
}
lpsPayloadElement->nSize = nSize;
lpsPayloadElement->eType = eType;
//if( eType == PAYLOAD_ADDRESS_MULTIPLE ) {
//lpsPayloadElement->u.lpucContentsArray = (unsigned char **)lpucContents;
//}
//else {
lpsPayloadElement->u.lpucContents = lpucContents;
//}
lpsPayloadElement->lpucRestrictedChars = lpucRestrictedChars;
ll_push_back( lpsPayloadElement );
}
void Payload::ll_push_back( PAYLOAD_ELEMENT * lpsElement )
{
if( this->lpsPayload == NULL ) {
this->lpsPayload = lpsElement;
this->lpsPayload->lpsNext = NULL;
this->lpsPayload->lpsPrev = NULL;
return;
}
PAYLOAD_ELEMENT * lpsCurrElement = this->lpsPayload;
while( lpsCurrElement->lpsNext != NULL ) {
lpsCurrElement = lpsCurrElement->lpsNext;
}
lpsCurrElement->lpsNext = lpsElement;
lpsElement->lpsPrev = lpsCurrElement;
return;
}
PAYLOAD_ELEMENT * Payload::get_head_element(void)
{
return this->lpsPayload;
}
BOOL Payload::remove_element( PAYLOAD_ELEMENT * lpsRemoveElement )
{
if( lpsRemoveElement == NULL ) return FALSE;
PAYLOAD_ELEMENT * lpsCurrElement = this->lpsPayload;
if( lpsCurrElement == NULL ) return FALSE;
do {
if( lpsCurrElement == lpsRemoveElement ) {
if( lpsCurrElement->lpsPrev == NULL ) {
if( lpsCurrElement->lpsNext != NULL ) {
this->lpsPayload = lpsCurrElement->lpsNext;
}
else {
this->lpsPayload = NULL;
}
free( lpsCurrElement );
return TRUE;
}
lpsCurrElement->lpsPrev->lpsNext = lpsCurrElement->lpsNext;
if( lpsCurrElement->lpsNext != NULL ) {
lpsCurrElement->lpsNext->lpsPrev = lpsCurrElement->lpsPrev;
}
free( lpsCurrElement );
return TRUE;
}
lpsCurrElement = lpsCurrElement->lpsNext;
} while( lpsCurrElement != NULL );
return FALSE;
} |
d0a56962f3e2386de027b46b774c97f5bb6654ac | e795cb7558f89846d2c1c68be877a4454a09f596 | /response/response.cpp | 75e2dc39c6dcda76cce1c87ecc8006422ba69d0e | [] | no_license | VGB-Devs/velocity-server | e2ff01e6c9f43957f8e94d05b2d23a2bf19e3dc1 | 72a2b775cda81c8517207b91b882f30cc1f14288 | refs/heads/main | 2023-02-05T16:01:17.512825 | 2020-12-30T02:23:55 | 2020-12-30T02:23:55 | 324,659,412 | 1 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 1,605 | cpp | response.cpp | #include <iostream>
#include <fstream>
#include <string>
#include <sys/socket.h>
#include <unistd.h>
#include "../include/response/Response.hpp"
Response::Response(int socketID) {
this->response = "";
this->bytes = "";
this->_data = "";
this->_status = "200";
this->_contentType = "text/plain";
this->fileData = "";
this->socketID = socketID;
}
std::string Response::data(std::string data) {
this->bytes = std::to_string(data.length());
this->_data = data;
return this->_data;
}
std::string Response::status(int code) {
this->_status = std::to_string(code);
return this->_status;
}
std::string Response::contentType(std::string type) {
this->_contentType = type;
return this->_contentType;
}
std::string Response::sendFile(std::string file) {
std::string line;
std::fstream target;
target.open(file, std::ios::in);
std::string tmp = "";
if(!target) { tmp = "cannot find file"; this->_status="404"; }
while(std::getline(target, line)) {
tmp += line + "\n";
}
target.close();
this->bytes = std::to_string(tmp.length());
this->_data = tmp;
return this->_data;
}
std::string Response::build() {
// TODO log to console;
this->response = "HTTP/1.1 " + this->_status + " OK\nContent-Type: " + this->_contentType + "\nContent-Length:" + this->bytes + "\n\n" + this->_data;
write(this->socketID, this->response.c_str(), this->response.length());
close(this->socketID);
return this->response;
} |
1a4a909e644c3ade7dc3e16c63d89859d4f6c629 | a75ee16dd583f16b97c0165d08e5ce8ca208ed01 | /FG_GP_C_Asteroids/PlayerCollider.h | 0a2a49fb1782858795b656690faf1277d023f310 | [] | no_license | FutureGamesTony/FG_GP_C_Asteroids | 881809a8438227297866b6e8998c0736e39fdab2 | 29ff3228aa3eba04570644415cca90f6891e6542 | refs/heads/main | 2023-04-04T05:11:38.306390 | 2021-03-14T19:07:48 | 2021-03-14T19:07:48 | 341,156,841 | 0 | 0 | null | 2021-03-02T09:42:31 | 2021-02-22T10:09:19 | C | UTF-8 | C++ | false | false | 1,077 | h | PlayerCollider.h | #pragma once
#include "ICollider.h"
#include "EngingConfig.h"
class PlayerCollider : public ICollider
{
public:// LazyFoo
PlayerCollider(EngineConfig::EntityType entity_type, Size size, Position setPosition, Movement setMovement, SDL_Rect* collider);
~PlayerCollider();
//Initializes the variables
void CreateCollider(EngineConfig::EntityType entity_type, Size size, Position setPosition, Movement setMovement, SDL_Rect* collider, Circle circleCollider) override;
//Takes key presses and adjusts the square's velocity
void handle_input();
//Moves the square
void move();
//Shows the square on the screen
void show();
Size GetSize();
private:
Size SetSize();
SDL_Rect box;
//The velocity of the square
int xVel, yVel;
Circle cirle;
// Inherited via ICollider
Position SetColliderPosition(Position colliderPosition) override;
Size GetCollider() override;
Position GetPosition() override;
virtual bool HasCollided() override;
virtual bool Collision(bool collision) override;
};
|
e4029664cc20ed21374d56642641ae587a74d3d6 | 6ffcfa84dd43ede1c25b162dc0a98663b7e56243 | /mlir/lib/Dialect/Linalg/Transforms/Detensorize.cpp | 2e2e3b94a34a91e3d0633c06c05be3dc6e923b6f | [
"LLVM-exception",
"Apache-2.0"
] | permissive | c3lang/llvm-project | afbef29e8b570fe82cc87f19eef57da8d877ef09 | 393b7a1e0306927dcd54cb9f6c7939251da4d266 | refs/heads/main | 2023-03-09T19:07:31.737607 | 2021-03-02T12:29:31 | 2021-03-02T12:34:54 | 343,720,178 | 1 | 0 | null | 2021-03-02T09:39:50 | 2021-03-02T09:39:50 | null | UTF-8 | C++ | false | false | 6,471 | cpp | Detensorize.cpp | //===- Detensorize.cpp - Linalg transformations as patterns ----------===//
//
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
// See https://llvm.org/LICENSE.txt for license information.
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
//
//===----------------------------------------------------------------------===//
#include "PassDetail.h"
#include "mlir/Dialect/Linalg/IR/LinalgOps.h"
#include "mlir/Dialect/Linalg/IR/LinalgTypes.h"
#include "mlir/Dialect/Linalg/Passes.h"
#include "mlir/Dialect/StandardOps/Transforms/FuncConversions.h"
#include "mlir/Dialect/Tensor/IR/Tensor.h"
#include "mlir/IR/OpDefinition.h"
#include "mlir/Transforms/DialectConversion.h"
#include "mlir/Transforms/GreedyPatternRewriteDriver.h"
#include <iterator>
#include <memory>
using namespace mlir;
using namespace mlir::linalg;
namespace {
/// Defines the criteria a TensorType must follow in order to be considered
/// "detensorable".
///
/// NOTE: For now, only 0-D are supported.
///
/// Returns true if tensorType can be detensored.
bool canBeDetensored(TensorType tensorType) {
return tensorType.hasRank() && tensorType.getRank() == 0;
}
/// A conversion patttern for detensoring `linalg.generic` ops.
class DetensorizeGenericOp : public OpConversionPattern<GenericOp> {
public:
using OpConversionPattern::OpConversionPattern;
LogicalResult
matchAndRewrite(GenericOp op, ArrayRef<Value> operands,
ConversionPatternRewriter &rewriter) const override {
Block *originalBlock = op->getBlock();
// Gather some information about the op before inling its region.
Block *opEntryBlock = &*op.region().begin();
YieldOp yieldOp = dyn_cast<YieldOp>(op.region().back().getTerminator());
// Split the op's region before the op. This way, we have a clear insertion
// point in which the op can be inlined.
Block *newBlock = originalBlock->splitBlock(op);
rewriter.inlineRegionBefore(op.region(), newBlock);
// Now that op's region is inlined, the operands of its YieldOp are mapped
// to the materialized target values. Therefore, we can replace the op's
// uses with those of its YielOp's operands.
rewriter.replaceOp(op, yieldOp->getOperands());
// No need for these intermediate blocks, merge them into 1.
rewriter.mergeBlocks(opEntryBlock, originalBlock, operands);
rewriter.mergeBlocks(newBlock, originalBlock, {});
rewriter.eraseOp(&*Block::iterator(yieldOp));
return success();
}
};
class DetensorizeTypeConverter : public TypeConverter {
public:
DetensorizeTypeConverter() {
addConversion([](Type type) { return type; });
// A TensorType that can be detensored, is converted to the underlying
// element type.
addConversion([](TensorType tensorType) -> Type {
if (canBeDetensored(tensorType))
return tensorType.getElementType();
return tensorType;
});
// A tensor value is detensoried by extracting its element(s).
addTargetMaterialization([](OpBuilder &builder, Type type,
ValueRange inputs, Location loc) -> Value {
return builder.create<tensor::ExtractOp>(loc, inputs[0], ValueRange{});
});
// A detensored value is converted back by creating a new tensor from its
// element(s).
addSourceMaterialization([](OpBuilder &builder, Type type,
ValueRange inputs, Location loc) -> Value {
auto createNewTensorOp = builder.create<tensor::FromElementsOp>(
loc, inputs[0].getType(), inputs[0]);
// FromElementsOp results in a tensor<1xdtype>, we need to reshape that to
// a tensor<dtype> instead.
return builder.create<linalg::TensorReshapeOp>(
loc, type, createNewTensorOp, ArrayRef<ReassociationExprs>{});
});
}
};
/// Canonicalizes the pattern of the form
///
/// %tensor = tensor.from_elements(%element) : (i32) -> tensor<1xi32>
/// %reshaped_tensor = linalg.tensor_reshape %tensor [] : tensor<1xi32> into
/// tensor<i32>
/// %extracted_element = tensor.extract %reshaped_tensor[] : tensor<i32>
///
/// to just %element.
struct ExtractFromReshapeFromElements
: public OpRewritePattern<tensor::ExtractOp> {
using OpRewritePattern<tensor::ExtractOp>::OpRewritePattern;
LogicalResult matchAndRewrite(tensor::ExtractOp extract,
PatternRewriter &rewriter) const final {
if (extract.indices().size() != 0)
return failure();
auto tensorReshape = extract.tensor().getDefiningOp<TensorReshapeOp>();
if (tensorReshape == nullptr)
return failure();
auto tensorFromElements =
tensorReshape.getOperand()
.getDefiningOp<mlir::tensor::FromElementsOp>();
if (tensorFromElements == nullptr)
return failure();
rewriter.replaceOp(extract, tensorFromElements.getOperand(0));
return success();
}
};
/// @see LinalgDetensorize in Linalg/Passes.td for more details.
struct LinalgDetensorize : public LinalgDetensorizeBase<LinalgDetensorize> {
void runOnFunction() override {
auto *context = &getContext();
DetensorizeTypeConverter typeConverter;
OwningRewritePatternList patterns;
ConversionTarget target(*context);
target.markUnknownOpDynamicallyLegal([](Operation *op) { return true; });
target.addLegalDialect<linalg::LinalgDialect>();
target.addDynamicallyLegalOp<GenericOp>([&](GenericOp op) {
// If any of the operands or results cannot be detensored, the op is
// considered legal and won't be detensored.
return llvm::any_of(
op.getShapedOperandTypes(), [](ShapedType shapedType) {
assert(shapedType.isa<TensorType>());
return !canBeDetensored(shapedType.cast<TensorType>());
});
});
patterns.insert<DetensorizeGenericOp>(typeConverter, context);
if (failed(
applyPartialConversion(getFunction(), target, std::move(patterns))))
signalPassFailure();
OwningRewritePatternList canonPatterns;
canonPatterns.insert<ExtractFromReshapeFromElements>(context);
if (failed(applyPatternsAndFoldGreedily(getFunction(),
std::move(canonPatterns))))
signalPassFailure();
// TODO Properly handle control flow within function boundaries.
}
};
} // namespace
std::unique_ptr<Pass> mlir::createLinalgDetensorizePass() {
return std::make_unique<LinalgDetensorize>();
}
|
fb5e3e9e9a42092af72ecb0f527198366ab86b13 | 1aaaf8af0d720b00c03454cc105e3e99ebdd993b | /1502 [NOI2005]月下柠檬树(自适应Simpson).cpp | 071f2164553a26849d85abdf65ddb22075079c6a | [
"Apache-2.0"
] | permissive | wwt17/BZOJ | 2b6858fb68c3654a9c18861f1e3775c825e539fd | b8b41adf84cd91f68616149dcfdf374b9721b11c | refs/heads/master | 2021-01-20T17:26:29.071661 | 2018-10-02T17:02:35 | 2018-10-02T17:02:35 | 63,025,417 | 12 | 6 | null | null | null | null | UTF-8 | C++ | false | false | 1,630 | cpp | 1502 [NOI2005]月下柠檬树(自适应Simpson).cpp | #include <cstdio>
#include <cmath>
#include <algorithm>
using namespace std;
typedef double db;
#define sqr(x) ((x)*(x))
const int N=505;
const db eps=1e-6;
int n;
db alpha,tana,d[N],s[N],r[N];
struct tpz{
db x1,y1,x2,y2;
} t[N];
inline bool inside(int a,int b,db d){
return d+r[b]<=r[a];
}
inline db calc(db x){
db ans=0;
for(int i=0;i<=n;i++){
db dx2=sqr(x-s[i]),r2=sqr(r[i]);
if(dx2>=r2) continue;
ans=max(ans,sqrt(r2-dx2));
}
for(int i=1;i<=n;i++){
if(x<t[i].x1||t[i].x2<x) continue;
ans=max(ans,t[i].y1+(x-t[i].x1)*(t[i].y2-t[i].y1)/(t[i].x2-t[i].x1));
}
return ans;
}
db simpson(db l,db r,db mid,db vl,db vr,db vmid,db simp){
db midl=(l+mid)/2,midr=(mid+r)/2,
vmidl=calc(midl),vmidr=calc(midr),
simpl=(vl+4*vmidl+vmid)*(mid-l)/6,
simpr=(vmid+4*vmidr+vr)*(r-mid)/6;
return fabs(simp-simpl-simpr)<eps?simpl+simpr:
simpson(l,mid,midl,vl,vmid,vmidl,simpl)+
simpson(mid,r,midr,vmid,vr,vmidr,simpr);
}
int main(){
scanf("%d%lf",&n,&alpha);
tana=tan(alpha);
for(int i=0;i<=n;i++){
scanf("%lf",&d[i]);
d[i]/=tana;
s[i]=(i?s[i-1]:0)+d[i];
}
for(int i=0;i<n;i++)
scanf("%lf",&r[i]);
r[n]=0;
for(int i=1;i<=n;i++){
if(inside(i-1,i,d[i])||inside(i,i-1,d[i])) continue;
t[i].x1=s[i-1]+r[i-1]*(r[i-1]-r[i])/d[i];
t[i].y1=sqrt(sqr(r[i-1])-sqr(t[i].x1-s[i-1]));
t[i].x2=s[i]+r[i]*(r[i-1]-r[i])/d[i];
t[i].y2=sqrt(sqr(r[i])-sqr(t[i].x2-s[i]));
}
db a=s[0]-r[0],b=s[n]+r[n];
for(int i=0;i<=n;i++){
a=min(a,s[i]-r[i]);
b=max(b,s[i]+r[i]);
}
db mid=(a+b)/2,
vl=0,vr=0,vmid=calc(mid),
simp=(vl+4*vmid+vr)*(b-a)/6;
printf("%.2lf\n",2*simpson(a,b,mid,vl,vr,vmid,simp));
}
|
189002b1b5f436bf209e084d81c8b6d421173ad2 | eeca3a684c1bdd9c6457752d12c681b79a050348 | /QuickSort.cpp | 4a596c62d6ac99ca740e5692cc2c94388b4a6fab | [] | no_license | suliutree/Data-Struct-and-Algorithm | 3bd7613aaf9ad99451f26eebe60dda0fef991c3a | 99d1a1025115a80f24f3ee815a8f9dbcc9fe1305 | refs/heads/master | 2021-01-21T13:41:45.215578 | 2020-05-11T11:54:14 | 2020-05-11T11:54:14 | 38,430,333 | 2 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 860 | cpp | QuickSort.cpp | #include <iostream>
using namespace std;
int partition(int array[], int left, int right)
{
int pivot = array[right];
while (left != right)
{
while (array[left] <= pivot && left < right)
left++;
if (left < right)
swap(array[left], array[right--]);
while (array[right] >= pivot && left < right)
right--;
if (left < right)
swap(array[left++], array[right]);
}
return left;
}
void QuickSort(int array[], int left, int right)
{
if (left >= right)
return;
int index = partition(array, left, right);
QuickSort(array, left, index - 1);
QuickSort(array, index + 1, right);
}
int main()
{
int array[] = { 23, 10, 24, 6, 7, 29, 15, 35, -9};
int length = sizeof(array) / sizeof(array[0]);
QuickSort(array, 0, length-1);
for (int i = 0; i < length; ++i)
cout << array[i] << " ";
cout << endl;
system("pause");
return 0;
}
|
2e0bcab8014222ff7f892204faf25c610a2de760 | 4be3405a9b952e48a47fc4556a849f63a61f6821 | /HandleThread.hpp | 5b86e802c373b3dd06dc729fb2c5390418902553 | [] | no_license | sergeibulavintsev/ddmlib_old_project | 847b20ede2e34d944651a74716288b9c59fe65c3 | acc67a88b14c765bd4884f406f938fb514f61f6c | refs/heads/master | 2022-04-16T12:40:38.861155 | 2020-04-17T10:05:47 | 2020-04-17T10:05:47 | 256,467,293 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 4,150 | hpp | HandleThread.hpp | /*
* HandleThread.hpp
*
* Created on: Feb 16, 2012
* Author: sergey bulavintsev
*/
#ifndef HANDLETHREAD_HPP_
#define HANDLETHREAD_HPP_
#include "ddmlib.hpp"
#include "ChunkHandler.hpp"
class ByteBuffer;
namespace ddmlib {
class Client;
class DDMLIB_LOCAL HandleThread: public ChunkHandler {
public:
static int CHUNK_THEN;
static int CHUNK_THCR;
static int CHUNK_THDE;
static int CHUNK_THST;
static int CHUNK_THNM;
static int CHUNK_STKL;
HandleThread();
/**
* Register for the packets we expect to get from the client.
*/
static void registerInReactor();
/**
* Client is ready.
*/
void clientReady(std::tr1::shared_ptr<Client> client);
/**
* Client went away.
*/
void clientDisconnected(std::tr1::shared_ptr<Client> client) {
}
/**
* Chunk handler entry point.
*/
void handleChunk(std::tr1::shared_ptr<Client> client, int type, std::tr1::shared_ptr<ByteBuffer> data, bool isReply, int msgId);
/**
* Send a THEN (THread notification ENable) request to the client.
*/
static void sendTHEN(std::tr1::shared_ptr<Client> client, bool enable);
/**
* Send a STKL (STacK List) request to the client. The VM will suspend
* the target thread, obtain its stack, and return it. If the thread
* is no longer running, a failure result will be returned.
*/
static void sendSTKL(std::tr1::shared_ptr<Client> client, int threadId);
/**
* This is called periodically from the UI thread. To avoid locking
* the UI while we request the updates, we create a new thread.
*
*/
static void requestThreadUpdate(std::tr1::shared_ptr<Client> client);
static void requestThreadStackCallRefresh(std::tr1::shared_ptr<Client> client, int threadId);
virtual ~HandleThread();
class RequestThread: public Poco::Runnable {
public:
RequestThread(volatile bool* mThreadStatus);
void setClient(std::tr1::shared_ptr<Client> client);
void run();
private:
std::tr1::shared_ptr<Client> mClient;
volatile bool *m_pThreadStatusReqRunning;
};
class RequestThreadStack: public Poco::Runnable {
public:
RequestThreadStack(volatile bool *mThreadStackTrace);
void setClientAndTID(std::tr1::shared_ptr<Client> client, int tid);
void run();
private:
std::tr1::shared_ptr<Client> mClient;
volatile bool *m_pThreadStackTraceReqRunning;
int mThreadId;
};
private:
/*
* Handle a thread creation message.
*
* We should be tolerant of receiving a duplicate create message. (It
* shouldn't happen with the current implementation.)
*/
void handleTHCR(std::tr1::shared_ptr<Client> client, std::tr1::shared_ptr<ByteBuffer> data);
/*
* Handle a thread death message.
*/
void handleTHDE(std::tr1::shared_ptr<Client> client, std::tr1::shared_ptr<ByteBuffer> data) /*
* Handle a thread status update message.
*
* Response has:
* (1b) header len
* (1b) bytes per entry
* (2b) thread count
* Then, for each thread:
* (4b) threadId (matches value from THCR)
* (1b) thread status
* (4b) tid
* (4b) utime
* (4b) stime
*/;
void handleTHST(std::tr1::shared_ptr<Client> client, std::tr1::shared_ptr<ByteBuffer> data);
/*
* Handle a THNM (THread NaMe) message. We get one of these after
* somebody calls Thread.setName() on a running thread.
*/
void handleTHNM(std::tr1::shared_ptr<Client> client, std::tr1::shared_ptr<ByteBuffer> data);
/**
* Parse an incoming STKL.
*/
void handleSTKL(std::tr1::shared_ptr<Client> client, std::tr1::shared_ptr<ByteBuffer> data);
/*
* Send a THST request to the specified client.
*/
static void sendTHST(std::tr1::shared_ptr<Client> client);
static std::tr1::shared_ptr<HandleThread> mInst;
// only read/written by requestThreadUpdates()
static volatile bool mThreadStatusReqRunning;
static volatile bool mThreadStackTraceReqRunning;
static Poco::Thread ThreadUpdate;
static Poco::Thread ThreadCallRefresh;
static RequestThread rThread;
static RequestThreadStack rThreadStackCall;
};
} /* namespace ddmlib */
#endif /* HANDLETHREAD_HPP_ */
|
167280bc2cea087cae2d1110ffbbc98722e1bf45 | 8618c39f1b39009b6f1cb0f660c0b84374592322 | /Projet/src/map.c.cpp | 27074c1af3f7495fdc7479be63c87d0eab118e7b | [] | no_license | FlavioPEIXOTO/Project_LangC | c5c57166caedb290d654cc4b846c1e9a4fac6c48 | 0bb2575c8f71aa75139908c6e15b7ce4a8ea8ac7 | refs/heads/master | 2022-04-06T08:04:49.779789 | 2020-03-11T16:21:17 | 2020-03-11T16:21:17 | 234,062,026 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 82 | cpp | map.c.cpp | #include "map.c.h"
map.c::map.c()
{
//ctor
}
map.c::~map.c()
{
//dtor
}
|
f8b7a12e16a58fd268dbf5698529530773fb341b | e976dbf26b93fef63213887e378ffa93e24febb9 | /source/ExternalDLL/ExternalDLL/IntensityImageStudent.cpp | a959a0372e6cef17329273befb840a72d67d1ae7 | [] | no_license | BIGduzy/HU-Vision-1718-NickMichel | 8e09016f5c9672f7970606f463f8ec1d3e26a392 | 14d26269ae674abf3dcdf1c24e78ac5c5f96b729 | refs/heads/master | 2021-05-02T04:52:50.587522 | 2018-04-15T15:51:44 | 2018-04-15T15:51:44 | 120,910,249 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 1,470 | cpp | IntensityImageStudent.cpp | #include "IntensityImageStudent.h"
IntensityImageStudent::IntensityImageStudent() : IntensityImage() {}
IntensityImageStudent::IntensityImageStudent(const IntensityImageStudent &other):
IntensityImage(other.getWidth(), other.getHeight()),
pixels(other.pixels)
{
for (int i = 0; i<getWidth()*getHeight(); ++i) {
pixels[i] = other.pixels[i];
}
}
IntensityImageStudent::IntensityImageStudent(const int width, const int height):
IntensityImage(width, height),
pixels(width*height)
{}
IntensityImageStudent::~IntensityImageStudent() {}
void IntensityImageStudent::set(const int width, const int height) {
IntensityImage::set(width, height);
pixels.reserve(width * height);
}
void IntensityImageStudent::set(const IntensityImageStudent &other) {
set(other.getWidth(), other.getHeight());
for (int i = 0; i < other.getWidth() * other.getHeight(); ++i) {
pixels[i] = other.pixels[i];
}
}
void IntensityImageStudent::setPixel(int x, int y, Intensity pixel) {
setPixel(y * getWidth() + x, pixel);
}
void IntensityImageStudent::setPixel(int i, Intensity pixel) {
/*
*
* Original 2d image (values):
* 9 1 2
* 4 3 5
* 8 7 8
*
* 1d representation (i, value):
* i value
* 0 9
* 1 1
* 2 2
* 3 4
* 4 3
* 5 5
* 6 8
* 7 7
* 8 8
*/
pixels[i] = pixel;
}
Intensity IntensityImageStudent::getPixel(int x, int y) const {
return getPixel(y * getWidth() + x);
}
Intensity IntensityImageStudent::getPixel(int i) const {
return pixels[i];
} |
9daa6480e048ce96ad747990500583905924c335 | c76b2bd5904b5dfe543773eb565ddb9e71ede437 | /SpringDamper.cpp | 13272066d60ee4eee27d5e37a79890d83ecdc41a | [] | no_license | juanramirez64/Cloth-Simulation | 63fbea75e49893f6b4e8ec39fd8778f5aa7abf29 | 1b3cb0fcaf9a99bd4f8f52cc975b914b884e5783 | refs/heads/main | 2023-03-31T23:32:16.699764 | 2021-04-07T02:46:50 | 2021-04-07T02:46:50 | 355,358,205 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 1,171 | cpp | SpringDamper.cpp | #include "SpringDamper.h"
/*
* Constructor.
*/
SpringDamper::SpringDamper(GLint index, GLfloat springConstant, GLfloat dampingConstant,
GLfloat restLength, Particle* particle1, Particle* particle2) : index(index),
springConstant(springConstant), dampingConstant(dampingConstant),
restLength(restLength), P1(particle1), P2(particle2) {
}
SpringDamper::~SpringDamper() {
}
/*
* Computes forces from spring-damper connecting particles P1 and P2.
* Applies forces directly to each particle once done.
*/
void SpringDamper::ComputeForce() {
// compute current length l & unit vector e
glm::vec3 e = P1->getPosition() - P2->getPosition();
GLfloat currentLength = glm::length(e);
e = e/currentLength;
// compute closing velocity
GLfloat closeV = glm::dot((P1->getVelocity() - P2->getVelocity()), e);
// compute final forces
GLfloat springForce = (-springConstant) * (currentLength - restLength);
GLfloat dampingForce = ((-dampingConstant) * closeV);
GLfloat forceConst = springForce + dampingForce;
glm::vec3 force1 = forceConst * e;
glm::vec3 force2 = -force1;
// apply final forces to each particle
P1->ApplyForce(force1);
P2->ApplyForce(force2);
} |
f2b26f769f22b01f7e6d454faf8519408840aee2 | 581d6eeb48dbd442dca27c1fa83689c58ffea2c9 | /Sources/Elastos/Frameworks/Droid/Base/Services/Server/inc/input/NativeInputApplicationHandle.h | 6b55d773cd49de43b62bc691beec21cdce009456 | [
"Apache-2.0"
] | permissive | TheTypoMaster/ElastosRDK5_0 | bda12b56271f38dfb0726a4b62cdacf1aa0729a7 | e59ba505e0732c903fb57a9f5755d900a33a80ab | refs/heads/master | 2021-01-20T21:00:59.528682 | 2015-09-19T21:29:08 | 2015-09-19T21:29:08 | 42,790,116 | 0 | 0 | null | 2015-09-19T21:23:27 | 2015-09-19T21:23:26 | null | UTF-8 | C++ | false | false | 847 | h | NativeInputApplicationHandle.h |
#ifndef __ELASTOS_DROID_SERVER_INPUT_NATIVEINPUTAPPLICATIONHANDLE_H__
#define __ELASTOS_DROID_SERVER_INPUT_NATIVEINPUTAPPLICATIONHANDLE_H__
#include <input/InputApplication.h>
namespace Elastos {
namespace Droid {
namespace Server {
namespace Input {
class InputApplicationHandle;
class NativeInputApplicationHandle : public android::InputApplicationHandle
{
public:
NativeInputApplicationHandle(
/* [in] */ Input::InputApplicationHandle* obj);
virtual ~NativeInputApplicationHandle();
Input::InputApplicationHandle* getInputApplicationHandleObj();
virtual bool updateInfo();
private:
// jweak mObjWeak;
Input::InputApplicationHandle* mObject;
};
} // namespace Input
} // namespace Server
} // namespace Droid
} // namespace Elastos
#endif //__ELASTOS_DROID_SERVER_INPUT_NATIVEINPUTAPPLICATIONHANDLE_H__
|
c4945c87e4540b57d57ab29ad3ace9fcf9d2840d | 8f6718be70f87a2520db46904f59f295da499a6a | /Game/HealingZone.h | 17f1ce8ee76195cc7c42380049ba7969a4ad566a | [] | no_license | ydl1991/Adventure-Land | 9f75c23bb01993ea8aafb6e895c4c3057733776a | e56a306d5b2d8d0972a96564bed430bafccb7960 | refs/heads/main | 2023-04-24T10:57:32.341708 | 2021-05-03T20:17:16 | 2021-05-03T20:17:16 | 364,048,693 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 502 | h | HealingZone.h | #pragma once
#include "ZoneBase.h"
class HealingZone : public ZoneBase
{
public:
HealingZone(ObjectSpawnInfo objectSpawnInfo);
~HealingZone();
// virtual
virtual void Init() override;
virtual void Tick(float deltaTime) override;
virtual void HandleBeginOverlap(ObjectBase* pOtherCollider) override;
virtual void OverlapUpdate(ObjectBase* pOtherCollider) override;
virtual void HandleEndOverlap(ObjectBase* pOtherCollider) override;
virtual void Render(SDL_Renderer* pRenderer) override;
};
|
1fa409406a7e51d35588905f3ae50414c9fe6902 | 3c339fa082b2ed728aa263d657aa4d23bee18d1e | /jni/game/Movepoint.cpp | 4cc68fd3fdcdaa55e63822f7aa139011209b63b4 | [] | no_license | Francklyi/Game-Shot | 08cb173872ec9aa3492e1df91706c758c1c919ad | 18d27fe044125e761fe2004d55b2bb05d7359cd1 | refs/heads/master | 2021-01-10T17:25:18.739544 | 2015-11-19T03:28:56 | 2015-11-19T03:28:56 | 46,415,996 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 1,603 | cpp | Movepoint.cpp | #include "Movepoint.h"
Movepoint::Movepoint()
:shapeType(0)
,stepSum(1)
,step(0)
,moveType(Movepoint::MOVE_PERSISTENT)
,frameSum(200)
,delay(0)
,delayNow(0)
,movePathType(PATH_LINE)
,direct(DIRECT_CB)
,numCirclePoints(20)
,offsetFrame(0)
,offsetFNow(0)
,Entity()
{
}
Movepoint::~Movepoint()
{
}
void Movepoint::setGraph(Entity *pE)
{
//设置所属的Graph,以传递变换矩阵
pEntity=pE;
}
void Movepoint::setShapeType(int ST_)
{
shapeType= ST_;
}
void Movepoint::setStepSum(int sum)
{
stepSum=sum;
}
void Movepoint::initSteps(float beginX, float beginY, float beginZ)
{
moveSteps[0]=(pTransform->pTOmatrix->mMatrixQueue.back()[12]-beginX)/frameSum;
moveSteps[1]=(pTransform->pTOmatrix->mMatrixQueue.back()[13]-beginY)/frameSum;
moveSteps[2]=(pTransform->pTOmatrix->mMatrixQueue.back()[14]-beginZ)/frameSum;
}
float *Movepoint::getSteps()
{
if(offsetFNow<offsetFrame)
{
moveStepsOut[0]=0;
moveStepsOut[1]=0;
moveStepsOut[2]=0;
offsetFNow++;
}else
if(step==0)
{
delayNow++;
moveStepsOut[0]=0;
moveStepsOut[1]=0;
moveStepsOut[2]=0;
if(delayNow>=delay)
{
delayNow=0;
step++;
moveStepsOut[0]=moveSteps[0];
moveStepsOut[1]=moveSteps[1];
moveStepsOut[2]=moveSteps[2];
}
}
else
{
if(step>=frameSum)
{
step=-1;
moveSteps[0]=-moveSteps[0];
moveSteps[1]=-moveSteps[1];
moveSteps[2]=-moveSteps[2];
moveStepsOut[0]=moveSteps[0];
moveStepsOut[1]=moveSteps[1];
moveStepsOut[2]=moveSteps[2];
}
step++;
}
return moveStepsOut;
}
|
66f3f1443cc9894eacc9742510e7e62fa9dc1862 | 99bd624695eed76a9d865758b467b980a7654e67 | /Opencv/Class21_HoughLines/code/hough.h | 58b851138b03767c72940b9124ec0d16bca304de | [] | no_license | SupremeDin/My_Material | 927bfae8f12479937a18519d349c420644d670bf | e600c777612fba3b9d068b4ffc2977a368d97818 | refs/heads/master | 2020-06-20T00:48:44.042113 | 2019-07-15T06:30:16 | 2019-07-15T06:30:16 | 196,929,137 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 732 | h | hough.h | //Declaration!
//DO NOT USE "using namespace XX"
#ifndef HOUGH_H
#define HOUGH_H
#include<opencv2/opencv.hpp>
#include <vector>
class LineFinder
{
private:
std::vector<cv::Vec2f> lines;
double deltaRho;
double deltaTheta;
int minVote;
public:
LineFinder();//first,there is a default constructor
//there is NO constructor;
~LineFinder();//destructor!(isnt a MUST,cause the compiler will do it if u didnt do it)
//other methods~
void setAccResolution(double dRho,double dTheta);//CAN olny use methods to change private;
void setminVote(int minV);//to change private varible
void findlines(cv::Mat& binary);
void drawDetectedLines(cv::Mat& result);
};
#endif // HOUGH_H
|
0315b56aad63224407ad6b6043986feb5d2a819a | e3a97b316fdf07b170341da206163a865f9e812c | /sprokit/processes/core/image_writer_process.cxx | d71ebeec8c9c0c7ada70648b9023a5c16ca9b3f8 | [
"BSD-3-Clause"
] | permissive | Kitware/kwiver | 09133ede9d05c33212839cc29d396aa8ca21baaf | a422409b83f78f31cda486e448e8009513e75427 | refs/heads/master | 2023-08-28T10:41:58.077148 | 2023-07-28T21:18:52 | 2023-07-28T21:18:52 | 23,229,909 | 191 | 92 | NOASSERTION | 2023-06-26T17:18:20 | 2014-08-22T15:22:20 | C++ | UTF-8 | C++ | false | false | 5,283 | cxx | image_writer_process.cxx | // This file is part of KWIVER, and is distributed under the
// OSI-approved BSD 3-Clause License. See top-level LICENSE file or
// https://github.com/Kitware/kwiver/blob/master/LICENSE for details.
#include "image_writer_process.h"
#include <vital/vital_types.h>
#include <vital/types/image_container.h>
#include <vital/types/image.h>
#include <vital/types/timestamp.h>
#include <vital/algo/image_io.h>
#include <vital/exceptions.h>
#include <vital/util/string.h>
#include <kwiver_type_traits.h>
#include <sprokit/pipeline/process_exception.h>
#include <sprokit/pipeline/datum.h>
#include <kwiversys/SystemTools.hxx>
#include <vector>
#include <stdint.h>
#include <fstream>
// -- DEBUG
#if defined DEBUG
#include <arrows/algorithms/ocv/image_container.h>
#include <opencv2/highgui/highgui.hpp>
using namespace cv;
#endif
namespace algo = kwiver::vital::algo;
namespace kwiver {
// (config-key, value-type, default-value, description )
create_config_trait( file_name_template, std::string, "image%04d.png",
"Template for generating output file names. The template is interpreted as a printf format with one "
"format specifier to convert an integer increasing image number. "
"The image file type is determined by the file extension and the concrete writer selected." );
create_algorithm_name_config_trait( image_writer );
//----------------------------------------------------------------
// Private implementation class
class image_writer_process::priv
{
public:
priv();
~priv();
// Configuration values
std::string m_file_template;
// Number for current image.
kwiver::vital::frame_id_t m_frame_number;
// processing classes
algo::image_io_sptr m_image_writer;
}; // end priv class
// ================================================================
image_writer_process
::image_writer_process( kwiver::vital::config_block_sptr const& config )
: process( config ),
d( new image_writer_process::priv )
{
make_ports();
make_config();
}
image_writer_process
::~image_writer_process()
{
}
// ----------------------------------------------------------------
void image_writer_process
::_configure()
{
scoped_configure_instrumentation();
// Get process config entries
d->m_file_template = config_value_using_trait( file_name_template );
// Get algo config entries
kwiver::vital::config_block_sptr algo_config = get_config(); // config for process
algo::image_io::set_nested_algo_configuration_using_trait(
image_writer,
algo_config,
d->m_image_writer);
if ( ! d->m_image_writer )
{
VITAL_THROW( sprokit::invalid_configuration_exception, name(),
"Unable to create image_writer." );
}
// instantiate image reader and converter based on config type
if ( ! algo::image_io::check_nested_algo_configuration_using_trait(
image_writer,
algo_config ) )
{
VITAL_THROW( sprokit::invalid_configuration_exception, name(), "Configuration check failed." );
}
}
// ----------------------------------------------------------------
void image_writer_process
::_step()
{
if ( has_input_port_edge_using_trait( timestamp ) )
{
kwiver::vital::timestamp frame_time;
frame_time = grab_from_port_using_trait( timestamp );
if (frame_time.has_valid_frame() )
{
kwiver::vital::frame_id_t next_frame;
next_frame = frame_time.get_frame();
if ( next_frame <= d->m_frame_number )
{
++d->m_frame_number;
LOG_WARN( logger(), "Frame number from input timestamp ("
<< next_frame
<< ") is not greater than last frame number. Adjusting frame number to "
<< d->m_frame_number );
}
}
else
{
// timestamp does not have valid frame number
++d->m_frame_number;
}
}
else
{
// timestamp port not connected.
++d->m_frame_number;
}
vital::image_container_sptr input = grab_from_port_using_trait( image );
std::string a_file;
{
scoped_step_instrumentation();
a_file = kwiver::vital::string_format( d->m_file_template, d->m_frame_number );
LOG_DEBUG( logger(), "Writing image to file \"" << a_file << "\"" );
}
d->m_image_writer->save( a_file, input );
}
// ----------------------------------------------------------------
void image_writer_process
::make_ports()
{
// Set up for required ports
sprokit::process::port_flags_t optional;
sprokit::process::port_flags_t required;
required.insert( flag_required );
declare_input_port_using_trait( image, required );
declare_input_port_using_trait( timestamp, optional,
"Image timestamp, optional. The frame number from this timestamp is used to number the output files. "
"If the timestamp is not connected or not valid, the output files are sequentially numbered from 1." );
}
// ----------------------------------------------------------------
void image_writer_process
::make_config()
{
declare_config_using_trait( file_name_template );
declare_config_using_trait( image_writer );
}
// ================================================================
image_writer_process::priv
::priv()
: m_frame_number(0)
{
}
image_writer_process::priv
::~priv()
{
}
} // end namespace
|
ee07dd24abdda844780067275b5e5302e6037a5c | c11485499c9b62481dfdfe56fa39374e36876dcd | /build/lua-gameplay/src/AI.cpp | 3bb88c0780460c9f8bfd595efebb639ad631ecb7 | [] | no_license | mengtest/TH_Game | 92c519f8e83a4bf5bce64edc9fe718a16427555c | f36d0c07571b31a128eae322408c480b6ad1f70a | refs/heads/master | 2022-12-09T14:11:54.539133 | 2020-08-26T16:25:27 | 2020-08-26T16:25:27 | null | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 202 | cpp | AI.cpp | #include "AI.h"
Pawn* AI::getPawnByHp(int combatId, int playerId, bool highest)
{
return nullptr;
}
Pawn* AI::getPawnByHpCond(int combatId, int playerId, int value, int greater)
{
return nullptr;
}
|
5de78778fb058aa8f3f17f41260fc406c9258ca5 | aa4565e477946917b30ee5d01ede8ee0916aba5a | /src/server/scripts/Kalimdor/Firelands/boss_belthtilac.cpp | 317361d78b7762843f1e0ce62dd981ec8608e605 | [] | no_license | mmoglider/GlideCore | 2b157953188f9c83b2b0ede86c469b10790cdc2d | 76b4a7562210f6fa60326d44fbc7a2640e416351 | refs/heads/master | 2016-09-06T18:46:57.294884 | 2014-04-25T03:03:57 | 2014-04-25T03:03:57 | 15,888,600 | 1 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 2,279 | cpp | boss_belthtilac.cpp | /*
* Copyright (C) 2013 OpenEmulator <http://www.openemulator.com/>
*
* 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 (at your
* option) any later version.
*
* This program is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
* more details.
*
* You should have received a copy of the GNU General Public License along
* with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#include "ScriptPCH.h"
#include "firelands.h"
enum Yells
{
SAY_AGGRO = -1999971,
SAY_SOFT_ENRAGE = -1999972, //TODO Add Sound
SAY_ON_DOGS_FALL = -1999973, //TODO Add Sound
SAY_ON_DEAD = -1999974, //TODO Add Sound
};
enum Spells
{
// Bethilac
// Phase 1
SPELL_EMBER_FLARE = 98934, // And Phase 2
SPELL_METEOR_BURN = 99076,
SPELL_CONSUME = 99304, // And Cinderweb Drone and Phase 2
SPELL_SMOLDERING_DEVASTATION = 99052,
// Phase 2
SPELL_FRENZY = 23537,
SPELL_THE_WIDOWS_KISS = 99506,
// Ciderweb Spinner
SPELL_BURNING_ACID = 98471, // And Cinderweb Drone
SPELL_FIERY_WEB_SPIN_H = 97202,
// Cinderweb Drone
SPELL_BOILING_SPLATTER = 0, // ID ?
SPELL_FIXATE_H = 49026,
//Cinderweb Spiderling
SPELL_SEEPING_VENOM = 97079,
// Engorged Broodling
SPELL_VOLATILE_BURST_H = 99990,
};
enum Events
{
EVENT_SUMMON_CINDERWEB_SPINNER = 1,
EVENT_SPINNER_BURNING_ACID = 2,
};
Position const CinderwebSummonPos[7] =
{
{55.614f, 385.11f, 0, 0},
{61.906f, 352.12f, 0, 0},
{49.118f, 352.12f, 0, 0},
{36.080f, 357.46f, 0, 0},
{28.873f, 372.63f, 0, 0},
{32.848f, 382.93f, 0, 0},
{39.499f, 393.54f, 0, 0}
};
// Grounds
const float groundLow = 74.042f;
const float groundUp = 111.767f;
// Event Timers
const int timerSummonCinderwebSpinner = 11000;
const int timerSpinnerBurningAcid = 7000;
/**** Beth'ilac ****/
|
0b88ada6f5675bcc4795e4e397ca5faf1b4ba698 | ccfdebd0c48315952b3bd348e74abde08caf5d85 | /OpenCV/Filtros.cpp | 4aa9c66905db1eb429ae2895084d433da5e2a2e2 | [] | no_license | gb-brag/Comp_Grafica | 0f1ba7aae33ad709cce32fd8c7d959c2363e3d3e | f6e18d24198e0f5200458429e0ff43b741a064da | refs/heads/main | 2023-01-24T23:03:10.452272 | 2020-11-22T20:27:30 | 2020-11-22T20:27:30 | 305,229,710 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 1,021 | cpp | Filtros.cpp |
#include <iostream>
#include <fstream>
#include <string>
#include <opencv2/core.hpp>
#include <opencv2/highgui.hpp>
#include <opencv2/imgcodecs.hpp>
#include <opencv2/imgproc.hpp>
using namespace std;
using namespace cv;
int main(void) {
Mat image;
Mat imgblur, imggaussian, imgmedian;
string filename;
int h, w, height, width;
filename = "C:/Users/bielb/Pictures/riven_spirit_2_pc_by_snowy2b_de53xxf-pre.jpg";
image = imread(filename);
if (image.empty()) {
cerr << "Image file name not found" << endl;
exit(-1);
}
//filtros
blur(image, imgblur, Size(11, 11));
medianBlur(image, imgmedian, 11);
GaussianBlur(image, imggaussian, Size(3, 3), 3.7, 3.7);
//abrir resultados
namedWindow(filename.c_str(), WINDOW_NORMAL);
imshow(filename.c_str(), image);
namedWindow("BLUR", WINDOW_NORMAL);
imshow("BLUR", imgblur);
namedWindow("MEDIAN", WINDOW_NORMAL);
imshow("MEDIAN", imgmedian);
namedWindow("GAUSSIAN", WINDOW_NORMAL);
imshow("GAUSSIAN", imggaussian);
waitKey(0);
return 0;
}
|
c5cd1587572d1283f108723a212d6ea6e55df9df | b4d1fc90b1c88f355c0cc165d73eebca4727d09b | /libcef/browser/browser_context_keyed_service_factories.cc | 8730bfb43e52cb2def9b006ce2694c954d737144 | [
"BSD-3-Clause"
] | permissive | chromiumembedded/cef | f03bee5fbd8745500490ac90fcba45616a29be6e | f808926fbda17c7678e21f1403d6f996e9a95138 | refs/heads/master | 2023-09-01T20:37:38.750882 | 2023-08-31T17:16:46 | 2023-08-31T17:28:27 | 87,006,077 | 2,600 | 454 | NOASSERTION | 2023-07-21T11:39:49 | 2017-04-02T18:19:23 | C++ | UTF-8 | C++ | false | false | 1,981 | cc | browser_context_keyed_service_factories.cc | // Copyright 2015 The Chromium Embedded Framework 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 "libcef/browser/browser_context_keyed_service_factories.h"
#include "libcef/common/extensions/extensions_util.h"
#include "base/feature_list.h"
#include "chrome/browser/content_settings/cookie_settings_factory.h"
#include "chrome/browser/media/router/chrome_media_router_factory.h"
#include "chrome/browser/media/webrtc/media_device_salt_service_factory.h"
#include "chrome/browser/plugins/plugin_prefs_factory.h"
#include "chrome/browser/profiles/renderer_updater_factory.h"
#include "chrome/browser/reduce_accept_language/reduce_accept_language_factory.h"
#include "chrome/browser/spellchecker/spellcheck_factory.h"
#include "chrome/browser/themes/theme_service_factory.h"
#include "chrome/browser/ui/prefs/prefs_tab_helper.h"
#include "components/permissions/features.h"
#include "extensions/browser/api/alarms/alarm_manager.h"
#include "extensions/browser/api/storage/storage_frontend.h"
#include "extensions/browser/renderer_startup_helper.h"
#include "services/network/public/cpp/features.h"
namespace cef {
void EnsureBrowserContextKeyedServiceFactoriesBuilt() {
CookieSettingsFactory::GetInstance();
MediaDeviceSaltServiceFactory::GetInstance();
media_router::ChromeMediaRouterFactory::GetInstance();
PluginPrefsFactory::GetInstance();
PrefsTabHelper::GetServiceInstance();
RendererUpdaterFactory::GetInstance();
SpellcheckServiceFactory::GetInstance();
ThemeServiceFactory::GetInstance();
if (extensions::ExtensionsEnabled()) {
extensions::AlarmManager::GetFactoryInstance();
extensions::RendererStartupHelperFactory::GetInstance();
extensions::StorageFrontend::GetFactoryInstance();
}
if (base::FeatureList::IsEnabled(network::features::kReduceAcceptLanguage)) {
ReduceAcceptLanguageFactory::GetInstance();
}
}
} // namespace cef
|
800ec745240b6b63040cf79fd35ca6a81920e3c3 | b81424733ba7aa22971017a2b723cebdb79e2ff9 | /B5904/B5904.cpp | adfec0c78627b740c139a4cc155e741ac131569e | [] | no_license | tongnamuu/Algorithm-PS | 1d8ee70c60da9bafdae7c820872e685fdf2b28fa | 464b68c34bb07f9e1e00e4b5475c6f0240cd20d4 | refs/heads/master | 2022-06-04T01:57:29.432141 | 2022-04-08T11:52:01 | 2022-04-08T11:52:01 | 164,219,701 | 0 | 1 | null | 2019-03-28T03:43:13 | 2019-01-05T13:58:05 | C++ | UTF-8 | C++ | false | false | 822 | cpp | B5904.cpp | #include <iostream>
#include <string>
using namespace std;
char solve(long long len, int idx, int k) {
if (len == 3) {
if (idx == 0) return 'm';
else return 'o';
}
int f = (len - (k + 3)) / 2;
int s = f + k + 3;
if (idx < f) {
return solve(f, idx, k - 1);
}
else if (idx < s) {
if (idx - f == 0) return 'm';
else return 'o';
}
else {
return solve(f, idx - s, k - 1);
}
}
int main() {
ios_base::sync_with_stdio(false), cin.tie(0);
int n; cin >> n;
if (n == 1) {
cout << 'm'; return 0;
}
else if (n == 2 || n == 3) {
cout << 'o'; return 0;
}
int idx = 0;
int len = 0;
while (n > len) {
len = 2 * len + idx + 3;
idx += 1;
}
cout << solve(len, n - 1, idx - 1);
} |
1a1b11bb7ed1db46ee6aa8ae0f488d1da0a88ec4 | 8a13adc8856f3ad6a184141999c58ac7a2ec214b | /src/serverctl/CommandBuilder.h | 8e4aab495d8aef78f495b26e9545f227fe7bfb62 | [] | no_license | netromdk/backup | 92c689b90dbaf1e9c2ab6ac013c0853e91fec2c1 | 9629be1a1170ca17781f9c765cd8b5bbc9713040 | refs/heads/master | 2016-09-06T17:34:49.403251 | 2012-04-29T14:23:57 | 2012-04-29T14:23:57 | null | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 425 | h | CommandBuilder.h | #ifndef COMMAND_BUILDER_H
#define COMMAND_BUILDER_H
#include "cmd/CommandTreeNode.h"
using namespace cmd;
class HelpContext;
class AgentContext;
class CommandBuilder {
public:
CommandBuilder();
virtual ~CommandBuilder();
const CommandTreeNode *getRootNode() const { return tree; }
private:
void build();
CommandTreeNode *tree;
HelpContext *helpCtx;
AgentContext *agentCtx;
};
#endif // COMMAND_BUILDER_H
|
168d3065322e57e52b917c5b607a39ec3ecfc19e | 05b696c8d7c6439cdd08bbbab7b352e9593298a9 | /LabWork1/CBallsArray.h | 26b7c6b1dbc824a3c312e0bbfd819060e2bfef10 | [] | no_license | KPEKZ/WinApi32 | 8fa323e1829d9188b9c2ba56c55f2d621e5415c7 | 148a7f509ba6d1421a0865054e828153b458b2ae | refs/heads/master | 2022-12-03T04:25:08.698601 | 2020-05-31T18:45:52 | 2020-05-31T18:45:52 | 266,629,840 | 0 | 1 | null | null | null | null | UTF-8 | C++ | false | false | 946 | h | CBallsArray.h | #pragma once
#include <Windows.h>
#include <windowsx.h>
#include "CBall.h"
#include "CColoredBall.h"
#include "CBallsTimeLmited.h"
#include "Trap.h"
#include "wind.h"
#include <typeinfo>
class CBallsArray
{
HWND HwndG;
HWND Hwnd;
int count;
int count1;
int max_balls;
double gF;
public:
CBall** balls;
CBallsArray();
CBallsArray(int max_balls);
virtual ~CBallsArray(void);
CBall* Add();
void SetBounds(RECT bnds);
void Move(DWORD ticks);
void Draw(HDC hdc);
CColoredBall* AddColoredBall();
CBallsTimeLmited* AddLImitedBall();
int GetCount() { return this->count; };
int GetMaxCount() { return this->max_balls; };
void SetCount(const int count) { this->count = count; };
CBall * operator [] (const int index) { return this->balls[index]; };
void SetGravityFactor(double gF, DWORD ticks);
bool empty() { if (this->count == 0) return true; return false;};
void SetTrap(Trap * t);
void SetWind(wind * w);
void del();
};
|
8a2afebab9c72da9b86ea4d6e26a1d5f2cff8ffc | ad40f31ec3086f40065b9cf66655704324bb744e | /Binary_Search_Tree/SortedLLtoBST.cpp | 94cb941c6994054df6baf60d474adabeaf28de39 | [] | no_license | mukundkedia/DSA | 6791a14db7ccbfd83335a09780f4987092729ce5 | d015943870e30eae91e497135cfb0baa90ed1234 | refs/heads/main | 2023-06-11T16:25:55.263185 | 2021-07-07T11:24:27 | 2021-07-07T11:24:27 | 304,045,048 | 2 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 726 | cpp | SortedLLtoBST.cpp | //https://leetcode.com/problems/convert-sorted-list-to-binary-search-tree/
//PC
class Solution {
public:
TreeNode* sortedListToBST(ListNode* head) {
if(!head){
return NULL;
}
if(!head->next){
return new TreeNode(head->val);
}
ListNode* temp = NULL;
ListNode* slow=head;
ListNode* fast = head;
while(fast!=NULL and fast->next!=NULL){
temp=slow;
slow=slow->next;
fast = fast->next->next;
}
temp->next = NULL;
TreeNode* root = new TreeNode(slow->val);
root->left = sortedListToBST(head);
root->right = sortedListToBST(slow->next);
return root;
}
}; |
743a6334c80ba325e208a73ff913b44b52cb2ef2 | 88f5250c2781064f63cdc1b2740c843ff1b619df | /Codeforces_#580_Div2_02.cpp | aa09ab361cc3098b98a3ffc9a3dc62d4feb0a7f6 | [] | no_license | evga7/codeforces | 7203820c000cd058b85b89b4752726d4c818c1e9 | 3382c97ff69347edd05c142526ccf95ccdf47738 | refs/heads/master | 2020-07-15T10:25:59.559803 | 2019-10-09T12:32:54 | 2019-10-09T12:32:54 | 205,542,976 | 1 | 0 | null | null | null | null | WINDOWS-1252 | C++ | false | false | 1,564 | cpp | Codeforces_#580_Div2_02.cpp | /*
¹®Á¦
B. Make Product Equal One
time limit per test1 second
memory limit per test256 megabytes
inputstandard input
outputstandard output
You are given n numbers a1,a2,¡¦,an. With a cost of one coin you can perform the following operation:
Choose one of these numbers and add or subtract 1 from it.
In particular, we can apply this operation to the same number several times.
We want to make the product of all these numbers equal to 1, in other words, we want a1?a2 ¡¦ ?an=1.
For example, for n=3 and numbers [1,?3,0] we can make product equal to 1 in 3 coins: add 1 to second element, add 1 to second element again, subtract 1 from third element, so that array becomes [1,?1,?1]. And 1?(?1)?(?1)=1.
What is the minimum cost we will have to pay to do that?
Input
The first line contains a single integer n (1¡Ân¡Â105) ? the number of numbers.
The second line contains n integers a1,a2,¡¦,an (?109¡Âai¡Â109) ? the numbers.
Output
Output a single number ? the minimal number of coins you need to pay to make the product equal to 1.
*/
#include <iostream>
#include <math.h>
using namespace std;
int main()
{
int N;
int i;
int op = 0;
long long num;
long long cnt = 0;
long long zero = 0;
scanf("%d", &N);
for (i = 0; i < N; i++)
{
scanf("%lld", &num);
if (num == 0)
{
zero++;
}
else if (num < 0)
{
cnt += abs(num)-1;
op++;
}
else
{
cnt += num - 1;
}
}
if (op % 2)
{
if (zero > 0)
{
zero--;
cnt++;
}
else
cnt += 2;
cnt += zero;
}
else
cnt += zero;
printf("%lld", cnt);
} |
ec7997a4bdfb44bf2e65937f089fe37ff4242745 | da56ead4e5e082408510e9e01df0fc7e4e455314 | /Engine/src/SoundPlayer.h | 1236b4501018b7dc87729395a75e5d110a7f17f1 | [] | no_license | thyde1/Wobba | db5f2ea1f4c007b3db73e8eaadd52f8cd5c67c6a | b4c009fb5441d3940d8153ef21ef4c19a5e1d520 | refs/heads/master | 2023-01-07T01:12:05.801155 | 2020-10-28T21:13:13 | 2020-10-28T21:13:13 | 274,194,538 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 239 | h | SoundPlayer.h | #pragma once
#include "Engine.h"
#include "SDL_mixer.h"
class SoundPlayer : public Component {
public:
SoundPlayer(const char *wavFile);
void play();
private:
const char *wavFile;
int currentChannel = -1;
};
|
8c78264bf069becadba2477a2043eea3dbf7d861 | fb9b42c9d01d55eb46b4e51d2184a41caffa5ac1 | /Trees/test.cc | d695cd3b9248d8c4e38804bca3408b13e25657f4 | [] | no_license | Priyadarshanvijay/Codingblocks-2018 | d60ca31b050b4c5bdced1fe8b26d2e57497ae44e | 963b722d0d665f241b359edd4e9cb4c1f5b19458 | refs/heads/master | 2020-05-25T06:40:55.695887 | 2020-01-30T11:39:59 | 2020-01-30T11:39:59 | 187,669,993 | 0 | 1 | null | null | null | null | UTF-8 | C++ | false | false | 109 | cc | test.cc | #include <iostream>
using namespace std;
int main()
{
char x[10];
cin >> x;
cout<<x<<endl;
return 0;
} |
06a65b84862614c7c03a6356e533e415a9c6859d | b371d4deaeed862492c735bbd1e06b3876b32a28 | /Source/Main.cpp | a6301bd631674aef8123880c11ad7c43aefeff9a | [] | no_license | PhantomGamesDevelopment/Galactic-2D | 1353cb596baa523c04b05db20229ba9dcb7708e9 | 01b7fc19a1b831ddc665534ad53933a2539bf211 | refs/heads/master | 2021-01-19T16:22:00.627199 | 2015-04-30T22:42:52 | 2015-04-30T22:42:52 | 22,177,646 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 3,389 | cpp | Main.cpp | /**
* Galactic 2D
* Source/Main.cpp
* The primary entry point of the engine software
* (C) 2014-2015 Phantom Games Development - All Rights Reserved
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in
* all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
* THE SOFTWARE.
**/
#include "EngineCore/engineCore.h"
#include "Engine/App/Main/galacticMain.h"
using namespace Galactic::Engine::Application;
#ifdef WIN32
//Forward Dec Start Codes
S32 galactic_init(UTF8 argv);
S32 galactic_engine_tick();
S32 galactic_shutdown();
//Main: Entry Point of the Engine.
S32 __stdcall WinMain( HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpszCmdLine, int nCommandShow ) {
// Galactic 2D Entry Point
if(!galactic_init(lpszCmdLine)) {
return 1;
}
while(galactic_engine_tick()) {}
galactic_shutdown();
return 0;
}
//Engine startup
S32 galactic_init(UTF8 argv) {
//Load up the loadup render window
//Load the engine's systems up and go.
return GalacticMain::init(argv);
}
//Engine Loop
S32 galactic_engine_tick() {
//Run the engine loop code, return 0 if a quit() command was sent.
return GalacticMain::mainLoop();
}
//Engine Shutdown
S32 galactic_shutdown() {
//Deallocate all used memory & shutdown engine systems
GalacticMain::shutdown();
//return 1 for proper shutdown. That's all folks!
return 1;
}
#elif defined(__MACOSX__) || defined(__linux__)
//Forward Dec Start Codes
S32 galactic_init(S32 argc, UTF8 argv[]);
S32 galactic_engine_tick();
S32 galactic_shutdown();
S32 main(S32 argc, UTF8 argv[]) {
// Galactic 2D Entry Point
if(!galactic_init(argc, argv)) {
return 1;
}
while(galactic_engine_tick()) {}
galactic_shutdown();
return 0;
}
//Engine startup
S32 galactic_init(S32 argc, UTF8 argv) {
//Load up the loadup render window
//Load the engine's systems up and go.
return GalacticMain::init(argc, argv);
}
//Engine Loop
S32 galactic_engine_tick() {
//Run the engine loop code, return 0 if a quit() command was sent.
return GalacticMain::mainLoop();
}
//Engine Shutdown
S32 galactic_shutdown() {
//Deallocate all used memory & shutdown engine systems
GalacticMain::shutdown();
//return 1 for proper shutdown. That's all folks!
return 1;
}
#else
//Something went terribly wrong, stop the build
#error "Cannot locate a OS Flag to compile against, please check your C++ compiler or affirm you are using a supported platform."
#endif |
3eb33c2ed8125c067e076288d95d7dadda7131c9 | 0c15cc538d15ead4483f40dfb424da437eca9e47 | /NewScene.cpp | 36f90ef36675c088f2b7658112f923c2ea117fe8 | [] | no_license | Johan08/cocos2d-x-3.2-ui- | 0c00d13bf773c2fca2a1b3dbf494b0c941f630e4 | bf7da0e2a689d5e1b133de3767f887133dc19e34 | refs/heads/master | 2021-01-19T18:32:06.493725 | 2015-08-03T21:00:18 | 2015-08-03T21:00:18 | 40,147,643 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 5,737 | cpp | NewScene.cpp | #include "NewScene.h"
#include "HelloWorldScene.h"
USING_NS_CC;
USING_NS_CC_EXT;
Scene* NewScene::createScene()
{
// 'scene' is an autorelease object
auto scene = Scene::create();
// 'layer' is an autorelease object
auto layer = NewScene::create();
// add layer as a child to scene
scene->addChild(layer);
// return the scene
return scene;
}
// on "init" you need to initialize your instance
bool NewScene::init()
{
//////////////////////////////
// 1. super init first
if ( !LayerColor::initWithColor(Color4B::GREEN) )
{
return false;
}
Size visibleSize = Director::getInstance()->getVisibleSize();
Vec2 origin = Director::getInstance()->getVisibleOrigin();
//------------------ LABEL------------------------
auto label = Label::createWithTTF("Nueva Escena", "fonts/airstrike3d.ttf", 24);
label->setColor(Color3B::BLACK);
label->setPosition(Vec2(origin.x + visibleSize.width/2,
origin.y + visibleSize.height - label->getContentSize().height));
this->addChild(label, 1);
//---------- BOTON ---------------------
Button *b1 = Button::create("b1.png","b2.png");
b1->setPosition(Point(origin.x + visibleSize.width - b1->getContentSize().width / 2, origin.y + visibleSize.height - b1->getContentSize().height ));
this->addChild(b1, 1);
b1->addTouchEventListener(CC_CALLBACK_2(NewScene::touchEvent, this));
auto b2 = Button::create("b1.png","b2.png");
b2->setPosition(Point(origin.x + b2->getContentSize().width / 2, origin.y + visibleSize.height / 2));
this->addChild(b2,1);
b2->addTouchEventListener(CC_CALLBACK_2(NewScene::touchEvent2,this));
//-----------CHECKBOX----------------
auto checkbox1 = CheckBox::create("ui/3.png","ui/3.png","ui/1.png","ui/3.png","ui/3.png" );
checkbox1->setPosition(Point(origin.x + checkbox1->getContentSize().width / 2, origin.y + visibleSize.height - checkbox1->getContentSize().height));
this->addChild(checkbox1,1);
checkbox1->addEventListener(CC_CALLBACK_2(NewScene::selectedEvent, this));
auto checkbox2 = CheckBox::create("ui/3.png","ui/3.png","ui/1.png","ui/3.png","ui/3.png" );
checkbox2->setPosition(Point(origin.y + checkbox1->getContentSize().width / 2, checkbox1->getPositionY() - checkbox1->getContentSize().height));
this->addChild(checkbox2,1);
checkbox2->addEventListener(CC_CALLBACK_2(NewScene::selectedEvent, this));
//-----------VOLVER------------------
auto menuItem = MenuItemLabel::create(Label::createWithTTF("Volver", "fonts/airstrike3d.ttf", 34), CC_CALLBACK_1(NewScene::volver, this));
menuItem->setPosition(Point(origin.x + visibleSize.width / 2, origin.y + menuItem->getContentSize().height / 2));
menuItem->setColor(Color3B::BLACK);
auto menuGral = Menu::create(menuItem,NULL);
menuGral->setPosition(Point::ZERO);
this->addChild(menuGral,2);
this->setKeyboardEnabled(true);
return true;
}
//-------------------EVENTOS DE BOTON---------------
//[EVENTO-1]
void NewScene::touchEvent(Ref *sender, Widget::TouchEventType type)
{
Size visibleSize = Director::getInstance()->getVisibleSize();
Point origin = Director::getInstance()->getVisibleOrigin();
auto l1 = Label::createWithTTF("Boton presionado","fonts/airstrikebold.ttf",100);
l1->setColor(Color3B::BLUE);
l1->setPosition(Point(origin.x + visibleSize.width / 2, origin.y + visibleSize.height / 2));
auto action = Sequence::create(FadeIn::create(2), FadeOut::create(1), NULL);
switch (type)
{
case cocos2d::ui::Widget::TouchEventType::BEGAN:
this->addChild(l1,1);
l1->runAction(action);
break;
case cocos2d::ui::Widget::TouchEventType::MOVED:
break;
case cocos2d::ui::Widget::TouchEventType::ENDED:
break;
case cocos2d::ui::Widget::TouchEventType::CANCELED:
break;
default:
break;
}
}
//[EVENTO-2]
void NewScene::touchEvent2(Ref *pSender, Widget::TouchEventType type)
{
switch (type)
{
case cocos2d::ui::Widget::TouchEventType::BEGAN:
cantidad();
break;
case cocos2d::ui::Widget::TouchEventType::MOVED:
break;
case cocos2d::ui::Widget::TouchEventType::ENDED:
break;
case cocos2d::ui::Widget::TouchEventType::CANCELED:
break;
default:
break;
}
}
//-------------------EVENTOS DE CHECKBOX--------------------------
void NewScene::selectedEvent(Ref *pSender, ui::CheckBox::EventType type)
{
Point origin = Director::getInstance()->getVisibleOrigin();
Size visibleSize = Director::getInstance()->getVisibleSize();
switch (type)
{
case cocos2d::ui::CheckBox::EventType::SELECTED:
setScore(getScore() + 1);
break;
case cocos2d::ui::CheckBox::EventType::UNSELECTED:
//log("checkbox deseleccionado");
//i -=1;
setScore(getScore() - 1);
break;
default:
break;
}
}
void NewScene::volver(Ref* pSender)
{
Director::getInstance()->replaceScene(TransitionMoveInL::create(2,HelloWorld::createScene()));
}
void NewScene::cantidad()
{
Point origin = Director::getInstance()->getVisibleOrigin();
Size visibleSize = Director::getInstance()->getVisibleSize();
auto action1 = Sequence::create(FadeIn::create(1), FadeOut::create(1), NULL);
string ctd = "La cantidad es : "+ to_string(getScore());
CCLOG("cantidad es: %s", ctd.c_str());
Label * l1 = Label::createWithTTF(ctd.c_str(),"fonts/airstrikecond.ttf",35);
l1->setPosition(Point(origin.x + visibleSize.width / 2, origin.y + visibleSize.height / 2));
l1->setColor(Color3B::MAGENTA);
l1->runAction(action1);
this->addChild(l1,1);
}
void NewScene::onKeyReleased(EventKeyboard::KeyCode keycode, Event *event)
{
Director::getInstance()->replaceScene(TransitionMoveInL::create(2,HelloWorld::createScene()));
}
|
39b1ba9477697a579cd5ac918fed1a364cc57e9b | 0eff74b05b60098333ad66cf801bdd93becc9ea4 | /second/download/httpd/gumtree/httpd_new_log_3800.cpp | 32ca1161540398e0969b12ba3f92eb9f3dbe3ee0 | [] | no_license | niuxu18/logTracker-old | 97543445ea7e414ed40bdc681239365d33418975 | f2b060f13a0295387fe02187543db124916eb446 | refs/heads/master | 2021-09-13T21:39:37.686481 | 2017-12-11T03:36:34 | 2017-12-11T03:36:34 | null | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 183 | cpp | httpd_new_log_3800.cpp | ap_log_error(APLOG_MARK, APLOG_ERR, errno, ap_server_conf, APLOGNO(01240)
"Couldn't unlink unix domain socket %s",
sockname); |
d5981d7d531d75a2e0dbf451ccddffe2206abf8e | b130b4067ff123e57cf29742d2be0f6ebf8bd1b5 | /elevator_trouble.cpp | cd34d3d9ab6aec5a408d507b6ad4c6b6b2586a08 | [] | no_license | vineetjai/Spoj | 880e3e12e59670255cb5a5adaa2ee32767bd314a | 25533f3290cae299e2052aebd173fda6fe383545 | refs/heads/master | 2022-06-24T12:04:10.261699 | 2022-05-15T13:18:26 | 2022-05-15T13:18:26 | 78,276,883 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 717 | cpp | elevator_trouble.cpp | #include<iostream>
#include<cmath>
#include<math.h>
using namespace std;
long long int euclid_gcd(int a,int b){
if(b==0) return a;
long long int c = a%b;
return euclid_gcd(b,c);
}
int main(){
long long f,s,g,u,d,gc,z,x,y;
cin>>f>>s>>g>>u>>d;
if(u!=0 && d!=0){
gc=euclid_gcd(u,d);
if(int(abs(g-s))%gc==0){
u=u/gc;d=d/gc;
z=(g-s)/gc;
for(y=0;;y++){
if((z+d*y)%u==0){cout<<(z+d*y)/u+y;break;}
}
}
else cout<<"use the stairs";
}
else{
if(u==0){
if((g-s)*(-d)>0 && int(abs(g-s))%d==0){
cout<<abs(g-s)/d;
}
else cout<<"use the stairs";
}
else if(d==0){
if((g-s)*(u)>0 && int(abs(g-s))%u==0){
cout<<abs(g-s)/u;
}
else cout<<"use the stairs";
}
}
}
|
82d1d387e8eb394cbcf8505fd773f2f7f67ad8b3 | 61858fad0231c89e504fac0e61c588743d5866ca | /Final Project/Q3/q3_maxProfit.cpp | 8808184696c6cc121933a7deec4db84097362d60 | [] | no_license | pazara18/algo-ii-hws | f9e86139ba44181fed902ee135448ca35e533548 | 094ce37f6501cddcaba79eb31046183a628c3523 | refs/heads/main | 2023-06-11T10:30:10.379561 | 2021-07-05T16:06:11 | 2021-07-05T16:06:11 | 383,195,299 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 2,277 | cpp | q3_maxProfit.cpp | /*
* q3_maxProfit_skeleton.cpp
*
* Created on: June 14th, 2021
* Author: Ugur Unal
* Modified on: June 26th, 2021
* Student: Abdulkadir Pazar
* Student ID: 150180028
*/
#include <iostream>
#include <iomanip>
#include <fstream>
#include <string>
#include <set>
#include <utility>
#include <vector>
#include <algorithm>
using namespace std;
pair<int, set<int>> MaxProfit(int numOfCrystals, vector<int> profits, vector<int> entryCosts)
{
set<int> citiesToVisit;
int N = profits.size();
int W = numOfCrystals;
int matrix[N + 1][W + 1];
for(int i = 0; i < N + 1; i++)
for(int w = 0; w < W + 1; w++)
matrix[i][w] = 0;
for(int i = 1; i < N + 1; i++)
{
for(int w = 1; w < W + 1; w++)
{
if(entryCosts[i-1] > w)
matrix[i][w] = matrix[i-1][w];
else
matrix[i][w] = max(matrix[i-1][w], profits[i-1] + matrix[i-1][w - entryCosts[i-1]]);
}
}
int maxProfit = matrix[N][W];
int i = N;
int w = W;
while(i > 0 && w > 0)
{
if (matrix[i][w] != matrix[i-1][w])
{
citiesToVisit.insert(i);
w = w - entryCosts[i-1];
}
i = i - 1;
}
int numOfCities = N;
cout << "Dynaming Programming Table" << endl;
for (int i = 0; i <= numOfCities; i++) {
for (int j = 0; j <= numOfCrystals; j++) {
cout << std::right << std::setw(3) << matrix[i][j];
}
cout << endl;
}
return pair<int, set<int>>(maxProfit, citiesToVisit);
}
int main() {
int numOfCrystals;
vector<int> profits;
vector<int> entryCosts;
string inputFilename;
cout << "Enter the name of the input file: ";
cin >> inputFilename;
ifstream input(inputFilename);
if (!input.is_open()) {
cerr << "File named \"" << inputFilename << "\" could not open!" << endl;
return EXIT_FAILURE;
}
string line;
if (getline(input, line)) {
numOfCrystals = stoi(line);
}
while (getline(input, line, ' ')) {
profits.push_back(stoi(line));
getline(input, line);
entryCosts.push_back(stoi(line));
}
pair<int, set<int>> result = MaxProfit(numOfCrystals, profits, entryCosts);
cout << "Max profit is " << result.first << "." << endl;
cout << "Cities visited:";
for (int cityNumber : result.second) {
cout << " " << cityNumber;
}
cout << endl;
}
|
f30f65aa7aa07cd10585ca0ee7df051689f6436a | d99ab6e8586f76c6e6bdec1b2fba73e7d892f5e8 | /ACM/CodeSprint Elims/Untitled7.cpp | 89d11badc477b089c604b18313a5d8e3515f818b | [] | no_license | jindalshivam09/cppcodes | 661d368c77793a0c8170397711c1eec9eeff1e27 | c2913c4d3e144de7a0a60749b675e2f661d5b07b | refs/heads/master | 2021-05-16T02:39:47.452998 | 2020-07-26T18:45:42 | 2020-07-26T18:45:42 | 23,185,118 | 1 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 848 | cpp | Untitled7.cpp | #include<bits/stdc++.h>
using namespace std;
#define MAX 21
int n,k ;
vector<vector<int> > matrix(MAX,vector<int>(MAX)) , sum(MAX,vector<int>(MAX));
map<pair<int,int>,int> memo ;
#define MAX 1000000009
int funct(int index, int num) {
// cout << index << " " << num << endl;
if(index > n)
return 0 ;
if(memo.count(make_pair(index,num)) )
return memo[make_pair(index,num)] ;
int ans = MAX ;
for(int j=1;j<=k;j++) {
if((num&(1<<j)) == 0) {
int cnt = 0 ;
for(int i=index;i<=n;i++) {
cnt += matrix[j][i] ;
ans = min ( ans, cnt + funct(i+1,num|(1<<j)) ) ;
}
}
}
// cout << ans << endl;
return memo[make_pair(index,num)] = ans ;
}
int main() {
cin >> n >> k ;
for(int i=1;i<=k;i++)
for(int j=1;j<=n;j++) {
cin >> matrix[i][j] ;
sum[i][j] = sum[i][j-1] + matrix[i][j] ;
}
cout << funct(1,0) << endl;
}
|
939054019de9f005fbdf6e8b9fba4664dae1ba66 | 9a33566bdd5fd8a1a7f40b27f69ad8d1118f8f18 | /epoch/ayla/src/ayla/serialization/glm_serializer.cc | 9f5b5684d6f1c45d47f8c0859aad04202ea7e2fd | [
"MIT"
] | permissive | nwalablessing/vize | d0968f6208d608d9b158f0b21b0d063a12a45c81 | 042c16f96d8790303563be6787200558e1ec00b2 | refs/heads/master | 2023-05-31T15:39:02.877681 | 2019-12-22T14:09:02 | 2019-12-22T14:09:02 | null | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 1,773 | cc | glm_serializer.cc | #include "ayla/serialization/glm_serializer.hpp"
#include "ayla/serialization/boost/explicit_instantiation_macros.hpp"
#include "ayla/config.hpp"
#include <boost/serialization/nvp.hpp>
namespace boost {
namespace serialization {
template<class Archive>
void serialize(Archive &ar, glm::vec2& vector, const unsigned int version) {
ar & make_nvp("x", vector.x);
ar & make_nvp("y", vector.y);
}
template<class Archive>
void serialize(Archive &ar, glm::vec3& vector, const unsigned int version) {
ar & make_nvp("x", vector.x);
ar & make_nvp("y", vector.y);
ar & make_nvp("z", vector.z);
}
template<class Archive>
void serialize(Archive &ar, glm::vec4& vector, const unsigned int version) {
ar & make_nvp("x", vector.x);
ar & make_nvp("y", vector.y);
ar & make_nvp("z", vector.z);
ar & make_nvp("w", vector.w);
}
template <class Archive>
void serialize(Archive &ar, glm::mat4& matrix, const unsigned int version) {
ar & make_nvp("m00", matrix[0][0]);
ar & make_nvp("m01", matrix[0][1]);
ar & make_nvp("m02", matrix[0][2]);
ar & make_nvp("m03", matrix[0][3]);
ar & make_nvp("m10", matrix[1][0]);
ar & make_nvp("m11", matrix[1][1]);
ar & make_nvp("m12", matrix[1][2]);
ar & make_nvp("m13", matrix[1][3]);
ar & make_nvp("m20", matrix[2][0]);
ar & make_nvp("m21", matrix[2][1]);
ar & make_nvp("m22", matrix[2][2]);
ar & make_nvp("m23", matrix[2][3]);
ar & make_nvp("m30", matrix[3][0]);
ar & make_nvp("m31", matrix[3][1]);
ar & make_nvp("m32", matrix[3][2]);
ar & make_nvp("m33", matrix[3][3]);
}
EXPLICIT_INSTANTIATION_SERIALIZE_FUNC_P(glm::vec2, AYLA_API);
EXPLICIT_INSTANTIATION_SERIALIZE_FUNC_P(glm::vec3, AYLA_API);
EXPLICIT_INSTANTIATION_SERIALIZE_FUNC_P(glm::vec4, AYLA_API);
EXPLICIT_INSTANTIATION_SERIALIZE_FUNC_P(glm::mat4, AYLA_API);
}
} |
0cb63b9cb3837274473b0cf70375c9df94d0b186 | 21a880dcdf84fd0c812f8506763a689fde297ba7 | /src/ctp/exchange/ctpcommunicator.cc | 5fbb884c0c04f9bfcb0c16fd464f7d43737ef537 | [] | no_license | chenlucan/fix_handler | 91df9037eeb675b0c7ea6f22d541da74b220092f | 765462ff1a85567f43f63e04c29dbc9546a6c2e1 | refs/heads/master | 2021-03-22T02:07:39.016551 | 2017-08-01T02:02:20 | 2017-08-01T02:02:20 | 84,138,943 | 2 | 2 | null | null | null | null | UTF-8 | C++ | false | false | 4,763 | cc | ctpcommunicator.cc | #include <unistd.h>
#include <time.h>
#include <boost/container/flat_map.hpp>
#include "ctpcommunicator.h"
#include "core/assist/logger.h"
namespace fh
{
namespace ctp
{
namespace exchange
{
CCtpCommunicator::CCtpCommunicator(core::exchange::ExchangeListenerI *strategy,const std::string &config_file)
:core::exchange::ExchangeI(strategy), m_strategy(strategy),m_itimeout(10)
{
m_pFileConfig = new fh::core::assist::Settings(config_file);
}
CCtpCommunicator::~CCtpCommunicator()
{
delete m_pFileConfig;
}
bool CCtpCommunicator::Start(const std::vector<::pb::ems::Order> &init_orders)
{
LOG_INFO("CCtpCommunicator::Start");
if(NULL == m_pFileConfig)
{
LOG_ERROR("Error m_pThostFtdcMdApi is NULL ");
return false;
}
auto accountID = std::make_shared<fh::ctp::exchange::AccountID>();
accountID->setInvestorID(m_pFileConfig->Get("ctp-exchange.InvestorID"));
accountID->setPassword(m_pFileConfig->Get("ctp-user.Password"));
accountID->setBrokerID(m_pFileConfig->Get("ctp-user.BrokerID"));
accountID->setExchangeFrontAddress(m_pFileConfig->Get("ctp-exchange.url"));
accountID->setUserID(m_pFileConfig->Get("ctp-user.UserID"));
accountID->setCombOffsetFlag(m_pFileConfig->Get("ctp-exchange.OffsetFlag"));
accountID->setCombHedgeFlag(m_pFileConfig->Get("ctp-exchange.HedgeFlag"));
accountID->setTimeCondition(m_pFileConfig->Get("ctp-exchange.TimeCondition"));
accountID->setIsAutoSuspend(m_pFileConfig->Get("ctp-exchange.IsAutoSuspend"));
accountID->setExchangeID(m_pFileConfig->Get("ctp-exchange.ExchangeID"));
accountID->setVolumeCondition(m_pFileConfig->Get("ctp-exchange.HedgeFlag"));
accountID->setForceCloseReason( m_pFileConfig->Get("ctp-exchange.HedgeFlag"));
accountID->settimeout(m_pFileConfig->Get("ctp-timeout.timeout"));
m_trader = std::make_shared<fh::ctp::exchange::CCtpTraderSpi>(m_strategy, accountID);
time_t tmtimeout = time(NULL);
while(true != m_trader->isTradable())
{
if(time(NULL)-tmtimeout>m_itimeout)
{
LOG_ERROR("tiomeout ");
break;
}
sleep(0.1);
}
// 做完投资者结算结果确认操作,整个服务器连接与用户登录过程就完成了,可以正常下单交易了。
if(m_trader->isTradable() != true)
{
LOG_ERROR("m_trader->isTradable() != true ");
return false;
}
m_trader->m_InitQueryNum = init_orders.size();
for(auto& it : init_orders)
{
sleep(1);
Query(it); //报单查询
}
tmtimeout = time(NULL);
int tmpQueryNum = m_trader->m_InitQueryNum;
while(0 != m_trader->m_InitQueryNum)
{
if(time(NULL)-tmtimeout>m_itimeout)
{
LOG_ERROR("CCtpCommunicator::InitQuery tiomeout ");
return false;
}
if(tmpQueryNum != m_trader->m_InitQueryNum)
{
tmpQueryNum = m_trader->m_InitQueryNum;
tmtimeout = time(NULL);
}
sleep(0.1);
}
//check suss order
SendReqQryTrade(init_orders);
//check suss position
SendReqQryInvestorPosition(init_orders);
m_strategy->OnExchangeReady(boost::container::flat_map<std::string, std::string>());
LOG_INFO("CCtpCommunicator::InitQuery is over ");
return true;
}
void CCtpCommunicator::Stop()
{
LOG_INFO("CCtpCommunicator::Stop ");
// send message
m_trader->reqUserLogout();
return;
}
void CCtpCommunicator::Initialize(std::vector<::pb::dms::Contract> contracts)
{
// make Initialize
LOG_INFO("CCtpCommunicator::Initialize ");
return;
}
void CCtpCommunicator::Add(const ::pb::ems::Order& order)
{
LOG_INFO("CCtpCommunicator::Add ");
if(NULL == m_trader)
{
return ;
}
m_trader->reqOrderInsert(order);
return;
}
void CCtpCommunicator::Change(const ::pb::ems::Order& order)
{
LOG_INFO("CCtpCommunicator::Change ");
return;
}
void CCtpCommunicator::Delete(const ::pb::ems::Order& order)
{
LOG_INFO("CCtpCommunicator::Delete ");
m_trader->reqOrderAction(order, THOST_FTDC_AF_Delete);
return;
}
void CCtpCommunicator::Query(const ::pb::ems::Order& order)
{
LOG_INFO("CCtpCommunicator::Query");
// send message
m_trader->reqQryOrder(order);
return;
}
void CCtpCommunicator::Query_mass(const char *data, size_t size)
{
LOG_INFO("CCtpCommunicator::Query_mass ");
return;
}
void CCtpCommunicator::Delete_mass(const char *data, size_t size)
{
LOG_INFO("CCtpCommunicator::Delete_mass ");
return;
}
void CCtpCommunicator::SendReqQryTrade(const std::vector<::pb::ems::Order> &init_orders)
{
m_trader->reqQryTrade(init_orders);
}
void CCtpCommunicator::SendReqQryInvestorPosition(const std::vector<::pb::ems::Order> &init_orders)
{
LOG_INFO("CCtpCommunicator::SendReqQryInvestorPosition ");
m_trader->queryPosition(init_orders);
}
}
}
} |
bbf87f456a2517c9aad2942cbf22e002365516a6 | f009245299705562b151dd012882cf7f18e6c0c0 | /Testbed/Tests/ContinuousTest.cpp | edbd0427638adc1c04ea11fd6a157d600046d477 | [
"Zlib"
] | permissive | louis-langholtz/PlayRho | 9c4e203de846fc95bb2ea6956cfa625408af3598 | e14ba5bb23df73399343bd15d0ed102b2545f446 | refs/heads/master | 2023-08-17T20:45:44.571239 | 2023-08-16T01:21:25 | 2023-08-17T15:46:17 | 96,907,873 | 110 | 25 | Zlib | 2023-09-13T14:22:38 | 2017-07-11T15:22:02 | C++ | UTF-8 | C++ | false | false | 2,945 | cpp | ContinuousTest.cpp | /*
* Original work Copyright (c) 2006-2009 Erin Catto http://www.box2d.org
* Modified work Copyright (c) 2023 Louis Langholtz https://github.com/louis-langholtz/PlayRho
*
* This software is provided 'as-is', without any express or implied
* warranty. In no event will the authors be held liable for any damages
* arising from the use of this software.
*
* Permission is granted to anyone to use this software for any purpose,
* including commercial applications, and to alter it and redistribute it
* freely, subject to the following restrictions:
*
* 1. The origin of this software must not be misrepresented; you must not
* claim that you wrote the original software. If you use this software
* in a product, an acknowledgment in the product documentation would be
* appreciated but is not required.
* 2. Altered source versions must be plainly marked as such, and must not be
* misrepresented as being the original software.
* 3. This notice may not be removed or altered from any source distribution.
*/
#include "../Framework/Test.hpp"
namespace testbed {
class ContinuousTest : public Test
{
public:
static inline const auto registered =
RegisterTest("Continuous Test", MakeUniqueTest<ContinuousTest>);
ContinuousTest()
{
{
const auto body = CreateBody(GetWorld());
Attach(GetWorld(), body,
CreateShape(GetWorld(),
EdgeShapeConf{Vec2(-10.0f, 0.0f) * 1_m, Vec2(10.0f, 0.0f) * 1_m}));
Attach(GetWorld(), body,
CreateShape(GetWorld(), PolygonShapeConf{}.SetAsBox(
0.2_m, 1_m, Vec2(0.5f, 1.0f) * 1_m, 0_rad)));
}
{
auto bd = BodyConf{};
bd.type = BodyType::Dynamic;
bd.location = Vec2(0.0f, 20.0f) * 1_m;
bd.linearAcceleration = GetGravity();
// bd.angle = 0.1f;
m_body = CreateBody(GetWorld(), bd);
Attach(GetWorld(), m_body,
CreateShape(GetWorld(),
PolygonShapeConf{}.UseDensity(1_kgpm2).SetAsBox(2_m, 0.1_m)));
m_angularVelocity = RandomFloat(-50.0f, 50.0f) * 1_rad / 1_s;
// m_angularVelocity = 46.661274f;
SetVelocity(GetWorld(), m_body,
Velocity{Vec2(0.0f, -100.0f) * 1_mps, m_angularVelocity});
}
}
void Launch()
{
SetTransform(GetWorld(), m_body, Vec2(0.0f, 20.0f) * 1_m, 0_rad);
m_angularVelocity = RandomFloat(-50.0f, 50.0f) * 1_rad / 1_s;
SetVelocity(GetWorld(), m_body, Velocity{Vec2(0.0f, -100.0f) * 1_mps, m_angularVelocity});
}
void PostStep(const Settings&, Drawer&) override
{
if (GetStepCount() % 60 == 0) {
Launch();
}
}
BodyID m_body;
AngularVelocity m_angularVelocity;
};
} // namespace testbed
|
436b8fb62f0bf162e712cd70d840be88a25dd52d | 90d39aa2f36783b89a17e0687980b1139b6c71ce | /SPOJ/PPATH.cpp | 33959dbbca4b0f4755eb1bbab0bd5a309a9aed63 | [] | no_license | nims11/coding | 634983b21ad98694ef9badf56ec8dfc950f33539 | 390d64aff1f0149e740629c64e1d00cd5fb59042 | refs/heads/master | 2021-03-22T08:15:29.770903 | 2018-05-28T23:27:37 | 2018-05-28T23:27:37 | 247,346,971 | 4 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 2,744 | cpp | PPATH.cpp | /*
Nimesh Ghelani (nims11)
*/
#include<iostream>
#include<cstdio>
#include<algorithm>
#include<queue>
#include<vector>
#include<cmath>
#define in_T int t;for(scanf("%d",&t);t--;)
#define in_I(a) scanf("%d",&a)
#define in_F(a) scanf("%lf",&a)
#define in_L(a) scanf("%lld",&a)
#define in_S(a) scanf("%s",&a)
#define newline printf("\n")
#define MAX(a,b) a>b?a:b
#define MIN(a,b) a<b?a:b
#define SWAP(a,b) {int tmp=a;a=b;b=tmp;}
#define P_I(a) printf("%d",a)
using namespace std;
vector<int> primes;
int Primes[2000];int Count=0;
bool isPrime(long n)
{
if(n==1)
return 0;
int len=primes.size();
int limit=sqrt(n);
for(int i=0;i<len && primes[i]<=limit;i++)
if(n%primes[i]==0)
return false;
return true;
}
void generatePrimes(long n)
{
primes.push_back(2);
for(long i=3;i<=n;i+=2)
{
if(isPrime(i))
{primes.push_back(i);if(i>1000)Primes[Count++]=i;}
}
}
struct _PRIME
{
int a[4];
}tmp;
int search_b(int n)
{
int start=0,end=Count-1;
int mid;
while(start<end)
{
mid=(start+end)/2;
if(Primes[mid]<n)
{
start=mid+1;
continue;
}
if(Primes[mid]>=n)
{
end=mid;
continue;
}
}
return end;
}
vector<_PRIME> nodes;
queue<int> BFS;
void clear( std::queue<int> &q )
{
std::queue<int> empty;
std::swap( q, empty );
}
int visited[2000];
int main()
{
generatePrimes(9999);
for(int i=0;i<Count;i++)
{
tmp.a[0]=Primes[i]%10;
tmp.a[1]=(Primes[i]/10)%10;
tmp.a[2]=(Primes[i]/100)%10;
tmp.a[3]=(Primes[i]/1000)%10;
nodes.push_back(tmp);
}
int a,b;
in_T
{
in_I(a);in_I(b);
int src,dest;
src=search_b(a);
dest=search_b(b);
if(a==b){printf("0\n");continue;}
for(int i=0;i<Count;i++)
visited[i]=-1;
visited[src]=0;
BFS.push(src);
int k,l;
int ans;
while(!BFS.empty())
{
k=BFS.front();BFS.pop();
for(int i=0;i<Count;i++)
{
if(visited[i]==-1)
{
l=0;
for(int j=0;j<4;j++)
if(nodes[i].a[j]==nodes[k].a[j])
l++;
if(l==3)
{
visited[i]=1+visited[k];
if(i==dest)
{
ans=visited[i];
clear(BFS);
break;
}
BFS.push(i);
}
}
}
}
printf("%d\n",ans);
}
}
|
43d5521f52dcd6831872f27443182d8e6611aab3 | 4bcc9806152542ab43fc2cf47c499424f200896c | /tensorflow/compiler/xla/service/constant_value.cc | 54e23552f21aad6d144e46ae7b4058265b322a3e | [
"Apache-2.0",
"LicenseRef-scancode-generic-cla",
"BSD-2-Clause"
] | permissive | tensorflow/tensorflow | 906276dbafcc70a941026aa5dc50425ef71ee282 | a7f3934a67900720af3d3b15389551483bee50b8 | refs/heads/master | 2023-08-25T04:24:41.611870 | 2023-08-25T04:06:24 | 2023-08-25T04:14:08 | 45,717,250 | 208,740 | 109,943 | Apache-2.0 | 2023-09-14T20:55:50 | 2015-11-07T01:19:20 | C++ | UTF-8 | C++ | false | false | 3,309 | cc | constant_value.cc | /* Copyright 2023 The TensorFlow 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 required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
==============================================================================*/
#include "tensorflow/compiler/xla/service/constant_value.h"
#include <string>
namespace xla {
StatusOr<ConstantValue> ConstantValue::FromLiteral(const Literal& literal) {
CHECK_EQ(literal.shape().dimensions_size(), 0) << "Expected scalar literal";
return primitive_util::PrimitiveTypeSwitch<StatusOr<ConstantValue>>(
[&](auto primitive_type_constant) -> StatusOr<ConstantValue> {
if constexpr (primitive_util::IsIntegralType(primitive_type_constant)) {
return ConstantValue(
static_cast<uint64_t>(
literal.GetFirstElement<
primitive_util::NativeTypeOf<primitive_type_constant>>()),
/*bitwidth=*/primitive_util::BitWidth(primitive_type_constant),
/*is_signed=*/
primitive_util::IsSignedIntegralType(primitive_type_constant));
}
return InvalidArgument("Unsupported type");
},
literal.shape().element_type());
}
ConstantValue ConstantValue::div(const ConstantValue& other) const {
if (!is_signed_) {
return ConstantValue(value_ / other.value_, bitwidth_, is_signed_);
}
return ConstantValue(
absl::bit_cast<uint64_t>(absl::bit_cast<int64_t>(value_) /
absl::bit_cast<int64_t>(other.value_)),
bitwidth_, is_signed_);
}
ConstantValue ConstantValue::mod(const ConstantValue& other) const {
if (!is_signed_) {
return ConstantValue(value_ % other.value_, bitwidth_, is_signed_);
}
return ConstantValue(
absl::bit_cast<uint64_t>(absl::bit_cast<int64_t>(value_) %
absl::bit_cast<int64_t>(other.value_)),
bitwidth_, is_signed_);
}
ConstantValue ConstantValue::mul(const ConstantValue& other) const {
if (!is_signed_) {
return ConstantValue(value_ * other.value_, bitwidth_, is_signed_);
}
return ConstantValue(
absl::bit_cast<uint64_t>(absl::bit_cast<int64_t>(value_) *
absl::bit_cast<int64_t>(other.value_)),
bitwidth_, is_signed_);
}
bool ConstantValue::lt(const ConstantValue& other) const {
if (!is_signed_) {
return value_ < other.value_;
}
return absl::bit_cast<int64_t>(value_) <
absl::bit_cast<int64_t>(other.value_);
}
bool ConstantValue::gt(const ConstantValue& other) const {
if (!is_signed_) {
return value_ > other.value_;
}
return absl::bit_cast<int64_t>(value_) >
absl::bit_cast<int64_t>(other.value_);
}
std::string ConstantValue::ToString() const {
return is_signed_ ? absl::StrCat(GetSignedValue())
: absl::StrCat(GetUnsignedValue());
}
} // namespace xla
|
4a261b63e312d57a476de6c5f06c086e4801c48b | 26135a1362f8cb9638cc9649ec9cc2a11e2cd66e | /src/Dialect/ONNX/ONNXOps/RNN/RNN.cpp | dbd7440fc9838a31b3368f81786edbb107d317d3 | [
"Apache-2.0",
"LicenseRef-scancode-dco-1.1"
] | permissive | onnx/onnx-mlir | 81003870714bf743aac7b08666563552aac34a5b | 8919cf3198e8e98960d95b1fb163a58f43c52070 | refs/heads/main | 2023-08-28T13:18:14.750654 | 2023-08-28T09:57:10 | 2023-08-28T09:57:10 | 241,400,276 | 590 | 286 | Apache-2.0 | 2023-09-14T18:46:19 | 2020-02-18T15:43:43 | C++ | UTF-8 | C++ | false | false | 7,448 | cpp | RNN.cpp | /*
* SPDX-License-Identifier: Apache-2.0
*/
//===------------------ RNN.cpp - ONNX Operations ------------------------===//
//
// Copyright 2019-2022 The IBM Research Authors.
//
// =============================================================================
//
// This file provides definition of ONNX dialect RNN operations.
//
//===----------------------------------------------------------------------===//
#include "src/Dialect/ONNX/ONNXOps/OpHelper.hpp"
using namespace mlir;
using namespace mlir::OpTrait::util;
using namespace onnx_mlir;
//===----------------------------------------------------------------------===//
// Support
//===----------------------------------------------------------------------===//
namespace onnx_mlir {
template <typename OP_TYPE>
LogicalResult ONNXGenericRNNShapeHelper<OP_TYPE>::customComputeShape(
int gates) {
OP_TYPE rnnOp = llvm::cast<OP_TYPE>(op);
typename OP_TYPE::Adaptor operandAdaptor(operands, op->getAttrDictionary());
Value X = operandAdaptor.getX();
Value W = operandAdaptor.getW();
Value R = operandAdaptor.getR();
bool batchwiseLayout = operandAdaptor.getLayout() == 1;
// xShape :: [batch_size, seq_length, input_size] if batchwiseLayout
// xShape :: [seq_length, batch_size, input_size] otherwise
DimsExpr xDims, wDims, rDims;
createIE->getShapeAsDims(X, xDims);
// wShape :: [num_dir, gates*hidden_size, input_size]
createIE->getShapeAsDims(W, wDims);
// rShape :: [num_dir, gates*hidden_size, hidden_size]
createIE->getShapeAsDims(R, rDims);
if (xDims.size() != 3)
return op->emitError("The first input tensor must have rank 3");
if (wDims.size() != 3)
return op->emitError("The second input tensor must have rank 3");
if (rDims.size() != 3)
return op->emitError("The third input tensor must have rank 3");
// Get sequence length, batch size.
IndexExpr seqLength = batchwiseLayout ? xDims[1] : xDims[0];
IndexExpr batchSize = batchwiseLayout ? xDims[0] : xDims[1];
// Get hidden size from hidden_size attribute.
IndexExpr hiddenSize;
if (operandAdaptor.getHiddenSize().has_value()) {
hiddenSize = LiteralIndexExpr(operandAdaptor.getHiddenSize().value());
} else {
// Infer hidden_size from wShape and rShape if possible.
if (rDims[2].isLiteral())
hiddenSize = rDims[2];
else if (rDims[1].isLiteral())
hiddenSize = rDims[1].floorDiv(gates);
else if (wDims[1].isLiteral())
hiddenSize = wDims[1].floorDiv(gates);
else
// Pick one of the option above.
hiddenSize = rDims[2];
// Update hidden_size attribute.
if (hiddenSize.isLiteral()) {
auto builder = Builder(op->getContext());
auto hiddenSizeAttr =
IntegerAttr::get(builder.getIntegerType(64, /*isSigned=*/true),
APInt(64, /*value=*/hiddenSize.getLiteral(), /*isSigned=*/true));
rnnOp.setHiddenSizeAttr(hiddenSizeAttr);
}
}
// Get direction.
IndexExpr numDir;
if ((operandAdaptor.getDirection() == "forward") ||
(operandAdaptor.getDirection() == "reverse"))
numDir = LiteralIndexExpr(1);
else if (operandAdaptor.getDirection() == "bidirectional")
numDir = LiteralIndexExpr(2);
else
return op->emitError(
"direction attribute must be one of the strings: forward, "
"reverse, and bidirectional");
// Set result types. There are always 2 (RNN, GRU) or 3 results
// but they are sometimes optional in which case they have NoneType.
assert((rnnOp->getNumResults() == 2 || rnnOp->getNumResults() == 3) &&
"RNN, GRU have 2 results, LSTM has 3");
// Y :: [batch_size, seq_length, num_dir, hidden_size] if batchwiseLayout
// Y :: [seq_length, num_dir, batch_size, hidden_size] otherwise
DimsExpr yOutputDims;
if (!isNoneValue(op->getResult(0))) {
if (batchwiseLayout) {
yOutputDims = {batchSize, seqLength, numDir, hiddenSize};
} else {
yOutputDims = {seqLength, numDir, batchSize, hiddenSize};
}
setOutputDims(yOutputDims, 0);
}
// Y_h :: [batch_size, num_dir, hidden_size] if batchwiseLayout
// Y_h :: [num_dir, batch_size, hidden_size] otherwise
DimsExpr yHOutputDims;
if (!isNoneValue(op->getResult(1))) {
if (batchwiseLayout) {
yHOutputDims = {batchSize, numDir, hiddenSize};
} else {
yHOutputDims = {numDir, batchSize, hiddenSize};
}
setOutputDims(yHOutputDims, 1);
}
if (op->getNumResults() == 3) {
// Y_c :: [batch_size, num_dir, hidden_size] if batchwiseLayout
// Y_c :: [num_dir, batch_size, hidden_size] otherwise
DimsExpr yCOutputDims;
if (!isNoneValue(op->getResult(2))) {
if (batchwiseLayout) {
yCOutputDims = {batchSize, numDir, hiddenSize};
} else {
yCOutputDims = {numDir, batchSize, hiddenSize};
}
}
setOutputDims(yCOutputDims, 2);
}
return success();
}
template <>
mlir::LogicalResult ONNXGRUOpShapeHelper::computeShape() {
int gates = 3;
return customComputeShape(gates);
}
template <>
mlir::LogicalResult ONNXLSTMOpShapeHelper::computeShape() {
int gates = 4;
return customComputeShape(gates);
}
template <>
mlir::LogicalResult ONNXRNNOpShapeHelper::computeShape() {
int gates = 1;
return customComputeShape(gates);
}
} // namespace onnx_mlir
//===----------------------------------------------------------------------===//
// GRU
//===----------------------------------------------------------------------===//
LogicalResult ONNXGRUOp::inferShapes(
std::function<void(Region &)> doShapeInference) {
if (!hasShapeAndRank(getX()) || !hasShapeAndRank(getW()) ||
!hasShapeAndRank(getR())) {
return success();
}
Type elementType = getX().getType().cast<RankedTensorType>().getElementType();
ONNXGRUOpShapeHelper shapeHelper(getOperation(), {});
return shapeHelper.computeShapeAndUpdateType(elementType);
}
//===----------------------------------------------------------------------===//
// LSTM
//===----------------------------------------------------------------------===//
LogicalResult ONNXLSTMOp::inferShapes(
std::function<void(Region &)> doShapeInference) {
if (!hasShapeAndRank(getX()) || !hasShapeAndRank(getW()) ||
!hasShapeAndRank(getR())) {
return success();
}
Type elementType = getX().getType().cast<RankedTensorType>().getElementType();
ONNXLSTMOpShapeHelper shapeHelper(getOperation(), {});
return shapeHelper.computeShapeAndUpdateType(elementType);
}
//===----------------------------------------------------------------------===//
// RNN
//===----------------------------------------------------------------------===//
LogicalResult ONNXRNNOp::inferShapes(
std::function<void(Region &)> doShapeInference) {
if (!hasShapeAndRank(getX()) || !hasShapeAndRank(getW()) ||
!hasShapeAndRank(getR())) {
return success();
}
Type elementType = getX().getType().cast<RankedTensorType>().getElementType();
ONNXRNNOpShapeHelper shapeHelper(getOperation(), {});
return shapeHelper.computeShapeAndUpdateType(elementType);
}
//===----------------------------------------------------------------------===//
// Template instantiation
//===----------------------------------------------------------------------===//
namespace onnx_mlir {
template struct ONNXGenericRNNShapeHelper<mlir::ONNXGRUOp>;
template struct ONNXGenericRNNShapeHelper<mlir::ONNXLSTMOp>;
template struct ONNXGenericRNNShapeHelper<mlir::ONNXRNNOp>;
} // namespace onnx_mlir
|
00a0724023211bfb1b46e70a14c9735440ab1b40 | af4785d06675b6e8ee0b37d6621c3cef2a7025d3 | /TTSIoT_Class5/ParticlePublish_analog.ino | 08ef83575982b95a1c8f1755a0ca0874c2ff3885 | [] | no_license | jlosaw/TTS-EP-IoT | 50d88e93b65b16e9f30542944ff7b364b4988752 | f429e094c9673f370c4e3461bfddacad6e8da46e | refs/heads/master | 2020-03-30T00:11:21.310598 | 2019-01-31T15:39:47 | 2019-01-31T15:39:47 | 150,509,852 | 1 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 2,513 | ino | ParticlePublish_analog.ino |
// -----------------------------------------
// Analog Value to Particle Variable
// -----------------------------------------
/* In this example, we're going to add a continiually
updating state based on an analog reading. This will be pushed to the Particle console via
a simple command called particle publish.
We will start with the rotary pot.
*/
int led=D7; //define LED pin
int pot = A0; // This is where your potentiometer or photoresistor is plugged in.
int analogvalue; // Here we are declaring the integer variable analogvalue, which we will use later to store the value of the photoresistor.
int anaThreshold; // This is a value halfway between ledOnValue and ledOffValue, above which we will assume the led is on and below which we will assume it is off.
void setup() {
pinMode(pot,INPUT); // Our potentiometer pin is input (reading the photoresistor)
pinMode (led, OUTPUT);
// We are going to declare a Particle.variable() here so that we can access the value of the photoresistor from the cloud.
Particle.variable("analogvalue", &analogvalue, INT);
// This is saying that when we ask the cloud for "analogvalue", this will reference the variable analogvalue in this app, which is an integer variable.
anaThreshold=1500;
// set analog threshhold to a mid range value. Adjust this to move the trigger threshold
}
void loop() {
// read the analog pin
analogvalue = analogRead(pot);
Particle.publish("Analog Raw",String (analogvalue),PUBLIC);
//send the raw value from the sensor to Particle console
if (analogvalue>anaThreshold) {
/* If you are above the threshold, we'll assume this creates a "HIGH"
state. Else it results in a "LOW" state.
*/
// Send a publish to your devices...
Particle.publish("Analog Value","HIGH",60,PRIVATE);
/*First argument is name of the variable, second is the value, third is "Time to live" (TTL),
fourth is public or private. Note that for public events, you need not define the TTL time
(it will default to 60). However, private publish events require all 4 arguments
*/
// And trigger the LED to give us a visual too
digitalWrite(led,HIGH);
}
else {
// Send a publish...
Particle.publish("Analog Value","LOW",60,PRIVATE);
// And turn the LED off to visualize the state
digitalWrite(led,LOW);
}
delay (1000);
}
|
e4dba50f495f96e7c043fcc913db060c36d08280 | 436b5baf399543abd7bcaa26174e09d7e344dc94 | /quiz/continuemax.cpp | 111f1500f6413bcdd0d5ff0ef900ced94d235130 | [] | no_license | jkl09/intev | 5e4f302ce6c0a6d1d858a3e0e38cc73d1c46b2b4 | 53d0795ffdc2a2ce913b6d85c58dfda73f76d18e | refs/heads/master | 2021-05-29T15:46:14.912865 | 2015-09-11T07:20:50 | 2015-09-11T07:20:50 | null | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 1,082 | cpp | continuemax.cpp | /*
* @Author: root
* @Date: 2015-07-04 22:45:11
* @Last Modified by: root
* @Last Modified time: 2015-07-04 23:14:53
find continue max substr in str
*/
#include <iostream>
#include <string.h>
using namespace std;
int ContinueMax(char *str,char *substr)
{
if (NULL == str)
{
return 0;
}
int len = strlen(str);
int sublen =0;
int maxlen =0;
char *start,*end;
char *sub_start,*sub_end;
start = end =str;
while('\0' != *start)
{
// start =end;
while('\0' != *end)
{
// end++;
if (*(end +1)== *end +1)
{
end++;
}
else
{
sublen = end - start+1; // len = end-start +1
if (sublen > maxlen)
{
maxlen = sublen;
sub_start = start;
sub_end = end;
}
start = ++end;
break;
}
}
}
char *ptr;
ptr = sub_start;
while(sub_start != sub_end)
{
*substr = *sub_start;
sub_start++;
substr++;
}
return maxlen;
}
int main(){
char str[] = "abcd123456ed12345678";
char substr[100];
int maxlen;
maxlen = ContinueMax(str,substr);
cout<<"maxlen:"<<maxlen<< endl;
cout<<substr<<endl;
return 0;
} |
b12f1b043b8d2b7a97552a28385b6de5c43d5e23 | 7569fed919a32f108e6f0f26ef43736d6550f189 | /AdvancingFrontSurfaceReconstruction.cpp | 10ca24ec608bcd3710a72d0f7f00bacbfd7139a7 | [] | no_license | liukaizheng/AdvancingFrontSurfaceReconstruction | 97a13b3e0677857966c857f17e1c384513f12ef8 | 6130b3d0ed439657d8a9e160f0e90b75ad801cbc | refs/heads/master | 2020-09-13T21:12:42.199302 | 2019-12-19T07:11:23 | 2019-12-19T07:11:23 | 222,904,268 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 26,975 | cpp | AdvancingFrontSurfaceReconstruction.cpp | #include "AdvancingFrontSurfaceReconstruction.h"
#include "Delaunay3D.h"
#include "PreTypeDefine.h"
#include "Plausibility.h"
#include "SortMatrix.h"
#include "FaceToOrientedFace.h"
#include "TetrahedronCenter.h"
#include "TriangleCircleRadius.h"
#include "DelaunayRadius.h"
#include <ctime>
#include <algorithm>
#include <iterator>
#include <Eigen/Sparse>
#include <queue>
#include "WriteObj.h"
#include <iostream>
typedef Eigen::SparseMatrix<double> SpMat;
#define PrintMSG(msg) \
std::cout << #msg << ": " << msg << "\n";
AdvancingFrontSurfaceReconstruction::AdvancingFrontSurfaceReconstruction(const std::vector<double>& V, const double K, const double cosA, const double cosB)
:mV(V), mK(K), mCosA(cosA), mCosB(cosB), STANDBY_CANDIDATE(2), NEVER_VALID_CANDIDATE(3)
{
RowMatrixXd _V;
RowMatrixXi T;
_V.resize(V.size() / 3, 3);
std::copy(V.begin(), V.end(), _V.data());
Delaunay3D(_V, T);
mT.resize(T.size());
std::copy(T.data(), T.data() + mT.size(), mT.begin());
auto start = clock();
RowMatrixXi rF; //raw faces
rF.resize(T.rows() * 4, 3);
//first face
rF.topRows(T.rows()) = T.rightCols(3);
//second face
rF.block(T.rows(), 0, T.rows(), 1) = T.col(2);
rF.block(T.rows(), 1, T.rows(), 1) = T.col(3);
rF.block(T.rows(), 2, T.rows(), 1) = T.col(0);
//third face
rF.block(T.rows() * 2, 0, T.rows(), 1) = T.col(3);
rF.block(T.rows() * 2, 1, T.rows(), 1) = T.col(0);
rF.block(T.rows() * 2, 2, T.rows(), 1) = T.col(1);
//fourth face
rF.bottomRows(T.rows()) = T.leftCols(3);
RowMatrixXi urF; //unique raw faces
Eigen::VectorXi F2uF;
{
Eigen::VectorXi _uF2F;
UniqueRows(rF, urF, F2uF, _uF2F);
std::cout << "extract faces: " << clock() - start << "\n";
}
mNumFaces = static_cast<int>(urF.rows());
mF.resize(urF.size());
std::copy(urF.data(), urF.data() + mF.size(), mF.begin());
mF2uF.resize(F2uF.size());
std::copy(F2uF.data(), F2uF.data() + mF2uF.size(), mF2uF.begin());
FaceToOrientedFace(F2uF, mUF2F);
RowMatrixXi E(urF.rows() * 3, 2);
E.topRows(urF.rows()) = urF.rightCols(2);
E.block(urF.rows(), 0, urF.rows(), 1) = urF.col(2);
E.block(urF.rows(), 1, urF.rows(), 1) = urF.col(0);
E.bottomRows(urF.rows()) = urF.leftCols(2);
RowMatrixXi uE;
Eigen::VectorXi E2uE;
{
start = clock();
Eigen::VectorXi _uE2E;
UniqueRows(E, uE, E2uE, _uE2E);
std::cout << "extract edges:" << clock() - start << "\n";
mE.resize(uE.size());
std::copy(uE.data(), uE.data() + mE.size(), mE.begin());
mV2E.resize(mV.size() / 3);
for(Eigen::Index i = 0; i < uE.rows(); i++)
{
mV2E[uE(i, 0)].emplace_back(i);
mV2E[uE(i, 1)].emplace_back(i);
}
mVE2E.resize(mV.size() / 3);
for(int i = 0; i < static_cast<int>(mF.size() / 3); i++)
{
int* fv = &mF[i*3];
for(int j = 0; j < 3; j++)
{
int ei[2] = {(j + 1) % 3, (j + 2) % 3};
int e[2] = {E2uE(ei[0] * mNumFaces + i), E2uE(ei[1] * mNumFaces + i)};
mVE2E[fv[j]][e[0]].emplace_back(e[1]);
mVE2E[fv[j]][e[1]].emplace_back(e[0]);
}
}
}
mE2uE.resize(E2uE.size());
std::copy(E2uE.data(), E2uE.data() + mE2uE.size(), mE2uE.begin());
FaceToOrientedFace(E2uE, mUE2E);
mInvalidFaces.resize(mUE2E.size());
std::vector<bool> computable;
RowMatrixXd C;
TetrahedronCenter(_V, T, C, computable);
Eigen::VectorXd TR, R;
SquaredTriangleCircleRadius(_V, urF, TR);
/*DelaunayRadius(_V, T, C, TR, mUF2F, computable, R);*/
TR = TR.cwiseSqrt().eval();
mR.resize(TR.size());
//std::copy(R.data(), R.data() + mR.size(), mR.begin());
std::copy(TR.data(), TR.data() + mR.size(), mR.begin());
mPP = static_cast<Plausibility<double, int>*>(malloc(sizeof(Plausibility<double, int>) * mUE2E.size()));
init();
}
AdvancingFrontSurfaceReconstruction::~AdvancingFrontSurfaceReconstruction()
{
free(mPP);
}
void AdvancingFrontSurfaceReconstruction::run()
{
const auto recomputeValue = [this](int& f, int& ei)->int {
const auto uf = std::abs(f) - 1;
const auto& ue = mE2uE[uf + ei * mNumFaces];
const auto it = mBEF.find(ue);
if(it == mBEF.end())
return -1;
mInvalidFaces[ue].emplace(uf);
const int uif = it->second.first;
const int iei = it->second.second;
int cf, cei;
double cp;
CandidateTriangle(uif, iei, cf, cei, cp);
mPP[ue].f = cf;
mPP[ue].ei = cei;
mPP[ue].p = cp;
return ue;
};
while(!mQ.empty())
{
auto qit = mQ.begin();
std::set<Plausibility<double, int>*>::iterator::difference_type ind = 0;
while(!mQ.empty())
{
qit = mQ.begin();
Plausibility<double, int>* pb = *qit;
PrintMSG(mS.size());
#ifndef NDEBUG
std::stringstream ss;
ss << "models/m_" << mS.size() << ".obj";
WriteObj(mS, ss.str());
#endif
mQ.erase(qit);
if(pb->p < STANDBY_CANDIDATE)
{
int ret = StitchTriangle(pb->f, pb->ei, pb->p);
if(ret == 1)
{
/*qit = mQ.begin();
ind = 0;*/
}
else if(ret == 0)
{
const int ue = recomputeValue(pb->f, pb->ei);
if(ue >= 0)
{
if(mPP[ue].f != mNumFaces + 1)
{
mQ.emplace(&mPP[ue]);
}
}
}
else if(ret == 2)
{
const int uf = std::abs(pb->f) - 1;
int* fv = &mF[uf * 3];
mVGP[fv[0]].emplace_back(pb);
mVGP[fv[1]].emplace_back(pb);
mVGP[fv[2]].emplace_back(pb);
}
}
else
{
/*mQ.erase(qit);
qit = mQ.begin();
ind = 0;*/
}
}
if(!mQ.empty())
{
qit = mQ.begin();
Plausibility<double, int>* pb = *qit;
mQ.erase(qit);
const int ue = recomputeValue(pb->f, pb->ei);
if(mPP[ue].f != mNumFaces + 1)
{
mQ.emplace(&mPP[ue]);
}
qit = mQ.begin();
ind = 0;
}
}
}
void AdvancingFrontSurfaceReconstruction::GetFace(std::vector<int>& faces)
{
faces.resize(mS.size() * 3);
int ind = 0;
for(auto it = mS.begin(); it != mS.end(); it++)
{
int* ifv = &faces[ind * 3];
int* ofv = &mF[it->first * 3];
ifv[0] = ofv[0];
ifv[1] = ofv[1];
ifv[2] = ofv[2];
if(it->second)
std::swap(ifv[0], ifv[2]);
ind++;
}
}
void AdvancingFrontSurfaceReconstruction::GetBoundaryEdge(std::vector<std::vector<int>>& edges)
{
std::unordered_map<int, std::vector<int>> V2E;
//V2E.reserve(mBEF.size());
for(auto it = mBEF.begin(); it != mBEF.end(); it++)
{
int uf = std::abs(it->second.first) - 1;
int ei = it->second.second;
const int* fvs = &mF[uf * 3];
int v[2] = {fvs[(ei + 1) % 3], fvs[(ei + 2) % 3]};
const int ue = mE2uE[ei * 3 + uf];
V2E[v[0]].emplace_back(it->first);
V2E[v[1]].emplace_back(it->first);
}
std::unordered_set<int> visited;
//visited.reserve(mBEF.size());
std::vector<std::unordered_set<int>> BE;
for(auto it = mBEF.begin(); it != mBEF.end(); it++)
{
const auto eit = visited.find(it->first);
if(eit != visited.end()) continue;
std::queue<int> Q;
Q.emplace(it->first);
std::unordered_set<int> edge_component;
while(!Q.empty())
{
const int ue = Q.front();
Q.pop();
edge_component.emplace(ue);
visited.emplace(ue);
const int* ev = &mE[ue * 2];
for(unsigned i = 0; i < 2; i++)
{
for(unsigned j = 0; j < V2E[ev[i]].size(); j++)
{
const int tue = V2E[ev[i]][j];
const auto teit = edge_component.find(tue);
if(teit == edge_component.end())
Q.emplace(tue);
}
}
}
BE.emplace_back(edge_component);
}
edges.resize(BE.size());
for(unsigned i = 0; i < BE.size(); i++)
{
auto se = *BE[i].begin() + 1;
int e = se;
do {
edges[i].emplace_back(e);
auto ue = std::abs(e) - 1;
int* ev = &mE[ue * 2];
int cv = e < 0 ? ev[0] : ev[1];
for(unsigned j = 0; j < V2E[cv].size(); j++)
{
const auto nue = V2E[cv][j];
if(nue == ue) continue;
int idx = -1;
const int* nev = &mE[nue * 2];
if(nev[0] == cv)
idx = 1;
else if(nev[1] == cv)
idx = 0;
if(idx >= 0)
{
e = nue + 1;
if(idx == 0)
e = - e;
break;
}
}
}while(e != se);
}
}
void AdvancingFrontSurfaceReconstruction::init()
{
unsigned minFace = mNumFaces;
double minRadius = std::numeric_limits<double>::infinity();
std::unordered_set<int> invalidFaces;
bool unfinished =true;
int ind = 0;
while(unfinished)
{
PrintMSG(ind++);
for(unsigned i = 0; i < mR.size(); i++)
{
if(mR[i] < minRadius && mR[i] > std::numeric_limits<double>::epsilon())
{
auto it = invalidFaces.find(i);
if(it == invalidFaces.end())
{
minFace = i;
minRadius = mR[i];
}
}
}
if(minFace != mNumFaces)
{
std::vector<Plausibility<double, int>*> candidates;
const int f = minFace + 1;
for(unsigned i = 0; i < 3; i++)
{
int cf, cei;
double cp;
CandidateTriangle(f, i, cf, cei, cp, false);
if(cp < -1.0)
{
auto pb = &mPP[mE2uE[minFace + i * mNumFaces]];
pb->p = cp;
pb->f = cf;
pb->ei = cei;
candidates.emplace_back(pb);
}
}
if(candidates.size() == 3)
{
for(unsigned i = 0; i < 3; i++)
mQ.emplace(candidates[i]);
unfinished = false;
}
else
{
invalidFaces.emplace(minFace);
minFace = mNumFaces;
minRadius = std::numeric_limits<double>::infinity();
}
}
else
unfinished = false;
}
if(minFace != mNumFaces)
{
mAR = mR[minFace];
int fe[3] = {mE2uE[minFace], mE2uE[minFace + mNumFaces], mE2uE[minFace + 2 * mNumFaces]};
int* fv = &mF[minFace * 3];
const int f = minFace + 1;
mS.clear();
mS.emplace(std::make_pair(minFace, false));
mSV.clear();
mSV.resize(mV.size() / 3, false);
mSV[fv[0]] = true;
mSV[fv[1]] = true;
mSV[fv[2]] = true;
mSE.clear();
mSE.emplace(fe[0]);
mSE.emplace(fe[1]);
mSE.emplace(fe[2]);
mBEF.clear();
mBEF.emplace(std::make_pair(fe[0], std::make_pair(f, 0)));
mBEF.emplace(std::make_pair(fe[1], std::make_pair(f, 1)));
mBEF.emplace(std::make_pair(fe[2], std::make_pair(f, 2)));
mBVE.clear();
mBVE.resize(mV.size() / 3);
mBVE[fv[0]].emplace_back(fe[1]);
mBVE[fv[0]].emplace_back(fe[2]);
mBVE[fv[1]].emplace_back(fe[2]);
mBVE[fv[1]].emplace_back(fe[0]);
mBVE[fv[2]].emplace_back(fe[0]);
mBVE[fv[2]].emplace_back(fe[1]);
mVGP.clear();
mVGP.resize(mV.size() / 3);
}
}
inline bool AdvancingFrontSurfaceReconstruction::DihedralAngle(const int& f1, const int& f2, double& value)
{
const int uf1 = std::abs(f1) - 1;
const int uf2 = std::abs(f2) - 1;
const int* fv1 = &mF[3*uf1];
const int* fv2 = &mF[3*uf2];
const int& f10 = mF[3*uf1];
Eigen::Vector3d v11(mV[3 * fv1[1]] - mV[3 * fv1[0]], mV[3 * fv1[1] + 1] - mV[3*fv1[0] + 1], mV[3*fv1[1] + 2] - mV[3*fv1[0] + 2]);
Eigen::Vector3d v12(mV[3 * fv1[2]] - mV[3 * fv1[0]], mV[3 * fv1[2] + 1] - mV[3*fv1[0] + 1], mV[3*fv1[2] + 2] - mV[3*fv1[0] + 2]);
Eigen::Vector3d v1 = v11.cross(v12);
if(v1.squaredNorm() < std::numeric_limits<double>::epsilon())
return false;
Eigen::Vector3d v21(mV[3 * fv2[1]] - mV[3 * fv2[0]], mV[3 * fv2[1] + 1] - mV[3*fv2[0] + 1], mV[3*fv2[1] + 2] - mV[3*fv2[0] + 2]);
Eigen::Vector3d v22(mV[3 * fv2[2]] - mV[3 * fv2[0]], mV[3 * fv2[2] + 1] - mV[3*fv2[0] + 1], mV[3*fv2[2] + 2] - mV[3*fv2[0] + 2]);
Eigen::Vector3d v2 = v21.cross(v22);
if(v2.squaredNorm() < std::numeric_limits<double>::epsilon())
return false;
v1.normalize();
v2.normalize();
value = v1.dot(v2);
if((f1 < 0) ^ (f2 < 0))
value = -value;
return true;
}
inline void AdvancingFrontSurfaceReconstruction::CandidateTriangle(const int& f, const int& ei, int& cf, int& cei, double& value, bool consideringRadius)
{
const int uf = std::abs(f) - 1;
cf = mNumFaces + 1;
double cr = std::numeric_limits<double>::infinity(), ca; //radius and angle
const auto ue = mE2uE[uf + ei * mNumFaces];
const auto& adjEdges = mUE2E[ue];
int v11 = mF[3 * uf + (ei + 1) % 3];
int v12 = mF[3 * uf + (ei + 2) % 3];
if(f < 0)
std::swap(v11, v12);
for(unsigned i = 0; i < adjEdges.size(); i++)
{
int af = adjEdges[i] % mNumFaces;
if(std::abs(af) == uf) continue;
const auto it = mInvalidFaces[ue].find(af);
if(it != mInvalidFaces[ue].end()) continue;
const int aei = adjEdges[i] / mNumFaces;
const int& v21 = mF[3*af + (aei + 1) % 3];
const int& v22 = mF[3*af + (aei + 2) % 3];
double da;
if(v11 == v21)
{
af = -(af + 1);
#ifndef NDEBUG
assert(v12 == v22);
#endif
}
else
{
af = af + 1;
#ifndef NDEBUG
assert(v11 == v22 && v12 == v21);
#endif
}
const int uaf = std::abs(af) - 1;
if(DihedralAngle(f, af, da))
{
if(da > mCosA)
{
if(mR[uaf] < cr)
{
cf = af;
cei = aei;
ca = da;
cr = mR[uaf];
}
}
}
}
const auto ucf = std::abs(cf) - 1;
if(ucf == mNumFaces || mR[ucf] < std::numeric_limits<double>::epsilon())
{
value = NEVER_VALID_CANDIDATE;
return;
}
/*if( mR[ucf] < mK * mR[uf] || mR[uf] < std::numeric_limits<double>::epsilon())*/
if(consideringRadius && mR[ucf] > mK * mAR)
{
value = NEVER_VALID_CANDIDATE;
return;
}
if(ca > mCosB)
{
value = -(1.0 + 1.0 / cr);
}
else
{
value = -ca;
}
}
inline AdvancingFrontSurfaceReconstruction::Type AdvancingFrontSurfaceReconstruction::Validate(const int& f, const int& ei)
{
const auto uf = std::abs(f) - 1;
if(!mSV[mF[uf * 3 + ei]])
return EXTENSION;
const auto& ue1 = mE2uE[uf + ((ei + 1) % 3) * mNumFaces];
const auto& ue2 = mE2uE[uf + ((ei + 2) % 3) * mNumFaces];
const auto bit1 = mBEF.find(ue1);
const auto bit2 = mBEF.find(ue2);
if(bit1 != mBEF.end() && bit2 != mBEF.end())
return HOLE_FILLING;
const auto sit1 = mSE.find(ue1);
const auto sit2 = mSE.find(ue2);
if(bit1 != mBEF.end() && sit2 == mSE.end())
return EARING_FILLING_1;
if(bit2 != mBEF.end() && sit1 == mSE.end())
return EARING_FILLING_2;
if(sit1 == mSE.end() && sit2 == mSE.end() && !mBVE[mF[uf * 3 + ei]].empty())
return GLUING;
return NOT_VALID;
}
inline int AdvancingFrontSurfaceReconstruction::StitchTriangle(const int& f, const int& ei, const double& p)
{
const auto uf = std::abs(f) - 1;
const int* fv = &mF[3 * uf];
const auto addFace = [&, this]() {
mS.emplace(std::make_pair(uf, f < 0));
mSV[fv[0]] = true;
mSV[fv[1]] = true;
mSV[fv[2]] = true;
mSE.emplace(mE2uE[uf]);
mSE.emplace(mE2uE[uf + mNumFaces]);
mSE.emplace(mE2uE[uf + 2 * mNumFaces]);
};
const auto addGluingCandidate = [&, this](const int& i) {
const int& v = fv[i];
if(mVGP[v].empty()) return;
for(auto it = mVGP[v].begin(); it != mVGP[v].end(); it++)
{
mQ.emplace(*it);
}
};
const auto removeEdge = [&, this](const int& i) {
const auto& ue = mE2uE[uf + i * mNumFaces];
auto eit = mBEF.find(ue);
#ifndef NDEBUG
assert(eit != mBEF.end());
#endif
if(eit != mBEF.end())
{
mBEF.erase(eit);
int ev[2] = {fv[(i+1)%3], fv[(i+2)%3]};
for(unsigned j = 0; j < 2; j++)
{
auto vit = std::find(mBVE[ev[j]].begin(), mBVE[ev[j]].end(), ue);
#ifndef NDEBUG
assert(vit != mBVE[ev[j]].end());
#endif
mBVE[ev[j]].erase(vit);
}
}
auto qit = mQ.find(&mPP[ue]);
if(qit != mQ.end())
{
mQ.erase(qit);
}
};
const auto addEdge = [&, this](const int& i) {
const auto ue = mE2uE[uf + i * mNumFaces];
const auto eit = mBEF.find(ue);
#ifndef NDEBUG
assert(eit == mBEF.end());
#endif
mBEF.emplace(std::make_pair(ue, std::make_pair(f, i)));
mBVE[fv[(i+1)%3]].emplace_back(ue);
mBVE[fv[(i+2)%3]].emplace_back(ue);
};
const auto addCandidate = [&, this](const int& i) {
int cf, cei;
double cp;
CandidateTriangle(f, i, cf, cei, cp);
const auto& ue = mE2uE[uf + i * mNumFaces];
mPP[ue].p = cp;
mPP[ue].f = cf;
mPP[ue].ei = cei;
mQ.emplace(&mPP[ue]);
};
#ifndef NDEBUG
const auto _ue = mE2uE[uf + ei * mNumFaces];
const auto _it = mBEF.find(_ue);
if(_it != mBEF.end())
WriteCandidate(_it->second.first, _it->second.second);
/*PrintMSG(fv[0]);
PrintMSG(fv[1]);
PrintMSG(fv[2]);
PrintMSG(_ue);
std::cout << "\n";*/
#endif
Type type = Validate(f, ei);
int eis[2] = {(ei + 1) % 3, (ei + 2) % 3};
if(type != NOT_VALID)
{
const auto n = mS.size();
mAR = mAR * (static_cast<double>(n) / (n + 1)) + mR[uf] * (1.0 / (n + 1));
}
if(type == EXTENSION)
{
addFace();
removeEdge(ei);
addEdge(eis[0]);
addEdge(eis[1]);
addCandidate(eis[0]);
addCandidate(eis[1]);
addGluingCandidate(0);
addGluingCandidate(1);
addGluingCandidate(2);
return 1;
}
else if(type == HOLE_FILLING)
{
addFace();
removeEdge(ei);
removeEdge(eis[0]);
removeEdge(eis[1]);
mVGP[fv[0]].clear();
mVGP[fv[1]].clear();
mVGP[fv[2]].clear();
return 1;
}
else if(type == EARING_FILLING_1 || type == EARING_FILLING_2)
{
addFace();
int ie = eis[0], re = eis[1]; //ie: edge to be inserted, re: edge to be removed
if(type == EARING_FILLING_1)
std::swap(ie, re);
removeEdge(ei);
removeEdge(re);
addEdge(ie);
addCandidate(ie);
mVGP[fv[ie]].clear();
addGluingCandidate(re);
addGluingCandidate(ei);
return 1;
}
else if(type == GLUING)
{
const auto& v0 = fv[ei];
#ifndef NDEBUG
assert(mBVE[v0].size() == 2);
#endif
const int& ue = mE2uE[uf + ei * mNumFaces];
const auto face_pair = mBEF[ue];
addFace();
removeEdge(ei);
addEdge(eis[0]);
addEdge(eis[1]);
int abv1[2];
int abv2[2];
for(unsigned i = 0; i < 2; i++)
{
const auto& be = mBVE[v0][i];
const auto it = mBEF.find(be);
#ifndef NDEBUG
assert(it != mBEF.end());
#endif
const int& abf = it->second.first;
const int& abei = it->second.second;
const int uabf = std::abs(abf) - 1;
const int* abfv = &mF[uabf * 3];
abv1[i] = abfv[(abei + 1) % 3];
abv2[i] = abfv[(abei + 2) % 3];
if(abf < 0)
std::swap(abv1[i], abv2[i]);
}
/*std::vector<std::tuple<int, int, double>> candidates;
std::vector<unsigned> indices;*/
std::vector<int> ge; //gluing triangle edges
std::vector<int> indices;
for(unsigned i = 0; i < 2; i++)
{
const auto cue = mE2uE[uf + eis[i] * mNumFaces];
//const auto cit = mGE.find(cue);
ge.emplace_back(cue);
Plausibility<double, int>* pb = &mPP[cue];
//if(cit == mGE.end())
//{
int cf, cei;
double cp;
CandidateTriangle(f, eis[i], cf, cei, cp);
pb->f = cf;
pb->ei = cei;
pb->p = cp;
//mGE.emplace(cue);
//}
if(pb->p < STANDBY_CANDIDATE)
{
const int* cfv = &mF[(std::abs(pb->f) - 1) * 3];
int cvei = (pb->ei + 1) % 3;
if(cfv[cvei] == v0)
cvei = (cvei + 1) % 3;
int cv[2] = {cfv[(cvei + 1) % 3], cfv[(cvei + 2) % 3]};
if(pb->f < 0)
std::swap(cv[0], cv[1]);
if((abv1[0] == cv[1] && abv2[0] == cv[0]) ||
(abv1[1] == cv[1] && abv2[1] == cv[0]))
{
Type t = Validate(pb->f, pb->ei);
if(t == EXTENSION || t == HOLE_FILLING || t == EARING_FILLING_1 || t == EARING_FILLING_2)
{
if(pb->p <= p)
indices.emplace_back(i);
}
}
}
}
if(indices.empty())
{
const auto sit = mS.find(uf);
#ifndef NDEBUG
assert(sit != mS.end());
#endif
mS.erase(sit);
for(unsigned i = 1; i < 3; i++)
{
const int rei = (ei + i) % 3;
const int& ae = mE2uE[uf + rei * mNumFaces];
const auto eit = mBEF.find(ae);
#ifndef NDEBUG
assert(eit != mBEF.end());
#endif
mBEF.erase(eit);
int rv[2] = {fv[(rei + 1) % 3], fv[(rei + 2) % 3]};
for(unsigned j = 0; j < 2; j++)
{
const auto vit = std::find(mBVE[rv[j]].begin(), mBVE[rv[j]].end(), ae);
#ifndef NDEBUG
assert(vit != mBVE[rv[j]].end());
#endif
mBVE[rv[j]].erase(vit);
}
const auto seit = mSE.find(ae);
#ifndef NDEBUG
assert(seit != mSE.end());
#endif
mSE.erase(seit);
}
mBEF.emplace(std::make_pair(ue, face_pair));
mBVE[fv[(ei + 1) % 3]].emplace_back(ue);
mBVE[fv[(ei + 2) % 3]].emplace_back(ue);
//return 2;
return 0;
}
int ind = -1;
if(indices.size() == 1)
{
ind = indices[0] == 0 ? 1 : 0;
}
else if(indices.size() == 2)
{
if(mPP[ge[indices[1]]].p < mPP[ge[indices[0]]].p)
{
indices[0] = 1;
indices[1] = 0;
}
}
addGluingCandidate(0);
addGluingCandidate(1);
addGluingCandidate(2);
for(unsigned i = 0; i < indices.size(); i++)
{
int ret = StitchTriangle(mPP[ge[indices[i]]].f, mPP[ge[indices[i]]].ei, mPP[ge[indices[i]]].p);
#ifndef NDEBUG
if(i == 0)
assert(ret == 1);
#endif
if(ret != 1)
{
ind = indices[i];
}
}
if(ind >= 0)
{
if(mPP[ge[ind]].f != mNumFaces + 1)
{
mQ.emplace(&mPP[ge[ind]]);
std::string here = "here";
PrintMSG(here);
}
}
return 1;
}
return 0;
}
#ifndef NDEBUG
void AdvancingFrontSurfaceReconstruction::WriteObj(const std::unordered_map<int, bool>& S, const std::string name)
{
unsigned ind = 0;
RowMatrixXi F(S.size(), 3);
for(auto it = S.begin(); it != S.end(); it++)
{
const int* fv = &mF[it->first * 3];
F(ind, 0) = fv[0];
F(ind, 1) = fv[1];
F(ind, 2) = fv[2];
if(it->second)
F.row(ind) = F.row(ind).reverse().eval();
ind++;
}
RowMatrixXd V(mV.size() / 3 ,3);
std::copy(mV.begin(), mV.end(), V.data());
::WriteObj(name, V, F);
}
void AdvancingFrontSurfaceReconstruction::WriteCandidate(const int& f, const int& ei)
{
const int uf = std::abs(f) - 1;
double cv = mCosA;
const auto& adjEdges = mUE2E[mE2uE[uf + ei * mNumFaces]];
int v11 = mF[3 * uf + (ei + 1) % 3];
int v12 = mF[3 * uf + (ei + 2) % 3];
if(f < 0)
std::swap(v11, v12);
std::unordered_map<int, bool> S;
for(unsigned i = 0; i < adjEdges.size(); i++)
{
int af = adjEdges[i] % mNumFaces;
const int aei = adjEdges[i] / mNumFaces;
const int& v21 = mF[3*af + (aei + 1) % 3];
const int& v22 = mF[3*af + (aei + 2) % 3];
if(v11 == v21)
{
af = -af;
}
S.emplace(std::make_pair(std::abs(af), af < 0));
}
std::stringstream ss;
ss << "models/m_" << mS.size() <<"c.obj";
WriteObj(S, ss.str());
}
int AdvancingFrontSurfaceReconstruction::GetBoundaryEdge(int v1, int v2)
{
for(auto it = mBEF.begin(); it != mBEF.end(); it++)
{
int uf = std::abs(it->second.first) - 1;
int ei = it->second.second;
const int* fvs = &mF[uf * 3];
int v[2] = {fvs[(ei + 1) % 3], fvs[(ei + 2) % 3]};
if ((v[0] == v1 && v[1] == v2) || (v[0] == v2 && v[1] == v1))
return it->first;
}
return - 1;
}
#endif
|
56be74803e3a5084570940a9d3f8e6686ce52a1d | 0e08da5eac5c1d3387546725c8cfcd54add98edc | /MPM/MPM/Vec3.h | 3b1bf369189cf3f1ff305d695c376cc35c4cc164 | [] | no_license | clucasa/MPMViz | 5eb16817f5411ceede6aecd02b2867ea40b9826d | 1563bab8393aed8887529a27ee23267deb6a0a7c | refs/heads/master | 2021-01-19T14:36:22.800108 | 2014-10-24T03:18:54 | 2014-10-24T03:18:54 | null | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 819 | h | Vec3.h | // Vec3.h - Zander Clucas 2014
// Handles all Vec3 functionality
#ifndef VEC3_H
#define VEC3_H
#include <stdio.h>
#include <string.h>
#define _USE_MATH_DEFINES
#include <cmath>
#include <glew.h>
class Vec3
{
public:
GLfloat x, y, z;
public:
Vec3( GLfloat=0, GLfloat=0, GLfloat=0 );
Vec3& operator=( const Vec3& );
Vec3 operator+( const Vec3& );
Vec3 operator-( const Vec3& ); // binary -
Vec3 operator-( ); // unary -
Vec3 cross( Vec3& );
GLfloat dot( Vec3& );
void export_out( GLfloat [3] );
GLfloat length( );
void print( char * = "", FILE * = stderr );
Vec3 normalize( );
friend class Mat4;
};
inline GLfloat
SQR( GLfloat f )
{
return f * f;
}
#endif |
45afdfc1c077aa4eb6f1e331b1d241cb9f29c54c | 588c5b577049374ffc2b079156109d09e4be9a61 | /imexport.h | 368cf0843397592fc11f5067356ea76c53ac9350 | [] | no_license | u3556490/ENGG1340-49 | b9b124292208e8d4debc6c481976d89e2697ce01 | bda1144af22fc0cfabd1351ec1133140bba27d00 | refs/heads/master | 2020-04-30T22:25:11.225741 | 2019-04-27T13:18:35 | 2019-04-27T13:18:35 | 177,118,541 | 0 | 1 | null | 2019-04-20T13:55:05 | 2019-03-22T10:15:50 | C++ | UTF-8 | C++ | false | false | 737 | h | imexport.h | #ifndef DBIEPORT
#define DBIEPORT
#include "main.h"
#include <vector>
// -----------------------------
// function import_file: reads an address from the user and imports a
// whole inventory from that address.
// @params none
// @return vector<Commodity>: the inventory obtained
// -----------------------------
std::vector<main_header::Commodity> import_file();
// -----------------------------
// function export_file: reads an address from the user and exports the
// current inventory to that address.
// @params vector<Commodity>* list: the inventory to export
// @return bool: whether the action is successful.
// -----------------------------
bool export_file(std::vector<main_header::Commodity>* list);
#endif /* DBIEPORT */
|
87901bc5e69d5b2668cff6c4b8f7898a5a1243d0 | 88d1ce3add86f8ced0df9d0d8411359592acaa4a | /labo 7/arreglo2.cpp | 0d6a7700e624b6cdeccffe0278790e18930c795a | [] | no_license | kevnefeg/Labosfunda | cf5f75bbe1c25a464908832943491182170a4dfa | 3919b51b521ad72d27ab9f541af920c333c713b0 | refs/heads/master | 2022-12-03T20:18:31.991618 | 2020-08-21T04:36:38 | 2020-08-21T04:36:38 | 249,773,463 | 1 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 1,066 | cpp | arreglo2.cpp | #include <iostream>
#include <conio.h>
using namespace std;
//cantida de elementos impares
int arreglo[] = {1, 3, 5, 7, 9, 11, 13, 15, 17, 19, 21, 23, 25, 27, 29,
31, 33, 35, 37, 39, 41, 43, 45, 47, 49, 51, 53, 55, 57, 59, 61, 63, 65, 67,
69, 71, 73, 75, 77, 79, 81, 83, 85, 87, 89, 91, 93, 95, 97, 99};
int main()
{
//despliege de informacion
cout<<"\n*-*-*-Bienvenido al programa-*-*-*\n";
cout<<"\nAcontinuacion se desplegara los numeros impares del 1-100\n";
//pausa para no correr todo sin dejar leer antes
system("pause");
int i, k, orden;
for ( i = 0; i < 49; i++)
{
for ( k = 0; k < 49; k++)
{
if (arreglo[k] > arreglo[k+1])
{
orden = arreglo[k];
arreglo[k] = arreglo[k + 1];
arreglo[k +1] = orden;
}
}
}
//salida de los numeros
cout<<"\nORDEN DESCENDENTE\n";
for ( i = 49; i>= 0; i--)
{
cout<<arreglo[i]<<" "<<" "<<endl;
}
getch();
return 0;
} |
510c1418c1f951a52f674ac3bfeac9abe33b87ae | 7619baf942a24e5f1c3c776126d5b3e9286f1341 | /KeywordsColoring2/source/cwprocess.cpp | 3cb90b950a33fe413bf0e7d4c22c0af3b0adafee | [] | no_license | sillsdev/CarlaLegacy | 2fe9c6f35f065e7167bfd4135dd5e48be3ad23be | 553ae08a7ca6c24cffcdeaf85846df63125a57fd | refs/heads/master | 2022-11-15T04:57:18.629339 | 2022-09-27T14:18:15 | 2022-09-27T14:18:15 | 6,128,324 | 10 | 8 | null | 2022-11-09T21:43:38 | 2012-10-08T17:33:08 | XSLT | UTF-8 | C++ | false | false | 12,822 | cpp | cwprocess.cpp | // CWProcess.cpp: implementation of the CCWProcess class.
//
// 2.0.4 19-Jan-2000 hab Fix getBatchName so it allows for more than 9 processes
// 2.1.0 07-Mar-2000 hab Added processInformationFile
//////////////////////////////////////////////////////////////////////
#include "stdafx.h"
#include "../resource.h" // will load the rsrc ids for carastudio, which is what we need for the progress dialog
#include <strstrea.h>
#include <fstream.h>
#include "ProcessSequence.h"
#include "ModelFilesSet.h"
#include "winerror.h"
#include <io.h>
#include <errno.h>
//#include "ProjectDoc.h"
#include "processingPrefs.h"
#include "ProcessOutput.h"
#include "ProcessStatus.h"
#include "DlgProgress.h"
static CString emptyString;
IMPLEMENT_DYNAMIC(CProcess, CObject);
CProcess::CProcess()
:m_bEnabled(TRUE)
{
}
#ifndef hab210
void CProcess::processInformationFile(CProcessStatus &status)
{
ASSERTX(FALSE);
//throw (CProcessFailureBadInputType(this, RAW));
}
#endif //hab210
void CProcess::processRAWTextString(CProcessStatus &status)
{
ASSERTX(FALSE);
//throw (CProcessFailureBadInputType(this, RAW));
}
void CProcess::processRAWTextFile(CProcessStatus &status)
{
ASSERTX(FALSE);
//throw (CProcessFailureBadInputType(this, RAW));
}
void CProcess::processInterlinearFile(CProcessStatus &status)
{
ASSERTX(FALSE);
//throw (CProcessFailureBadInputType(this, RAW));
}
void CProcess::processANAFile(CProcessStatus &status)
{
ASSERTX(FALSE);
//throw (CProcessFailureBadInputType(this, ANA));
}
void CProcess::processPTEXTFile(CProcessStatus &status)
{
ASSERTX(FALSE);
//throw (CProcessFailureBadInputType(this, PTEXT));
}
void CProcess::processDictionaries(CProcessStatus & status)
{
ASSERTX(FALSE);
//throw (CProcessFailureBadInputType(this, PTEXT));
}
IMPLEMENT_DYNAMIC(CDLLProcess, CProcess);
IMPLEMENT_DYNAMIC(CDOSProcess, CProcess);
CString CDOSProcess::getBatchName(CProcessStatus& status)
{
//CCarlaLanguage* pLang = m_pOwningSequence->getSrcLang();
#ifndef hab204
CString sBatchFile;
sBatchFile.Format("%s%d",
status.getInputMFS()->getAbrev(),
status.m_iProcNumber);
#else // hab204
CString sBatchFile (status.getInputMFS()->getAbrev());
sBatchFile+='0' + status.m_iProcNumber;
#endif // hab204
return sBatchFile;
}
/*
* WinExecWait(char *szCmdLine, UINT);
*
* This function executes szCmdLine and doesn't return until szCmdLine is done.
* Used by Run Batch File command.
* Written by Doug Eberman Aug 97
*/
BOOL WinExecWait(const char *szCmdLine, UINT nCmdShow)
{
STARTUPINFO si;
PROCESS_INFORMATION pi;
si.cb = sizeof(si);
// DebugMessage ("%i", (int) sizeof(si));
si.lpReserved = NULL;
si.lpDesktop = NULL;
si.lpTitle = NULL;
si.dwFlags = STARTF_USESHOWWINDOW;
si.wShowWindow = (WORD) nCmdShow;
si.cbReserved2 = 0;
si.lpReserved2 = 0;
if (!CreateProcess (NULL, (char*)szCmdLine, NULL, NULL, FALSE,
CREATE_DEFAULT_ERROR_MODE, NULL, NULL, &si, &pi))
{
MessageBox (NULL, "WinExecWait failed.", "Installation Program", MB_OK);
return FALSE;
}
//WaitForSingleObject (pi.hProcess, 1000*60*10); // 10 minutes INFINITE);
return TRUE;
}
BOOL CDOSProcess::executeTool(CProcessStatus& status)
{
CString sCl = getCommandLine(status);
/* FIND OUT WHERE THE EXECUTABLE IS */
CString sActualPath;
HINSTANCE hInstance = FindExecutable(getToolPath(), NULL, sActualPath.GetBuffer(MAX_PATH));
sActualPath.ReleaseBuffer();
if((DWORD)hInstance == ERROR_FILE_NOT_FOUND)
{
CString s;
s.Format("The executable %s could not be found. Make sure it is part of the PATH statement in your AUTOEXEC.BAT file\n", getToolPath());
throw(CProcessFailure(this, s));
}
else if((DWORD)hInstance == ERROR_PATH_NOT_FOUND)
{
CString s;
s.Format("Windows gave a PATH NOT FOUND error while trying to execute %s\n", getToolPath());
throw(CProcessFailure(this, s));
}
else if((DWORD)hInstance == SE_ERR_ACCESSDENIED)
{
CString s;
s.Format("Windows gave an ACCESS DENIED error while trying to execute %s\n", getToolPath());
throw(CProcessFailure(this, s));
}
else if((DWORD)hInstance <=32)
{
CString s;
s.Format("Unknown problem trying to execute(find?) %s\n", getToolPath());
throw(CProcessFailure(this, s));
}
CString sBatchPath = status.makeTempPath(getBatchName(status), ".bat");
ofstream fout(sBatchPath);
if(!fout.is_open())
{
MessageBox( NULL, "executeTool()", "Couldn't open batch file for writing", MB_ICONEXCLAMATION | MB_OK);
return FALSE;
}
//TRACE("%s Command Line Length=%d\n", getToolPath(), strlen(sCl));
fout << "REM created by CARLAStudio during a parse operation\n";
fout << "\"" << sActualPath << "\" " << sCl << "\n";
fout.close();
CString s;
#ifdef Before1_04
if(status.getVerbosity())
s = sBatchPath;
else
s.Format("C:\\WINDOWS\\COMMAND.COM /c \"%s\"", sBatchPath);
#else // hab and drz 1.04 to make work with NT
TCHAR lpszCommand[MAX_PATH];
if (RunningNT())
{
GetSystemDirectory(lpszCommand, MAX_PATH);
lstrcat(lpszCommand, "\\cmd.exe");
}
else
{
GetWindowsDirectory(lpszCommand, MAX_PATH);
lstrcat(lpszCommand, "\\command.com");
}
s.Format("%s %s \"%s\"", lpszCommand,
(status.getVerbosity()& 0x01) ? "/k" : "/c", //jdh 11/10/99
sBatchPath);
#endif // Before1_04
return WinExecWait(s, TRUE); //status.getVerbosity());// false makes winoldapps
/* hInstance = ShellExecute(
AfxGetMainWnd( )->m_hWnd, // handle to parent window
"open", // pointer to string that specifies operation to perform
sBatchPath, // pointer to filename or folder name string
NULL, // pointer to string that specifies executable-file parameters
// To Do: this is just a guess at the best place to put them
//status.sRAWPath.getDirectory(), // pointer to string that specifies default directory
status.getTempDirectory(),
status.getVerbosity()?SW_SHOW:SW_HIDE // whether file is shown when opened
);
return TRUE;
*/
}
CProcessTemplate::CProcessTemplate(CRuntimeClass* pClass ,
LPCTSTR lpszDisplayName,
LPCTSTR lpszInputTypeDisplay,
LPCTSTR lpszOutputTypeDisplay,
LPCTSTR lpszIdentifier,
DWORD allowable_seq_types,
long lVersion)
: m_pClass(pClass),
m_sDisplayName(lpszDisplayName),
m_sIdentifier(lpszIdentifier),
m_lVersion(lVersion),
m_sInputTypeDisplay(lpszInputTypeDisplay),
m_sOutputTypeDisplay(lpszOutputTypeDisplay),
m_allowable_seq_types(allowable_seq_types)
{
}
// used to dynamically create an instance of a process
// will return null if that process is marked to only allow one instantiation
// parameters: pInputFile (optional). This object is ready to
// iSeqFunctionCode: what kind of sequence is this? (CProcess::kAnalysis, etc)
// this is ignored by the baseclass implementation
// give the parameters that were saved by this process.
// Example: \+Process JOINCOMPDLL
// \PartialCompoundsOK 0 <--- pInputFile pointing here
// \-Process JOINCOMPDLL
CProcess* CProcessTemplate::createProcess(int iSeqFunctionCode, SFMFile* pInputFile)
{
CProcess* pObject = (CProcess*)m_pClass->CreateObject();
if(pObject)
{
ASSERTX( pObject->IsKindOf( m_pClass ));
if(pInputFile)
pObject->readParametersFromSFMFile(pInputFile);
}
else
AfxMessageBox("Couldn't create the process.\n");
return pObject;
}
IMPLEMENT_DYNAMIC(CProcessTemplate, CObject);
void CProcessTemplate::addItemToListControl(CListCtrl & clc, const CProcessSequence* pSeq)
{
LV_ITEM lvi;
lvi.mask = LVIF_TEXT | LVIF_PARAM |LVIF_STATE; //; | LVIF_STATE;
lvi.pszText = LPSTR_TEXTCALLBACK; // app. maintains text
lvi.iImage = 1; // image list index
lvi.iSubItem = 0;
lvi.iItem = 999; // make it the last
lvi.lParam = (LPARAM) this;
if(!getCanAddToSeq(pSeq))
lvi.state = INDEXTOOVERLAYMASK(1); // draw the 'not' icon over it
//lvi.state = LVIS_CUT;
else
{ lvi.state = 0; // getStateValue();
lvi.stateMask = LVIS_OVERLAYMASK;
ASSERTX(-1 != clc.InsertItem(&lvi)); // only insert the availible ones
}
//lvi.stateMask = LVIS_CUT;
//ASSERTX(-1 != clc.InsertItem(&lvi));
}
CString CProcessTemplate::getListCtrlText(int iColumn)
{
switch(iColumn)
{
case 0: return m_sDisplayName;
break;
case 1: return m_sInputTypeDisplay; break;
case 2: return m_sOutputTypeDisplay; break;
default: ASSERTX(FALSE);
return CString("COLUMN ERROR"); ;
break;
}
}
void CProcess::addItemToListControl(CListCtrl & clc)
{
LV_ITEM lvi;
lvi.mask = LVIF_TEXT | LVIF_PARAM; //; | LVIF_STATE;
lvi.pszText = LPSTR_TEXTCALLBACK; // app. maintains text
lvi.iImage = 1; // image list index
lvi.iSubItem = 0;
lvi.iItem = 999; // make it the last
lvi.lParam = (LPARAM) this;
lvi.state = 0; // getStateValue();
lvi.stateMask = 0; //LVIF_STATE;
ASSERTX(-1 != clc.InsertItem(&lvi));
}
CString CProcess::getListCtrlText(int iColumn)
{
switch(iColumn)
{
case 0: return getDisplayName();
break;
case 1: return getInputTypeDisplayName();
break;
case 2: return getOutputTypeDisplayName();
break;
default: ASSERTX(FALSE);
return CString("COLUMN ERROR"); ;
break;
}
}
// path1 is a file we'll wait to appear. Will throw an exception if it doesn't show up.
// then path2 will be checked, and an error will be thrown if it's not there.
void CProcess::waitForCompletion(CProcessStatus *pStatus, CPathDescriptor * path1, CPathDescriptor * path2)
{
#define SECONDS_TO_WAIT_B4_MSG 15
/* for(int x=0; x< 1000; x++)
{
pStatus->progress(NULL); // will check the cancel button
}
*/
for(int i=0; i< SECONDS_TO_WAIT_B4_MSG; i++)
{
if(path1->fileExistsAndIsClosed())
break;
Sleep(1000);
pStatus->progress(NULL); // will check the cancel button
}
// if it's still not done, change the progress msg
// to show impatience, so the user will be more likely
// to click cancel
if(!path1->fileExistsAndIsClosed())
{
CString s("Waiting for ");
s+= getDisplayName();
s+= " to finish. Click 'Cancel' to abort processing.";
pStatus->progress(s);
}
while(!path1->fileExistsAndIsClosed())
{
Sleep(1000);
pStatus->progress(NULL); // will check the cancel button
}
// working here
//Delay(pStatus->m_pProcPrefs->m_iWaitSeconds * 100);
if(path2 && !path2->fileExistsAndIsClosed())
{
CString s;
s.Format("It did not produce an expected file: %s.\nCheck this processor's log for more information.",
path2->getQuotedPath());
throw(CProcessFailure(this, s));
}
// TRACE("%s closed\n", path1->getFullPath());
// if(path2)
// TRACE(" and also %s closed\n", path2->getFullPath());
}
// virtual, so subclasses can be more descriptive
CString CProcess::getInputTypeDisplayName()
{
return getFileTypeDisplayName(getInputType());
}
// virtual, so subclasses can be more descriptive
CString CProcess::getOutputTypeDisplayName()
{
return getFileTypeDisplayName(getOutputType());
}
//STATIC
CString CProcess::getFileTypeDisplayName(PROCESS_FILE_TYPE t)
{
switch(t)
{
case INTERLINEAR: return "Interlinear Text"; break;
case INFORMATION: return "Information"; break;
case DICT: return "Dictionary"; break;
case RAWTEXT: return "Text"; break;
case ANA: return "ANA"; break;
case PTEXT: return "PText"; break;
default: return "UNKNOWN TYPE"; break;
}
}
CProcess::~CProcess()
{
}
// virtual
// later, we can subclass these templates and do something smart here
BOOL CProcessTemplate::getCanAddToSeq(const CProcessSequence * pSeq) const
{
return m_allowable_seq_types & pSeq->getFunctionCode();
}
/*void CResultStreamDescriptor::addItemToListControl(CListCtrl & clc, const CProcessSequence * pSeq)
{
LV_ITEM lvi;
lvi.mask = LVIF_TEXT | LVIF_PARAM ;//| LVIF_STATE;
char* lpsz = new char[m_sDisplayLabel.GetLength()+1];
strcpy (lpsz, m_sDisplayLabel);
lvi.pszText = lpsz;//LPSTR_TEXTCALLBACK; // app. maintains text
//lvi.iImage = 1; // image list index
lvi.iSubItem = 0;
lvi.iItem = 999; // make it the last
lvi.lParam = (LPARAM) this;
lvi.stateMask = NULL;
ASSERTX(-1 != clc.InsertItem(&lvi));
}
*/
CString CProcessTemplate::getDisplayName()
{
return m_sDisplayName;
}
void CProcess::registerLog(CProcessStatus& status,
CPathDescriptor & path,
CCarlaLanguage *pLang/*=NULL*/,
int eIcon/*=CResultStream::kNoIcon*/
)
{
if(path.fileExistsAndIsClosed())
{ CResultStreamFile* logStream =
new CResultStreamFile(
new CResultStreamDescriptor(this), // special log constructor
path.getFullPath(),
pLang, // can be null
eIcon);
status.registerResultStream(logStream);
}
}
BOOL CProcess::RunningNT()
{
OSVERSIONINFO osv;
osv.dwOSVersionInfoSize = sizeof(osv);
if (!GetVersionEx(&osv))
{
// error. you probably forgot to set osv.dwOSVersionInfoSize appropriately.
return false;
}
return VER_PLATFORM_WIN32_NT == osv.dwPlatformId;
}
|
258105937ece351e89a2e132b5f197ba82f6de2f | 1b8805aea65e2230d5f66bfef366f3fab54fa6d6 | /src/ComponentDispatcher/MessageHandles/Implementation/CComponentDispatcherPortConfigAllocTypeHandle.cpp | 5ae3c4e2eb0c1089a57c06bb92663a11e17a0b92 | [] | no_license | aplced/il_module | 153f3623203e021ab46de8792f9775e3d58cda5d | 0f15408a5473df608d9e99c15085477e1d42ff0f | refs/heads/master | 2020-05-30T00:48:19.272345 | 2012-12-11T13:59:06 | 2012-12-11T13:59:06 | null | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 1,424 | cpp | CComponentDispatcherPortConfigAllocTypeHandle.cpp | #include "inc/ComponentDispatcher/MessageHandles/Implementation/CComponentDispatcherPortConfigAllocTypeHandle.h"
TIMM_OSAL_ERRORTYPE CComponentDispatcherPortConfigAllocTypeHandle::Process(void* pMessage)
{
COMXComponent* compHdl;
COMXPortHandle* portData;
omxPortAllocMethodSetUp_t* allocType;
memAllocStrat_t allocStrat;
allocType = (omxPortAllocMethodSetUp_t*)((systemMessage_t *)pMessage)->pPayload;
compHdl = (COMXComponent*)dispatcher->GetOMXComponentSlot(allocType->nComponentId);
if (NULL == compHdl)
{
MMS_IL_PRINT("Unknown component\n");
return TIMM_OSAL_ERR_UNKNOWN;
}
portData = compHdl->GetPortData(allocType->nPortNumber);
if(portData == NULL)
{
MMS_IL_PRINT("Failed to get port %d data\n", allocType->nPortNumber);
return TIMM_OSAL_ERR_OMX;
}
// Set Input and Output Port
/* if ((portData->tPortDef.eDir != OMX_DirOutput))
{
return TIMM_OSAL_ERR_UNKNOWN;
}*/
switch(allocType->nAllocMethod)
{
case 0:
allocStrat = MEM_OMX;
break;
case 1:
allocStrat = MEM_OSAL;
break;
case 2:
allocStrat = MEM_ION_1D;
break;
case 3:
allocStrat = MEM_ION_2D;
break;
default:
allocStrat = MEM_UNDEF;
break;
}
portData->eAllocType = allocStrat;
return TIMM_OSAL_ERR_NONE;
} |
214a5cd4379a0630d97435abadf25213057391e4 | f956dbb991ceca512df6d8f6d20b202f069c5394 | /src/Lethe/Core/Collect/ArrayRef.h | 29dfc7999fe3d0dfd6d2b4edc5f70dd7226a4bd3 | [
"LicenseRef-scancode-unknown-license-reference",
"BSL-1.0",
"LicenseRef-scancode-warranty-disclaimer"
] | permissive | ntoskrnl7/lethe | bdda532a1273f683f6a101ee72e7e1863e4c7916 | c1a9bb45063f5148dc6cf681ce907dcbb468f5e6 | refs/heads/master | 2021-03-04T12:38:33.943621 | 2020-03-08T17:32:01 | 2020-03-08T17:32:01 | null | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 3,043 | h | ArrayRef.h | #pragma once
#include "../Sys/Types.h"
namespace lethe
{
template<typename T, typename S = Int>
class ArrayRef
{
public:
ArrayRef();
ArrayRef(T *ptr, S nsize);
void Init(T *ptr, S nsize);
const T *GetData() const;
T *GetData();
S GetSize() const;
const T &operator[](S index) const;
T &operator[](S index);
typedef const T *ConstIterator;
typedef T *Iterator;
ConstIterator Begin() const;
Iterator Begin();
ConstIterator End() const;
Iterator End();
ConstIterator begin() const;
Iterator begin();
ConstIterator end() const;
Iterator end();
// get slice
ArrayRef Slice(S from, S to) const;
ArrayRef Slice(S from) const;
inline bool IsValidIndex(S idx) const
{
return idx >= 0 && idx < this->size;
}
private:
T *data;
S size;
};
template<typename T, typename S>
inline ArrayRef<T,S>::ArrayRef()
: data(nullptr)
, size(0)
{
}
template<typename T, typename S>
inline ArrayRef<T,S>::ArrayRef(T *ptr, S nsize)
: data(ptr)
, size(nsize)
{
}
template<typename T, typename S>
inline void ArrayRef<T,S>::Init(T *ptr, S nsize)
{
data = ptr;
size = nsize;
LETHE_ASSERT(nsize >= 0);
LETHE_ASSERT(!nsize || ptr);
}
template<typename T, typename S>
inline const T *ArrayRef<T,S>::GetData() const
{
return data;
}
template<typename T, typename S>
inline T *ArrayRef<T, S>::GetData()
{
return data;
}
template<typename T, typename S>
inline S ArrayRef<T,S>::GetSize() const
{
return size;
}
template<typename T, typename S>
inline const T &ArrayRef<T,S>::operator[](S index) const
{
LETHE_ASSERT(index >= 0 && index < size);
return data[index];
}
template<typename T, typename S>
inline T &ArrayRef<T,S>::operator[](S index)
{
LETHE_ASSERT(index >= 0 && index < size);
return data[index];
}
template<typename T, typename S>
inline typename ArrayRef<T,S>::ConstIterator ArrayRef<T,S>::Begin() const
{
return data;
}
template<typename T, typename S>
inline typename ArrayRef<T,S>::Iterator ArrayRef<T,S>::Begin()
{
return data;
}
template<typename T, typename S>
inline typename ArrayRef<T,S>::ConstIterator ArrayRef<T,S>::End() const
{
return data + size;
}
template<typename T, typename S>
inline typename ArrayRef<T,S>::Iterator ArrayRef<T,S>::End()
{
return data + size;
}
template<typename T, typename S>
inline typename ArrayRef<T,S>::ConstIterator ArrayRef<T,S>::begin() const
{
return data;
}
template<typename T, typename S>
inline typename ArrayRef<T,S>::Iterator ArrayRef<T,S>::begin()
{
return data;
}
template<typename T, typename S>
inline typename ArrayRef<T,S>::ConstIterator ArrayRef<T,S>::end() const
{
return data + size;
}
template<typename T, typename S>
inline typename ArrayRef<T,S>::Iterator ArrayRef<T,S>::end()
{
return data + size;
}
template<typename T, typename S>
inline ArrayRef<T,S> ArrayRef<T,S>::Slice(S from, S to) const
{
LETHE_ASSERT(from >= 0 && to <= size && to >= from);
return ArrayRef(data + from, to - from);
}
template<typename T, typename S>
inline ArrayRef<T, S> ArrayRef<T, S>::Slice(S from) const
{
return Slice(from, size);
}
}
|
43441efa089b7290f940cf39818bf16c1195faa9 | 5d7403f86ce2611df053a196edbb63900bd1623b | /Задача№9/Задача№9/DynamicArray.cpp | dae7a55333e2834f1b659cba583968c996250828 | [] | no_license | tulenpodsoysom/Exam | b90e37cde8e4d1c00339109b5049ba3a3fefba39 | 2ca852415b7e97a0f98e85d7fa7f51f676959417 | refs/heads/master | 2023-06-09T18:15:17.054044 | 2021-06-29T10:57:54 | 2021-06-29T10:57:54 | 381,325,781 | 0 | 0 | null | null | null | null | WINDOWS-1251 | C++ | false | false | 766 | cpp | DynamicArray.cpp | #include "DynamicArray.h"
#include <ostream>
DynamicArray::DynamicArray()
{
_array = nullptr;
}
DynamicArray::~DynamicArray()
{
delete[] _array;
}
void DynamicArray::insert(int in)
{
_amount++;
if (_array != nullptr)
{
int* buffer = _array;
_array = new int[_amount];
for (int i = 0; i < _amount-1; i++)
{
_array[i] = buffer[i];
}
_array[_amount-1] = in;
}
else
{
_array = new int;
_array[0] = in;
}
}
int DynamicArray::amount()
{
return this->_amount;
}
int& DynamicArray::operator[](const int index)
{
// TODO: вставьте здесь оператор return
return _array[index];
}
ostream& DynamicArray::operator << (ostream& stream)
{
for (int i = 0; i < _amount; i++)
stream << _array[i] << endl;
return stream;
}
|
8bab805e623d4634afa157b0e5fa650cef956ad9 | eb1ff3bb16c4c276f4732c21491fdb41bcda2d1a | /src/Client/RemotePlayer.h | ac73fa78aab00e5111881eb6e7925f3e35ba8924 | [] | no_license | benHodadov/Reversi | 2dcaf339f44bd72aa7bf46fae3691744d99c9321 | 1e7bcec0023f4446d8706b641fc6784eabb6b58f | refs/heads/master | 2021-09-02T05:03:21.044325 | 2017-12-30T16:04:14 | 2017-12-30T16:04:14 | 112,382,322 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 964 | h | RemotePlayer.h | //
// Created by ben-hodadov on 07/12/17.
//
#ifndef REVERSITEST_REMOTEPLAYER_H
#define REVERSITEST_REMOTEPLAYER_H
#include "Player.h"
#include "Client.h"
class RemotePlayer : public Player{
public:
/**
* Constructor - create a new remote player class.
* @param _s char
*/
RemotePlayer(char _s, Client* client);
/**
* The method plays one turn for the computer.
* @param gl GameLogic&
* @param b Board*
* @return played
*/
Position playOneTurn(GameLogic &gl, Board *b);
/**
* The method chooses the computer's best move
* @param gl GameLogic&
* @param om vector<Position>
* @param b const Board&
* @return played
*/
Position chooseMove(GameLogic &gl, vector<Position> om, const Board &b);
/**
* end the game for local player (sends -1,-1 to the server)
*/
void endGame();
private:
Client* client;
};
#endif //REVERSITEST_REMOTEPLAYER_H
|
22d1b49825b19868146d0222ac4a8558b86d9ec6 | 263bf6aa8ace1b498809c49d7ff07f39976d4771 | /Test/Parser expresions/sy.hpp | 935b98c87eeccac01760e13b8c057dcfa8819d21 | [] | no_license | FedeVerstraeten/pgm-conformal-map | e96778541ec12c59d514cb6a839c5fae8fa7f915 | 2151468c86342d335ee379f2cd798bc18ebab918 | refs/heads/master | 2020-09-27T19:01:09.102288 | 2014-11-22T22:51:32 | 2014-11-22T22:51:32 | 226,586,634 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 1,164 | hpp | sy.hpp | #ifndef SY_HPP_INCLUDED
#define SY_HPP_INCLUDED
#include <iostream>
#include <string>
#include <vector>
#include <stack>
#include <cctype>
#include <cstdlib>
#include "common.hpp"
/*** Definiciones ***/
#define MAXOPERATION 6
/*** Tabla de asociatividad de operadores ***/
enum {
ASSOC_NONE=0,
ASSOC_LEFT, //Izquierda a derecha
ASSOC_RIGHT //Derecha a izquierda
};
/*** Estructura para manejar los operadores ***/
typedef struct operation {
string op; //Nombre o símbolo
int prec; //Valor de precedencia
int assoc; //Asociatividad
int unary; //Es unario
float (*eval)(float a1, float a2); //Función
} t_operation;
/*** Evaluadores ***/
float eval_uminus(float a1, float a2);
float eval_mul(float a1, float a2);
float eval_add(float a1, float a2);
float eval_sub(float a1, float a2);
/*** Funciones ***/
t_operation* getOp(const string &);
status_t shuntingYard(vector<string> &);
status_t shunt_op(t_operation *op);
#endif
|
c2057933ae6c55328d6a7d4c733110d7759925aa | e47e2263ca0b60d0c8327f74b4d4078deadea430 | /tess-two/jni/com_googlecode_tesseract_android/src/classify/picofeat.cpp | a4a39263cfd0b4ee5417203b323ca922a6ec2553 | [
"Apache-2.0",
"LicenseRef-scancode-unknown-license-reference"
] | permissive | rmtheis/tess-two | 43ed1bdcceee88df696efdee7c3965572ff2121f | ab4cab1bd9794aacb74162aff339daa921a68c3f | refs/heads/master | 2023-03-10T08:27:42.539055 | 2022-03-17T11:21:24 | 2022-03-17T11:21:24 | 2,581,357 | 3,632 | 1,331 | Apache-2.0 | 2019-10-20T00:51:50 | 2011-10-15T11:14:00 | C | UTF-8 | C++ | false | false | 10,127 | cpp | picofeat.cpp | /******************************************************************************
** Filename: picofeat.c
** Purpose: Definition of pico-features.
** Author: Dan Johnson
** History: 9/4/90, DSJ, Created.
**
** (c) Copyright Hewlett-Packard Company, 1988.
** 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 required by applicable law or agreed to in writing, software
** distributed under the License is distributed on an "AS IS" BASIS,
** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
** See the License for the specific language governing permissions and
** limitations under the License.
******************************************************************************/
/*----------------------------------------------------------------------------
Include Files and Type Defines
----------------------------------------------------------------------------*/
#include "picofeat.h"
#include "classify.h"
#include "efio.h"
#include "featdefs.h"
#include "fpoint.h"
#include "mfoutline.h"
#include "ocrfeatures.h"
#include "params.h"
#include "trainingsample.h"
#include <math.h>
#include <stdio.h>
/*---------------------------------------------------------------------------
Variables
----------------------------------------------------------------------------*/
double_VAR(classify_pico_feature_length, 0.05, "Pico Feature Length");
/*---------------------------------------------------------------------------
Private Function Prototypes
----------------------------------------------------------------------------*/
void ConvertSegmentToPicoFeat(FPOINT *Start,
FPOINT *End,
FEATURE_SET FeatureSet);
void ConvertToPicoFeatures2(MFOUTLINE Outline, FEATURE_SET FeatureSet);
void NormalizePicoX(FEATURE_SET FeatureSet);
/*----------------------------------------------------------------------------
Public Code
----------------------------------------------------------------------------*/
/*---------------------------------------------------------------------------*/
namespace tesseract {
/**
* Operation: Dummy for now.
*
* Globals:
* - classify_norm_method normalization method currently specified
* @param Blob blob to extract pico-features from
* @return Pico-features for Blob.
* @note Exceptions: none
* @note History: 9/4/90, DSJ, Created.
*/
FEATURE_SET Classify::ExtractPicoFeatures(TBLOB *Blob) {
LIST Outlines;
LIST RemainingOutlines;
MFOUTLINE Outline;
FEATURE_SET FeatureSet;
FLOAT32 XScale, YScale;
FeatureSet = NewFeatureSet(MAX_PICO_FEATURES);
Outlines = ConvertBlob(Blob);
NormalizeOutlines(Outlines, &XScale, &YScale);
RemainingOutlines = Outlines;
iterate(RemainingOutlines) {
Outline = (MFOUTLINE) first_node (RemainingOutlines);
ConvertToPicoFeatures2(Outline, FeatureSet);
}
if (classify_norm_method == baseline)
NormalizePicoX(FeatureSet);
FreeOutlines(Outlines);
return (FeatureSet);
} /* ExtractPicoFeatures */
} // namespace tesseract
/*----------------------------------------------------------------------------
Private Code
----------------------------------------------------------------------------*/
/*---------------------------------------------------------------------------*/
/**
* This routine converts an entire segment of an outline
* into a set of pico features which are added to
* FeatureSet. The length of the segment is rounded to the
* nearest whole number of pico-features. The pico-features
* are spaced evenly over the entire segment.
* Globals:
* - classify_pico_feature_length length of a single pico-feature
* @param Start starting point of pico-feature
* @param End ending point of pico-feature
* @param FeatureSet set to add pico-feature to
* @return none (results are placed in FeatureSet)
* @note Exceptions: none
* @note History: Tue Apr 30 15:44:34 1991, DSJ, Created.
*/
void ConvertSegmentToPicoFeat(FPOINT *Start,
FPOINT *End,
FEATURE_SET FeatureSet) {
FEATURE Feature;
FLOAT32 Angle;
FLOAT32 Length;
int NumFeatures;
FPOINT Center;
FPOINT Delta;
int i;
Angle = NormalizedAngleFrom (Start, End, 1.0);
Length = DistanceBetween (*Start, *End);
NumFeatures = (int) floor (Length / classify_pico_feature_length + 0.5);
if (NumFeatures < 1)
NumFeatures = 1;
/* compute vector for one pico feature */
Delta.x = XDelta (*Start, *End) / NumFeatures;
Delta.y = YDelta (*Start, *End) / NumFeatures;
/* compute position of first pico feature */
Center.x = Start->x + Delta.x / 2.0;
Center.y = Start->y + Delta.y / 2.0;
/* compute each pico feature in segment and add to feature set */
for (i = 0; i < NumFeatures; i++) {
Feature = NewFeature (&PicoFeatDesc);
Feature->Params[PicoFeatDir] = Angle;
Feature->Params[PicoFeatX] = Center.x;
Feature->Params[PicoFeatY] = Center.y;
AddFeature(FeatureSet, Feature);
Center.x += Delta.x;
Center.y += Delta.y;
}
} /* ConvertSegmentToPicoFeat */
/*---------------------------------------------------------------------------*/
/**
* This routine steps through the specified outline and cuts it
* up into pieces of equal length. These pieces become the
* desired pico-features. Each segment in the outline
* is converted into an integral number of pico-features.
*
* Globals:
* - classify_pico_feature_length length of features to be extracted
* @param Outline outline to extract micro-features from
* @param FeatureSet set of features to add pico-features to
* @return none (results are returned in FeatureSet)
* @note Exceptions: none
* @note History: 4/30/91, DSJ, Adapted from ConvertToPicoFeatures().
*/
void ConvertToPicoFeatures2(MFOUTLINE Outline, FEATURE_SET FeatureSet) {
MFOUTLINE Next;
MFOUTLINE First;
MFOUTLINE Current;
if (DegenerateOutline(Outline))
return;
First = Outline;
Current = First;
Next = NextPointAfter(Current);
do {
/* note that an edge is hidden if the ending point of the edge is
marked as hidden. This situation happens because the order of
the outlines is reversed when they are converted from the old
format. In the old format, a hidden edge is marked by the
starting point for that edge. */
if (!(PointAt(Next)->Hidden))
ConvertSegmentToPicoFeat (&(PointAt(Current)->Point),
&(PointAt(Next)->Point), FeatureSet);
Current = Next;
Next = NextPointAfter(Current);
}
while (Current != First);
} /* ConvertToPicoFeatures2 */
/*---------------------------------------------------------------------------*/
/**
* This routine computes the average x position over all
* of the pico-features in FeatureSet and then renormalizes
* the pico-features to force this average to be the x origin
* (i.e. x=0).
* @param FeatureSet pico-features to be normalized
* @return none (FeatureSet is changed)
* @note Globals: none
* @note Exceptions: none
* @note History: Tue Sep 4 16:50:08 1990, DSJ, Created.
*/
void NormalizePicoX(FEATURE_SET FeatureSet) {
int i;
FEATURE Feature;
FLOAT32 Origin = 0.0;
for (i = 0; i < FeatureSet->NumFeatures; i++) {
Feature = FeatureSet->Features[i];
Origin += Feature->Params[PicoFeatX];
}
Origin /= FeatureSet->NumFeatures;
for (i = 0; i < FeatureSet->NumFeatures; i++) {
Feature = FeatureSet->Features[i];
Feature->Params[PicoFeatX] -= Origin;
}
} /* NormalizePicoX */
namespace tesseract {
/*---------------------------------------------------------------------------*/
/**
* @param blob blob to extract features from
* @param fx_info
* @return Integer character-normalized features for blob.
* @note Exceptions: none
* @note History: 8/8/2011, rays, Created.
*/
FEATURE_SET Classify::ExtractIntCNFeatures(
const TBLOB& blob, const INT_FX_RESULT_STRUCT& fx_info) {
INT_FX_RESULT_STRUCT local_fx_info(fx_info);
GenericVector<INT_FEATURE_STRUCT> bl_features;
tesseract::TrainingSample* sample = tesseract::BlobToTrainingSample(
blob, false, &local_fx_info, &bl_features);
if (sample == NULL) return NULL;
int num_features = sample->num_features();
const INT_FEATURE_STRUCT* features = sample->features();
FEATURE_SET feature_set = NewFeatureSet(num_features);
for (int f = 0; f < num_features; ++f) {
FEATURE feature = NewFeature(&IntFeatDesc);
feature->Params[IntX] = features[f].X;
feature->Params[IntY] = features[f].Y;
feature->Params[IntDir] = features[f].Theta;
AddFeature(feature_set, feature);
}
delete sample;
return feature_set;
} /* ExtractIntCNFeatures */
/*---------------------------------------------------------------------------*/
/**
* @param blob blob to extract features from
* @param fx_info
* @return Geometric (top/bottom/width) features for blob.
* @note Exceptions: none
* @note History: 8/8/2011, rays, Created.
*/
FEATURE_SET Classify::ExtractIntGeoFeatures(
const TBLOB& blob, const INT_FX_RESULT_STRUCT& fx_info) {
INT_FX_RESULT_STRUCT local_fx_info(fx_info);
GenericVector<INT_FEATURE_STRUCT> bl_features;
tesseract::TrainingSample* sample = tesseract::BlobToTrainingSample(
blob, false, &local_fx_info, &bl_features);
if (sample == NULL) return NULL;
FEATURE_SET feature_set = NewFeatureSet(1);
FEATURE feature = NewFeature(&IntFeatDesc);
feature->Params[GeoBottom] = sample->geo_feature(GeoBottom);
feature->Params[GeoTop] = sample->geo_feature(GeoTop);
feature->Params[GeoWidth] = sample->geo_feature(GeoWidth);
AddFeature(feature_set, feature);
delete sample;
return feature_set;
} /* ExtractIntGeoFeatures */
} // namespace tesseract.
|
71884667992244a9c3d88025819dd4a0b66dcdf0 | c0f0941e3d6f62dbe6932da3d428ae2afed53b43 | /offline/packages/trackreco/PHCASeeding.h | ca0493c132ed11795c300511805906797d42578b | [] | no_license | sPHENIX-Collaboration/coresoftware | ffbb1bd5c107f45c1b3574996aba6693169281ea | 19748d09d1997dfc21522e8e3816246691f46512 | refs/heads/master | 2023-08-03T15:55:20.018519 | 2023-08-01T23:33:03 | 2023-08-01T23:33:03 | 34,742,432 | 39 | 208 | null | 2023-09-14T20:25:46 | 2015-04-28T16:29:55 | C++ | UTF-8 | C++ | false | false | 5,841 | h | PHCASeeding.h | #ifndef TRACKRECO_PHCASEEDING_H
#define TRACKRECO_PHCASEEDING_H
/*!
* \file PHCASeeding.cc
* \brief Track seeding using ALICE-style "cellular automaton" (CA) algorithm
* \detail
* \author Michael Peters & Christof Roland
*/
//begin
#include "PHTrackSeeding.h" // for PHTrackSeeding
#include "ALICEKF.h"
#include <tpc/TpcDistortionCorrection.h>
#include <trackbase/TrkrDefs.h> // for cluskey
#include <trackbase/ActsGeometry.h>
#include <phool/PHTimer.h> // for PHTimer
#include <Eigen/Core>
#include <Eigen/Dense>
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wdeprecated-declarations"
#include <boost/geometry/geometries/box.hpp> // for box
#pragma GCC diagnostic pop
#include <boost/geometry/geometries/point.hpp> // for point
#include <boost/geometry/index/rtree.hpp> // for ca
#include <cmath> // for M_PI
#include <cstdint> // for uint64_t
#include <map> // for map
#include <memory>
#include <set>
#include <string> // for string
#include <utility> // for pair
#include <unordered_set>
#include <vector> // for vector
class PHCompositeNode;
class PHTimer;
class SvtxTrack_v3;
class TpcDistortionCorrectionContainer;
class TrkrCluster;
namespace bg = boost::geometry;
namespace bgi = boost::geometry::index;
using point = bg::model::point<float, 3, bg::cs::cartesian>;
using box = bg::model::box<point>;
using pointKey = std::pair<point, TrkrDefs::cluskey>;
using coordKey = std::pair<std::array<float,3>, TrkrDefs::cluskey>;
using keylink = std::array<coordKey,2>;
using keylist = std::vector<TrkrDefs::cluskey>;
using PositionMap = std::map<TrkrDefs::cluskey, Acts::Vector3>;
class PHCASeeding : public PHTrackSeeding
{
public:
PHCASeeding(
const std::string &name = "PHCASeeding",
unsigned int start_layer = 7,
unsigned int end_layer = 55,
unsigned int min_nhits_per_cluster = 0,
unsigned int min_clusters_per_track = 5,
const unsigned int nlayers_maps = 3,
const unsigned int nlayers_intt = 4,
const unsigned int nlayers_tpc = 48,
float neighbor_phi_width = .02,
float neighbor_eta_width = .01,
float maxSinPhi = 0.999,
float cosTheta_limit = -0.8);
~PHCASeeding() override {}
void SetLayerRange(unsigned int layer_low, unsigned int layer_up) {_start_layer = layer_low; _end_layer = layer_up;}
void SetSearchWindow(float eta_width, float phi_width) {_neighbor_eta_width = eta_width; _neighbor_phi_width = phi_width;}
void SetMinHitsPerCluster(unsigned int minHits) {_min_nhits_per_cluster = minHits;}
void SetMinClustersPerTrack(unsigned int minClus) {_min_clusters_per_track = minClus;}
void set_field_dir(const double rescale)
{
std::cout << "rescale: " << rescale << std::endl;
_fieldDir = 1;
if(rescale > 0)
_fieldDir = -1;
}
void useConstBField(bool opt){_use_const_field = opt;}
void useFixedClusterError(bool opt){_use_fixed_clus_err = opt;}
void setFixedClusterError(int i, double val){_fixed_clus_err.at(i) = val;}
protected:
int Setup(PHCompositeNode *topNode) override;
int Process(PHCompositeNode *topNode) override;
int InitializeGeometry(PHCompositeNode *topNode);
int FindSeedsLayerSkip(double cosTheta_limit);
int End() override;
private:
enum skip_layers {on, off};
/// tpc distortion correction utility class
TpcDistortionCorrection m_distortionCorrection;
/// get global position for a given cluster
/**
* uses ActsTransformation to convert cluster local position into global coordinates
* incorporates TPC distortion correction, if present
*/
Acts::Vector3 getGlobalPosition(TrkrDefs::cluskey, TrkrCluster*) const;
PositionMap FillTree();
int FindSeedsWithMerger(const PositionMap&);
std::pair<std::vector<std::unordered_set<keylink>>,std::vector<std::unordered_set<keylink>>> CreateLinks(const std::vector<coordKey>& clusters, const PositionMap& globalPositions) const;
std::vector<std::vector<keylink>> FindBiLinks(const std::vector<std::unordered_set<keylink>>& belowLinks, const std::vector<std::unordered_set<keylink>>& aboveLinks) const;
std::vector<keylist> FollowBiLinks(const std::vector<std::vector<keylink>>& bidirectionalLinks, const PositionMap& globalPositions) const;
void QueryTree(const bgi::rtree<pointKey, bgi::quadratic<16>> &rtree, double phimin, double etamin, double lmin, double phimax, double etamax, double lmax, std::vector<pointKey> &returned_values) const;
std::vector<TrackSeed_v1> RemoveBadClusters(const std::vector<keylist>& seeds, const PositionMap& globalPositions) const;
double getMengerCurvature(TrkrDefs::cluskey a, TrkrDefs::cluskey b, TrkrDefs::cluskey c, const PositionMap& globalPositions) const;
void publishSeeds(const std::vector<TrackSeed_v1>& seeds);
//int _nlayers_all;
//unsigned int _nlayers_seeding;
//std::vector<int> _seeding_layer;
const unsigned int _nlayers_maps;
const unsigned int _nlayers_intt;
const unsigned int _nlayers_tpc;
unsigned int _start_layer;
unsigned int _end_layer;
unsigned int _min_nhits_per_cluster;
unsigned int _min_clusters_per_track;
// float _cluster_z_error;
// float _cluster_alice_y_error;
float _neighbor_phi_width;
float _neighbor_eta_width;
float _max_sin_phi;
float _cosTheta_limit;
double _rz_outlier_threshold = 0.1;
double _xy_outlier_threshold = 0.1;
double _fieldDir = -1;
bool _use_const_field = false;
bool _use_fixed_clus_err = false;
std::array<double,3> _fixed_clus_err = {.1,.1,.1};
/// acts geometry
ActsGeometry *tGeometry{nullptr};
/// distortion correction container
TpcDistortionCorrectionContainer* m_dcc = nullptr;
std::unique_ptr<ALICEKF> fitter;
std::unique_ptr<PHTimer> t_seed;
std::unique_ptr<PHTimer> t_fill;
bgi::rtree<pointKey, bgi::quadratic<16>> _rtree;
};
#endif
|
78ec692ec0576ce059d5ce3847a33a5c2357f02a | 167c6226bc77c5daaedab007dfdad4377f588ef4 | /cpp/ql/test/library-tests/files/files1.cpp | 210c5586e7ac2522ef741394c3e6754ad23963a7 | [
"LicenseRef-scancode-public-domain",
"MIT"
] | permissive | github/codeql | 1eebb449a34f774db9e881b52cb8f7a1b1a53612 | d109637e2d7ab3b819812eb960c05cb31d9d2168 | refs/heads/main | 2023-08-20T11:32:39.162059 | 2023-08-18T14:33:32 | 2023-08-18T14:33:32 | 143,040,428 | 5,987 | 1,363 | MIT | 2023-09-14T19:36:50 | 2018-07-31T16:35:51 | CodeQL | UTF-8 | C++ | false | false | 84 | cpp | files1.cpp | #include "files1.h"
void swap(int* p, int* q)
{
int t = *p;
*p = *q;
*q = t;
}
|
ffebd517f4eecf483e55a1663066cf9a0fd2d2bd | 0c7551bf55705451ca8cc298b09934af0ca6e84b | /160A.cpp | acecbb85a544e2ce66b87de6e674e039f8ad5c96 | [] | no_license | yungkyle19/codeforces-solutions | 97c9e655659ece660138ed9b41d1b8dc9a9020c3 | b156285a8149b7a7b4f08fba276fb2f32b356c3f | refs/heads/master | 2022-12-29T02:17:15.100549 | 2020-10-18T13:32:00 | 2020-10-18T13:32:00 | null | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 497 | cpp | 160A.cpp | // Written By Deepesh Nimma
// Problem: 160A Codeforces
#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define space " "
#define end1 "\n"
#define ar array
int n, i, a[100], sum = 0, ans = 0, cnt = 0;
int main() {
cin >> n;
for(i = 0; i < n; ++i) {
cin >> a[i];
}
sort(a, a + n);
for(i = 0; i < n; ++i) {
sum += a[i];
}
sum = sum / 2;
while(ans <= sum) {
++cnt;
ans += a[n - cnt];
}
cout << cnt;
}
|
0294e8158f54bda73f1b7ec3dbd0541669d34705 | 877fff5bb313ccd23d1d01bf23b1e1f2b13bb85a | /app/src/main/cpp/dir7941/dir29315/dir29712/dir30926/dir32551/dir32552/dir32801/file32814.cpp | 01a99243e7fc92bb750e357ed693b611f688e487 | [] | no_license | tgeng/HugeProject | 829c3bdfb7cbaf57727c41263212d4a67e3eb93d | 4488d3b765e8827636ce5e878baacdf388710ef2 | refs/heads/master | 2022-08-21T16:58:54.161627 | 2020-05-28T01:54:03 | 2020-05-28T01:54:03 | 267,468,475 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 115 | cpp | file32814.cpp | #ifndef file32814
#error "macro file32814 must be defined"
#endif
static const char* file32814String = "file32814"; |
160b2b3108678cce4f53f757440cac727a75f405 | 24437e399a6da6dc9ebcfb15fea9c1a7bfcac8cb | /prueva promedio.cpp | 3803600b189265210f5e6340c08197c769a1a8fc | [] | no_license | IvonneTurcios-98/Clases-Programacion | 6c37bcf57a7a35ee3c6fa189b34dec42a703f608 | 4eccccc92cfd08e4ce047edc54ad869c79a661bc | refs/heads/master | 2020-03-30T17:08:39.633241 | 2018-10-03T16:35:34 | 2018-10-03T16:35:34 | 151,442,401 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 1,552 | cpp | prueva promedio.cpp | //Programa realizado por:
//Carmen Ivonne Turcios Martinez
//Numero de DUE:
//TM18012
//programa para calcular el promedio de notas de un alumno
//librerias obligatorias utilizadas
#include <iostream> //Esta libreria ha sido utilizado para operaciones de entrada/salida.
#include <math.h> //Esta libreria ha sido utilizado para procesos matematicos.
#include <iomanip> //Esta libreria ha sido utilizado para manipular el formato de entrada y salida.
#include <windows.h> //Esta libreria ha sido utilizado para declarar las funciones de la biblioteca windows API.
//Desarrollo del cuerpo del programa
using namespace std;
int main (int argc, char *argv[])
{ //variables utilizadas.
float notas [5];
float suma=0;
float promedio;
//Ciclo for.
for (int i=0;i<=4;i++)
//Inicio de la condicion do while.
do
{ //Comando
system("cls");
//Peticion de las notas.
cout <<"Ingrese la nota: "<<i+1<<endl;
//Adquiere un valor.
cin>>notas[i];
//acumular la sumatoria de notas.
suma=suma+notas[i];
} while (notas[i] < 0 || notas[i] > 10); //Fin de la condicion do while
//Proceso de dividir la sumatoria de las notas con la cantidad, para sacar el promedio.
promedio=suma/5;
//Imprime
cout<<"Sus notas son: "<<endl;
//Ciclo for para imprimir notas.
for (int i=0;i<=4;i++)
{ //Imprime las notas una por una.
cout<<notas[i]<<endl;
}
//Imprime el promedio.
cout<<"El promedio es de: "<<promedio<<endl;
//Fin del programa
return 0;
}
|
8c175ceae036acf67b34cab215cf69acc174533e | 7f16d42e71a7550d1848fa6d31d8133486760768 | /Laplacian2D.h | 927bbe01dbca5fda82d61e962cbade23b242acd2 | [] | no_license | TERMMK2/TER-2A | 03215c6c966bf2a17c70b470399d41c4a07041a6 | 144e151dc74498737dd8a8c72aa3f85abb471bde | refs/heads/master | 2021-09-14T09:58:48.754342 | 2018-05-11T14:32:37 | 2018-05-11T14:32:37 | 117,685,449 | 1 | 1 | null | 2018-01-16T13:18:55 | 2018-01-16T13:12:40 | null | UTF-8 | C++ | false | false | 3,594 | h | Laplacian2D.h | #include "Sparse"
#include "Dense"
#include <cmath>
#include <iostream>
#include <fstream>
#include <string>
#include <algorithm>
#include <memory>
#include "Datafile.h"
class Laplacian2D // pas fini de modifier
{
protected: // Les attributs de la classe
double _x_min, _x_max, _y_min, _y_max, _h_x, _h_y, _a, _deltaT;
int _Nx, _Ny;
Eigen::SparseMatrix<double> _LapMat; // matrice creuse du laplacien
Eigen::VectorXd _f; // vecteur source _f qui prend les données de _sol(i) pour calculer _sol(i+1)
Eigen::VectorXd _sol; // vecteur solution U
std::string _CL_bas, _CL_haut, _CL_gauche, _CL_droite;
double _Val_CL_bas, _Val_CL_haut, _Val_CL_gauche, _Val_CL_droite;
std::string _Solveur;
std::string _save_all_file, _save_points_file, _restart_file;
int _number_saved_points;
std::vector<std::vector<double>> _saved_points;
public: // Méthodes et opérateurs de la classe
Laplacian2D();
// Constructeur : Initialiser _x_min, _x_max, _y_min; _y_max; _N; _h; _LapMat; _x; _y et _sol.
virtual ~Laplacian2D();
virtual void Initialize(DataFile datafile);
virtual void InitializeMatrix();
void UpdateCL (int num_it);
virtual void DirectSolver(int nb_iterations) = 0; // Résout le système _LapMat * _sol = _f avec un solveur direct.
virtual void IterativeSolver(int nb_iterations) = 0; // Résout le système _LapMat * _sol = _f avec un solveur itératif.
virtual void SaveSol(std::string name_file); // Écrit les solutions dans le fichier "name_file".
void ConditionsLimites(int num_it);
virtual void Advance(int nb_iterations)=0;
};
class EC_ClassiqueM : public Laplacian2D //Première version avec un matrice identique quelles que soient les conditions aux bords
{
public:
void DirectSolver(int nb_iterations);
void IterativeSolver(int nb_iterations);
void ConditionsLimites(int num_it);
inline void Advance(int nb_iteration) {};
};
class EC_ClassiqueP : public Laplacian2D //Seconde version avec une matrice qui dépend des conditions aux bords
{
public:
void InitializeMatrix();
void DirectSolver(int nb_iterations);
void IterativeSolver(int nb_iterations);
void ConditionsLimites(int num_it);
inline void Advance(int nb_iteration) {};
};
class EC_PyrolyseMC : public Laplacian2D //Schéma équation correction à matériau constant
{
protected:
double _FS, _FN, _FE, _FO;
double _Cp, _Lambda, _A, _Ta;
double _rho_v, _rho_p;
Eigen::VectorXd _RhoTilde; //valeur provisoire de rho
Eigen::VectorXd _sol_T; //solution en température
Eigen::VectorXd _sol_R; //solution en masse volumique
public:
void Initialize(DataFile datafile);
void InitializeMatrix();
void SaveSol(int iteration);
void Flux_Cal(int i, int j); //Calcul des flux Nord/Sud/Est/Ouest à lambda constant
void Rho_Cal_P(); //Calcul de _RhoTilde (prédiction)
void Rho_Cal_C(); //Calcul de _sol_R (correction)
void T_Cal(); //Calcul de T si Cp est CONSTANT
void Advance(int nb_iterations);
void IterativeSolver(int nb_iterations);
void ConditionsLimites(int num_it);
inline void DirectSolver(int nb_iterations){};
};
class EC_PyrolyseMV : public EC_PyrolyseMC
{
private:
Eigen::VectorXd _lambdaMV,_CpMV;
double _Cpp,_Cpv;
public:
void Initialize (DataFile datafile);
void lambda_Cal();
void Cp_Cal();
void Advance(int nb_iterations); //version explicite
void T_Cal(); //Calcul de T si Cp est variable
void Flux_Cal(int i, int j); // Lambda variable
void InitializeMatrix();
void IterativeSolver(int nb_iterations);
void ConditionsLimites(int num_it);
void Newton(double epsilon);
};
|
3a1d4858a68fcb5cc69cf16e5fd3094bece6c14a | 01ded2a5d31233d0f978dd877aebe222b484afd2 | /Source/Server/Basic_V1.0/WinMonitorCLIB.1.0/WinMonitorXmlUtility.h | 9918544c06aaf01aaf109e71e0cb1ecaa8f867db | [
"MIT"
] | permissive | avarghesein/WinMonitor | 5b4bc55c0f9032114ac1488fc7782f8ec1664877 | 2ba872758708ef1b74d7b2cc4a93a39e6e3aa1fd | refs/heads/master | 2020-04-14T17:40:42.376580 | 2019-01-03T18:07:54 | 2019-01-03T18:07:54 | 163,989,661 | 2 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 1,909 | h | WinMonitorXmlUtility.h |
#define INCLUDED "true"
#import<msxml.dll> named_guids
#include<TCHAR.H>
#include <comip.h>
using namespace MSXML;
struct IXmlUtility
{
public:
virtual TCHAR *GetError(void)=0;
virtual bool SetTokenSeperator(TCHAR *TokenSeperator=_T("/"))=0;
virtual bool CreateNewXmlDocument(_bstr_t NewXML_FullFileName,TCHAR *RootNodeName)=0;
virtual bool OpenXmlDocument(_bstr_t bstrXmlFullFileName)=0;
virtual bool GetNodeTextFromHeirarchy(TCHAR *Heirarchy,TCHAR *NodeText,bool BeginAtRoot=true)=0;
virtual bool GetNodeAttributeFromHeirarchy(TCHAR *Heirarchy,TCHAR *AttributeName,TCHAR *AttributeValue,bool BeginAtRoot=true)=0;
virtual bool SetTextIntoHeirarchy(TCHAR *Heirarchy,TCHAR *Text,bool BeginAtRoot=true)=0;
virtual bool SetNodeTextIntoHeirarchy(TCHAR *Heirarchy,TCHAR *NodeToBeCreated,TCHAR *NodeValue,bool BeginAtRoot=true)=0;
virtual bool SetNodeAttributeIntoHeirarchy(TCHAR *Heirarchy,TCHAR *AttributeToBeCreated,TCHAR *AttributeValue,bool BeginAtRoot=true)=0;
virtual bool InsertAllNodesFrom(_bstr_t XML_FileToBeMerged,bool InsertAtRoot=true)=0;
virtual bool InsertSelectedNodesFrom(IXmlUtility *XmlObjToBeInserted,bool InsertAtRoot=true)=0;
virtual bool MoveToChild(TCHAR *ParentNodeHeirarchy,long ChildIndex=0,bool BeginAtRoot=true)=0;
virtual bool MoveToChild(TCHAR *ParentNodeHeirarchy,TCHAR *ChildName,bool BeginAtRoot=true)=0;
virtual bool MoveToBrother(bool Older=false)=0;
virtual bool MoveToParent(void)=0;
virtual bool ResetSearchPointerToRoot(void)=0;
virtual long NumberOfBrothers(void)=0;
virtual long NumberOfChildren(bool OfRootNode=true)=0;
virtual bool GetNodeName(TCHAR *NodeName,bool OfRootNode=true)=0;
virtual bool SetForceCreate(bool MakeOnState=false)=0;
};
bool Create_IXmlUtility(IXmlUtility **objptrIXmlUtility);
bool Delete_IXmlUtility(IXmlUtility **objptrIXmlUtility);
#include "WinMonitorXmlUtilityIMP.h"
|
7d513de85163b9eb5b42f306ffb88f5dcdcfadb8 | 7fbf9b52a4b7890115f25678683d713c7ea32d83 | /Source/Mach/Public/MachHeavyCharacter.h | cc96a56944ba90820e3acc2a63df53aaf4059c11 | [] | no_license | epic-studio/Mach | e3de281074932f5b5c775491233488343057ffa0 | 87697db336562ce686d18620ca21e3f24967c56c | refs/heads/master | 2021-01-02T09:03:52.527783 | 2016-11-20T21:34:19 | 2016-11-20T21:34:19 | null | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 976 | h | MachHeavyCharacter.h | // Fill out your copyright notice in the Description page of Project Settings.
#pragma once
#include "MachCharacter.h"
#include "MachHeavyCharacter.generated.h"
/**
*
*/
UCLASS()
class MACH_API AMachHeavyCharacter : public AMachCharacter
{
GENERATED_UCLASS_BODY()
UPROPERTY(VisibleAnywhere, Category=Heavy)
class UCapsuleComponent* ChargeTrigger;
float LeapHitVerticalImuplse;
float LeapHitHorizontalImpulse;
float ChargeHitVerticalImuplse;
float ChargeHitHorizontalImpulse;
float LastJumpTime;
float LeapCost;
float ChargeTurnRateModifier;
void LeapLanded(const FHitResult& HitResult);
void LeapEnded();
void StartMovementSpecial() override;
void StartJump() override;
void Tick(float DeltaSeconds) override;
UFUNCTION()
void OnChargeTriggerOverlap(class AActor * OtherActor, class UPrimitiveComponent* OtherComp, int32 OtherBodyIndex, bool bFromSweep, const FHitResult & SweepResult);
void OnStartFire() override;
void OnReload() override;
};
|
2f50fe7c512e4360d7b9bc7901db27dca277ac14 | b30dd565b55f4b5e97efa617d940270738f8e410 | /src/util/Side.cpp | e9344450f7611de54176b7bdcb4f56ded954c66d | [] | no_license | TrashPandit/Vex4911B2 | eacc1db5d507dedf7434cb1ef69faa710f86a656 | 461c8defad6ddce4aff46b9b44c2d9a25b933df0 | refs/heads/master | 2020-08-05T20:38:25.896934 | 2020-02-05T00:42:07 | 2020-02-05T00:42:07 | 212,701,973 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 523 | cpp | Side.cpp | #include "util/Side.hpp"
#include "cmath"
Side::Side(pros::Motor * front_, pros::Motor * back_, bool flipped_){
front = front_;
back = back_;
flipped = flipped_;
}
void Side::move_relative(double inches, int speed){
if(flipped){
front->move_relative(-inches * ticksPerInch,speed);
back->move_relative(-inches * ticksPerInch,speed);
}
else{
front->move_relative(inches * ticksPerInch,speed);
back->move_relative(inches * ticksPerInch,speed);
}
}
const int Side::ticksPerInch = 900/(M_PI*4);
|
3bbf0032b9c5ce541402f9127cbf6ba6ee87e42c | 2f723bd4f4e8e38c764eadeee4c4590bee77ed55 | /examples/Example3/main.cpp | a691f35336737e3661764f6da03e8c14298d6233 | [] | no_license | anthony2445/UOIT-Graphics | 3de841199475d2ca5fb4eb1dc66ea30bbca12062 | fab15d43831d84003ad19c254fee838194953fed | refs/heads/master | 2021-01-20T06:26:08.263996 | 2017-04-30T22:18:28 | 2017-04-30T22:18:28 | 89,878,544 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 9,259 | cpp | main.cpp | /************************************************
*
* Example Three
*
* A basic OpenGL program that draws a
* triangle on the screen with colour computed using
* a simple diffuse light model. This program illustrates
* the addition of normal vectors to the vertex array.
*
************************************************/
#include <Windows.h>
#include <gl/glew.h>
#include <gl/glut.h>
#include <glm/glm.hpp>
#include <glm/gtc/matrix_transform.hpp>
#include <glm/gtc/type_ptr.hpp>
#include "shaders.h"
#include <stdio.h>
#include "readply.h"
#include <iostream>
GLuint program; // shader programs
GLuint triangleVAO; // the data to be displayed
float angle = 0.0; // rotation angle and its initial value
int window; // ID of the window we are using
int faces=1;
float eyex, eyey, eyez, theta, phi, r, cx, cy, cz; // eye position
glm::mat4 projection; // projection matrix
/*
* The init procedure creates the OpenGL data structures
* that contain the triangle geometry, compiles our
* shader program and links the shader programs to
* the data.
*/
void init() {
ply_model* model = readply("bunny.ply");
GLuint vbuffer;
GLuint ibuffer;
GLint vPosition;
GLint vNormal;
int vs;
int fs;
glGenVertexArrays(1, &triangleVAO);
glBindVertexArray(triangleVAO);
GLfloat * vertNormals = new GLfloat[model->nvertex * 3];
GLfloat * vertices = new GLfloat[model->nvertex * 3];
for (int i = 0; i < model->nvertex; i++)
{
vertices[(i*3) + 0] = model->vertices[i].x;
vertices[(i*3) + 1] = model->vertices[i].y;
vertices[(i*3) + 2] = model->vertices[i].z;
vertNormals[(i * 3) + 0] = 0.0;
vertNormals[(i * 3) + 1] = 0.0;
vertNormals[(i * 3) + 2] = 0.0;
}
/*
* Find the range of the x, y and z
* coordinates.
*/
int xmin, ymin, zmin, xmax, ymax, zmax;
xmin = ymin = zmin = 1000000.0;
xmax = ymax = zmax = -1000000.0;
for (int i = 0; i<model->nvertex / 3; i++) {
if (vertices[3 * i] < xmin)
xmin = vertices[3 * i];
if (vertices[3 * i] > xmax)
xmax = vertices[3 * i];
if (vertices[3 * i + 1] < ymin)
ymin = vertices[3 * i + 1];
if (vertices[3 * i + 1] > ymax)
ymax = vertices[3 * i + 1];
if (vertices[3 * i + 2] < zmin)
zmin = vertices[3 * i + 2];
if (vertices[3 * i + 2] > zmax)
zmax = vertices[3 * i + 2];
}
/* compute center and print range */
cx = (xmin + xmax) / 2.0f;
cy = (ymin + ymax) / 2.0f;
cz = (zmin + zmax) / 2.0f;
faces = model->nface;
//GLushort indexes[3] = { 0, 1, 2 }; // indexes of triangle vertices
GLushort * indexes = new GLushort[3 * model->nface];
for (int i = 0; i < model->nface; i++)
{
for (int j = 0; j < 3; j++)
{
indexes[(i*3) + j] = model->faces[i].vertices[j];
}
}
GLfloat length = 0;
GLfloat vertex[3][3] = { {0,0,0}, {0,0,0}, {0,0,0} };
/*GLfloat bsubtractAx = 0;
GLfloat bsubtractAy = 0;
GLfloat bsubtractAz = 0;
GLfloat csubtractAx = 0;
GLfloat csubtractAy = 0;
GLfloat csubtractAz = 0;
GLfloat crossX = 0;
GLfloat crossY = 0;
GLfloat crossZ = 0;*/
for (int i = 0; i < model->nvertex; i++)
{
for (int j = 0; j < 3; j++)
{
for (int k = 0; k < 3; k++)
{
vertex[j][k] = vertices[indexes[(i * 3) + j]+k];
}
}
/*bsubtractAx = vertex[1][0] - vertex[0][0];
bsubtractAy = vertex[1][1] - vertex[0][1];
bsubtractAz = vertex[1][2] - vertex[0][2];
csubtractAx = vertex[2][0] - vertex[0][0];
csubtractAy = vertex[2][1] - vertex[0][1];
csubtractAz = vertex[2][2] - vertex[0][2];*/
glm::vec3 u = glm::vec3(vertex[1][0] - vertex[0][0], vertex[1][1] - vertex[0][1], vertex[1][2] - vertex[0][2]);
glm::vec3 v = glm::vec3(vertex[3][0] - vertex[0][0], vertex[3][1] - vertex[0][1], vertex[3][2] - vertex[0][2]);
/*crossX = ((bsubtractAy*csubtractAz) - (csubtractAy*bsubtractAz));
crossY = ((bsubtractAz*csubtractAx) - (csubtractAz*bsubtractAx));
crossX = ((bsubtractAx*csubtractAy) - (csubtractAx*bsubtractAy));*/
glm::vec3 crossProd = glm::normalize(glm::cross(u, v));
//length = sqrt((crossX*crossX) + (crossY*crossY) + (crossZ*crossZ));
//vertNormals[indexes[(i * 3) + (i % 3)] + j]=
vertNormals[indexes[(i * 3)]] += crossProd.x; //x component
vertNormals[indexes[(i * 3)]+1] += crossProd.y; //y component
vertNormals[indexes[(i * 3)]+2] += crossProd.z; //z component
vertNormals[indexes[(i * 3)+1]] += crossProd.x; //x component
vertNormals[indexes[(i * 3)+1] + 1] += crossProd.y; //y component
vertNormals[indexes[(i * 3)+1] + 2] += crossProd.z; //z component
vertNormals[indexes[(i * 3)+2]] += crossProd.x; //x component
vertNormals[indexes[(i * 3)+2] + 1] += crossProd.y; //y component
vertNormals[indexes[(i * 3)+2] + 2] += crossProd.z; //z component
//std::cout << "loop" + i;
}
for (int i = 0; i < model->nvertex; i++) {
glm::vec3 n = glm::normalize(glm::vec3(vertNormals[i * 3], vertNormals[(i * 3) + 1], vertNormals[(i * 3) + 2]));
vertNormals[i * 3] = n.x;
vertNormals[(i * 3) + 1] = n.y;
vertNormals[(i * 3) + 2] = n.z;
}
/*
* load the vertex coordinate data and normal vectors
*/
glGenBuffers(1, &vbuffer);
glBindBuffer(GL_ARRAY_BUFFER, vbuffer);
glBufferData(GL_ARRAY_BUFFER, (model->nvertex * 3)*2*sizeof(GLfloat), NULL, GL_STATIC_DRAW);
glBufferSubData(GL_ARRAY_BUFFER, 0, (model->nvertex * 3 * sizeof(GLfloat)), vertices);
glBufferSubData(GL_ARRAY_BUFFER, (model->nvertex * 3 * sizeof(GLfloat)), (model->nvertex * 3 * sizeof(GLfloat)), vertNormals);
/*
* load the vertex indexes
*/
glGenBuffers(1, &ibuffer);
glBindBuffer(GL_ELEMENT_ARRAY_BUFFER, ibuffer);
glBufferData(GL_ELEMENT_ARRAY_BUFFER, (model->nface * 3 * sizeof(GLushort)), indexes, GL_STATIC_DRAW);
/*
* compile and build the shader program
*/
vs = buildShader(GL_VERTEX_SHADER, "lab2.vs");
fs = buildShader(GL_FRAGMENT_SHADER, "lab2.fs");
program = buildProgram(vs,fs,0);
/*
* link the vertex coordinates to the vPosition
* variable in the vertex program and the normal
* vectors to the vNormal variable in the
* vertext program.
*/
glUseProgram(program);
vPosition = glGetAttribLocation(program,"vPosition");
glVertexAttribPointer(vPosition, 3, GL_FLOAT, GL_FALSE, 0, 0);
glEnableVertexAttribArray(vPosition);
vNormal = glGetAttribLocation(program, "vNormal");
glVertexAttribPointer(vNormal, 3, GL_FLOAT, GL_FALSE, 0, (void*)(model->nvertex * 3 * sizeof(GLfloat)));
glEnableVertexAttribArray(vNormal);
}
/*
* This procedure is called each time the screen needs
* to be redisplayed
*/
void displayFunc() {
glm::mat4 model;
glm::mat4 view;
glm::mat4 viewPerspective;
int viewLoc;
int modelLoc;
int normalLoc;
GLint vPosition;
int colourLoc;
view = glm::lookAt(glm::vec3(eyex, eyey, eyez),
glm::vec3(cx, cy, cz),
glm::vec3(0.0f, 0.0f, 1.0f));
glm::mat3 normal = glm::transpose(glm::inverse(glm::mat3(view)));
viewPerspective = projection * view;
//model = glm::rotate(glm::mat4(1.0), angle, glm::vec3(eyex, eyey, eyez));
model = glm::rotate(glm::mat4(1.0), angle, glm::vec3(0.0, 1.0, 0.0));
glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
glUseProgram(program);
viewLoc = glGetUniformLocation(program, "viewPerspective");
glUniformMatrix4fv(viewLoc, 1, 0, glm::value_ptr(viewPerspective));
modelLoc = glGetUniformLocation(program,"model");
glUniformMatrix4fv(modelLoc, 1, 0, glm::value_ptr(model));
normalLoc = glGetUniformLocation(program, "normalMat");
glUniformMatrix3fv(normalLoc, 1, 0, glm::value_ptr(normal));
glBindVertexArray(triangleVAO);
glDrawElements(GL_TRIANGLES, (3*faces), GL_UNSIGNED_SHORT, NULL);
glutSwapBuffers();
}
/*
* Executed each time the window is resized,
* usually once at the start of the program.
*/
void changeSize(int w, int h) {
// Prevent a divide by zero, when window is too short
// (you cant make a window of zero width).
if (h == 0)
h = 1;
float ratio = 1.0 * w / h;
glViewport(cx, cy, w, h);
projection = glm::perspective(45.0f, ratio, 20.0f, 100.0f);
}
/*
* Called each time a key is pressed on
* the keyboard.
*/
void keyboardFunc(unsigned char key, int x, int y) {
switch (key) {
case 'a':
phi -= 0.1;
break;
case 'd':
phi += 0.1;
break;
case 'w':
theta += 0.1;
break;
case 's':
theta -= 0.1;
break;
}
//eyex = r*sin(theta)*cos(phi);
//eyey = r*sin(theta)*sin(phi);
//eyez = r*cos(theta);
glutPostRedisplay();
}
/*
* Update the value of angle on each update
*/
void idleFunc() {
glutSetWindow(window);
angle = angle + 0.001;
glutPostRedisplay();
}
int main(int argc, char **argv) {
/*
* initialize glut, set some parameters for
* the application and create the window
*/
glutInit(&argc, argv);
glutInitDisplayMode(GLUT_DOUBLE | GLUT_RGBA | GLUT_DEPTH);
glEnable(GL_DEPTH_TEST);
glutInitWindowPosition(100,100);
glutInitWindowSize(600,600);
window = glutCreateWindow("Example Three");
/*
* initialize glew
*/
GLenum error = glewInit();
if(error != GLEW_OK) {
printf("Error starting GLEW: %s\n",glewGetErrorString(error));
exit(0);
}
glutDisplayFunc(displayFunc);
glutReshapeFunc(changeSize);
glutKeyboardFunc(keyboardFunc);
glutIdleFunc(idleFunc);
eyex = 0.0;
eyey = 1000.0;
eyez = 0.0;
theta = 1.5;
phi = 1.5;
r = 0.3;
init();
glClearColor(1.0,1.0,1.0,1.0);
glutMainLoop();
} |
f9a4bc880f757eb9df4002656c0cd3098016c6ad | ead0d52c5423bbcfdda6a780cd9c740b57d1ad57 | /util/uProfile.cpp | 4915586c3f4389db7a30f6644cb0118f6ef7d42b | [] | no_license | nitoyon/winamp-zipmp3plugin | 20ff82d178e7319ba06ac38776492b3965680a31 | cc7054d2f564ce6f510ab32e4388f5035d6fb6df | refs/heads/master | 2021-01-13T02:15:57.053472 | 2003-12-08T12:35:45 | 2003-12-08T12:35:45 | null | 0 | 0 | null | null | null | null | SHIFT_JIS | C++ | false | false | 12,779 | cpp | uProfile.cpp |
// uProfile.cpp
// 設定ファイルを扱うユーティリティー関数群
//============================================================================//
// 概要:なし。
// 補足:なし。
//============================================================================//
#include "uProfile.h"
/******************************************************************************/
// 書き込み
/******************************************************************************/
// 数字を書き込み
//============================================================================//
// 概要:なし。
// 補足:なし。
//============================================================================//
void WriteIniInt(LPTSTR pszSection, LPTSTR pszName, UINT ui, const tstring& s)
{
TCHAR pszBuf[256];
wsprintf(pszBuf, TEXT("%u"), ui);
WritePrivateProfileString(pszSection, pszName, pszBuf, s.c_str()) ;
}
/******************************************************************************/
// 文字列を書き込み
//============================================================================//
// 概要:なし。
// 補足:なし。
//============================================================================//
void WriteIniStr(LPTSTR pszSection, LPTSTR pszName, const tstring& strData, const tstring& s)
{
WritePrivateProfileString(pszSection, pszName, strData.c_str(), s.c_str()) ;
}
/******************************************************************************/
// 真偽値を書き込み
//============================================================================//
// 概要:なし。
// 補足:なし。
//============================================================================//
void WriteIniBln(LPTSTR pszSection, LPTSTR pszName, BOOL b, const tstring& s)
{
WritePrivateProfileString(pszSection, pszName, b ? TEXT("yes") : TEXT("no"), s.c_str());
}
/******************************************************************************/
// メッセージを書き込み
//============================================================================//
// 概要:なし。
// 補足:なし。
//============================================================================//
void WriteIniMsg(LPTSTR pszSection, LPTSTR pszName, const tstring& strData, const tstring& s)
{
WritePrivateProfileString(pszSection, pszName, Str2IniMsg(strData).c_str(), s.c_str()) ;
}
/******************************************************************************/
// 読み取り
/******************************************************************************/
// 文字列を読み取り
//============================================================================//
// 概要:なし。
// 補足:なし。
//============================================================================//
tstring ReadIniStr(const tstring& strSection, const tstring& strName, const tstring& s, const tstring& strDefault)
{
DWORD dwSize = 256 ;
TCHAR* pszBuf ;
while(1)
{
pszBuf = new TCHAR[dwSize] ;
DWORD dw = GetPrivateProfileString(strSection.c_str(), strName.c_str(), strDefault.c_str(), pszBuf, dwSize, s.c_str()) ;
if(dw == dwSize - 1 || dw == dwSize - 2)
{
dwSize *= 2 ;
delete[] pszBuf ;
continue ;
}
break ;
}
tstring str = pszBuf ;
delete[] pszBuf ;
return str ;
}
/******************************************************************************/
// 整数を読み取り
//============================================================================//
// 概要:なし。
// 補足:なし。
//============================================================================//
int ReadIniInt(const tstring& strSection, const tstring& strName, const tstring& s, int intDefault)
{
return GetPrivateProfileInt(strSection.c_str(), strName.c_str(), intDefault, s.c_str());
}
/******************************************************************************/
// 真偽を読み取り
//============================================================================//
// 概要:なし。
// 補足:なし。
//============================================================================//
BOOL ReadIniBln(const tstring& strSection, const tstring& strName, const tstring& s, BOOL blnDefault)
{
return IniBln2Bln(ReadIniStr(strSection, strName, s, TEXT("")), blnDefault);
}
/******************************************************************************/
// 時間を読み取り
//============================================================================//
// 概要:なし。
// 補足:なし。
//============================================================================//
UINT ReadIniTime(const tstring& strSection, const tstring& strName, const tstring& s, UINT uiDefault)
{
return IniTime2Int(ReadIniStr(strSection, strName, s, Int2Str(uiDefault)));
}
/******************************************************************************/
// メッセージを読み取り
//============================================================================//
// 概要:なし。
// 補足:なし。
//============================================================================//
tstring ReadIniMsg(const tstring& strSection, const tstring& strName, const tstring& s)
{
return IniMsg2Str(ReadIniStr(strSection, strName, s, TEXT("")));
}
/******************************************************************************/
// 変換
/******************************************************************************/
// 真偽形式に変換
//============================================================================//
// 概要:なし。
// 補足:なし。
//============================================================================//
BOOL IniBln2Bln(const tstring& str, BOOL blnDefault)
{
if(str.IsEqualNoCase(TEXT("yes")) || str.IsEqualNoCase(TEXT("true")))
{
return TRUE;
}
if(str.IsEqualNoCase(TEXT("no")) || str.IsEqualNoCase(TEXT("false")))
{
return FALSE;
}
return blnDefault;
}
/******************************************************************************/
// メッセージ形式に変換
//============================================================================//
// 概要:なし。
// 補足:なし。
//============================================================================//
tstring IniMsg2Str(const tstring& strMsg)
{
tstring strRet;
BOOL blnEscape = FALSE;
for(UINT i = 0; i < strMsg.size(); i++)
{
// エスケープ文字の処理
if(blnEscape)
{
if(strMsg[i] == TEXT('\\'))
{
strRet += TEXT('\\');
}
else if(strMsg[i] == TEXT('n'))
{
strRet += TEXT('\n');
}
else if(strMsg[i] == TEXT('t'))
{
strRet += TEXT('\t');
}
blnEscape = FALSE;
continue;
}
if(strMsg[i] == TEXT('\\'))
{
blnEscape = TRUE;
}
else
{
strRet += strMsg[i];
}
}
return strRet;
}
/******************************************************************************/
// メッセージ形式に変換
//============================================================================//
// 概要:なし。
// 補足:なし。
//============================================================================//
tstring Str2IniMsg(const tstring& strMsg)
{
tstring strRet;
for(UINT i = 0; i < strMsg.size(); i++)
{
if(strMsg[i] == TEXT('\n'))
{
strRet += TEXT("\\n");
}
else if(strMsg[i] == TEXT('\t'))
{
strRet += TEXT("\\t");
}
else if(strMsg[i] == TEXT('\\'))
{
strRet += TEXT("\\\\");
}
else
{
strRet += strMsg[i];
}
}
return strRet;
}
/******************************************************************************/
// 時間に変換
//============================================================================//
// 概要:なし。
// 補足:なし。
//============================================================================//
UINT IniTime2Int(const tstring& strTime)
{
// 無限時間
if(strTime == TEXT("-1"))
{
return (UINT)-1;
}
// 数字部分を変換
UINT uiTime = 0;
int i = 0;
while(TEXT('0') <= strTime[i] && strTime[i] <= TEXT('9'))
{
uiTime *= 10;
uiTime += strTime[i] - TEXT('0');
i++;
if(i >= strTime.size())
{
break;
}
}
// 単位を変換
if(i < strTime.size())
{
tstring strUnit = strTime.substr(i);
if(strUnit == TEXT("ms"))
{
}
else if(strUnit == TEXT("s"))
{
uiTime *= 1000;
}
else if(strUnit == TEXT("m"))
{
uiTime *= 1000 * 60;
}
else if(strUnit == TEXT("h"))
{
uiTime *= 1000 * 60 * 60;
}
else if(strUnit == TEXT("d"))
{
uiTime *= 1000 * 60 * 60 * 24;
}
else
{
uiTime *= 1000; // s と解釈
}
}
else
{
uiTime *= 1000;
}
return uiTime;
}
/******************************************************************************/
// 数字を時間に変換
//============================================================================//
// 概要:なし。
// 補足:なし。
//============================================================================//
tstring Int2IniTime(UINT uiTime)
{
tstring strRet;
if(uiTime == INFINITE)
{
strRet = TEXT("無限時間");
}
else
{
uiTime /= 1000;
// 時間の文字列計算
TCHAR pszBuf[100];
if(uiTime / 60 > 0)
{
wsprintf(pszBuf, TEXT("%02d"), uiTime % 60);
}
else
{
wsprintf(pszBuf, TEXT("%d"), uiTime % 60);
}
strRet = pszBuf + tstring(TEXT("秒"));
uiTime /= 60;
if(uiTime > 0)
{
wsprintf(pszBuf, TEXT("%d"), uiTime);
strRet = pszBuf + tstring(TEXT("分")) + strRet;
uiTime /= 60;
if(uiTime > 0)
{
wsprintf(pszBuf, TEXT("%d"), uiTime);
strRet = pszBuf + tstring(TEXT("時間")) + strRet;
}
}
}
return strRet;
}
/******************************************************************************/
// セクション
/******************************************************************************/
// 文字列を INI ファイルとして評価
//============================================================================//
// 概要:なし。
// 補足:なし。
//============================================================================//
map<tstring, tstring> ReadStrIni(const tstring& strData)
{
vector<tstring> vecLine = SplitStr(strData, TEXT("\r\n"));
map<tstring, tstring> mapValue;
for(int i = 0; i < vecLine.size(); i++)
{
tstring str = vecLine[i];
if(str.size() == 0 || str[0] == TEXT('#') || str[0] == TEXT(';'))
{
continue;
}
UINT uiEqual = str.find(TEXT('='));
if(uiEqual != string::npos)
{
mapValue[str.substr(0, uiEqual)] = str.substr(uiEqual + 1);
}
}
return mapValue;
}
/******************************************************************************/
// セクションリスト取得
//============================================================================//
// 概要:なし。
// 補足:なし。
//============================================================================//
vector<tstring> GetSectionList(const tstring& strFileName)
{
// ini ファイル読み取り
DWORD dwSize = 256 ;
PTSTR pszBuf ;
while( TRUE)
{
// バッファ確保して読み取り
pszBuf = new TCHAR[dwSize] ;
DWORD dwResult = GetPrivateProfileSectionNames(pszBuf, dwSize, strFileName.c_str()) ;
// バッファサイズが小さかったとき
if( dwResult == dwSize - 2)
{
dwSize *= 2 ;
delete[] pszBuf ;
continue ;
}
else
{
break ;
}
}
// リストを設定
vector<tstring> vecList;
PTSTR pszPointer = pszBuf;
while(*pszPointer != TEXT('\0'))
{
vecList.push_back(pszPointer);
pszPointer += lstrlen(pszPointer) + 1;
}
return vecList;
}
/******************************************************************************/
// セクション内の文字を取得
//============================================================================//
// 概要:なし。
// 補足:なし。
//============================================================================//
tstring GetSectionString(const tstring& strSection, const tstring& strFileName)
{
// ini ファイル読み取り
DWORD dwSize = 256 ;
PTSTR pszBuf ;
while( TRUE)
{
// バッファ確保して読み取り
pszBuf = new TCHAR[dwSize] ;
DWORD dwResult = GetPrivateProfileSection(strSection.c_str(), pszBuf, dwSize, strFileName.c_str()) ;
// バッファサイズが小さかったとき
if( dwResult == dwSize - 2)
{
dwSize *= 2 ;
delete[] pszBuf ;
continue ;
}
else
{
break ;
}
}
// リストを設定
PTSTR p = pszBuf;
tstring s = TEXT("");
while(*p)
{
if(p[0] == TEXT('#') || p[0] == TEXT(';'))
{
p += _tcslen(p) + 1;
continue;
}
if(s != TEXT(""))
{
s += TEXT("\n");
}
s += p;
p += lstrlen(p) + 1;
}
delete[] pszBuf;
return s;
} |
4686f088d4a5b562a735f02a355288ec369c39fd | 34bec7e199061f67fb1c8d86ac6e8055cef6de38 | /World.cpp | 7b1a9d13d9711a70f00ec9252a4755826a490cb9 | [] | no_license | miquelgalianallorca/IngSoftware1 | 248506477d6eff816c681f5ee5c400f3ac116b56 | 8091f6b8569e1f8214ee13886ec7a38321b0830b | refs/heads/master | 2021-09-01T10:45:10.886155 | 2017-12-26T15:22:41 | 2017-12-26T15:22:41 | 110,733,019 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 3,799 | cpp | World.cpp | #include "stdafx.h"
#include "Utils.h"
#include "World.h"
#include "Bullet.h"
#include "Enemy.h"
#include "Mushroom.h"
#include "Player.h"
#include "MeteoManager.h"
World::World() {
enemySpawnTime = 20;
mushroomSpawnTime = 20;
enemyTimer = 0;
mushroomTimer = 0;
player = nullptr;
meteoManager = nullptr;
}
World::~World() {
delete player;
delete meteoManager;
}
void World::Init() {
player = new Player();
meteoManager = new MeteoManager();
meteoManager->Init(5);
}
void World::Update() {
meteoManager->Update();
// Bullet logic
for (auto itB = bullets.begin(); itB != bullets.end();) {
bool eraseBullet = false;
itB->Update();
// Destroy bullet out of bounds
if (OutOfBounds(itB->GetPos())) eraseBullet = true;
else {
// Collision bullet/enemy
for (auto itE = enemies.begin(); itE != enemies.end();) {
bool eraseEnemy = false;
if (Distance(itB->GetPos(), itE->GetPos()) <= 1) {
eraseEnemy = true;
eraseBullet = true;
player->AddPoints(pointsEnemyKill);
}
if (eraseEnemy) itE = enemies.erase(itE);
else itE++;
}
// Collision bullet/mushroom
for (auto itM = mushrooms.begin(); itM != mushrooms.end();) {
bool eraseMushroom = false;
if (Distance(itB->GetPos(), itM->GetPos()) < 1) {
eraseBullet = true;
eraseMushroom = true;
}
if (eraseMushroom) itM = mushrooms.erase(itM);
else itM++;
}
}
if (eraseBullet) itB = bullets.erase(itB);
else itB++;
}
// Enemy logic
if (enemyTimer > enemySpawnTime) {
//Spawn enemy
Enemy e;
e.Init(lineSize);
enemies.push_back(e);
enemyTimer = 0;
}
else enemyTimer++;
for (auto it = enemies.begin(); it != enemies.end();) {
bool remove = false;
it->Update();
//Destroy enemy out of bounds
if (OutOfBounds(it->GetPos())) remove = true;
else {
//Collision enemy/player
if (Distance(player->GetPos(), it->GetPos()) <= 1) {
remove = true;
player->Damage();
}
}
if (remove) it = enemies.erase(it);
else it++;
}
// Mushroom logic
if (mushroomTimer > mushroomSpawnTime) {
//Spawn mushroom
Mushroom m;
m.Init(lineSize);
mushrooms.push_back(m);
mushroomTimer = 0;
}
else mushroomTimer++;
for (auto itM = mushrooms.begin(); itM != mushrooms.end();) {
bool eraseMushroom = false;
//Collision mushroom/player
if (Distance(player->GetPos(), itM->GetPos()) < 1) {
eraseMushroom = true;
player->AddPoints(pointsMushroom);
}
if (eraseMushroom) itM = mushrooms.erase(itM);
else itM++;
}
}
void World::MovePlayer(Direction _dir) {
player->Move(_dir);
}
void World::AddBullet(Direction _dir) {
Bullet b;
if (_dir == Direction::Left) b.SetLeftBullet (player->GetPos() - 1);
else b.SetRightBullet(player->GetPos() + 1);
bullets.push_back(b);
}
void World::Draw() {
//Draw sky
MoveConsoleCursor(0, 11);
for (int i = 0; i < lineSize; i++) {
char draw = meteoManager->GetGraphicAt(i, 1);
printf("%c", draw);
}
//Draw ground
MoveConsoleCursor(0, 12);
for (int i = 0; i < lineSize; i++) {
// Weather effects
char draw = meteoManager->GetGraphicAt(i, 0);
// Draw character
if (i == player->GetPos()) draw = player->GetGraphic();
// Draw bullets
for (auto it = bullets.begin(); it != bullets.end(); it++) {
if (it->GetPos() == i) draw = it->GetGraphic();
}
// Draw enemies
for (auto it = enemies.begin(); it != enemies.end(); it++) {
if (it->GetPos() == i) draw = it->GetGraphic();
}
// Draw mushrooms
for (auto it = mushrooms.begin(); it != mushrooms.end(); it++) {
if (it->GetPos() == i) draw = it->GetGraphic();
}
printf("%c", draw);
}
printf(" LIVES: %i POINTS: %03i", player->GetLives(), player->GetPoints());
} |
64aab52300e84a40351cd0ba45f301cef670b5b2 | e2847929f485edb74dda23e63dff0b59e93998d2 | /0206.reverse-linked-list/reverse-linked-list.cpp | ecff2aee8ca37f71780e61cca1d96bbee60db807 | [] | no_license | hbsun2113/LeetCodeCrawler | 36b068641fa0b485ac51c2cd151498ce7c27599f | 43507e04eb41160ecfd859de41fd42d798431d00 | refs/heads/master | 2020-05-23T21:11:32.158160 | 2019-10-18T07:20:39 | 2019-10-18T07:20:39 | 186,947,546 | 5 | 1 | null | null | null | null | UTF-8 | C++ | false | false | 2,409 | cpp | reverse-linked-list.cpp | /**
* Definition for singly-linked list.
* struct ListNode {
* int val;
* ListNode *next;
* ListNode(int x) : val(x), next(NULL) {}
* };
*/
class Solution {
public:
// 多刷,这次写得挺快的,都是一把过,而且我觉得很规范:
// 这种东西感觉不是每次硬写的,要记住大致思路。
// 比如递归法记住每次是返回头节点;迭代法是最外面需要定义两个节点(curr和pre),while里面需要记录下一个节点(next),然后节点是按顺序转移,不会"跳转"
// 递归写法
ListNode* reverseList3(ListNode* head) {
if(!head || !head->next) return head;
ListNode* nn=head->next;
ListNode* newhead=reverseList(nn);
nn->next=head;
head->next=nullptr;
return newhead;
}
// 迭代法
ListNode* reverseList4(ListNode* head) {
ListNode* pre=nullptr;
ListNode* first=head;
while(first){
ListNode* second=first->next;
first->next=pre;
pre=first;
first=second;
}
return pre;
}
//https://www.acwing.com/solution/LeetCode/content/316/
//比我的优雅,因为它先增加了一个nullptr作为头结点。
ListNode* reverseList(ListNode* head){
ListNode* pre=nullptr;
ListNode* cur=head;
while(cur){
ListNode *nnext=cur->next;
cur->next=pre;
pre=cur;
cur=nnext;
}
return pre;
}
//迭代,自己写的
ListNode* reverseList2(ListNode* head) {
if(!head || !head->next) return head;
ListNode* f=head; //first
ListNode* prev=nullptr;
while(f && f->next){
ListNode* s=f->next; //second
ListNode* t=s->next;
s->next=f;
f->next=prev;
prev=s;
f=t;
}
//长度为奇偶分别处理
if(!f) return prev;
f->next=prev;
return f;
}
//递归解法,自己写的
ListNode* reverseList1(ListNode* head) {
if(!head) return head;
if(!head->next) return head;
ListNode* forward=head->next;
ListNode* newhead=reverseList(forward);
forward->next=head;
head->next=nullptr;
return newhead;
}
}; |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.