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 |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
4ce1844692f177522c591f170ce19f1e8e018f10 | 70d0ec79be7f09b869158ccd8d4e9681ee0c579c | /ActiveWarSimulation/StageEditor/EditMove.h | 5caa57766a61af3dd264bf4867c51ea432834c12 | [] | no_license | mabo207/ActiveWarSimulation | 3eaf68cc2d57115bbc431c68df5aedac05c786c2 | 4c449283b4abeebcf2ff70ae750ad5a9c2ab08c2 | refs/heads/master | 2021-01-24T01:28:27.726976 | 2019-08-19T07:06:33 | 2019-08-19T07:06:47 | 122,803,694 | 0 | 0 | null | 2019-12-06T05:25:17 | 2018-02-25T04:03:49 | C++ | SHIFT_JIS | C++ | false | false | 978 | h | EditMove.h | #ifndef DEF_EDITMOVE_H
#define DEF_EDITMOVE_H
#include"EditAction.h"
//設置場所を動かす行為を記述するクラス
class EditMove:public EditAction{
//型・列挙体
public:
struct EditMoveButton:public EditActionButton{
EditMoveButton(Vector2D point,Vector2D vec);
void PushedProcess(EditActionSettings &settings)const;//ボタンが押された時の処理
};
//定数
//変数
protected:
//関数
public:
EditMove(int buttonX,int buttonY,int buttonDX,int buttonDY,unsigned int pushedColor);
~EditMove() {}
void VNonPressEditing(Vector2D point,EditActionSettings &settings)const;//マウスを押していない時も編集を行う編集行為について、そのような編集行為を行う
void VProcessAction(Vector2D point,EditActionSettings &settings);//編集行為を実行する
PosSetKind VGetPosSetKind(const EditActionSettings &settings)const;//編集状況に依って返す値が異なるため
};
#endif // !DEF_EDITMOVE_H
|
f1c98b8378a2a8278b810aec1f165deaeb1e6863 | ad0f06d334dcb419abf673dd004505020976691d | /src/server.cpp | a5f817637c876237042049742d2ab837e596cfab | [] | no_license | Coderlane/QtWebkitUI | b112444c09ffd9e3b3984205067233a953b20298 | 5290fa0f5fa21798408f9d67c50c1fa403d0b474 | refs/heads/master | 2016-08-05T03:21:32.513015 | 2013-03-26T18:11:09 | 2013-03-26T18:11:09 | null | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 6,065 | cpp | server.cpp | #include "server.h"
Server::Server(QObject *parent) : QObject(parent)
{
mainSocket = NULL;
}
void Server::Connect()
{
if(mainSocket != NULL)
{
Disconnect();
free(mainSocket);
mainSocket = NULL;
}
mainSocket = new QTcpSocket(this);
connect(mainSocket, SIGNAL(connected ()), this, SLOT(ConnectedToHost()));
connect(mainSocket, SIGNAL(disconnected ()), this, SLOT(DisconnectedFromHost()));
connect(mainSocket, SIGNAL(error( QAbstractSocket::SocketError )), this, SLOT(SocketError( QAbstractSocket::SocketError )));
connect(mainSocket, SIGNAL(stateChanged ( QAbstractSocket::SocketState )), this, SLOT(SocketStateChanged ( QAbstractSocket::SocketState )));
ConnectToHost();
}
void Server::Disconnect()
{
}
void Server::DisconnectFromHost()
{
}
void Server::ConnectToHost()
{
mainSocket->connectToHost(HostIP, HostTCPPort, QIODevice::ReadWrite);
}
void Server::ConnectedToHost()
{
emit Connected();
}
void Server::DisconnectedFromHost()
{
emit Disconnected();
}
/* Server::SocketError
* Handle all possible errors that could occur
* See: http://qt-project.org/doc/qt-4.8/qabstractsocket.html#SocketError-enum
*/
void Server::SocketError(QAbstractSocket::SocketError socketError )
{
switch (socketError)
{
case QAbstractSocket::ConnectionRefusedError:
emit Status("The connection was refused by the peer (or timed out)");
break;
case QAbstractSocket::RemoteHostClosedError:
emit Status("The remote host closed the connection. Note that the client socket (i.e., this socket) will be closed after the remote close notification has been sent.");
break;
case QAbstractSocket::HostNotFoundError:
emit Status("The host address was not found.");
break;
case QAbstractSocket::SocketAccessError:
emit Status("The socket operation failed because the application lacked the required privileges.");
break;
case QAbstractSocket::SocketResourceError:
emit Status("The local system ran out of resources (e.g., too many sockets).");
break;
case QAbstractSocket::SocketTimeoutError:
emit Status("The socket operation timed out.");
break;
case QAbstractSocket::NetworkError:
emit Status("An error occurred with the network (e.g., the network cable was accidentally plugged out).");
break;
case QAbstractSocket::AddressInUseError:
emit Status("The address specified to QUdpSocket::bind() is already in use and was set to be exclusive.");
break;
case QAbstractSocket::SocketAddressNotAvailableError:
emit Status("The address specified to QUdpSocket::bind() does not belong to the host.");
break;
case QAbstractSocket::UnsupportedSocketOperationError:
emit Status("The requested socket operation is not supported by the local operating system (e.g., lack of IPv6 support).");
break;
case QAbstractSocket::ProxyAuthenticationRequiredError:
emit Status("The socket is using a proxy, and the proxy requires authentication.");
break;
case QAbstractSocket::UnfinishedSocketOperationError:
emit Status("Used by QAbstractSocketEngine only, The last operation attempted has not finished yet (still in progress in the background)");
break;
case QAbstractSocket::ProxyConnectionRefusedError:
emit Status("Could not contact the proxy server because the connection to that server was denied ");
break;
case QAbstractSocket::ProxyConnectionClosedError:
emit Status("The connection to the proxy server was closed unexpectedly (before the connection to the final peer was established)");
break;
case QAbstractSocket::ProxyConnectionTimeoutError:
emit Status("The connection to the proxy server timed out or the proxy server stopped responding in the authentication phase.");
break;
case QAbstractSocket::ProxyNotFoundError:
emit Status("The proxy address set with setProxy() (or the application proxy) was not found.");
break;
case QAbstractSocket::ProxyProtocolError:
emit Status("The connection negotiation with the proxy server because the response from the proxy server could not be understood. ");
break;
case QAbstractSocket::UnknownSocketError:
emit Status("An unidentified error occurred.");
break;
default:
emit Status("An unidentified error occurred.");
break;
}
}
/* Server::SocketStateChanged
* Handle all possible socket state changes
* See: http://qt-project.org/doc/qt-4.8/qabstractsocket.html#SocketState-enum
*/
void Server::SocketStateChanged ( QAbstractSocket::SocketState socketState )
{
switch (socketState)
{
case QAbstractSocket::UnconnectedState:
emit Status("The socket is not connected.");
break;
case QAbstractSocket::HostLookupState:
emit Status("The socket is performing a host name lookup.");
break;
case QAbstractSocket::ConnectingState:
emit Status("The socket has started establishing a connection.");
break;
case QAbstractSocket::ConnectedState:
emit Status("A connection is established.");
break;
case QAbstractSocket::BoundState:
emit Status("The socket is bound to an address and port (for servers).");
break;
case QAbstractSocket::ClosingState:
emit Status("The socket is about to close (data may still be waiting to be written).");
break;
case QAbstractSocket::ListeningState:
emit Status("For internal use only.");
break;
default:
emit Status("Unidentified socket state.");
break;
}
}
|
346c43d969ab8bf16bd448913a7c1f8238959e1e | a099b1cd56d522f3e425ee4650c9cd3022201b2d | /Algorithms/NumberTheory_MatrixExpo.cpp | 5ac84aa4f6f258dc17d938ad7110586a9a5c364a | [] | no_license | SamuelT13/Competition_Programming | 1d1f3556cd50965ff4ef8b9ef60f4a6f456e6ec9 | efb461762cfe544e4a795ad8c5ce7c1445603ddb | refs/heads/master | 2021-01-02T09:45:43.697448 | 2017-09-16T15:04:48 | 2017-09-16T15:04:48 | 99,290,014 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 2,059 | cpp | NumberTheory_MatrixExpo.cpp | #include <iostream>
#include <vector>
#include <fstream>
#include <cstring>
using namespace std;
typedef long long LL;
const LL MAT_SIZE = 2;
// A struct for a square matrix.
struct matrix{
LL mat[MAT_SIZE][MAT_SIZE];
matrix() {
memset(mat, 0, sizeof(mat));
}
matrix(LL w, LL x, LL y, LL z){
mat[0][0] = w;
mat[0][1] = x;
mat[1][0] = y;
mat[1][1] = z;
}
matrix add(const matrix& b, LL mod) const{
matrix res(*this);
for (LL r = 0; r < MAT_SIZE; r++)
for (LL c = 0; c < MAT_SIZE; c++)
res.mat[r][c] = (res.mat[r][c]%mod + b.mat[r][c]%mod) % mod;
return res;
}
matrix multiply(const matrix& b, LL mod) const{
matrix res;
for (LL r = 0; r < MAT_SIZE; r++)
for (LL c = 0; c < MAT_SIZE; c++)
for (LL k = 0; k < MAT_SIZE; k++)
res.mat[r][c] = (res.mat[r][c] % mod + (mat[r][k]%mod) * (b.mat[k][c]%mod)) % mod;
return res;
}
matrix operator%(LL mod) const{
matrix res(*this);
for (LL r = 0; r < MAT_SIZE; r++)
for (LL c = 0; c < MAT_SIZE; c++)
res.mat[r][c] %= mod;
return res;
}
};
// Calculates Base^Expo mod Mod, where Base is a matrix.
matrix mod_matrix_power(const matrix& base, LL expo, LL mod){
matrix result = matrix(1, 0, 0, 1) % mod;
matrix square = base % mod;
for (LL p = 0; p < 63; p++){
if (expo & (LL(1) << p))
result = result.multiply(square, mod);
square = square.multiply(square, mod);
}
return result;
}
LL calc_recurrence_matrix(LL index, LL a, LL b, LL f0, LL f1, LL mod){
matrix recur(0, 1, b, a);
matrix initial(f0, 0, f1, 0);
matrix res = mod_matrix_power(recur, index, mod).multiply(initial, mod);
return res.mat[0][0];
}
int main(){
ios_base::sync_with_stdio(false);
cin.tie(NULL);
//F(n) = AF(n-1) + BF(n-2)
const LL A = 1;
const LL B = 1;
const LL F0 = 1;
const LL F1 = 1;
const LL MODULUS = 10;
LL index;
while (cin >> index)
cout << calc_recurrence_matrix(index-1, A, B, F0, F1, MODULUS) << "\n";
return 0;
}
|
6901547c1178ac8893a4d85f4dcb73a3dccecddb | a575e3dee4b387d61c78ad4ee00afc15544aba18 | /src/Graphic/CustomNode.hpp | 21f0c0913391ce9221c61ce82b884781a3cd8a9a | [] | no_license | nicolasguerinAI/cpp_indie_studio | 858fbecbe0270bac4af23982d2abed2b4804c143 | bf3894956d9e139c35f3cc6f9db74a6a36bff9ca | refs/heads/master | 2021-11-22T03:44:17.401618 | 2018-06-18T11:58:57 | 2018-06-18T11:58:57 | null | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 894 | hpp | CustomNode.hpp | //
// Created by jdecombe on 08/05/18.
//
#ifndef IRRLICHTTESTS_CUSTOMNODE_HPP
#define IRRLICHTTESTS_CUSTOMNODE_HPP
#include "Irrlicht/irrlicht.h"
class CustomNode : public irr::scene::ISceneNode {
private:
irr::core::aabbox3df _box;
irr::video::S3DVertex _vertices[4];
irr::video::SMaterial _material;
public:
CustomNode(ISceneNode *parent, irr::scene::ISceneManager *mgr, irr::s32 id);
CustomNode(ISceneNode *parent, irr::scene::ISceneManager *mgr, irr::s32 id,
const irr::core::vector3df &position, const irr::core::vector3df &rotation,
const irr::core::vector3df &scale
);
void OnRegisterSceneNode() override;
void render() override;
const irr::core::aabbox3d<irr::f32> &getBoundingBox() const override;
irr::u32 getMaterialCount() const override;
irr::video::SMaterial &getMaterial(irr::u32 num) override;
};
#endif //IRRLICHTTESTS_CUSTOMNODE_HPP
|
9fd591fdc4e667dcff8e3db9eb17041fb317d8c6 | eda03521b87da8bdbef6339b5b252472a5be8d23 | /Userland/Libraries/LibSQL/AST/CreateTable.cpp | a5f383c691d49056906538c1c5af5adb44e2a1f9 | [
"BSD-2-Clause"
] | permissive | SerenityOS/serenity | 6ba3ffb242ed76c9f335bd2c3b9a928329cd7d98 | ef9b6c25fafcf4ef0b44a562ee07f6412aeb8561 | refs/heads/master | 2023-09-01T13:04:30.262106 | 2023-09-01T08:06:28 | 2023-09-01T10:45:38 | 160,083,795 | 27,256 | 3,929 | BSD-2-Clause | 2023-09-14T21:00:04 | 2018-12-02T19:28:41 | C++ | UTF-8 | C++ | false | false | 1,389 | cpp | CreateTable.cpp | /*
* Copyright (c) 2021, Jan de Visser <jan@de-visser.net>
*
* SPDX-License-Identifier: BSD-2-Clause
*/
#include <LibSQL/AST/AST.h>
#include <LibSQL/Database.h>
namespace SQL::AST {
ResultOr<ResultSet> CreateTable::execute(ExecutionContext& context) const
{
auto schema_def = TRY(context.database->get_schema(m_schema_name));
auto table_def = TRY(TableDef::create(schema_def, m_table_name));
for (auto const& column : m_columns) {
SQLType type;
if (column->type_name()->name().is_one_of("VARCHAR"sv, "TEXT"sv))
type = SQLType::Text;
else if (column->type_name()->name().is_one_of("INT"sv, "INTEGER"sv))
type = SQLType::Integer;
else if (column->type_name()->name().is_one_of("FLOAT"sv, "NUMBER"sv))
type = SQLType::Float;
else if (column->type_name()->name().is_one_of("BOOL"sv, "BOOLEAN"sv))
type = SQLType::Boolean;
else
return Result { SQLCommand::Create, SQLErrorCode::InvalidType, column->type_name()->name() };
table_def->append_column(column->name(), type);
}
if (auto result = context.database->add_table(*table_def); result.is_error()) {
if (result.error().error() != SQLErrorCode::TableExists || m_is_error_if_table_exists)
return result.release_error();
}
return ResultSet { SQLCommand::Create };
}
}
|
4acbf1d170f0629050253f840a45c12599ece450 | 4dbb0388367d0ca4ec29dfeaecf86625b85eecce | /Others/LeibICT-UDK_new/LeibICT-UDK_new/1.0a/samples/c++/ussdtest/ussd.cpp | 0d1eb95b8915cc76648e86a26543f0ec80500975 | [] | no_license | Harshad-Pardeshi/Unreserved-train-ticketing-system-using-mobile-phones | 086a63be26d9ab30876e9e67804d5cbe52f444f4 | 24fd635d8307ad398758ded75ae09940cfed691e | refs/heads/master | 2021-04-15T07:16:55.461073 | 2018-03-26T22:04:56 | 2018-03-26T22:04:56 | 126,884,785 | 2 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 1,768 | cpp | ussd.cpp |
#include "StdAfx.h"
#include <stdio.h>
#include "ussd.h"
#define STDLOG printf
#ifdef _WIN32
#define DLLSYM GetProcAddress
#define DLLUNLOAD FreeLibrary
#define DLLERROR GetLastError
#else
#include <dlfcn.h>
#define DLLSYM dlsym
#define DLLUNLOAD dlclose
#define DLLERROR dlerror
#endif
CUSSD::CUSSD(){
dll_pong =0;
dll_ussd_end =0;
dll_ussd_request =0;
dll_connectgw =0;
dll_initialize =0;
#ifdef _WIN32
ussdDll = LoadLibrary("ussd.dll");
#else
ussdDll = dlopen("libussd.so.1.0", RTLD_LAZY);
#endif
if(!ussdDll){
STDLOG("ERROR ussd library not found %s",DLLERROR());
//AfxMessageBox("xml parser.dll not found",MB_SYSTEMMODAL|MB_ICONSTOP);
return;
}
dll_pong = (pongFn) DLLSYM(ussdDll,"pong");
dll_ussd_end = (ussd_endFn) DLLSYM(ussdDll,"ussd_end");
dll_ussd_request = (ussd_requestFn) DLLSYM(ussdDll,"ussd_request");
dll_initialize = (initializeFn) DLLSYM(ussdDll,"initialize");
dll_connectgw = (connectgwFn) DLLSYM(ussdDll,"connectgw");
if( !dll_pong ||
!dll_ussd_end ||
!dll_ussd_request ||
!dll_initialize ||
!dll_connectgw ){
STDLOG("ERROR ussd library bad link %d:%d:%d:%d:%d",dll_pong,dll_ussd_end,dll_ussd_request,dll_initialize,dll_connectgw);
DLLUNLOAD(ussdDll);
ussdDll = NULL;
return;
}
}
CUSSD::~CUSSD(){
if(ussdDll) DLLUNLOAD(ussdDll);
}
int CUSSD::pong(){
return dll_pong();
}
int CUSSD::ussd_end(int dialogId, char* text){
return dll_ussd_end(dialogId,text);
}
int CUSSD::ussd_request(int dialogId,char* prompt){
return dll_ussd_request(dialogId,prompt);
}
int CUSSD::connectgw(char* addr, int port, int jrx, int jtx){
return dll_connectgw(addr,port,jrx,jtx);
}
int CUSSD::initialize(USSDCallbacks* callbacks){
if(!ussdDll){ return 0; }
return dll_initialize(callbacks);
}
|
593fc48a2919c16c17051300f1f12cb4190e609b | 768316ed72470715e641fda62a9166b610b27350 | /03-CodeChef-Medium/579--Grid Shuffle.cpp | 7c8f0e405586e18d639c1905b030d05337ae8354 | [] | no_license | dhnesh12/codechef-solutions | 41113bb5922156888d9e57fdc35df89246e194f7 | 55bc7a69f76306bc0c3694180195c149cf951fb6 | refs/heads/master | 2023-03-31T15:42:04.649785 | 2021-04-06T05:38:38 | 2021-04-06T05:38:38 | 355,063,355 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 5,693 | cpp | 579--Grid Shuffle.cpp | #include<bits/stdc++.h>
using namespace std;
// (POLICY BASED DS)
// #include <ext/pb_ds/assoc_container.hpp>
// #include <ext/pb_ds/tree_policy.hpp>
// using namespace __gnu_pbds;
// template<typename T>
// using ordered_set=tree<T,null_type,less<T>,rb_tree_tag,tree_order_statistics_node_update>;
// template<typename T>
// using ordered_multiset=tree<T,null_type,less_equal<T>,rb_tree_tag,tree_order_statistics_node_update>;
// ( find_by_order( ) , order_of_key( ) )
typedef long long ll;
typedef long double ld;
typedef unsigned long long ull;
typedef vector<long long> vll;
typedef pair<ll,ll> pll;
const ll mod = 998244353;
const ld PI = 3.1415926535897932384626;
const ld eps = 1e-9;
#define boost ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL)
#define sidha(i,a,b) for(ll i=(ll)(a);i<(ll)(b);++i)
#define ulta(i,a,b) for(ll i=(ll)(a);i>=(ll)(b);--i)
#define stl(container,itr) \
for(auto itr = container.begin(); itr != container.end(); itr++)
#define sab(v) v.begin(), v.end()
#define rall(v) v.rbegin(), v.rend()
#define test ll t;cin>>t;while(t--)
#define sz size()
#define pb push_back
#define mp make_pair
#define fi first
#define se second
#define LOG2(X) (63ll - __builtin_clzll(X))
#define endl '\n'
#define modinv(x) powermod(x, mod-2)
#define mktree(x) ll a,b; sidha(i,0,x){cin>>a>>b; adj[a].pb(b); adj[b].pb(a);}
#define ncr(n,r) ( (n) >= (r) ? ((((fact[n]*modinv(fact[r]))%mod)*modinv(fact[n-(r)]))%mod) : (ll)0)
#define MAX 100005
ll powermod(ll x, ll y) {
ll ans=1;
x=x%mod;
while(y>0) {
if (y&1)
ans=(ans*x)%mod;
y=y>>1;
x=(x*x)%mod;
}
return ans;
}
ll power(ll x, ll y) {
ll ans=1;
while(y>0) {
if (y&1)
ans=(ans*x);
y=y>>1;
x=(x*x);
}
return ans;
}
ll gcd(ll x,ll y){
if(y==0) return x;
return gcd(y,x%y);
}
ll ceil(ll x,ll y){
return ( (x/y)+(x%y!=0) );
}
// vector<ll> adj[MAX];
// ll visit[MAX];
// void dfs(ll node){
// visit[node]=1;
// for(auto i : adj[node]){
// if(!visit[i]) dfs(i);
// }
// }
// ll spf[MAX];
// void sieve(){
// sidha(i,1,MAX) spf[i]=i;
// for(ll i=4;i<MAX;i+=2) spf[i]=2;
// for(ll i=3;i*i<=MAX;i++){
// if(spf[i]==i){
// for(ll j=i*i;j<MAX;j+=i){
// if(spf[j]==j) spf[j]=i;
// }
// }
// }
// }
// use pow , ceil , max , min with precaution :)
int main()
{
boost;
clock_t begin,end;
begin=clock();
test{
ll n,k,r,c,temp;
cin>>n>>k>>r>>c;
if(n==1){
cout<<"1\n";
continue;
}
ll dp[k+1][2][2];
dp[0][0][0]=1;
dp[0][0][1]=dp[0][1][0]=dp[0][1][1]=0;
sidha(i,1,k+1){
// for 0 0
temp=((dp[i-1][0][0]*(n*2-2))%mod);
temp=((temp*modinv(n*2))%mod);
dp[i][0][0]=temp;
temp=dp[i-1][0][0];
temp=((temp*modinv(n*n))%mod);
dp[i][0][0]=((dp[i][0][0]+temp)%mod);
temp=((dp[i-1][0][1]+dp[i-1][1][0])%mod);
temp=((temp*modinv(n*n*2))%mod);
dp[i][0][0]=((dp[i][0][0]+temp)%mod);
// for 0 1
temp=((dp[i-1][0][0]*(n-1))%mod);
temp=((temp*modinv(n*n*2))%mod);
dp[i][0][1]=temp;
temp=((dp[i-1][0][1]*(n*2-2))%mod);
temp=((temp*modinv(n*2))%mod);
dp[i][0][1]=((dp[i][0][1]+temp)%mod);
temp=(dp[i-1][0][1]);
temp=((temp*modinv(n*2))%mod);
dp[i][0][1]=((dp[i][0][1]+temp)%mod);
temp=(dp[i-1][1][1]);
temp=((temp*modinv(n*n*2))%mod);
dp[i][0][1]=((dp[i][0][1]+temp)%mod);
// for 1 0
dp[i][1][0]=dp[i][0][1];
// for 1 1
// temp=((dp[i-1][1][1]*(n*2-2))%mod);
// temp=((temp*modinv(n*2))%mod);
// dp[i][1][1]=temp;
// temp=((dp[i-1][1][1]*(n*2-2))%mod);
// temp=((temp*modinv(n*n))%mod);
// dp[i][1][1]=((dp[i][1][1]+temp)%mod);
// temp=((dp[i-1][0][1]+dp[i-1][1][0])%mod);
// temp=((temp*(n-1))%mod);
// temp=((temp*modinv(n*n*2))%mod);
// dp[i][1][1]=((dp[i][1][1]+temp)%mod);
temp=((((dp[i][0][0]+dp[i][0][1])%mod)+dp[i][1][0])%mod);
temp=((1-temp+mod)%mod);
dp[i][1][1]=temp;
}
cout<<dp[k][0][0]<<endl;
}
end=clock();
double tot_time=double(end-begin)/double(CLOCKS_PER_SEC);
// cout<<"Time Taken: "<<fixed<<setprecision(3)<<tot_time;
return 0;
}
|
834af21247ae3d40911ea393fb42facfc473d781 | c96a8c199c4e7f8b636d4ce94926d708ccdd4992 | /src/widgets/controllers/ListController.h | 60fb9b475c16ec189bd7eead014c504efac0672c | [
"MIT"
] | permissive | Kaosumaru/libmx | b662db96e52d9c7805a20b41a96a509357f36c41 | 7f412a7b845a315da02deb279fb208c739fb2f30 | refs/heads/master | 2020-08-04T01:50:37.197501 | 2020-02-02T15:24:23 | 2020-02-02T15:24:23 | 73,533,925 | 0 | 0 | MIT | 2019-12-18T19:50:53 | 2016-11-12T05:39:35 | C++ | UTF-8 | C++ | false | false | 4,687 | h | ListController.h | #pragma once
#include "widgets/Widget.h"
#include "widgets/strategies/Strategy.h"
namespace MX
{
namespace Widgets
{
//populates parent with controls created from data
template <typename T, typename SignalType = Signal<void(const T&)>>
class ListController : public Strategies::Strategy, public shared_ptr_init<ListController<T, SignalType>>
{
public:
~ListController()
{
//for (auto &view : _views)
// view->Unlink();
}
using CreatorFunction = std::function<std::shared_ptr<Widget>(const T&, ListController* controller, unsigned int index)>;
SignalType OnAction;
static std::shared_ptr<ListController> Create(const CreatorFunction& function)
{
return std::make_shared<ListController<T, SignalType>>(function);
}
ListController(const CreatorFunction& function)
{
_creator = function;
}
virtual void SetData(const std::list<T>& data)
{
for (auto& view : _views)
view->Unlink();
_views.clear();
_data = data;
_views.resize(_data.size());
auto it2 = _views.begin();
unsigned int index = 0;
for (auto& dataItem : _data)
{
auto widget = _creator(dataItem, this, index);
*it2 = widget;
this->widget().AddWidget(widget);
it2++;
index++;
}
}
protected:
CreatorFunction _creator;
std::list<std::shared_ptr<Widget>> _views;
std::list<T> _data;
};
// automatically listen for touched
template <typename T, template <class Created, class Alloc = std::allocator<Created>> class Container = std::vector>
class OneSelectionListController : public Strategies::Strategy, public shared_ptr_init<OneSelectionListController<T, Container>>
{
public:
using ContainerType = Container<T>;
~OneSelectionListController()
{
//for (auto &view : _views)
// view->Unlink();
}
struct ItemContext
{
bool default_item = false;
};
using SignalType = Signal<void(const T&, int index)>;
using CreatorFunction = std::function<std::shared_ptr<ButtonWidget>(const T&, OneSelectionListController* controller, unsigned int index, ItemContext& ctx)>;
SignalType OnAction;
Signal<void()> OnListEmpty;
static std::shared_ptr<OneSelectionListController> Create(const CreatorFunction& function)
{
return std::make_shared<OneSelectionListController<T, Container>>(function);
}
OneSelectionListController(const CreatorFunction& function)
{
_creator = function;
}
void SetData(const ContainerType& data)
{
_currentWidget = nullptr;
for (auto& view : _views)
view->Unlink();
_views.clear();
_data = data;
_views.resize(_data.size());
auto it2 = _views.begin();
unsigned int index = 0;
for (auto& dataItem : _data)
{
ItemContext ctx;
auto widget = _creator(dataItem, this, index, ctx);
*it2 = widget;
this->widget().AddWidget(widget);
if (_currentWidget == nullptr || ctx.default_item)
SelectedButton(widget, dataItem, index);
widget->onTouched.connect(std::bind(&OneSelectionListController::SelectedButton, this, widget, std::ref(dataItem), index));
it2++;
index++;
}
if (!_currentWidget)
OnListEmpty();
}
void SelectedButton(const std::shared_ptr<ButtonWidget>& widget, const T& data, int index)
{
if (_currentWidget)
_currentWidget->SetSelected(false);
_currentWidget = widget;
_currentWidget->SetSelected(true);
OnAction(data, index);
}
void SelectedIndex(int index)
{
if (index < 0 || index >= (int)_data.size())
return;
auto& widget = _views[index];
auto& data = _data[index];
SelectedButton(widget, data, index);
}
const auto& data() { return _data; }
protected:
std::shared_ptr<ButtonWidget> _currentWidget;
CreatorFunction _creator;
std::vector<std::shared_ptr<ButtonWidget>> _views;
ContainerType _data;
};
}
}
|
501d7f6621058ddda7ebe6e6ad060b879972f295 | dc94bbc6128ffebb39fd5ccc23125a4f4ef6a6b9 | /search/search_engine.hpp | 394aa7cc0b4b4e2aa24e0b0cc5e90d5ef862a164 | [
"Apache-2.0"
] | permissive | liqian/omim | 9c6f73a06b2c254e2d81770c1baa4d15ef42f933 | e3e4ad800158171d934adf2fed2b3caa46ccbf8e | refs/heads/master | 2021-01-18T02:17:34.187177 | 2016-03-20T16:12:38 | 2016-03-20T16:12:38 | null | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 1,667 | hpp | search_engine.hpp | #pragma once
#include "params.hpp"
#include "result.hpp"
#include "search_query_factory.hpp"
#include "geometry/rect2d.hpp"
#include "coding/reader.hpp"
#include "base/mutex.hpp"
#include "std/atomic.hpp"
#include "std/function.hpp"
#include "std/string.hpp"
#include "std/unique_ptr.hpp"
class Index;
namespace storage
{
class CountryInfoGetter;
}
namespace search
{
class EngineData;
class Query;
class Engine
{
typedef function<void (Results const &)> SearchCallbackT;
public:
// Doesn't take ownership of index. Takes ownership of pCategories
Engine(Index & index, Reader * categoriesR, storage::CountryInfoGetter const & infoGetter,
string const & locale, unique_ptr<SearchQueryFactory> && factory);
~Engine();
void SupportOldFormat(bool b);
void PrepareSearch(m2::RectD const & viewport);
bool Search(SearchParams const & params, m2::RectD const & viewport);
int8_t GetCurrentLanguage() const;
bool GetNameByType(uint32_t type, int8_t lang, string & name) const;
void ClearViewportsCache();
void ClearAllCaches();
private:
static const int RESULTS_COUNT = 30;
void SetRankPivot(SearchParams const & params,
m2::RectD const & viewport, bool viewportSearch);
void SetViewportAsync(m2::RectD const & viewport);
void SearchAsync();
void EmitResults(SearchParams const & params, Results const & res);
threads::Mutex m_searchMutex;
threads::Mutex m_updateMutex;
atomic_flag m_isReadyThread;
SearchParams m_params;
m2::RectD m_viewport;
unique_ptr<Query> m_query;
unique_ptr<SearchQueryFactory> m_factory;
unique_ptr<EngineData> const m_data;
};
} // namespace search
|
95284cdf7189523bc2aee44ba42f807a4002dc0d | 31a035666e2ee9f0b05e213123ed29f3ce20fafa | /FileReader.h | 6627aca32ce9c39c42b652b001edbae3bc941324 | [] | no_license | vismeneer/OOPAcircuit | 3b5da038ccbad52f3d18ae83f5e32d141922f661 | b4d4d8bc3555667f43250fc4c986ae707084b69f | refs/heads/master | 2016-09-06T21:26:37.591954 | 2013-11-13T23:45:42 | 2013-11-13T23:45:42 | null | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 205 | h | FileReader.h | #pragma once
#include <iostream>
class FileReader
{
public:
FileReader(const char* szFileName);
virtual ~FileReader(void);
int ReadFile(std::string& rsText);
private:
std::string m_sFileName;
};
|
e3c274912ef7127a2f6d992f0a7cf7dfb0c6a2e2 | 6377ddaa8e3140b330ad80787a18bad7f47c87f0 | /src/bear.h | 5c8e6d5ddec112637056ebb9009f4b70adda07e7 | [] | no_license | tonca/TP3_CPLUS | 51965ed335d1437e30c66296b0c7756feda57ea2 | c5292aff606c7dbd3505a7bc1fa2d6d388fa6228 | refs/heads/master | 2021-01-10T02:42:30.021572 | 2015-11-21T11:57:47 | 2015-11-21T11:57:47 | 46,611,884 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 306 | h | bear.h | #include "animal.h"
#include <iostream>
#ifndef BEAR_H_
#define BEAR_H_
class Bear: public Animal
{
private:
int compteur;
public:
virtual void deplace();
virtual char nom();
virtual string attaquer();
//contructeur
Bear();
//destructeur
~Bear() {};
};
#endif
|
220724b1be32ea900936c38b1e94c78bba8c727d | 0aae835a7de983505f114b8e52c98765d7fe2cc2 | /gui/guistate.cpp | 849226a8dfb0a8448cdebdc6c838c5f5706360db | [
"MIT"
] | permissive | ousttrue/Skeletal | 92c54b3f75060e188a3707040e5f7fddee7e0803 | bfbed4ec87e06787d3c004050d65954d53d0abbd | refs/heads/master | 2023-06-11T06:55:07.037894 | 2019-07-21T15:20:52 | 2019-07-21T15:20:52 | 193,386,381 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 7,920 | cpp | guistate.cpp | #include "guistate.h"
#include <scene.h>
#include <dx11.h>
#include <imgui.h>
// #include <imgui_widgets.cpp>
#include <memory>
#include <Windows.h>
static std::wstring OpenDialog()
{
OPENFILENAME ofn; // common dialog box structure
TCHAR szFile[260] = {0}; // if using TCHAR macros
// Initialize OPENFILENAME
ZeroMemory(&ofn, sizeof(ofn));
ofn.lStructSize = sizeof(ofn);
ofn.hwndOwner = NULL;
ofn.lpstrFile = szFile;
ofn.nMaxFile = sizeof(szFile);
ofn.lpstrFilter = L"All\0*.*\0Text\0*.TXT\0";
ofn.nFilterIndex = 1;
ofn.lpstrFileTitle = NULL;
ofn.nMaxFileTitle = 0;
ofn.lpstrInitialDir = NULL;
ofn.Flags = OFN_PATHMUSTEXIST | OFN_FILEMUSTEXIST;
if (!GetOpenFileName(&ofn) == TRUE)
{
// use ofn.lpstrFile
return L"";
}
return szFile;
}
struct NodeTreeDrawer
{
// int selection_mask = (1 << 2); // Dumb representation of what may be user-side selection state. You may carry selection state inside or outside your objects in whatever format you see fit.
std::shared_ptr<skeletal::scene::Node> m_clicked;
void DrawRecursive(const skeletal::scene::Scene *pScene, const std::shared_ptr<skeletal::scene::Node> &node)
{
// Disable the default open on single-click behavior and pass in Selected flag according to our selection state.
ImGuiTreeNodeFlags node_flags = ImGuiTreeNodeFlags_OpenOnArrow | ImGuiTreeNodeFlags_OpenOnDoubleClick;
if (pScene->IsSelected(node->GetID()))
{
node_flags |= ImGuiTreeNodeFlags_Selected;
}
auto hasChild = node->GetChildCount();
if (!hasChild)
{
node_flags |= ImGuiTreeNodeFlags_Leaf | ImGuiTreeNodeFlags_NoTreePushOnOpen; // ImGuiTreeNodeFlags_Bullet
}
bool isOpen = ImGui::TreeNodeEx((void *)(int64_t)node->GetID(),
node_flags, "%s", node->GetName().c_str());
if (ImGui::IsItemClicked())
{
m_clicked = node;
}
if (hasChild && isOpen)
{
for (auto &child : *node)
{
DrawRecursive(pScene, child);
}
ImGui::TreePop();
}
}
void
Draw(skeletal::scene::Scene *pScene, const std::shared_ptr<skeletal::scene::Node> &node)
{
// clear
m_clicked = nullptr;
// indent
ImGui::PushStyleVar(ImGuiStyleVar_IndentSpacing, ImGui::GetFontSize());
DrawRecursive(pScene, node);
ImGui::PopStyleVar();
if (m_clicked)
{
// update selection
if (!ImGui::GetIO().KeyCtrl)
{
pScene->ClearSelection();
}
pScene->Select(m_clicked);
}
}
};
static NodeTreeDrawer m_tree;
void GuiState::Update(skeletal::scene::Scene *scene, skeletal::dx11::ResourceManager *resourceManager)
{
////////////////////////////////////////////////////////////
ImGui::ShowDemoWindow();
if(ImGui::Begin("scene", &modelOpen, ImGuiWindowFlags_MenuBar))
{
if (ImGui::BeginMenuBar())
{
if (ImGui::BeginMenu("File"))
{
if (ImGui::MenuItem("Open"))
{
auto path = OpenDialog();
if (!path.empty())
{
scene->Load(path);
}
}
ImGui::EndMenu();
}
ImGui::EndMenuBar();
}
ImGui::Text("time: %0.3f", scene->GetTime());
ImGui::Text("fps: %d", scene->GetFps());
auto model = scene->GetModel();
if (model)
{
m_tree.Draw(scene, model->Root);
}
}
ImGui::End();
if(ImGui::Begin("assets", &assetsOpen, ImGuiWindowFlags_MenuBar))
{
auto model = scene->GetModel();
if (model)
{
//ImGui::Text("generator: %s", m_gltf->asset.generator.c_str());
//ImGui::SetNextTreeNodeOpen(true, ImGuiSetCond_Once);
if (ImGui::TreeNode("textures"))
{
auto &textures = model->Textures;
for (int i = 0; i < textures.size(); ++i)
{
auto &texture = textures[i];
ImGui::PushID(texture->GetID());
bool isOpen = ImGui::TreeNode("%s", texture->GetName().c_str());
if (isOpen)
{
// draw image
ImGui::Image(resourceManager->GetTexture(texture->GetID()), ImVec2(100, 100));
ImGui::TreePop();
}
ImGui::PopID();
}
ImGui::TreePop();
}
if (ImGui::TreeNode("materials"))
{
auto &materials = model->Materials;
for (int i = 0; i < materials.size(); ++i)
{
auto &material = materials[i];
ImGui::PushID(material->GetID());
bool isOpen = ImGui::TreeNode("%s", material->GetName().c_str());
if (isOpen)
{
ImGui::TreePop();
}
ImGui::PopID();
}
ImGui::TreePop();
}
if (ImGui::TreeNode("meshes"))
{
auto &meshes = model->Meshes;
for (int i = 0; i < meshes.size(); ++i)
{
auto &mesh = meshes[i];
ImGui::PushID(mesh->GetID());
bool isOpen = ImGui::TreeNode("%s", mesh->GetName().c_str());
if (isOpen)
{
ImGui::TreePop();
}
ImGui::PopID();
}
ImGui::TreePop();
}
if (ImGui::TreeNode("nodes"))
{
ImGui::Columns(2);
for (int i = 0; i < model->Nodes.size(); ++i)
{
auto &node = model->Nodes[i];
ImGui::PushID(node->GetID());
bool isOpen = ImGui::TreeNode("%s", node->GetName().c_str());
ImGui::NextColumn();
if (isOpen)
{
ImGui::Text("%03d", i);
ImGui::TreePop();
}
ImGui::PopID();
ImGui::NextColumn();
}
ImGui::Columns(1);
ImGui::TreePop();
}
}
}
ImGui::End();
if(ImGui::Begin("logger", &loggerOpen, ImGuiWindowFlags_MenuBar))
{
ImGui::BeginChild("scrolling");
ImGui::PushStyleVar(ImGuiStyleVar_ItemSpacing, ImVec2(0, 1));
//if (copy) ImGui::LogToClipboard();
/*
if (Filter.IsActive())
{
const char* buf_begin = Buf.begin();
const char* line = buf_begin;
for (int line_no = 0; line != NULL; line_no++)
{
const char* line_end = (line_no < LineOffsets.Size) ? buf_begin + LineOffsets[line_no] : NULL;
if (Filter.PassFilter(line, line_end))
ImGui::TextUnformatted(line, line_end);
line = line_end && line_end[1] ? line_end + 1 : NULL;
}
}
else
*/
{
ImGui::TextUnformatted(logger.c_str());
}
ImGui::SetScrollHere(1.0f);
ImGui::PopStyleVar();
ImGui::EndChild();
}
ImGui::End();
}
|
afc505440100ac3cd7f6618d24371970123f0a6a | 25ee624bc6995383b24adf010b638674a15db72e | /libraries/SD/sd_log.h | 6707289fa84cfd6bc31c9f216e10043a3ca19c14 | [] | no_license | kicksat/KickSatBoards-ArduinoIDE | c81bd0b6131addf6aee5730fa19136a520d9bd7d | 887e22948fcd8e4d947df8967b9af2f826d09ec5 | refs/heads/master | 2020-03-25T16:39:12.033513 | 2018-10-04T23:23:53 | 2018-10-04T23:23:53 | 143,940,753 | 4 | 3 | null | null | null | null | UTF-8 | C++ | false | false | 1,928 | h | sd_log.h | // sd_log.h - Library for reading from and writing to the log on the SD card
#ifndef SD_LOG_h
#define SD_LOG_h
#include "Arduino.h"
#include "SD_DataFile.h"
#define CS SPI_CS_SD
#define ENTRY_LEN 126
#define LOG_NUM_INDEX 3
#define STATUS_BYTE_INDEX 8
#define I_BATT_INDEX 12
#define V_BATT_INDEX 16
#define I_SOLAR_INDEX 20
#define DT_INDEX 25
#define LAT_INDEX 33
#define LON_INDEX 41
#define ALT_INDEX 49
#define GYR_X_INDEX 58
#define GYR_Y_INDEX 63
#define GYR_Z_INDEX 68
#define ACC_X_INDEX 78
#define ACC_Y_INDEX 83
#define ACC_Z_INDEX 88
#define CMP_X_INDEX 98
#define CMP_Y_INDEX 103
#define CMP_Z_INDEX 108
#define COM_INDEX 117
#define FLOAT_LEN 4
#define INT_LEN 2
#define COM_LEN 8
#define BYTE_LEN 1
#define NUM_DEC_IN_FLOAT 6
#define LOG_NAME "TEST5.txt"
class sd_log{
public:
struct Log_Data{
int log_num;
byte status_byte;
byte power_data[3];
float GPS_data[4];
float IMU_data[9];
byte command_data[8];
}logData;
sd_log();
bool sd_init();
bool sd_refresh();
bool sd_end();
bool write_log(Log_Data data); //takes all data and logs it
String read_entry(int entryIndex); //reads a specific entry indexed from current entry
bool data_dump(int startEntry, int numEntries, String buf[]); //reads the last numEntries logs and outputs in string array
String read_GPS(int entryIndex);
String read_IMU(int entryIndex);
String read_header(int entryIndex, byte bytes[]);
void zero_logData();
//member variables
SD_DataFile dataLog = SD_DataFile(ENTRY_LEN, LOG_NAME);
private:
String encode_int(int value);
String encode_float(float value);
void add_String_Entry(String input, int entry_num, byte array1[]);
float decode_float(byte* data);
int decode_int(byte* data);
String log_to_String();
float read_float(byte buf[], int index);
int read_int(byte buf[], int index);
};
#endif
|
c51853bbe8a5395022e910760a5d04cf0100928e | 8b431a95400331a8c3201a05514df024d6b4cc7b | /src/iesidcm_cipher.hpp | c21ed7bd139d9abb5333e2822e664286348c9398 | [
"MIT"
] | permissive | botezatumihaicatalin/ChaoticImageCrypto | d45a056809c87518e5097f5fb7ac1fbedc3e7c54 | b8f41b159b21a618cec794584ca67a604bdf98ec | refs/heads/master | 2021-01-18T18:01:09.300622 | 2017-06-12T18:28:42 | 2017-06-12T18:28:42 | 86,836,397 | 2 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 7,599 | hpp | iesidcm_cipher.hpp | #pragma once
#include <stdint.h>
#include <stdexcept>
#include "image_cipher_base.hpp"
#include "generator3.hpp"
#include "generator1.hpp"
#include "cat_generator3.hpp"
#include "skew_tent_generator1.hpp"
#include "ruleT_generator3.hpp"
template <size_t spectrum>
class iesidcm_cipher: public image_cipher_base<spectrum> {
private:
static uint32_t discretize_(const double& value);
static uint32_t* permutation_(uint32_t size, generator3* mapper);
static uint32_t* inversate_(uint32_t* permutation, uint32_t size);
protected:
static uint8_t* shuffle_(uint8_t* pixels, uint32_t size, generator3* mapper);
static uint8_t* unshuffle_(uint8_t* pixels, uint32_t size, generator3* mapper);
static uint8_t* substitute_(uint8_t* pixels, uint32_t size, generator3* mapper, uint32_t block_size);
static uint8_t* unsubstitute_(uint8_t* pixels, uint32_t size, generator3* mapper, uint32_t block_size);
public:
uint8_t* encrypt(uint8_t* pixels, uint32_t size) const override;
uint8_t* decrypt(uint8_t* pixels, uint32_t size) const override;
};
template <size_t spectrum>
inline uint32_t iesidcm_cipher<spectrum>::discretize_(const double& value) {
static double TEN_TO_FIFTEEN = std::pow(10.0, 15);
return std::abs(std::floor(TEN_TO_FIFTEEN * value));
}
template <size_t spectrum>
inline uint32_t* iesidcm_cipher<spectrum>::permutation_(uint32_t size, generator3* mapper) {
uint32_t* perm = new uint32_t[size];
bool* has = new bool[size];
memset(has, false, size * sizeof(bool));
uint32_t max = size, i = 0;
dvec3 p = mapper->current();
uint32_t aux_x = 0, aux_y = 0, aux_z = 0;
bool found = false;
while (i < size) {
found = false;
aux_x = discretize_(p.x) % size;
aux_y = discretize_(p.y) % size;
aux_z = discretize_(p.z) % size;
if (!has[aux_x]) {
perm[i++] = aux_x, has[aux_x] = true;
found = true;
}
if (!has[aux_y]) {
perm[i++] = aux_y, has[aux_y] = true;
found = true;
}
if (!has[aux_z]) {
perm[i++] = aux_z, has[aux_z] = true;
found = true;
}
if (!found) {
uint32_t j = max - 1;
for (; j > 0 && has[j]; j--);
max = j;
perm[i++] = max, has[max] = true;
}
p = mapper->next();
}
return perm;
}
template <size_t spectrum>
inline uint32_t* iesidcm_cipher<spectrum>::inversate_(uint32_t* permutation, uint32_t size) {
uint32_t* inverse = new uint32_t[size];
for (uint32_t i = 0; i < size; i++) {
inverse[permutation[i]] = i;
}
return inverse;
}
template <size_t spectrum>
inline uint8_t* iesidcm_cipher<spectrum>::shuffle_(uint8_t* pixels, uint32_t size, generator3* mapper) {
if (size % spectrum != 0) {
throw std::invalid_argument("Size must be a multiple of spectrum");
}
uint8_t* shuffled = new uint8_t[size];
uint32_t* permutation = permutation_(size, mapper);
for (uint32_t idx = 0; idx < size; idx++) {
shuffled[permutation[idx]] = pixels[idx];
}
delete[] permutation;
return shuffled;
}
template <size_t spectrum>
inline uint8_t* iesidcm_cipher<spectrum>::unshuffle_(uint8_t* pixels, uint32_t size, generator3* mapper) {
if (size % spectrum != 0) {
throw std::invalid_argument("Size must be a multiple of spectrum");
}
uint8_t* unshuffled = new uint8_t[size];
uint32_t* permutation = permutation_(size, mapper);
uint32_t* inversePerm = inversate_(permutation, size);
for (uint32_t idx = 0; idx < size; idx++) {
unshuffled[inversePerm[idx]] = pixels[idx];
}
delete[] permutation, delete[] inversePerm;
return unshuffled;
}
template<size_t spectrum>
inline uint8_t* iesidcm_cipher<spectrum>::substitute_(uint8_t* pixels, uint32_t size, generator3* mapper, uint32_t block_size) {
if (size % spectrum != 0) {
throw std::invalid_argument("Size must be a multiple of spectrum");
}
// Init IV
uint8_t* iv = new uint8_t[block_size];
for (size_t i = 0; i < block_size; i++) {
iv[i] = uint8_t(10 * i + 2);
}
// Init encrypted buffer
uint8_t* encrypted = new uint8_t[size];
// Init algorithm declarations
uint8_t u = 0;
uint8_t* prev_block = &iv[0];
uint8_t* rand_block = new uint8_t[block_size];
for (uint32_t b = 0; b < size; b += block_size) {
uint32_t w = 0;
for (uint32_t p = 0; p < block_size && p + b < size; p++) {
w += prev_block[p];
}
for (uint32_t p = 0; p < block_size && p + b < size; p++) {
const dvec3 point = mapper->next();
u += w + std::floor(256.0 * (point.x + point.y + point.z));
rand_block[p] = u;
}
for (uint32_t p = 0; p < block_size && p + b < size; p++) {
encrypted[b + p] = pixels[b + p] ^ rand_block[p];
}
const uint32_t t = 3 + w % 23;
for (uint32_t j = 0; j < t; j++) { mapper->next(); }
prev_block = encrypted + b;
}
delete[] rand_block, delete[] iv;
return encrypted;
}
template<size_t spectrum>
inline uint8_t* iesidcm_cipher<spectrum>::unsubstitute_(uint8_t* pixels, uint32_t size, generator3* mapper, uint32_t block_size) {
if (size % spectrum != 0) {
throw std::invalid_argument("Size must be a multiple of spectrum");
}
// Init IV
uint8_t* iv = new uint8_t[block_size];
for (size_t i = 0; i < block_size; i++) {
iv[i] = uint8_t(10 * i + 2);
}
// Init decrypted buffer
uint8_t* decrypted = new uint8_t[size];
// Init algorithm declarations
uint8_t u = 0;
uint8_t* prev_block = &iv[0];
uint8_t* rand_block = new uint8_t[block_size];
for (uint32_t b = 0; b < size; b += block_size) {
uint32_t w = 0;
for (uint32_t p = 0; p < block_size && p + b < size; p++) {
w += prev_block[p];
}
for (uint32_t p = 0; p < block_size && p + b < size; p++) {
const dvec3 point = mapper->next();
u += w + std::floor(256.0 * (point.x + point.y + point.z));
rand_block[p] = u;
}
for (uint32_t p = 0; p < block_size && p + b < size; p++) {
decrypted[b + p] = pixels[b + p] ^ rand_block[p];
}
const uint32_t t = 3 + w % 23;
for (uint32_t j = 0; j < t; j++) { mapper->next(); }
prev_block = pixels + b;
}
delete[] rand_block, delete[] iv;
return decrypted;
}
template<size_t spectrum>
inline uint8_t* iesidcm_cipher<spectrum>::encrypt(uint8_t* pixels, uint32_t size) const {
skew_tent_generator1 skew_tent_map1(0.42377183397545126, 0.9211909680024992);
skew_tent_generator1 skew_tent_map2(0.45987045954620664, 0.39736630183773136);
skew_tent_generator1 skew_tent_map3(0.8832720468837092, 0.2091818714907403);
ruleT_generator3 ruleT_map(skew_tent_map1, skew_tent_map2, skew_tent_map3);
cat_generator3 cat_map(0.237218932182183, 0.7213872103872803217, 0.346426821827137912, 2, 2, 2, 1, 1, 1);
uint8_t* shuffled = shuffle_(pixels, size, &cat_map);
uint8_t* substituted = substitute_(shuffled, size, &ruleT_map, 32);
delete[] shuffled;
return substituted;
}
template<size_t spectrum>
inline uint8_t* iesidcm_cipher<spectrum>::decrypt(uint8_t* pixels, uint32_t size) const {
skew_tent_generator1 skew_tent_map1(0.42377183397545126, 0.9211909680024992);
skew_tent_generator1 skew_tent_map2(0.45987045954620664, 0.39736630183773136);
skew_tent_generator1 skew_tent_map3(0.8832720468837092, 0.2091818714907403);
ruleT_generator3 ruleT_map(skew_tent_map1, skew_tent_map2, skew_tent_map3);
cat_generator3 cat_map(0.237218932182183, 0.7213872103872803217, 0.346426821827137912, 2, 2, 2, 1, 1, 1);
uint8_t* unsubstituted = unsubstitute_(pixels, size, &ruleT_map, 32);
uint8_t* unshuffled = unshuffle_(unsubstituted, size, &cat_map);
delete[] unsubstituted;
return unshuffled;
}
|
f19498945f6bcd85eef5ff836b57ab2d6ce214ab | 2c7e7764ba353498520ebfd04e12892bea8d587b | /231A.cpp | 59bc776fab227d0db46185858d8c05662f290ee3 | [] | no_license | IJmouri/codeforces | 240bab4c8bcb86a0f238e91e5fd2a1db68df08b0 | a617198ae1607db6df52a02d6e0a2c44c3548526 | refs/heads/master | 2022-11-19T23:43:31.247541 | 2020-07-06T20:42:14 | 2020-07-06T20:42:14 | 277,644,652 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 374 | cpp | 231A.cpp | #include<bits/stdc++.h>
using namespace std;
int main()
{
int n,i,co=0,a,b,c,t=0;
cin>>n;
for(i=1;i<=n;i++)
{
cin>>a>>b>>c;
if(a==1)
co++;
if(b==1)
co++;
if(c==1)
co++;
if(co==2||co==3)
{
t++;
co=0;
}
co=0;
}
cout<<t<<endl;
}
|
6efe6621779b4affe92048a8dc922a939080cf3c | 1c540a07fe2f068a31cb8d23a9db0ea4364539be | /DS/stack.cpp | 0b19537cf8c5e54ddf01319687a542d93c9cf8e6 | [] | no_license | guneet96/Data-Structures | 56e70693d07c7c208aa5108601e8edae3d70894e | b6eb32201fbc009b47943d46665b82816830ef9c | refs/heads/master | 2020-05-24T18:03:26.197090 | 2017-04-03T21:41:28 | 2017-04-03T21:41:28 | 84,867,192 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 1,761 | cpp | stack.cpp | // Linked implementation of stack.
#include<stdio.h>
#include<stdlib.h>
struct node
{
int info;
struct node *link;
}*top = NULL;
void push(int item);
int pop();
int peek();
int isEmpty();
void display();
main()
{
int choice, item;
while(1)
{
printf("\n1. Push");
printf("\n2. Pop");
printf("\n3. Display item at the top");
printf("\n4. Display all items at the top");
printf("\n5. Quit\n");
scanf("%d", &choice);
switch(choice)
{
case 1:
printf("\nEnter the item to be pushed.");
scanf("%d", &item);
push(item);
break;
case 2:
item = pop();
if(item!=0)printf("\nPopped item is : %d", item);
break;
case 3:
printf("Item at the top is : %d", peek());
break;
case 4:
display();
case 5:
exit(0);
default:
printf("\nPick a valid choice...");
} // End of swtich
} // End of while loop
} // End of main()
void push(int item)
{
struct node *temp;
temp = (struct node *)malloc(sizeof(struct node));
if(temp == NULL)
{
printf("\nOverflow error, system ran out of memory.");
return;
}
temp->info = item;
temp->link = top;
top = temp;
return;
}
int pop()
{
struct node *temp;
int item;
if(top == NULL)
{
printf("\nUnderflow error.");
return 0;
}
temp = top;
top = top->link;
item = temp->info;
free(temp);
free(temp);
return item;
}
int peek()
{
if(isEmpty())
{
printf("\nStack is empty.");
return 0;
}
return top->info;
}
int isEmpty()
{
if(top->link == NULL)
return 1;
return 0;
}
void display()
{
struct node *p;
p = top;
if(isEmpty())
{
printf("\nStack is empty.");
return;
}
printf("\nStack elements => \n");
while(p->link!=NULL)
{
printf("%d\n", p->info);
p = p->link;
}
printf("NULL\n");
}
|
409eb84efe5e24c41b0be0d4447fb9c21da9b718 | c0f0941e3d6f62dbe6932da3d428ae2afed53b43 | /simulation/g4simulation/g4eval/TrackSeedTrackMapConverter.cc | 214c91ac7983d352427c907ceadd4caddd8763b6 | [] | 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 | 10,937 | cc | TrackSeedTrackMapConverter.cc |
#include "TrackSeedTrackMapConverter.h"
#include <trackbase/ActsGeometry.h>
#include <trackbase/TrkrCluster.h>
#include <trackbase/TrkrClusterContainer.h>
#include <trackbase_historic/SvtxTrackMap_v1.h>
#include <trackbase_historic/SvtxTrack_v4.h>
#include <trackbase_historic/TrackSeed.h>
#include <trackbase_historic/TrackSeedContainer.h>
#include <fun4all/Fun4AllReturnCodes.h>
#include <phool/PHCompositeNode.h>
#include <phool/PHIODataNode.h>
#include <phool/PHNode.h> // for PHNode
#include <phool/PHNodeIterator.h>
#include <phool/PHObject.h> // for PHObject
#include <phool/getClass.h>
#include <phool/phool.h>
//____________________________________________________________________________..
TrackSeedTrackMapConverter::TrackSeedTrackMapConverter(const std::string& name)
: SubsysReco(name)
{
}
//____________________________________________________________________________..
TrackSeedTrackMapConverter::~TrackSeedTrackMapConverter() = default;
//____________________________________________________________________________..
int TrackSeedTrackMapConverter::InitRun(PHCompositeNode* topNode)
{
int ret = getNodes(topNode);
return ret;
}
//____________________________________________________________________________..
int TrackSeedTrackMapConverter::process_event(PHCompositeNode* /*unused*/)
{
if (Verbosity() > 1)
{
std::cout << "silicon seed map size " << m_siContainer->size() << std::endl;
for (auto iter = m_siContainer->begin(); iter != m_siContainer->end();
++iter)
{
auto seed = *iter;
if (!seed)
{
std::cout << "no seed at index " << m_siContainer->index(iter)
<< std::endl;
continue;
}
seed->identify();
}
if (m_tpcContainer)
{
std::cout << "tpc seed map size " << m_tpcContainer->size() << std::endl;
for (auto iter = m_tpcContainer->begin(); iter != m_tpcContainer->end();
++iter)
{
auto seed = *iter;
if (!seed)
{
std::cout << "no tpc seed at entry " << m_tpcContainer->index(iter)
<< std::endl;
continue;
}
seed->identify();
}
}
}
unsigned int trackid = 0;
for (const auto& trackSeed : *m_seedContainer)
{
/// If the seed was removed, skip it
if (!trackSeed)
{
continue;
}
if (m_trackSeedName.find("SvtxTrackSeed") != std::string::npos)
{
/// Catches entries in the vector removed by ghost finder
unsigned int tpcindex = trackSeed->get_tpc_seed_index();
TrackSeed* seed = m_tpcContainer->get(tpcindex);
if (!seed)
{
continue;
}
}
auto svtxtrack = std::make_unique<SvtxTrack_v4>();
if (Verbosity() > 0)
{
std::cout << "iterating track seed " << trackid << std::endl;
}
svtxtrack->set_id(trackid);
trackid++;
/// If we've run the track matching
if (m_trackSeedName.find("SvtxTrackSeed") != std::string::npos)
{
if (Verbosity() > 0)
{
std::cout << "tpc seed id " << trackSeed->get_tpc_seed_index() << std::endl;
std::cout << "si seed id " << trackSeed->get_silicon_seed_index() << std::endl;
}
unsigned int seedindex = trackSeed->get_tpc_seed_index();
TrackSeed* tpcseed = m_tpcContainer->get(seedindex);
if (trackSeed->get_silicon_seed_index() == std::numeric_limits<unsigned int>::max())
{
/// Didn't find a match, so just use the tpc seed
svtxtrack->set_x(tpcseed->get_x());
svtxtrack->set_y(tpcseed->get_y());
svtxtrack->set_z(tpcseed->get_z());
}
else
{
TrackSeed* siseed = m_siContainer->get(trackSeed->get_silicon_seed_index());
svtxtrack->set_x(siseed->get_x());
svtxtrack->set_y(siseed->get_y());
svtxtrack->set_z(siseed->get_z());
addKeys(svtxtrack, siseed);
svtxtrack->set_silicon_seed(siseed);
}
svtxtrack->set_charge(tpcseed->get_qOverR() > 0 ? 1 : -1);
svtxtrack->set_px(tpcseed->get_px(m_clusters, m_tGeometry));
svtxtrack->set_py(tpcseed->get_py(m_clusters, m_tGeometry));
svtxtrack->set_pz(tpcseed->get_pz());
addKeys(svtxtrack, tpcseed);
svtxtrack->set_tpc_seed(tpcseed);
}
else
{
/// Otherwise we are using an individual subdetectors container
svtxtrack->set_x(trackSeed->get_x());
svtxtrack->set_y(trackSeed->get_y());
svtxtrack->set_z(trackSeed->get_z());
svtxtrack->set_charge(trackSeed->get_qOverR() > 0 ? 1 : -1);
svtxtrack->set_px(trackSeed->get_px(m_clusters, m_tGeometry));
svtxtrack->set_py(trackSeed->get_py(m_clusters, m_tGeometry));
svtxtrack->set_pz(trackSeed->get_pz());
// calculate chisq and ndf
double R = 1. / std::fabs(trackSeed->get_qOverR());
double X0 = trackSeed->get_X0();
double Y0 = trackSeed->get_Y0();
double Z0 = trackSeed->get_Z0();
double slope = trackSeed->get_slope();
std::vector<double> xy_error2;
std::vector<double> rz_error2;
std::vector<double> xy_residuals;
std::vector<double> rz_residuals;
std::vector<double> x_circle;
std::vector<double> y_circle;
std::vector<double> z_line;
for (auto c_iter = trackSeed->begin_cluster_keys();
c_iter != trackSeed->end_cluster_keys();
++c_iter)
{
TrkrCluster* c = m_clusters->findCluster(*c_iter);
Acts::Vector3 pos = m_tGeometry->getGlobalPosition(*c_iter, c);
double x = pos(0);
double y = pos(1);
double z = pos(2);
double r = sqrt(x * x + y * y);
double dx = x - X0;
double dy = y - Y0;
double xy_centerdist = sqrt(dx * dx + dy * dy);
// method lifted from ALICEKF::GetCircleClusterResiduals
xy_residuals.push_back(xy_centerdist - R);
// method lifted from ALICEKF::GetLineClusterResiduals
rz_residuals.push_back(fabs(-slope * r + z - Z0) / sqrt(slope * slope + 1));
// ignoring covariance for simplicity
xy_error2.push_back(c->getActsLocalError(0, 0) + c->getActsLocalError(1, 1));
rz_error2.push_back(c->getActsLocalError(2, 2));
double phi = atan2(dy, dx);
x_circle.push_back(R * cos(phi) + X0);
y_circle.push_back(R * sin(phi) + Y0);
z_line.push_back(R * slope + Z0);
}
double chi2 = 0.;
for (unsigned int i = 0; i < xy_residuals.size(); i++)
{
if (std::isnan(xy_error2[i]))
{
xy_error2[i] = 0.01;
}
if (std::isnan(rz_error2[i]))
{
rz_error2[i] = 0.01;
}
// method lifted from GPUTPCTrackParam::Filter
chi2 += xy_residuals[i] * xy_residuals[i] / xy_error2[i] + rz_residuals[i] * rz_residuals[i] / rz_error2[i];
}
svtxtrack->set_chisq(chi2);
// GPUTPCTrackParam initially sets NDF to -3 on first cluster and increments by 2 with every application of filter
svtxtrack->set_ndf(2 * xy_residuals.size() - 5);
addKeys(svtxtrack, trackSeed);
if (m_trackSeedName.find("SiliconTrackSeed") != std::string::npos)
{
svtxtrack->set_silicon_seed(trackSeed);
svtxtrack->set_tpc_seed(nullptr);
}
else if (m_trackSeedName.find("TpcTrackSeed") != std::string::npos)
{
svtxtrack->set_tpc_seed(trackSeed);
svtxtrack->set_silicon_seed(nullptr);
}
}
if (Verbosity() > 0)
{
std::cout << "Inserting svtxtrack into map " << std::endl;
svtxtrack->identify();
}
m_trackMap->insert(svtxtrack.get());
}
return Fun4AllReturnCodes::EVENT_OK;
}
//____________________________________________________________________________..
int TrackSeedTrackMapConverter::End(PHCompositeNode* /*unused*/)
{
return Fun4AllReturnCodes::EVENT_OK;
}
void TrackSeedTrackMapConverter::addKeys(std::unique_ptr<SvtxTrack_v4>& track, TrackSeed* seed)
{
for (TrackSeed::ConstClusterKeyIter iter = seed->begin_cluster_keys();
iter != seed->end_cluster_keys();
++iter)
{
track->insert_cluster_key(*iter);
}
}
int TrackSeedTrackMapConverter::getNodes(PHCompositeNode* topNode)
{
m_trackMap = findNode::getClass<SvtxTrackMap>(topNode, "SvtxTrackMap");
if (!m_trackMap)
{
// create it
PHNodeIterator iter(topNode);
PHCompositeNode* dstNode = static_cast<PHCompositeNode*>(iter.findFirst(
"PHCompositeNode", "DST"));
if (!dstNode)
{
std::cerr << PHWHERE << "DST Node missing, doing nothing." << std::endl;
return Fun4AllReturnCodes::ABORTEVENT;
}
PHNodeIterator iter_dst(dstNode);
// Create the SVTX node
PHCompositeNode* tb_node =
dynamic_cast<PHCompositeNode*>(iter_dst.findFirst("PHCompositeNode",
"SVTX"));
if (!tb_node)
{
tb_node = new PHCompositeNode("SVTX");
dstNode->addNode(tb_node);
if (Verbosity() > 0)
{
std::cout << PHWHERE << "SVTX node added" << std::endl;
}
}
m_trackMap = findNode::getClass<SvtxTrackMap>(topNode, m_trackMapName);
if (!m_trackMap)
{
m_trackMap = new SvtxTrackMap_v1;
PHIODataNode<PHObject>* tracks_node =
new PHIODataNode<PHObject>(m_trackMap, m_trackMapName, "PHObject");
tb_node->addNode(tracks_node);
if (Verbosity() > 0)
{
std::cout << PHWHERE << "Svtx/" << m_trackMapName << " node added" << std::endl;
}
}
}
m_seedContainer = findNode::getClass<TrackSeedContainer>(topNode, m_trackSeedName);
if (!m_seedContainer)
{
std::cout << PHWHERE << " Can't find track seed container " << m_trackSeedName << ", can't continue."
<< std::endl;
return Fun4AllReturnCodes::ABORTEVENT;
}
m_tpcContainer = findNode::getClass<TrackSeedContainer>(topNode, "TpcTrackSeedContainer");
if (!m_tpcContainer)
{
std::cout << PHWHERE << "WARNING, TrackSeedTrackMapConverter may seg fault depending on what seeding algorithm this is run after" << std::endl;
}
m_siContainer = findNode::getClass<TrackSeedContainer>(topNode, "SiliconTrackSeedContainer");
if (!m_siContainer)
{
std::cout << PHWHERE << "WARNING, TrackSeedTrackMapConverter may seg fault depending on what seeding algorithm this is run after" << std::endl;
}
m_clusters = findNode::getClass<TrkrClusterContainer>(topNode, "TRKR_CLUSTER");
if (!m_clusters)
{
std::cout << PHWHERE << " Can't find cluster container, can't continue."
<< std::endl;
return Fun4AllReturnCodes::ABORTEVENT;
}
m_tGeometry = findNode::getClass<ActsGeometry>(topNode, "ActsGeometry");
if (!m_tGeometry)
{
std::cout << PHWHERE << " Can't find ActsGeometry, can't continue."
<< std::endl;
return Fun4AllReturnCodes::ABORTEVENT;
}
return Fun4AllReturnCodes::EVENT_OK;
}
|
e06ecd44ec5bf53f87e7cf1486a187866a867b25 | 6cd1bf6544347c85cabaf672a5ed2dad94a18b63 | /ABC/ABC212/abc204_d.cpp | 2f4d122e7f5ca7fd5811f73f1df2da5f97fff91e | [] | no_license | Shell-Wataru/AtCoder | 0a35f12478ac0ab54711171f653ce7bed5189c92 | 0ba32250f4e4a44459a4cd231ff47a5f46c4fe87 | refs/heads/master | 2023-01-10T04:21:25.199532 | 2023-01-09T04:16:30 | 2023-01-09T04:16:30 | 89,144,933 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 1,014 | cpp | abc204_d.cpp | #define _USE_MATH_DEFINES
#include <iostream>
#include <algorithm>
#include <vector>
#include <deque>
#include <queue>
#include <set>
#include <map>
#include <limits>
#include <cmath>
#include <iomanip>
#include <functional>
#include <random>
#include <boost/multiprecision/cpp_int.hpp>
using namespace std;
using ll = long long;
namespace mp = boost::multiprecision;
int main()
{
ll N;
cin >> N;
vector<ll> T(N);
vector<bool> currentDP(100001,false);
vector<bool> nextDP(100001,false);
ll total = 0;
for(int i = 0;i < N;i++){
cin >> T[i];
total += T[i];
}
currentDP[0] = true;
for(int i = 0;i < N;i++){
nextDP = currentDP;
for(int j = 0; j + T[i]< 100001;j++){
if(currentDP[j]){
nextDP[j+T[i]] = true;
}
}
swap(currentDP,nextDP);
}
ll ans = numeric_limits<ll>::max();
for(ll i = 0; i < 100001;i++){
if (currentDP[i]){
ans = min(ans,max(i,total-i));
}
}
cout << ans << endl;
return 0;
} |
04b9b25c365ba292a17cc770e3a3e284dbc0f6b0 | d31e7dda63e8231fed64a73f0730d5d55227e752 | /arduino_test/arduino_test.ino | 18110031bc57935e92b5bdf639afebff5c82c8a1 | [] | no_license | cedced19/challenge-imagine-and-make | 2f960c57bce494f17c2fe317145711f9a8d77818 | 13a984833c0e481dd38f456fdeb69880c44b82d6 | refs/heads/master | 2023-08-10T18:48:37.335975 | 2021-10-06T09:42:50 | 2021-10-06T09:42:50 | 413,823,785 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 469 | ino | arduino_test.ino |
int rPot;
int bPot;
void setup()
{
Serial.begin(9600); //com speed. bits per second
pinMode(9, OUTPUT);
pinMode(2, INPUT_PULLUP); //add pullup resistor
}
void loop(){
rPot = analogRead(0);
bPot = analogRead(1);
Serial.print("R = ");
Serial.print(rPot);
Serial.print(" B = ");
Serial.println(bPot);
if( !digitalRead(2) || rPot<315 || rPot>715 || bPot<315 || bPot>715) {
digitalWrite(9, HIGH);
} else {
digitalWrite(9, LOW);
}
delay(200);
} |
a7e4c6f29892c9996eadc6118d7cf12a927dcfba | ec7e0d0febe5546125e5c8f17f57196d680b9c58 | /applications/nbody/hardware/nbody_memcpy_vhls/nbody_tb.cpp | 002deb181456fd41663a2115b8d56e654df55c39 | [] | no_license | Hosseinabady/ZynqDynamicEnergyManagemen | c8031d2c3e4593293ccc8efff9ff34d9c3806163 | fadbfd09aaeaf5d16f12f69724e61cbdbbe4bf99 | refs/heads/master | 2021-01-19T16:34:56.404707 | 2017-04-22T00:34:41 | 2017-04-22T00:34:41 | 88,272,742 | 5 | 2 | null | null | null | null | UTF-8 | C++ | false | false | 5,095 | cpp | nbody_tb.cpp | #include <math.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include "nbody.h"
void runReference(const float *initialPositions,
const float *initialVelocities,
float *finalPositions);
int main() {
unsigned long dataSize = NUM_BODIES*4*sizeof(float);
float sphereRadius = 128;
float tolerance = 0.001f;
printf("Running reference...\n");
float *h_reference = (float *)malloc(dataSize);
float *h_initialPositions = (float *)malloc(dataSize);
float *h_initialVelocities = (float *)malloc(dataSize);
float *h_positionsIn = (float *)malloc(4*dataSize);
float *h_positionsOut = h_positionsIn + 1*NUM_BODIES*4;//(float *)malloc(dataSize);
float *h_velocitiesIn = h_positionsIn + 2*NUM_BODIES*4;//(float *)malloc(dataSize);
float *h_velocitiesOut = h_positionsIn + 3*NUM_BODIES*4;//(float *)malloc(dataSize);
#define RAND_MAX 0x7FFF
for (int i = 0; i < NUM_BODIES; i++) {
// Generate a random point on the edge of a sphere
float longitude = 2.f * M_PI * (rand() / (float)RAND_MAX);
float latitude = acos((2.f * (rand() / (float)RAND_MAX)) - 1);
h_initialPositions[i*4 + 0] = sphereRadius * sin(latitude) * cos(longitude);
h_initialPositions[i*4 + 1] = sphereRadius * sin(latitude) * sin(longitude);
h_initialPositions[i*4 + 2] = sphereRadius * cos(latitude);
h_initialPositions[i*4 + 3] = 1;
}
memset(h_initialVelocities, 0, dataSize);
memcpy(h_positionsIn, h_initialPositions, dataSize);
memcpy(h_velocitiesIn, h_initialVelocities, dataSize);
runReference(h_initialPositions, h_initialVelocities, h_reference);
for (int itr = 0; itr < ITERATIONS; itr++) {
nbody(h_positionsIn, h_positionsIn, h_positionsIn, h_positionsIn, 0*NUM_BODIES*4, 1*NUM_BODIES*4+0*GROUP_SIZE*4, 2*NUM_BODIES*4, 3*NUM_BODIES*4);
memcpy(h_positionsIn, h_positionsOut, dataSize);
memcpy(h_velocitiesIn, h_velocitiesOut, dataSize);
}
// Verify final positions
unsigned errors = 0;
for (int i = 0; i < NUM_BODIES; i++) {
float ix = h_positionsIn[i*4 + 0];
float iy = h_positionsIn[i*4 + 1];
float iz = h_positionsIn[i*4 + 2];
float rx = h_reference[i*4 + 0];
float ry = h_reference[i*4 + 1];
float rz = h_reference[i*4 + 2];
float dx = (rx-ix);
float dy = (ry-iy);
float dz = (rz-iz);
float dist = sqrt(dx*dx + dy*dy + dz*dz);
if (dist > tolerance || isnan(dist))
{
if (!errors)
{
printf("Verification failed:\n");
}
// Only show the first 8 errors
if (errors++ < 8)
{
printf("-> Position error at %d: %.8f x1 = %.8f x2=%.8f\n", i, dist, rx, ix);
}
}
}
if (errors)
{
printf("Total errors: %d\n", errors);
}
else
{
printf("Verification passed.\n");
}
printf("\n");
return errors;
}
void runReference(const float *initialPositions,
const float *initialVelocities,
float *finalPositions)
{
size_t dataSize = NUM_BODIES*4*sizeof(float);
float *positionsIn = (float *)malloc(dataSize);
float *positionsOut = (float *)malloc(dataSize);
float *velocities = (float *)malloc(dataSize);
memcpy(positionsIn, initialPositions, dataSize);
memcpy(velocities, initialVelocities, dataSize);
for (int itr = 0; itr < ITERATIONS; itr++) {
for (int i = 0; i < NUM_BODIES; i++) {
float ix = positionsIn[i*4 + 0];
float iy = positionsIn[i*4 + 1];
float iz = positionsIn[i*4 + 2];
float iw = positionsIn[i*4 + 3];
float fx = 0.f;
float fy = 0.f;
float fz = 0.f;
for (int j = 0; j < NUM_BODIES; j++) {
float jx = positionsIn[j*4 + 0];
float jy = positionsIn[j*4 + 1];
float jz = positionsIn[j*4 + 2];
float jw = positionsIn[j*4 + 3];
// Compute distance between bodies
float dx = (jx-ix);
float dy = (jy-iy);
float dz = (jz-iz);
float dist = sqrt(dx*dx + dy*dy + dz*dz + SOFTENING*SOFTENING);
// Compute interaction force
float coeff = jw / (dist*dist*dist);
fx += coeff * dx;
fy += coeff * dy;
fz += coeff * dz;
}
// Update velocity
float vx = velocities[i*4 + 0] + fx * DELTA;
float vy = velocities[i*4 + 1] + fy * DELTA;
float vz = velocities[i*4 + 2] + fz * DELTA;
velocities[i*4 + 0] = vx;
velocities[i*4 + 1] = vy;
velocities[i*4 + 2] = vz;
// Update position
positionsOut[i*4 + 0] = ix + vx * DELTA;
positionsOut[i*4 + 1] = iy + vy * DELTA;
positionsOut[i*4 + 2] = iz + vz * DELTA;
positionsOut[i*4 + 3] = iw;
}
// Swap buffers
float *temp = positionsIn;
positionsIn = positionsOut;
positionsOut = temp;
}
memcpy(finalPositions, positionsIn, dataSize);
free(positionsIn);
free(positionsOut);
free(velocities);
}
|
32aaea16d43d42abd997b665e73c5f2eb0b60c6a | 787e4f4c385204d502d2bcb13cfb1eaa16fa567b | /rpc/RPC 4/D.cpp | a79caa238219fde6b2df8ec50161ba5723ecb76d | [] | no_license | Hecodes98/Competitive_Programming | 29df23dd9b9e2aa0a7af63c1395ab8b3e41c6024 | cada3d5d87684a5ecf6e57366121507596189648 | refs/heads/master | 2022-12-11T20:08:38.990572 | 2020-09-09T22:12:26 | 2020-09-09T22:12:26 | 259,469,943 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 1,582 | cpp | D.cpp | #include <bits/stdc++.h>
using namespace std;
#define ll long long
#define ull unsigned long long
#define REPL(i,a,b) for(int i=a;i<b;++i)
#define REPLE(i,a,b) for(int i=a;i<=b;++i)
#define DEBUG(x) cerr << #x << " = " << (x) << endl;
#define f first
#define s second
#define ALL(v) v.begin(), v.end()
typedef vector<int> vi;
typedef vector<ll> vll;
typedef pair<int,int> pi;
const int MOD=1e9+7;
const int inf=1<<30;
const ll INF=1e18;
const int d4x[4]={-1,0,1,0}, d4y[4]={0,1,0,-1};
const int d8x[8]={-1,-1,0,1,1,1,0,-1}, d8y[8]={0,1,1,1,0,-1,-1,-1};
int gcd(int a, int b){return a==0 ? b : gcd(b%a, a);}
void solve(){
int w,r1,r2,r3;
cin>>w>>r1>>r2>>r3;
int n;cin>>n;
int ans = 0;
while(n--){
double x,y;cin>>x>>y;
double dist = x*x + y*y;
if(dist<(double)r1*(double)r1){
ans+=50;
}else if(dist>(double)r3*(double)r3){
ans+=0;
}else{
int cuadr;
if(x>0&&y>0)cuadr=1;
else if(x<0&&y>0)cuadr=2;
else if(x<0&&y<0)cuadr=3;
else cuadr = 4;
double ang = atan(y/x)*180.0/3.1415926;
if(cuadr==2||cuadr==3)ang+=180.0;
else if(cuadr == 4)ang+=360.0;
double ba = 360.0/(double)w;
int k = (int)(ang/ba)+1;
if(dist>(double)r1*(double)r1 && dist<(double)r2*(double)r2){
ans+=k*2;
}else if(dist>(double)r2*(double)r2&&dist<(double)r3*(double)r3){
ans+=k;
}
}
}
cout << ans << '\n';
}
int main(){
ios::sync_with_stdio(0);cin.tie(0);
#ifndef ONLINE_JUDGE
//freopen("input.txt", "r", stdin);
//freopen("output.txt", "w", stdout);
#endif
int t;cin>>t;
for(int i = 1 ; i <= t ; ++i){
solve();
}
}
|
085773b5405610b09c8a4b7d5669c7c3e48f798e | 06ccf385c23228f7c62614c914185670b19430a4 | /Document_Processing_neural_network/src/cuda/blas.hpp | fc95f29d491a811aaaae6b5fd7b496398a10e219 | [] | no_license | Deepti-1027/Document_Processing | 40d29e989588cfa04483e0336efca516c8d6fc67 | ad2b6f8dab897a4020360f0578e344fd9bcd622a | refs/heads/master | 2022-06-07T15:43:38.646589 | 2020-05-05T15:38:54 | 2020-05-05T15:38:54 | 261,508,682 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 1,224 | hpp | blas.hpp | #pragma once
#include <storage.hpp>
#include <utils.hpp>
#include<omp.h>
// #include <cuda_runtime.h>
// #include <device_launch_parameters.h>
void operator_add(const Storage *input1, const Storage *input2,
Storage *outputs);
void operator_add(const Storage *input1, float value, Storage *outputs);
void operator_sub(const Storage *input1, const Storage *input2,
Storage *outputs);
void operator_mul(const Storage *input1, const Storage *input2,
Storage *outputs);
void operator_mul(const Storage *input1, float value, Storage *outputs);
void operator_div(const Storage *input1, const Storage *input2,
Storage *outputs);
void operator_log(const Storage *input1, Storage *outputs);
void operator_exp(const Storage *input1, Storage *outputs);
void operator_pow(const Storage *input1, float e, Storage *outputs);
void operator_matmul(const Storage *input1, const Storage *input2,
Storage *outputs, int broadcast = 0);
void operator_transpose(const Storage *input1, Storage *outputs);
void operator_mean(const Storage *input1, int dim, Storage *outputs);
void operator_sum(const Storage *input1, int dim, Storage *outputs); |
34a3307f4cf82629d6e04424602882453463322e | 91ff482968f618098c8faeeca892c6d256ee415c | /cf/672A.cpp | 7c10998de5d41ec2b5be1710af5797baa3f4d188 | [] | no_license | Rajat-Goyal/all-over-again | 5728c8d05afc409f103d78f6fbbd3be1bf382793 | a5e4192762febf1666808c4068c83502ef7485fb | refs/heads/master | 2021-01-20T11:18:17.477916 | 2018-10-03T12:12:44 | 2018-10-03T12:12:44 | 83,948,322 | 0 | 1 | null | 2018-10-03T12:12:46 | 2017-03-05T05:48:38 | C++ | UTF-8 | C++ | false | false | 261 | cpp | 672A.cpp | #include<bits/stdc++.h>
#include<string>
using namespace std;
int main(){
// ios::sync_with_stdio(false);
string x="";
for(int i=1;i<=10000;i++){
x.append(to_string(i));
}
int n;
cin>>n;
cout<<x[n-1]<<endl;
return 0;
}
|
c7d245c92b00ebf6751517fc7bb3c60fb2973868 | 94a1ae89fa4fac16b3d2a6c56ca678d6c8af668a | /include/ircd/util/all.h | b48ec5683cda09ac4bf1e5a4776397244389662f | [
"BSD-3-Clause",
"LicenseRef-scancode-warranty-disclaimer"
] | permissive | matrix-construct/construct | 99d677d0c2254cac2176d80690bbfd02b18a8658 | 0624b69246878da592d3f5c2c3737ad0b5ff6277 | refs/heads/master | 2023-05-28T12:16:23.661446 | 2023-04-28T05:33:46 | 2023-05-01T19:45:37 | 147,328,703 | 356 | 41 | NOASSERTION | 2022-07-22T03:45:21 | 2018-09-04T10:26:23 | C++ | UTF-8 | C++ | false | false | 820 | h | all.h | // The Construct
//
// Copyright (C) The Construct Developers, Authors & Contributors
// Copyright (C) 2016-2020 Jason Volk <jason@zemos.net>
//
// Permission to use, copy, modify, and/or distribute this software for any
// purpose with or without fee is hereby granted, provided that the above
// copyright notice and this permission notice is present in all copies. The
// full license for this software is available in the LICENSE file.
#pragma once
#define HAVE_IRCD_UTIL_ALL_H
namespace ircd {
inline namespace util
{
template<size_t SIZE,
class T>
bool all(const T (&vec)[SIZE]) noexcept;
template<size_t SIZE>
bool all(const bool (&vec)[SIZE]) noexcept;
}}
template<size_t SIZE>
inline bool
ircd::util::all(const bool (&vec)[SIZE])
noexcept
{
return std::all_of(vec, vec + SIZE, identity{});
}
|
7e8f000def1cd428d7635ac78c1a614298a4ae82 | f20e965e19b749e84281cb35baea6787f815f777 | /Hlt/Phys/LoKiTrigger/src/UpgradeVertices.cpp | 6db7739ef7fe156ad059c84e4ed693f944778776 | [] | no_license | marromlam/lhcb-software | f677abc9c6a27aa82a9b68c062eab587e6883906 | f3a80ecab090d9ec1b33e12b987d3d743884dc24 | refs/heads/master | 2020-12-23T15:26:01.606128 | 2016-04-08T15:48:59 | 2016-04-08T15:48:59 | null | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 14,016 | cpp | UpgradeVertices.cpp | // ============================================================================
// Include files
// ============================================================================
// GaudiAlg
// ============================================================================
#include "GaudiAlg/GaudiAlgorithm.h"
// ============================================================================
// HltBase
// ============================================================================
#include "HltBase/HltUtils.h"
// ============================================================================
// LoKi
// ============================================================================
#include "LoKi/TrgToCpp.h"
#include "LoKi/UpgradeVertices.h"
#include "LoKi/Combiner.h"
#include "LoKi/Constants.h"
// ============================================================================
// local
// ============================================================================
#include "LTTools.h"
// ============================================================================
/** @file
* Implementation file for class LoKi::Hlt1::UpgradeVertices
* @date 2012-02-24
* @author Pieter David pieter.david@cern.ch
*/
// ============================================================================
/* constructor from all configuration parameters
* @param output the output selection name
* @param config the tool configuration
*/
// ============================================================================
LoKi::Hlt1::UpgradeVertices::UpgradeVertices
( const std::string& output , // output selection name/key
const LoKi::Hlt1::UpgradeConf& config , // configuration
const bool allow1Fail ,
const std::string& clonedTracksLocation )
: LoKi::AuxFunBase ( std::tie ( output , config , allow1Fail , clonedTracksLocation ) )
, LoKi::Hlt1::UpgradeTracks( output, config )
, m_allow1Fail ( allow1Fail )
, m_clonedTracksLocation ( clonedTracksLocation )
{
if ( m_allow1Fail ) { retrieveFailKey() ; }
}
// ============================================================================
/* constructor from all configuration parameters
* @param output the output selection name
* @param config the tool configuration
*/
// ============================================================================
LoKi::Hlt1::UpgradeVertices::UpgradeVertices
( const std::string& output , // output selection name/key
const LoKi::Hlt1::UpgradeTool& config , // configuration
const bool allow1Fail ,
const std::string& clonedTracksLocation )
: LoKi::AuxFunBase ( std::tie ( output , config , allow1Fail , clonedTracksLocation ) )
, LoKi::Hlt1::UpgradeTracks( output, config )
, m_allow1Fail ( allow1Fail )
, m_clonedTracksLocation ( clonedTracksLocation )
{
if ( m_allow1Fail ) { retrieveFailKey() ; }
}
// ============================================================================
// Retrieve ExtraInfo key for failed tracks
// ============================================================================
void LoKi::Hlt1::UpgradeVertices::retrieveFailKey ()
{
SmartIF<IANNSvc> ann = LoKi::Hlt1::Utils::annSvc( *this ) ;
const std::string infoIDName { "HltUnit/" + alg()->name() };
auto _info = ann->value(Gaudi::StringKey(std::string("InfoID")) , infoIDName ) ;
Assert( bool(_info) , " request for unknown Info ID : " + infoIDName ) ;
m_failKey = _info->second;
}
// ============================================================================
// MANDATORY: virtual destructor
// ============================================================================
LoKi::Hlt1::UpgradeVertices::~UpgradeVertices(){}
// ============================================================================
// MANDATORY: clone method ("virtual constructor")
// ============================================================================
LoKi::Hlt1::UpgradeVertices*
LoKi::Hlt1::UpgradeVertices::clone() const
{ return new LoKi::Hlt1::UpgradeVertices ( *this ) ; }
// ============================================================================
// OPTIONAL: nice printout
// ============================================================================
std::ostream& LoKi::Hlt1::UpgradeVertices::fillStream ( std::ostream& s ) const
{
s << "TC_UPGRADE_VX('" << selName()
<< "'," << config ();
if ( m_allow1Fail ) {
s << ", " << m_failKey;
}
s << ")";
return s ;
}
// ============================================================================
// MANDATORY: the only one essential method
// ============================================================================
LoKi::Hlt1::UpgradeVertices::result_type
LoKi::Hlt1::UpgradeVertices::operator()
( LoKi::Hlt1::UpgradeVertices::argument a ) const
{
result_type output ;
if ( !a.empty() )
{
StatusCode sc = upgradeVertices ( a, output ) ;
if ( sc.isFailure() ) { Error ( "Error from upgrade" , sc, 0 ) ; }
}
// register the selection
return !m_sink ? output : m_sink ( output ) ;
}
// ============================================================================
// The "worker" method - combination of fragments from TrUpgrade and VxUpgrade
// ============================================================================
StatusCode LoKi::Hlt1::UpgradeVertices::upgradeVertices
( const Hlt::Candidate::ConstVector& input ,
Hlt::Candidate::ConstVector& output ) const
{
//
Assert ( !(!upgradeTool()) , "ITracksFromTrack* points to NULL!" ) ;
Assert ( alg() , "GaudiAlgorithm* points to NULL!" ) ;
//
LHCb::Track::Container* otracks = storedTracks ( address () ) ;
//
// loop over input candidates, upgrade one-by-one
for ( Hlt::Candidate::ConstVector::const_iterator iseed = input.begin() ;
input.end() != iseed ; ++iseed )
{
const Hlt::Candidate* candidate = *iseed ;
if ( !candidate )
{ Error ( "Invalid Hlt::Candidate, skip it!") ; continue ; } // CONTINUE
const Hlt::Stage* stage = candidate->currentStage() ;
if ( !stage )
{ Error ( "Invalid Hlt::Stage, skip it!") ; continue ; } // CONTINUE
//
// upgrade single track
if ( !stage->is<LHCb::RecVertex>() )
{ Error ( "No LHCb::RecVertex, skip it!") ; continue ; } // CONTINUE
//
StatusCode sc = _i_upgrade_recvertex_j
( candidate ,
output ,
otracks ) ;
//
if ( sc.isFailure() ) { Warning( "Error from i_uprgade_recvertex_j", sc, 0 ) ; }
//
} // end of the loop over new candidates
//
return StatusCode::SUCCESS ;
}
// ============================================================================
/* upgrade the candidate
* @param itrack input track/seeds
* @param otracks output container of upgraded tracks (cumulative)
* @return status code
*/
// ============================================================================
StatusCode LoKi::Hlt1::UpgradeVertices::_i_upgrade_recvertex_j
( const Hlt::Candidate* input ,
Hlt::Candidate::ConstVector& output ,
LHCb::Track::Container* otracks ) const
{
//
if ( !input ) { return Error ( "Hlt::Candidate* points to NULL") ; }
//
const Hlt::Stage* stage = input->currentStage() ;
if ( !stage || !stage->is<LHCb::RecVertex> () )
{ return Error ( "Invalid Hlt::Stage*" ) ; }
//
const LHCb::RecVertex* inputVertex = stage->get<LHCb::RecVertex> () ;
//
const auto& tracks = inputVertex -> tracks();
if ( 2 != tracks.size() ) { return Error ( " nTrack != 2, skip it! " ) ; }
const LHCb::Track* tr1 = tracks[0] ;
const LHCb::Track* tr2 = tracks[1] ;
if ( !tr1 || !tr2 )
{ return Error ( "LHCb::Track* points to NULL, skip it") ; }
auto tracks1 = LHCb::Track::ConstVector{};
auto tracks2 = LHCb::Track::ConstVector{};
if ( ! m_allow1Fail ) {
// upgrade the first track
StatusCode sc1 = iupgrade ( tr1 , tracks1, otracks ) ;
if ( sc1.isFailure() )
{ return Error ( "Error from upgrade(track1) , skip " , sc1 ) ; }
// upgrade the second track
StatusCode sc2 = iupgrade ( tr2 , tracks2, otracks ) ;
if ( sc2.isFailure() )
{ return Error ( "Error from upgrade(track2) , skip " , sc2 ) ; }
} else {
bool tr1Failed = tr1->hasInfo(m_failKey);
bool tr2Failed = tr2->hasInfo(m_failKey);
bool tr1FailedNow = false;
bool tr2FailedNow = false;
StatusCode sc1 = StatusCode::SUCCESS;
StatusCode sc2 = StatusCode::SUCCESS;
if ( ! tr1Failed ) {
// upgrade the first track
sc1 = iupgrade( tr1 , tracks1, otracks ) ;
tr1FailedNow = ( sc1.isFailure() || tracks1.empty() );
tr1Failed = tr1FailedNow;
}
if ( ! tr2Failed ) {
// upgrade the second track
sc2 = iupgrade ( tr2 , tracks2, otracks ) ;
tr2FailedNow = ( sc2.isFailure() || tracks2.empty() );
tr2Failed = tr2FailedNow;
}
if ( tr1Failed && ( ! tr2Failed ) ) {
// recover track 1
if ( tr1FailedNow ) {
// failed now, need to check the flag
LHCb::Track* newTr = tr1->clone();
storedTracks(m_clonedTracksLocation)->add(newTr);
newTr->addInfo(m_failKey, 1.);
tracks1.push_back(newTr);
} else {
// failed previously, just pass on
tracks1.push_back(tr1);
}
}
if ( tr2Failed && ( ! tr1Failed ) ) {
// recover track 2
if ( tr2FailedNow ) {
// failed now, need to check the flag
LHCb::Track* newTr = tr2->clone();
storedTracks(m_clonedTracksLocation)->add(newTr);
newTr->addInfo(m_failKey, 1.);
tracks2.push_back(newTr);
} else {
// failed previously, just pass on
tracks2.push_back(tr2);
}
}
}
if ( tracks1.empty() || tracks2.empty() ) { return StatusCode::SUCCESS ; }
auto out = std::vector<LHCb::RecVertex*>{};
StatusCode sc = make ( tracks1 , tracks2 , out );
if ( sc.isFailure() )
{ return Error ( "Error from vertex creation, skip", sc, 0 ) ; }
//
// Process output vertices, create a new candidate for vertices (beyond the first ??)
for ( auto iout = out.begin() ; out.end() != iout ; ++iout ) {
const LHCb::RecVertex* vx = *iout ;
if ( !vx ) continue ;
//
Hlt::Candidate* _input = 0;
if ( iout == out.begin() ) {
_input = const_cast<Hlt::Candidate*> ( input ) ;
// *assumed* to be correct for vertices as well...
} else {
//
// start new Candidate:
_input = newCandidate() ;
_input -> addToWorkers ( alg() ) ;
//
// the initiator of new candidate is the stage of the initial candidate:
Hlt::Stage* stage1 = newStage() ;
_input -> addToStages ( stage1 ) ;
//
Hlt::Stage::Lock lock1{ stage1, upgradeTool() } ;
lock1.addToHistory ( input->workers() ) ;
// lock1.addToHistory ( myName() ) ;
stage1 -> set ( stage ) ; // add stage into stage as initiator
}
if ( vx != inputVertex ) {
// Add the new stage to the candidate
Hlt::Stage* newstage = newStage() ;
//
Hlt::Stage::Lock lock { newstage , upgradeTool() } ;
newstage -> set( vx ) ; // add vertex to the stage
_input -> addToStages ( newstage ) ;
}
_input -> addToWorkers ( alg() ) ;
output.push_back ( _input ) ; // OUTPUT++
} // end of the loop over output vertices
return StatusCode::SUCCESS ;
}
// ============================================================================
// make the vertices
// ============================================================================
size_t LoKi::Hlt1::UpgradeVertices::make
( const LHCb::Track::ConstVector& tracks1 ,
const LHCb::Track::ConstVector& tracks2 ,
std::vector<LHCb::RecVertex*>& vertices ) const
{
if ( tracks1.empty() || tracks2.empty() ) { return 0 ; }
const bool same =
( &tracks1 == &tracks2 ) || ( tracks1 == tracks2 ) ;
const size_t n1 = tracks1.size() ;
const size_t n2 = tracks2.size() ;
vertices.reserve ( same ?
vertices.size() + n1*(n1-1)/2 :
vertices.size() + n1*n2 ) ;
typedef LHCb::Track::ConstVector Tracks ;
const Hlt::VertexCreator creator{};
const LoKi::Hlt1::Utils::CmpTrack compare{};
const size_t size = vertices.size() ;
/// create the combiner & fill it with data
auto loop = LoKi::Combiner_<Tracks>{};
loop.add ( { tracks1 } ) ;
loop.add ( { tracks2 } ) ;
// make the combinations
for ( ; loop.valid() ; loop.next() )
{
// get the current combination
Tracks tracks ( 2 ) ;
loop.current ( tracks.begin() ) ;
const LHCb::Track* first = tracks[0] ;
const LHCb::Track* second = tracks[1] ;
// skip invalid
if ( !first || !second ) { continue ; } // CONTINUE
// skip the same
if ( first == second ) { continue ; } // CONTINUE
// reduce the double count :
if ( same && !compare ( first , second ) ) { continue ; } // CONTINUE
// chech the overrlap
if ( HltUtils::matchIDs ( *first , *second ) ) { continue ; } // CONTINUE
// create the vertex
std::unique_ptr<LHCb::RecVertex> vertex{ newRecVertex() };
/// fill it with some information
creator ( *first , *second , *vertex ) ;
// good vertex! add it to the outptu container
vertices.push_back ( vertex.release() ) ;
} // end of loop over all combinations
//
// return number of created vertcies
return vertices.size() - size ; // RETURN
}
// ============================================================================
// The END
// ============================================================================
|
1ff033acc366af9be5a3a537aa823ce7dae6690d | 246843976f5daefec373de980b009294128b7225 | /solution/TopCoder/Incubator.cpp | 88e18a8d3716fcbb8712ac52c50e8e4e0c19cfe0 | [] | no_license | nlbao/competitive-programming | 48cd18f3f7813c63d90ce0927d0ed8a215a435a1 | 918cec44facfc4bd4daf7ba2ce183432e7a352aa | refs/heads/master | 2022-08-21T07:11:31.985603 | 2020-05-18T01:18:41 | 2020-05-18T01:18:41 | 75,738,161 | 3 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 3,416 | cpp | Incubator.cpp | #include <vector>
#include <list>
#include <map>
#include <set>
#include <deque>
#include <stack>
#include <bitset>
#include <algorithm>
#include <functional>
#include <numeric>
#include <sstream>
#include <iostream>
#include <cstdio>
#include <cmath>
#include <cstdlib>
#include <ctime>
#include <queue>
using namespace std;
typedef long long ll;
typedef vector<int> VI;
typedef pair<int, int> PI;
#define foru(i,a,b) for(int i = int(a); i <= int(b); ++i)
#define ford(i,b,a) for(int i = int(b); i >= int(a); --i)
#define rep(i, n) for(int i = 0; i < int(n); ++i)
#define all(a) a.begin(),a.end()
#define size(a) int(a.size())
#define fill(a,x) memset(a, (x), sizeof(a))
#define mp(x,y) make_pair((x), (y))
#define pb(x) push_back((x))
#define fr first
#define sc second
class Incubator {
public:
int maxMagicalGirls(vector <string> love) {
}
// BEGIN CUT HERE
public:
void run_test(int Case) { if ((Case == -1) || (Case == 0)) test_case_0(); if ((Case == -1) || (Case == 1)) test_case_1(); if ((Case == -1) || (Case == 2)) test_case_2(); if ((Case == -1) || (Case == 3)) test_case_3(); if ((Case == -1) || (Case == 4)) test_case_4(); if ((Case == -1) || (Case == 5)) test_case_5(); if ((Case == -1) || (Case == 6)) test_case_6(); }
private:
template <typename T> string print_array(const vector<T> &V) { ostringstream os; os << "{ "; for (typename vector<T>::const_iterator iter = V.begin(); iter != V.end(); ++iter) os << '\"' << *iter << "\","; os << " }"; return os.str(); }
void verify_case(int Case, const int &Expected, const int &Received) { cerr << "Test Case #" << Case << "..."; if (Expected == Received) cerr << "PASSED" << endl; else { cerr << "FAILED" << endl; cerr << "\tExpected: \"" << Expected << '\"' << endl; cerr << "\tReceived: \"" << Received << '\"' << endl; } }
void test_case_0() { string Arr0[] = {"NY","NN"}; vector <string> Arg0(Arr0, Arr0 + (sizeof(Arr0) / sizeof(Arr0[0]))); int Arg1 = 1; verify_case(0, Arg1, maxMagicalGirls(Arg0)); }
void test_case_1() { string Arr0[] = {"NYN", "NNY", "NNN"}; vector <string> Arg0(Arr0, Arr0 + (sizeof(Arr0) / sizeof(Arr0[0]))); int Arg1 = 1; verify_case(1, Arg1, maxMagicalGirls(Arg0)); }
void test_case_2() { string Arr0[] = {"NNYNN","NNYNN","NNNYY","NNNNN","NNNNN"}; vector <string> Arg0(Arr0, Arr0 + (sizeof(Arr0) / sizeof(Arr0[0]))); int Arg1 = 2; verify_case(2, Arg1, maxMagicalGirls(Arg0)); }
void test_case_3() { string Arr0[] = {"NNNNN","NYNNN","NYNYN","YNYNN","NNNNN"}; vector <string> Arg0(Arr0, Arr0 + (sizeof(Arr0) / sizeof(Arr0[0]))); int Arg1 = 2; verify_case(3, Arg1, maxMagicalGirls(Arg0)); }
void test_case_4() { string Arr0[] = {"NNNNN","NNNNN","NNNNN","NNNNN","NNNNN"}; vector <string> Arg0(Arr0, Arr0 + (sizeof(Arr0) / sizeof(Arr0[0]))); int Arg1 = 5; verify_case(4, Arg1, maxMagicalGirls(Arg0)); }
void test_case_5() { string Arr0[] = {"NNYNNNNN","NNNYNNNN","NNNNYNNN","NNYNNNNN","NNNNNYYN","NNNYNNNY","NNNNNNNN","NNNNNNNN"}; vector <string> Arg0(Arr0, Arr0 + (sizeof(Arr0) / sizeof(Arr0[0]))); int Arg1 = 2; verify_case(5, Arg1, maxMagicalGirls(Arg0)); }
void test_case_6() { string Arr0[] = {"Y"}; vector <string> Arg0(Arr0, Arr0 + (sizeof(Arr0) / sizeof(Arr0[0]))); int Arg1 = 0; verify_case(6, Arg1, maxMagicalGirls(Arg0)); }
// END CUT HERE
};
// BEGIN CUT HERE
int main()
{
Incubator ___test;
___test.run_test(-1);
}
// END CUT HERE
|
841166ea233d2ca3a2860b7cdf33069ea2e93251 | cb753c7f0f03201a100f2d279e084a49ef522b23 | /PDI2-finalProject/Viewer.h | fda6d891703adf3ef40b9cec052b2a02edd697fb | [] | no_license | bingluen/CSE-CODE | 866f481de213a75b496d914c35affd1a18be236c | 1aaa8fa2ef3ea9062304ee9fb276b2bbd17e870d | refs/heads/master | 2020-04-09T12:10:24.712421 | 2015-06-28T15:29:34 | 2015-06-28T15:29:34 | null | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 130 | h | Viewer.h | #ifndef VIEWER_H
#define VIEWER_H
#include "database.h"
class Viewer : virtual public ItemMan{
public:
void showList();
};
#endif |
832d65d70fdf87c3d99408b6fcd6bbfb9058ae88 | bc44dcf0ef640668b185ae3d788cc0ec452210b0 | /P5/SDK/P5SDK/Knight/Source/KeyboardControl.h | a5a0f8e5efc9e5f23c7958d6b3dd631e6d2e1789 | [] | no_license | ttrask/staubliserver | 606ad6bcbae9c980d4491bdc6be6b251b29990d7 | 2d69ef2d3026b2ff19c21b8eeb93e9a73a4ce50b | refs/heads/master | 2021-01-23T09:53:06.761894 | 2012-04-17T01:00:24 | 2012-04-17T01:00:24 | 40,439,948 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 2,856 | h | KeyboardControl.h | #ifndef KeyboardControl_H
#define KeyboardControl_H
class KeyboardControl;
class KeyValue
{
public:
KeyValue(KeyboardControl *pKeyCtrl, char *groupName);
~KeyValue();
float GetMinValue() {return minValue;}
float GetMaxValue() {return maxValue;}
float GetValue() {return value;}
float GetRawValue() {return rawValue;}
float *GetValuePtr() {return &value;}
float GetDelta() {return delta;}
float GetScale() {return scale;}
float GetBias() {return bias;}
unsigned int GetKeyIncrease() {return keyIncrease;}
unsigned int GetKeyDecrease() {return keyDecrease;}
char *GetName() {return nameValue;}
void SetValue(float fValue);
void SetRawValue( float fRawValue );
void Increment();
void Decrement();
private:
// disable default constructor
KeyValue();
float minValue;
float maxValue;
float minRawValue;
float maxRawValue;
float value;
float rawValue;
float delta;
float scale;
float bias;
unsigned int keyIncrease;
unsigned int keyDecrease;
char *nameValue;
};
typedef KeyValue* PKeyValue;
class KeyboardObject
{
public:
KeyboardObject(KeyboardControl *pKeyCtrl, char *groupName);
~KeyboardObject();
int GetNumValues();
KeyValue *GetKeyValue(int index);
const char *GetName() { return nameObject; }
const char *GetAnimation() { return animationName; }
const char *GetType() { return controlType; }
const char *GetDisplayText() { return displayText; }
const char *GetValueName(int index);
float *GetValuePtr(int index);
int GetValueIndex( const char *szName );
private:
// disable default constructor
KeyboardObject();
char *nameObject;
char *controlType;
char *animationName;
char *displayText;
int numValues;
KeyValue **keyValues;
};
typedef KeyboardObject* PKeyboardObject;
class KeyboardControl
{
// letting the controller peek at the values avoids linear search to look up a value
friend class C3DController6DOF;
public:
KeyboardControl(const char *iniName, const char *baseGroupName);
~KeyboardControl();
int GetNumObjects() { return numObjects; }
KeyboardObject *GetObjectPtr( int i );
float GetFloat(const char *group, const char *entry, float defaultValue);
const char *GetString(const char *group, const char *entry, const char *defaultValue);
int GetInt(const char *group, const char *entry, int defaultValue);
float GetValue(const char *name);
float GetRawValue(const char *name);
float *GetValuePtr(const char *name);
float GetMinValue(const char *name);
float GetMaxValue(const char *name);
void SetValue(const char *name, float value);
void SetRawValue( const char *name, float rawValue );
bool HandleKey(unsigned int keyCode);
private:
KeyValue *GetKeyValue(const char *name);
int numObjects;
KeyboardObject **keyObjects;
char *nameOfIniFile;
};
#endif |
dd1346343f4c56f8e16ead4d9fffcd8dbda9fc55 | 7ada338e189a9e941a467f9d4eca3317f3ef8f4a | /Tag1_Aufgabe3/CharGenerator.hpp | 46f913621e39669028072739f7e6aa3c64d47052 | [] | no_license | cbiehl/cpp_tutorials | 6927429b8bcd5f25e026a2fde064c43de8158b5f | ff83f8616bda4a17204d5f2097a7d4c292f4c94f | refs/heads/master | 2020-03-27T07:06:48.592670 | 2018-09-22T13:29:35 | 2018-09-22T13:29:35 | 146,163,377 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 125 | hpp | CharGenerator.hpp | class CharGenerator {
public:
CharGenerator(char initialChar = 'a');
char generateNextChar();
private:
char nextChar;
}; |
a1a39f0f99cf88ec58cbf1c1e19a562a6a4a49b7 | f6e895e1fada24ac3987c9374c84a912709e197c | /HDU/HDU_1017.cpp | c072f9e2c91f10c7fbddf28abf0d9a0b33294a63 | [] | no_license | tpbluesky/Online-Judjing | 7b0f4f08525830d6765be6dfc39a7c230fffb881 | dc5c186b79d3f4b32a7f9496fb849bd987bf84d7 | refs/heads/master | 2021-01-23T11:04:26.788901 | 2018-03-11T05:01:49 | 2018-03-11T05:01:49 | 93,123,032 | 2 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 754 | cpp | HDU_1017.cpp | #include <iostream>
#include <cstdio>
#include <cstring>
#include <cstdlib>
#include <cmath>
#include <algorithm>
#include <vector>
#include <set>
#include <map>
#include <string>
#include <sstream>
#include <queue>
#define inf 0x3f3f3f3f
#define eps 1e-8
#define sqr(x) ((x)*(x))
using namespace std;
typedef long long ll;
//const int maxn = ;
int main(){
int T_T, n, m;
scanf("%d",&T_T);
while(T_T--){
int cas = 1;
while(scanf("%d%d",&n,&m) == 2){
if(n == 0 && m == 0) break;
int ans = 0;
for(int i = 1;i < n;++i){
for(int j = i+1;j < n;++j){
if((i*i+j*j+m)%(i*j) == 0) ans++;
}
}
printf("Case %d: %d\n",cas++,ans);
}
if(T_T != 0)
printf("\n");
}
return 0;
}
|
6f728e4a6495eee1b4fdf0791dca674a5af3339d | 093df6cf938afc1f0af9f7120e2b48112cde7e36 | /libstd_cpp/memory/shared_ptr/shared_ptr_allocateshared11.cpp | 93f1a37f707e8b4860766b789d36586fb38adefb | [] | no_license | hexu1985/cpp_code | 6487e19563ed2a751f889cb81ad724c40b442097 | 1cdbe297dec47cdd11f9e5d28e6caa2971b469bb | refs/heads/master | 2020-06-25T22:19:55.409303 | 2019-02-19T03:29:49 | 2019-02-19T03:29:49 | 96,992,341 | 3 | 0 | null | 2017-07-12T09:54:11 | 2017-07-12T09:54:11 | null | UTF-8 | C++ | false | false | 609 | cpp | shared_ptr_allocateshared11.cpp | // allocate_shared example
#include <iostream>
#include "memory.h"
int main () {
std::allocator<int> alloc; // the default allocator for int
std::default_delete<int> del; // the default deleter for int
Hx::shared_ptr<int> foo = Hx::allocate_shared<int> (alloc,10);
auto bar = Hx::allocate_shared<int> (alloc,20);
auto baz = Hx::allocate_shared<std::pair<int,int>> (alloc,30,40);
std::cout << "*foo: " << *foo << '\n';
std::cout << "*bar: " << *bar << '\n';
std::cout << "*baz: " << baz->first << ' ' << baz->second << '\n';
return 0;
}
/*
Output:
*foo: 10
*bar: 20
*baz: 30 40
*/
|
269a8ba6b463aafd99134b6b2f76de53a8c3edf3 | 01f40e6707240d7c00231f4eba205ebc5132a2cc | /browser/Node.h | 9b04c7f6b175d87a172bb32c505b0769121484a8 | [] | no_license | SeungKyuHong/Preloading | c852d0e7897be06dba617dbf2cbc23d6182158ae | d2deb5f61a36c015ff0b08ea0677e5e1565dd8de | refs/heads/master | 2021-01-13T05:53:46.151460 | 2017-09-07T06:55:17 | 2017-09-07T06:55:17 | 94,963,137 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 915 | h | Node.h | #pragma once
#include<iostream>
#include<fstream>
#include <cstring>
#include <ctime>
#include "linkedqueue.h"
using namespace std;
#define EDGE 300
class linkedqueue;
class my_queue;
class Node
{
private:
int e_count[EDGE];
double priorN[EDGE];
unsigned long node_size;
public:
Node* Prior[50];
int e_index, p_index;
char* url;
int v_count; //the number of count visiting the current node
linkedqueue* queue;
Node* edge[EDGE];
~Node(void);
Node(void);
Node(char* i_url,Node* pre, long msecs_v);//{H}
char* insert_edge(Node* New);
void delete_edge(Node* New);
void set_Prior(Node* pre);
Node* get_Prior(int);
int get_p_index();
Node** get_edge();
int get_e_index();
long msecs;
void setPrior(int j);
long calLoadTime(long ms);
int comVCount(Node* a, Node* b, int allVCount);
double get_priorN(int In);
int get_e_count(int i);
};
|
841fd40cbe50227d7e04dcd42fac617a856a25a5 | 0a8a0b80abb155fa74b0fd4746bf01e8d666a5d3 | /clouds/proceduralClouds_gl/skyDemo/src/ProceduralClouds.cpp | d1a9b048da27592edf3bb293e1fc87976511fae1 | [
"Unlicense"
] | permissive | doggan/code-dump | 48e7cf0c39bc9a84fc3e91e423e248d17b5fb3d5 | 8f4c7bc32ea45ae0a775838e2a7f7217017cd1be | refs/heads/master | 2022-01-11T19:13:17.942575 | 2021-12-29T08:25:01 | 2021-12-29T08:25:01 | 29,381,706 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 9,920 | cpp | ProceduralClouds.cpp | #include "ProceduralClouds.h"
#include "TextureManager.h"
#include "gl/glew.h"
#include <cassert>
ProceduralClouds::ProceduralClouds(unsigned int programID)
: m_programID(programID)
{
}
ProceduralClouds::~ProceduralClouds()
{
// Clean up.
delete [] m_skyColorData;
delete [] m_tex_Octave1_data;
delete [] m_tex_Octave1_cur_data;
delete [] m_tex_Octave1_pre_data;
delete [] m_tex_Octave2_data;
delete [] m_tex_Octave2_cur_data;
delete [] m_tex_Octave2_pre_data;
delete [] m_tex_Octave3_data;
delete [] m_tex_Octave3_cur_data;
delete [] m_tex_Octave3_pre_data;
delete [] m_tex_Octave4_data;
delete [] m_tex_Octave4_cur_data;
delete [] m_tex_Octave4_pre_data;
}
bool ProceduralClouds::init(float updateInterval, float cloudCover, float cloudSharpness, float scrollU, float scrollV)
{
glPushMatrix();
glPushAttrib( GL_ALL_ATTRIB_BITS );
m_updateInterval = updateInterval;
m_scrollU = scrollU;
m_scrollV = scrollV;
m_cloudCover = cloudCover;
m_cloudSharpness = cloudSharpness;
srand(0); // TODO: remove once better PRNG is implemented
// Sky color texture.
m_skyColorData = new unsigned char [128 * 128 * 4];
glActiveTexture(GL_TEXTURE0);
m_skyColor = TextureManager::getSingleton().loadTexture(m_skyColorData, 128, 128, GL_LINEAR);
glBindTexture(GL_TEXTURE_2D, m_skyColor);
glUseProgram(m_programID);
glUniform1i(glGetUniformLocation(m_programID, "tex_skyColor"), 0);
glUseProgram(0);
generateSkyColor(m_skyColor);
// Create each octave texture.
// Octave 1.
m_tex_Octave1_data = new unsigned char [32 * 32 * 4];
m_tex_Octave1_cur_data = new unsigned char [32 * 32 * 4];
m_tex_Octave1_pre_data = new unsigned char [32 * 32 * 4];
glActiveTexture(GL_TEXTURE1);
m_tex_Octave1 = TextureManager::getSingleton().loadTexture(m_tex_Octave1_data, 32, 32, GL_LINEAR);
glBindTexture(GL_TEXTURE_2D, m_tex_Octave1);
glUseProgram(m_programID);
glUniform1i(glGetUniformLocation(m_programID, "tex_octave1"), 1);
glUseProgram(0);
generateNoise(m_tex_Octave1_pre_data, NULL);
generateNoise(m_tex_Octave1_cur_data, NULL);
// Octave 2.
m_tex_Octave2_data = new unsigned char [32 * 32 * 4];
m_tex_Octave2_cur_data = new unsigned char [32 * 32 * 4];
m_tex_Octave2_pre_data = new unsigned char [32 * 32 * 4];
glActiveTexture(GL_TEXTURE2);
m_tex_Octave2 = TextureManager::getSingleton().loadTexture(m_tex_Octave2_data, 32, 32, GL_LINEAR);
glBindTexture(GL_TEXTURE_2D, m_tex_Octave2);
glUseProgram(m_programID);
glUniform1i(glGetUniformLocation(m_programID, "tex_octave2"), 2);
glUseProgram(0);
generateNoise(m_tex_Octave2_pre_data, NULL);
generateNoise(m_tex_Octave2_cur_data, NULL);
// Octave 3.
m_tex_Octave3_data = new unsigned char [32 * 32 * 4];
m_tex_Octave3_cur_data = new unsigned char [32 * 32 * 4];
m_tex_Octave3_pre_data = new unsigned char [32 * 32 * 4];
glActiveTexture(GL_TEXTURE3);
m_tex_Octave2 = TextureManager::getSingleton().loadTexture(m_tex_Octave3_data, 32, 32, GL_LINEAR);
glBindTexture(GL_TEXTURE_2D, m_tex_Octave3);
glUseProgram(m_programID);
glUniform1i(glGetUniformLocation(m_programID, "tex_octave3"), 3);
glUseProgram(0);
generateNoise(m_tex_Octave3_pre_data, NULL);
generateNoise(m_tex_Octave3_cur_data, NULL);
// Octave 4.
m_tex_Octave4_data = new unsigned char [32 * 32 * 4];
m_tex_Octave4_cur_data = new unsigned char [32 * 32 * 4];
m_tex_Octave4_pre_data = new unsigned char [32 * 32 * 4];
glActiveTexture(GL_TEXTURE4);
m_tex_Octave2 = TextureManager::getSingleton().loadTexture(m_tex_Octave4_data, 32, 32, GL_LINEAR);
glBindTexture(GL_TEXTURE_2D, m_tex_Octave4);
glUseProgram(m_programID);
glUniform1i(glGetUniformLocation(m_programID, "tex_octave4"), 4);
glUseProgram(0);
generateNoise(m_tex_Octave4_pre_data, NULL);
generateNoise(m_tex_Octave4_cur_data, NULL);
glUseProgram(m_programID);
glUniform1f(glGetUniformLocation(m_programID, "cloudCover"), m_cloudCover);
glUniform1f(glGetUniformLocation(m_programID, "cloudSharpness"), m_cloudSharpness);
glUniform1f(glGetUniformLocation(m_programID, "scrollSpeedU"), m_scrollU);
glUniform1f(glGetUniformLocation(m_programID, "scrollSpeedV"), m_scrollV);
glUseProgram(0);
glPopAttrib();
glPopMatrix();
return true;
}
void ProceduralClouds::update(float timeSinceLastFrame)
{
// TODO: not sure why this breaks other stuff.
// glPushMatrix();
// glPushAttrib( GL_ALL_ATTRIB_BITS );
static float tScroll = 0.0f;
// Used for texture scrolling animation.
glUniform1f(glGetUniformLocation(m_programID, "theTime"), tScroll);
tScroll += timeSinceLastFrame;
// This time is used for cloud formation animation.
static float runningTime = 0.0f;
if (runningTime > m_updateInterval)
{
// Generate some new noise, saving out old noise.
generateNoise(m_tex_Octave1_cur_data, m_tex_Octave1_pre_data);
generateNoise(m_tex_Octave2_cur_data, m_tex_Octave2_pre_data);
generateNoise(m_tex_Octave3_cur_data, m_tex_Octave3_pre_data);
generateNoise(m_tex_Octave4_cur_data, m_tex_Octave4_pre_data);
runningTime -= m_updateInterval;
}
// Noise interpolation (cloud formation animation).
float t = runningTime / m_updateInterval;
if (t < 0.0f) t = 0.0f;
if (t > 1.0f) t = 1.0f;
glActiveTexture(GL_TEXTURE0);
glBindTexture(GL_TEXTURE_2D, m_skyColor);
glActiveTexture(GL_TEXTURE1);
glBindTexture(GL_TEXTURE_2D, m_tex_Octave1);
interpolateNoise(t, m_tex_Octave1_pre_data, m_tex_Octave1_cur_data, m_tex_Octave1_data);
glActiveTexture(GL_TEXTURE2);
glBindTexture(GL_TEXTURE_2D, m_tex_Octave2);
interpolateNoise(t, m_tex_Octave2_pre_data, m_tex_Octave2_cur_data, m_tex_Octave2_data);
glActiveTexture(GL_TEXTURE3);
glBindTexture(GL_TEXTURE_2D, m_tex_Octave3);
interpolateNoise(t, m_tex_Octave3_pre_data, m_tex_Octave3_cur_data, m_tex_Octave3_data);
glActiveTexture(GL_TEXTURE4);
glBindTexture(GL_TEXTURE_2D, m_tex_Octave4);
interpolateNoise(t, m_tex_Octave4_pre_data, m_tex_Octave4_cur_data, m_tex_Octave4_data);
runningTime += timeSinceLastFrame;
glActiveTexture(GL_TEXTURE0);
// glPopAttrib();
// glPopMatrix();
}
void ProceduralClouds::generateNoise(unsigned char *textureData, unsigned char *prevTextureData)
{
// Fill in pixel data.
for (unsigned int row = 0; row < 32; ++row)
{
for(unsigned int col = 0; col < 32; ++col)
{
unsigned int base = indexInto(row, col, 32);
// Save out current into prev.
if (prevTextureData != NULL)
{
prevTextureData[base] = textureData[base];
prevTextureData[base + 1] = textureData[base + 1];
prevTextureData[base + 2] = textureData[base + 2];
prevTextureData[base + 3] = textureData[base + 3];
}
// TODO: implement better noise.
// Noise generation.
float r = (float)rand() / ((float)RAND_MAX+1.0f);
unsigned char rInt = (unsigned char)(r * 255.0f);
assert(rInt >= 0 && rInt <= 255);
textureData[base] = rInt; // R
textureData[base + 1] = rInt; // G
textureData[base + 2] = rInt; // B
textureData[base + 3] = 255; // A
}
}
}
void ProceduralClouds::generateSkyColor(unsigned int skyTexture)
{
TextureManager::textureInfo ti = TextureManager::getSingleton().findTex(skyTexture);
// Fill in pixel data.
for (unsigned int row = 0; row < ti.height; ++row)
{
for(unsigned int col = 0; col < ti.width; ++col)
{
unsigned int base = indexInto(row, col, ti.width);
m_skyColorData[base] = 0; // R
m_skyColorData[base + 1] = 0; // G
m_skyColorData[base + 2] = 255; // B
m_skyColorData[base + 3] = 255; // A
}
}
glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA8, ti.width, ti.height, 0, GL_RGBA, GL_UNSIGNED_BYTE, m_skyColorData);
}
void ProceduralClouds::interpolateNoise(float t, unsigned char *tex1, unsigned char *tex2, unsigned char *dest)
{
// Fill in pixel data.
for (unsigned int row = 0; row < 32; ++row)
{
for(unsigned int col = 0; col < 32; ++col)
{
unsigned int base = indexInto(row, col, 32);
// Interpolate.
dest[base] = unsigned char((float)tex1[base] * (1.0f - t) + (float)tex2[base] * t);
dest[base + 1] = unsigned char((float)tex1[base + 1] * (1.0f - t) + (float)tex2[base + 1] * t);
dest[base + 2] = unsigned char((float)tex1[base + 2] * (1.0f - t) + (float)tex2[base + 2] * t);
dest[base + 3] = unsigned char((float)tex1[base + 3] * (1.0f - t) + (float)tex2[base + 3] * t);
}
}
glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA8, 32, 32, 0, GL_RGBA, GL_UNSIGNED_BYTE, dest);
}
void ProceduralClouds::setCloudFormationUpdateInterval(float delta)
{
m_updateInterval += delta;
if (m_updateInterval < 0.0f)
m_updateInterval = 0.0f;
}
void ProceduralClouds::setCloudScrollU(float delta)
{
m_scrollU += delta;
if (m_scrollU < 0.0f)
m_scrollU = 0.0f;
glUseProgram(m_programID);
glUniform1f(glGetUniformLocation(m_programID, "scrollSpeedU"), m_scrollU);
glUseProgram(0);
}
void ProceduralClouds::setCloudScrollV(float delta)
{
m_scrollV += delta;
if (m_scrollV < 0.0f)
m_scrollV = 0.0f;
glUseProgram(m_programID);
glUniform1f(glGetUniformLocation(m_programID, "scrollSpeedV"), m_scrollV);
glUseProgram(0);
}
void ProceduralClouds::setCloudCover(float delta)
{
m_cloudCover += delta;
if (m_cloudCover < 0.0f)
m_cloudCover = 0.0f;
else if (m_cloudCover > 1.0f)
m_cloudCover = 1.0f;
glUseProgram(m_programID);
glUniform1f(glGetUniformLocation(m_programID, "cloudCover"), m_cloudCover);
glUseProgram(0);
}
void ProceduralClouds::setCloudSharpness(float delta)
{
m_cloudSharpness += delta;
if (m_cloudSharpness < 0.0f)
m_cloudSharpness = 0.0f;
else if (m_cloudSharpness > 1.0f)
m_cloudSharpness = 1.0f;
glUseProgram(m_programID);
glUniform1f(glGetUniformLocation(m_programID, "cloudSharpness"), m_cloudSharpness);
glUseProgram(0);
} |
b8a4c2a1f9b7659c24d873fb55240848b45147a4 | 458eea1b41c9eae73146a1668af6bb6a3362a14c | /libraries/utilities/include/mcrl2/utilities/detail/separate_keyword_section.h | 81ea0e3832e138580a66c4a75b20b82589b28b88 | [
"BSL-1.0"
] | permissive | mCRL2org/mCRL2 | 91fb459f26087ac50036150cd77c7e8a16b5ec42 | 33d77f5ef994381e03a0d3b0693c1014e4e12d41 | refs/heads/master | 2023-09-01T13:54:28.982994 | 2023-09-01T12:54:35 | 2023-09-01T12:54:35 | 128,542,478 | 90 | 42 | BSL-1.0 | 2023-08-10T15:12:42 | 2018-04-07T15:35:53 | C++ | UTF-8 | C++ | false | false | 2,688 | h | separate_keyword_section.h | // Author(s): Wieger Wesselink
// Copyright: see the accompanying file COPYING or copy at
// https://github.com/mCRL2org/mCRL2/blob/master/COPYING
//
// Distributed under the Boost Software License, Version 1.0.
// (See accompanying file LICENSE_1_0.txt or copy at
// http://www.boost.org/LICENSE_1_0.txt)
//
/// \file mcrl2/utilities/detail/separate_keyword_section.h
/// \brief add your file description here.
#ifndef MCRL2_UTILITIES_DETAIL_SEPARATE_KEYWORD_SECTION_H
#define MCRL2_UTILITIES_DETAIL_SEPARATE_KEYWORD_SECTION_H
#include <utility>
#include <boost/algorithm/string/join.hpp>
#include <boost/algorithm/string/trim.hpp>
#include "mcrl2/utilities/text_utility.h"
namespace mcrl2 {
namespace utilities {
namespace detail {
// Separates all sections with a keyword from the other keyword sections
// Returns a pair containing consisiting of the keyword section and the other keyword sections
inline
std::pair<std::string, std::string> separate_keyword_section(const std::string& text1, const std::string& keyword, const std::vector<std::string>& all_keywords, bool repeat_keyword = false)
{
std::string text = boost::trim_copy(text1);
std::ostringstream out1; // will contain the keyword sections
std::ostringstream out2; // will contain the other keyword sections
std::string regex_keyword = "\\b" + keyword + "\\b";
// create a regex that looks like this: "(\\beqn\\b)|(\\bcons\\b)|(\\bmap\\b)|(\\bvar\\b)"
std::vector<std::string> v = all_keywords;
v.erase(std::remove(v.begin(), v.end(), keyword), v.end()); // erase keyword from v
for (std::string& s: v)
{
s = "(\\b" + s + "\\b)";
}
std::string regex_other_keywords = boost::algorithm::join(v, "|");
std::vector<std::string> specs = utilities::regex_split(text, regex_keyword);
if (text.find(keyword) != 0 && !specs.empty())
{
out2 << specs.front() << std::endl;
specs.erase(specs.begin());
}
for (const std::string& spec: specs)
{
// strip trailing map/cons/var/eqn declarations
std::vector<std::string> v = utilities::regex_split(spec, regex_other_keywords);
if (!v.empty())
{
if (repeat_keyword)
{
out1 << "\n" << keyword;
}
out1 << " " << v.front();
out2 << spec.substr(v.front().size());
}
}
std::string s1 = out1.str();
if (!s1.empty())
{
if (!repeat_keyword)
{
s1 = keyword + "\n" + s1;
}
}
return std::make_pair(s1 + "\n", out2.str() + "\n");
}
} // namespace detail
} // namespace utilities
} // namespace mcrl2
#endif // MCRL2_UTILITIES_DETAIL_SEPARATE_KEYWORD_SECTION_H
|
2f0925fc92ccb2bad9401260049cab5f4d78d91e | 2769d06b54725e78a755c1c8342032ac95a947f0 | /Djikstra Shortest Path on Turkey Map/Kodlar.txt | ff4833694b9a29321f5a687d08e6ead26ba7eea6 | [] | no_license | nedret212/Djikstra-Shortest-Path-on-Turkey-Map-on-C- | 025681b61c882a7560925f28cdcd9b342defac98 | 1301ab33dafc8bf6a79fcfef991240d14adc8dd1 | refs/heads/master | 2020-11-27T07:29:21.563754 | 2019-12-21T00:19:02 | 2019-12-21T00:19:02 | 229,354,980 | 0 | 0 | null | null | null | null | ISO-8859-3 | C++ | false | false | 8,078 | txt | Kodlar.txt | #include <iostream>
#include <graphics.h>
#include <stdio.h>
#include <string.h>
#include <conio.h>
#define K 6
struct djikstra{
char sehir1[50];
char sehir2[50];
int maliyet;
}dugum[K][K];
int sonsuz=9999;
void nedret(char bas_dugum[50],char hedef_dugum[50],int maliyet_matris[K][K]);
void ekran();
int satirno();
void konum(int no[],int matris[][2]);
void cizgi(int a[][2]);
void grafik_rota(int rota[][2]);
int main()
{
FILE *dosya;
dosya=fopen("Deneme2.txt","r");
int maliyet_matris[K][K];
char bas_dugum[50],hedef_dugum[50];
int i,j;
fseek(dosya, 0, SEEK_END);
long int son=ftell(dosya); ///dosya sonuna gitti yeri söyledi
fseek(dosya, 0, SEEK_SET);
///txt verisinden dugum bilgileri aktarildi
for(i=0;i<K;i++)
{
for(j=0;j<K;j++)
{
fscanf(dosya,"%s %s %d\n",dugum[i][j].sehir1,dugum[i][j].sehir2,&dugum[i][j].maliyet);
maliyet_matris[i][j]=dugum[i][j].maliyet;
}
}
printf("A: Ankara\tB: Eskisehir\tC: Bolu\tD: Cankiri\tE: Kirsehir\tF: Kirikkale\t\n");
printf(" A\tB\tC\tD\tE\tF\n");
/// maliyet matrisini listeler
for(i=0;i<K;i++)
{
printf("%s :",dugum[i][0].sehir1);
for(j=0;j<K;j++)
{
printf("%d\t ",maliyet_matris[i][j]);
}
printf("\n");
}
printf("\nbaslangic dugumunu giriniz: ");
scanf("%s",&bas_dugum);
printf("hedef dugumu giriniz: ");
scanf("%s",&hedef_dugum);
///enk_yol_djikstra(bas_dugum,hedef_dugum,maliyet_matris);
nedret(bas_dugum,hedef_dugum,maliyet_matris);
fclose(dosya);
/// konumlari aktarir
int satir=satirno();
int konumxy[satir][2];
int numara[satir];
konum(numara,konumxy);
/*int i;
for(i=0;i<satir;i++)
{
printf("%d\tnumara: x: %d, y: %d\n",numara[i],konumxy[i][0],konumxy[i][1]);
}*/
ekran();
while(1)
{
grafik_rota(konumxy);
}
getch();
return 0;
}
int grafik_ciz[K];
int g_no=0;
void nedret(char bas_dugum[50],char hedef_dugum[50],int maliyet_matris[K][K])
{
int guncel_dugum[K],baslangic_indisi;
int secilen_dugum[K];
int enkisa_dugum[K];
int i,j,min1=10000;
int gezilecek_dugum;
int tekrar_kontrol[K];
int sayac=0;
char rota[K];
int rota_sayac=0;
int bitis_indisi;
int cizim[K];
int cizim_no=0;
for(i=0;i<K;i++)
{
tekrar_kontrol[i]=0;
}
printf(" \tA\tB\tC\tD\tE\tF\n");
///baslangic dugumunu guncel dizisine aktarir
for(i=0;i<K;i++)
{
if(strcmp(bas_dugum,dugum[i][0].sehir1)==0)
{
baslangic_indisi=i;
printf(" %s:\t",dugum[baslangic_indisi][0].sehir1);
rota[rota_sayac]=baslangic_indisi;
rota_sayac++;
for(j=0;j<K;j++)
{
guncel_dugum[j]=maliyet_matris[i][j];
printf("%d\t",guncel_dugum[j]);
if(min1>guncel_dugum[j] && guncel_dugum[j]!=0)
{
min1=guncel_dugum[j];
gezilecek_dugum=j;
}
}
printf("\n");
// printf("min: %d",min);
}
}
///bitis dugumunu bulur
for(i=0;i<K;i++)
{
if(strcmp(hedef_dugum,dugum[i][0].sehir1)==0)
{
bitis_indisi=i;
}
}
/// secilen dugum dizisine aktarir
tekrar_kontrol[baslangic_indisi]=1;
dugum:
sayac=0;
tekrar_kontrol[gezilecek_dugum]=1;
for(j=0;j<K;j++)
{
secilen_dugum[j]=maliyet_matris[gezilecek_dugum][j]+min1;
}
for(i=0;i<K;i++)
{
if(secilen_dugum[i]<guncel_dugum[i])
{
enkisa_dugum[i]=secilen_dugum[i];
}
else
{
enkisa_dugum[i]=guncel_dugum[i];
}
}
printf(" %s:\t",dugum[gezilecek_dugum][0].sehir1);
rota[rota_sayac]=gezilecek_dugum;
rota_sayac++;
for(i=0;i<K;i++)
{
printf("%d\t",enkisa_dugum[i]);
}
min1=sonsuz;
for(j=0;j<K;j++)
{
if(min1>enkisa_dugum[j] && enkisa_dugum[j]!=0)
{
if(tekrar_kontrol[j]==0)
{
min1=enkisa_dugum[j];
gezilecek_dugum=j;
}
}
}
min1=maliyet_matris[baslangic_indisi][gezilecek_dugum];
for(j=0;j<K;j++)
{
guncel_dugum[j]=enkisa_dugum[j];
}
//printf("\n tekrar kontrol\n");
for(i=0;i<K;i++)
{
//printf("%d\t",tekrar_kontrol[i]);
if(tekrar_kontrol[i]==1)
{
sayac++;
}
}
printf("\n");
if(sayac<6)
{
goto dugum;
}
for(i=0;i<rota_sayac;i++)
{
printf(" %s:-->",dugum[rota[i]][0].sehir1);
if(rota[i]==bitis_indisi)
{
i=rota_sayac;
}
}
printf("ROTA\n\n");
for(i=0;i<rota_sayac;i++)
{
cizim[i]=rota[i];
if(rota[i]==bitis_indisi)
{
i=rota_sayac;
}
}
for(i=0;i<K;i++)
{
if(cizim[i]<K)
{
grafik_ciz[g_no]=cizim[i];
g_no++;
}
}
}
int satirno()
{
FILE *dosya;
dosya=fopen("sehir kod.txt","r");
char sehir[50];
int satirno=0;
fseek(dosya, 0, SEEK_END);
long int son=ftell(dosya); ///dosya sonuna gitti yeri söyledi
fseek(dosya, 0, SEEK_SET);
while(ftell(dosya)!=son){
fscanf(dosya,"%s\n",sehir);
satirno++;
}
fclose(dosya);
return satirno;
}
void konum(int no[],int matris[][2])
{
FILE *dosya;
dosya=fopen("sehir konum.txt","r");
int satir=satirno();
int konum_xy[satir][2];
int numara[satir];
int i,j;
//printf("satir no: %d\n",satir);
for(i=0;i<satir;i++)
{
fscanf(dosya,"%d %d %d\n",&no[i],&matris[i][0],&matris[i][1]);
}
/* printf("\n");
for(i=0;i<g_no;i++)
printf("%d ",grafik_ciz[i]);*/
}
void ekran()
{
initwindow(1000,514,"En Kisa Yol");
setbkcolor(3);
readimagefile("harita.jpg",0,0,1000,514);
outtextxy(365,144,"A");
outtextxy(250,150,"B");
outtextxy(310,90,"C");
outtextxy(400,100,"D");
outtextxy(430,195,"E");
outtextxy(400,150,"F");
}
void cizgi(int a[][2])
{
setcolor(BLACK);
setlinestyle(0,0,4);
line(a[0][0],a[0][1],a[1][0],a[1][1]);
}
void grafik_rota(int rota[][2])
{
int satir=satirno();
int grafik_rota[satir];
int grafik_rota_no=0;
int i;
int kontrol=0;
int k_no=0;
for(i=0;i<satir;i++)
{
grafik_rota[grafik_rota_no]=i;
grafik_rota_no++;
}
while(kontrol!=(g_no-1))
{
setcolor(BLACK);
setlinestyle(0,0,4);
line(rota[grafik_ciz[kontrol]][0],rota[grafik_ciz[kontrol]][1],rota[grafik_ciz[kontrol+1]][0],rota[grafik_ciz[kontrol+1]][1]);
kontrol++;
}
}
|
6c469e92b749f378bcdd9d83aacb11ebb2cf7630 | 9f9660f318732124b8a5154e6670e1cfc372acc4 | /Case_save/Case30/case3/800/alphat | 1ff031146307994a2479fb857b715a55928c048a | [] | no_license | mamitsu2/aircond5 | 9a6857f4190caec15823cb3f975cdddb7cfec80b | 20a6408fb10c3ba7081923b61e44454a8f09e2be | refs/heads/master | 2020-04-10T22:41:47.782141 | 2019-09-02T03:42:37 | 2019-09-02T03:42:37 | 161,329,638 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 9,407 | alphat | /*--------------------------------*- C++ -*----------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | Website: https://openfoam.org
\\ / A nd | Version: 6
\\/ M anipulation |
\*---------------------------------------------------------------------------*/
FoamFile
{
version 2.0;
format ascii;
class volScalarField;
location "800";
object alphat;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
dimensions [1 -1 -1 0 0 0 0];
internalField nonuniform List<scalar>
459
(
0.00124492
0.00136067
0.00138547
0.00145178
0.00151304
0.0015702
0.00162598
0.00168166
0.0017218
0.00174023
0.001731
0.00169023
0.0016178
0.00152048
0.00141445
0.000548425
0.000673684
0.000755293
0.000746992
0.000719381
0.000684445
0.00064215
0.000600672
0.000563073
0.00052966
0.000500032
0.000473668
0.000450203
0.000429095
0.000409595
0.000390724
0.000371016
0.000356701
0.000324608
0.00169747
0.00413997
0.00396088
0.00461118
0.0052476
0.0058858
0.00645484
0.00687646
0.00725941
0.00757316
0.00777284
0.00780528
0.00758995
0.006929
0.00513493
0.00143792
0.000866612
0.000597495
0.00124175
0.0017011
0.0020229
0.00218758
0.00217593
0.00176538
0.00152896
0.00135857
0.00122709
0.00112205
0.00103625
0.000961627
0.000891797
0.000823947
0.000763734
0.00071111
0.000828964
0.000424326
0.00207392
0.00565574
0.00491434
0.00618914
0.00682421
0.00729317
0.00765464
0.00793298
0.00823475
0.008552
0.00884829
0.00906715
0.00914654
0.00900196
0.00840801
0.00651436
0.00141344
0.00120288
0.00170798
0.00216606
0.00256412
0.00282622
0.00274135
0.000918947
0.000812344
0.000726708
0.000657567
0.000601192
0.000554734
0.000516148
0.000484122
0.000458098
0.000493509
0.000570443
0.000927924
0.000490239
0.00243523
0.00723832
0.00492389
0.00656441
0.00714283
0.00733717
0.00744961
0.0075772
0.00780668
0.00812411
0.0084945
0.00884621
0.00911569
0.00923943
0.00912421
0.0084952
0.00636681
0.00170516
0.00211533
0.00271792
0.00328036
0.00371001
0.0039619
0.00370243
0.00103517
0.000942852
0.000876621
0.000826088
0.000783191
0.000743992
0.000706427
0.000667114
0.000621606
0.000583669
0.000596424
0.0010532
0.000541198
0.00280356
0.00927188
0.00541541
0.00630627
0.00708586
0.0071492
0.0070742
0.00711799
0.00731836
0.00763756
0.00805407
0.00846864
0.00879557
0.0089601
0.00893181
0.00866052
0.00796118
0.00656123
0.00607335
0.00589539
0.0058168
0.00576129
0.00568494
0.00546302
0.00462108
0.00421791
0.00398345
0.00380176
0.0036097
0.00333207
0.00295717
0.00250114
0.00199273
0.00147627
0.00108726
0.00108488
0.000722659
0.000667992
0.000809699
0.000908173
0.00319383
0.0114836
0.00746791
0.00624792
0.00682611
0.0070928
0.00693424
0.00698308
0.00713709
0.00742474
0.00783935
0.00829217
0.00865383
0.00881709
0.00874769
0.00848988
0.00813059
0.00774474
0.00751574
0.00734496
0.00716293
0.0069667
0.00675598
0.00649908
0.00612252
0.00578516
0.00548453
0.00519561
0.00490153
0.00458174
0.00417819
0.00367412
0.00306822
0.00239342
0.00179336
0.00133852
0.00100577
0.000854127
0.0012191
0.000946566
0.00354909
0.013031
0.0104805
0.00805348
0.00759817
0.0075404
0.00730999
0.00714738
0.00718228
0.00745475
0.0079112
0.00841617
0.00880048
0.00893588
0.00879536
0.00847577
0.00816908
0.00802477
0.00799897
0.00790936
0.00769383
0.00738557
0.00701858
0.00661473
0.00619586
0.00581111
0.00545989
0.00513292
0.00483026
0.00455905
0.00431892
0.00398115
0.00350478
0.0029233
0.00236302
0.00185919
0.00148805
0.00136926
0.00139359
0.00107206
0.00361601
0.0116017
0.0103036
0.00950648
0.00884519
0.00806038
0.00741089
0.00712358
0.0072384
0.00768035
0.00829424
0.00887762
0.00923267
0.00924981
0.00895624
0.00852585
0.00822091
0.00816075
0.0081492
0.00789499
0.00744916
0.00690242
0.00633236
0.00580233
0.00534799
0.00497068
0.00465154
0.00438136
0.00416366
0.00400787
0.0039234
0.00388065
0.00362674
0.00324726
0.0029113
0.00273344
0.00282411
0.00324674
0.0040076
0.00168094
0.00351658
0.00417518
0.00464388
0.00477527
0.00486503
0.0051062
0.00560894
0.00639444
0.00737975
0.00839572
0.0092536
0.00977871
0.00984422
0.00947425
0.00886203
0.00836401
0.00809248
0.0078689
0.00751539
0.00695998
0.00628397
0.00560233
0.00500205
0.00451774
0.00413941
0.0038378
0.00358756
0.00337463
0.00319053
0.00302669
0.00287379
0.00273183
0.00261829
0.00253409
0.00250205
0.00251466
0.00250524
0.00241116
0.00225752
0.00158375
0.00177681
0.00362135
0.00572738
0.00750886
0.00892206
0.010028
0.0107526
0.0110664
0.0110002
0.0105584
0.00979324
0.00883825
0.0079739
0.007403
0.00696313
0.00644317
0.00581612
0.00515296
0.00453516
0.00401961
0.00361929
0.00331141
0.00306902
0.00287361
0.00271521
0.0025897
0.00249572
0.00243305
0.00240444
0.00240722
0.00242581
0.00245631
0.00249045
0.00250096
0.00244303
0.00230053
0.00208564
0.00131984
0.00235635
0.0059808
0.00889164
0.00997665
0.0105433
0.0107506
0.0105528
0.0100034
0.00921138
0.0082935
0.00739554
0.00660176
0.00595012
0.0053937
0.00484408
0.00431512
0.00385926
0.00349775
0.003222
0.0030065
0.00282708
0.00267156
0.00253628
0.00242839
0.00234772
0.00229395
0.00226593
0.00226163
0.00228759
0.00234052
0.00241653
0.00250749
0.00259513
0.00265592
0.0026382
0.00267132
0.00272353
0.00134616
0.00208675
0.00221212
0.00230065
0.00246227
0.00237557
0.00227219
0.00220662
0.00211849
0.00199323
0.00183676
0.00165926
0.00147336
0.00129216
0.00113395
0.00101264
0.000926519
0.00086633
0.000823774
0.000793464
0.000772204
0.000758058
0.000749801
0.000746978
0.000749882
0.000758962
0.000773295
0.000793166
0.000818986
0.000851407
0.000891373
0.000937747
0.000990625
0.00105063
0.00111833
0.00119329
0.00128174
0.00131257
0.00128007
0.00120281
0.00112171
)
;
boundaryField
{
floor
{
type compressible::alphatWallFunction;
Prt 0.85;
value nonuniform List<scalar>
29
(
0.00019946
7.66245e-05
9.53389e-05
0.0001073
0.00010609
0.000102056
9.69252e-05
9.06706e-05
8.44876e-05
7.88375e-05
7.3777e-05
6.92566e-05
6.52057e-05
6.15763e-05
5.82908e-05
5.52374e-05
5.22646e-05
4.91401e-05
4.68573e-05
4.16951e-05
4.16945e-05
5.75462e-05
6.77557e-05
7.55298e-05
0.000199458
7.66235e-05
8.40123e-05
0.000170566
0.00023839
)
;
}
ceiling
{
type compressible::alphatWallFunction;
Prt 0.85;
value nonuniform List<scalar>
43
(
0.0002883
0.000304501
0.000315886
0.00033667
0.000325655
0.000312427
0.000304001
0.000292627
0.000276364
0.000255887
0.000232422
0.000207544
0.000182953
0.00016116
0.000144214
0.000132039
0.000123452
0.000117339
0.000112961
0.000109879
0.000107823
0.000106621
0.00010621
0.000106633
0.000107956
0.00011004
0.000112921
0.000116651
0.000121316
0.000127037
0.000133637
0.000141117
0.000149549
0.000158995
0.000169378
0.000181536
0.00018575
0.000181307
0.000170694
0.00015947
0.000468617
0.000548729
0.000322858
)
;
}
sWall
{
type compressible::alphatWallFunction;
Prt 0.85;
value uniform 0.000287091;
}
nWall
{
type compressible::alphatWallFunction;
Prt 0.85;
value nonuniform List<scalar> 6(0.000129114 0.000134564 0.000152212 0.000186417 0.000190002 0.000159149);
}
sideWalls
{
type empty;
}
glass1
{
type compressible::alphatWallFunction;
Prt 0.85;
value nonuniform List<scalar> 9(0.000172098 0.00023231 0.000281168 0.000327249 0.000373548 0.000421958 0.000465538 0.000473827 0.000461926);
}
glass2
{
type compressible::alphatWallFunction;
Prt 0.85;
value nonuniform List<scalar> 2(0.000233638 0.000220805);
}
sun
{
type compressible::alphatWallFunction;
Prt 0.85;
value nonuniform List<scalar>
14
(
0.000176371
0.000192169
0.000195537
0.000204509
0.000212757
0.000220421
0.000227868
0.000235275
0.000240597
0.000243036
0.000241813
0.00023641
0.000226775
0.000213753
)
;
}
heatsource1
{
type compressible::alphatWallFunction;
Prt 0.85;
value nonuniform List<scalar> 3(9.46004e-05 0.000115293 0.000129414);
}
heatsource2
{
type compressible::alphatWallFunction;
Prt 0.85;
value nonuniform List<scalar> 4(0.000202753 0.000123479 0.000123478 0.000199439);
}
Table_master
{
type compressible::alphatWallFunction;
Prt 0.85;
value nonuniform List<scalar> 9(0.000130944 0.000115672 0.00010323 9.30554e-05 8.46629e-05 7.76737e-05 7.18133e-05 6.69077e-05 6.28911e-05);
}
Table_slave
{
type compressible::alphatWallFunction;
Prt 0.85;
value nonuniform List<scalar> 9(0.000147362 0.000134342 0.00012491 0.000117656 0.000111457 0.000105757 0.000100261 9.44701e-05 8.77149e-05);
}
inlet
{
type fixedValue;
value uniform 1.94e-05;
}
outlet
{
type zeroGradient;
}
}
// ************************************************************************* //
| |
82b6e65033accf61b10e456c1b61530149ae312f | deca8d4725b1b4e4a5aacb5c29f7f0dd98c2b982 | /sam.cpp | d652d0cdafc2622b5d9c38c484a0dd076389c91f | [] | no_license | NhatTanXT3/QtSAMtest | 0485193b80b426178292456c6b3a7a78d99689b1 | 8c747e37e3d4d19a7014e2f4102caee0cce23e88 | refs/heads/master | 2020-12-30T11:28:44.378853 | 2017-11-10T09:45:30 | 2017-11-10T09:45:30 | 91,568,528 | 0 | 1 | null | null | null | null | UTF-8 | C++ | false | false | 7,278 | cpp | sam.cpp | #include "sam.h"
SAM::SAM(QObject *parent) : QObject(parent)
{
}
void SAM::serialSend(const QByteArray &byteArray)
{
serial->write(byteArray);
}
void SAM::initConnection()
{
serial=new QSerialPort(this);
serial->setPortName("ttyUSB0");
// serial->setPortName("ttyACM0");
// serial->setBaudRate(QSerialPort::Baud115200);
serial->setBaudRate(1500000);
serial->setDataBits(QSerialPort::Data8);
serial->setParity(QSerialPort::NoParity);
serial->setStopBits(QSerialPort::OneStop);
serial->setFlowControl(QSerialPort::NoFlowControl);
serial->open(QIODevice::ReadWrite);
serial->write("ok");
connect(serial,SIGNAL(readyRead()),this,SLOT(serialReceived()));
}
void SAM::setSamPos12(quint8 ID, quint16 Pos)
{
quint8 Mode=8;
QByteArray ba;
ba.resize(6);
ba[0] = 0xff;
ba[1] = (((Mode&0x0C)<<3)+ID)&0x7F;
ba[2] = (((Mode&0x03)<<5)+(Pos>>7))&0x7F;
ba[3] = Pos&0x7F;
ba[4] = (ba.at(1)^ba.at(2)^ba.at(3))&0x7F;
ba[5] =0xfe;
this->serialSend(ba);
}
void SAM::getSamPos12(quint8 ID)
{
quint8 Mode=7;
quint16 Pos=0;
QByteArray ba;
ba.resize(6);
ba[0] = 0xff;
ba[1] = (((Mode&0x0C)<<3)+ID)&0x7F;
ba[2] = (((Mode&0x03)<<5)+(Pos>>7))&0x7F;
ba[3] = Pos&0x7F;
ba[4] = (ba.at(1)^ba.at(2)^ba.at(3))&0x7F;
ba[5] =0xfe;
this->serialSend(ba);
}
void SAM::setSamAverageTorq(quint8 ID, quint16 ATorq)
{
quint8 Mode=9;
QByteArray ba;
ba.resize(6);
ba[0] = 0xff;
ba[1] = (((Mode&0x0C)<<3)+ID)&0x7F;
ba[2] = (((Mode&0x03)<<5)+(ATorq>>7))&0x7F;
ba[3] = ATorq&0x7F;
ba[4] = (ba.at(1)^ba.at(2)^ba.at(3))&0x7F;
ba[5] =0xfe;
this->serialSend(ba);
}
void SAM::getSamAverageTorq(quint8 ID)
{
quint8 Mode=10;
QByteArray ba;
ba.resize(6);
ba[0] = 0xff;
ba[1] = (((Mode&0x0C)<<3)+ID)&0x7F;
ba[2] = ((Mode&0x03)<<5);
ba[3] = 0;
ba[4] = (ba.at(1)^ba.at(2)^ba.at(3))&0x7F;
ba[5] =0xfe;
this->serialSend(ba);
}
void SAM::setSamPos8(quint8 ID, quint8 Pos,quint8 Mode)
{
if (Mode>4)
Mode=4;
QByteArray ba;
ba.resize(6);
ba[0] = 0xff;
ba[1] = (((Mode&0x0C)<<3)+ID)&0x7F;
ba[2] = (((Mode&0x03)<<5)+((Pos>>7)&0x01))&0x7F;
ba[3] = Pos&0x7F;
ba[4] = (ba.at(1)^ba.at(2)^ba.at(3))&0x7F;
ba[5] =0xfe;
this->serialSend(ba);
}
void SAM::getSamPos8(quint8 ID)
{
quint8 Mode=5;
quint8 Pos=0;
QByteArray ba;
ba.resize(6);
ba[0] = 0xff;
ba[1] = (((Mode&0x0C)<<3)+ID)&0x7F;
ba[2] = (((Mode&0x03)<<5)+((Pos>>7)&0x01))&0x7F;
ba[3] = Pos&0x7F;
ba[4] = (ba.at(1)^ba.at(2)^ba.at(3))&0x7F;
ba[5] =0xfe;
this->serialSend(ba);
}
void SAM::setPassive(quint8 ID)
{
quint8 Mode=6;
quint16 Pos=0;
QByteArray ba;
ba.resize(6);
ba[0] = 0xff;
ba[1] = (((Mode&0x0C)<<3)+ID)&0x7F;
ba[2] = (((Mode&0x03)<<5)+(Pos>>7))&0x7F;
ba[3] = Pos&0x7F;
ba[4] = (ba.at(1)^ba.at(2)^ba.at(3))&0x7F;
ba[5] =0xfe;
this->serialSend(ba);
}
void SAM::getPID(quint8 ID)
{
QByteArray ba;
ba.resize(4);
ba[0] = 0xff;
ba[1] = 0x95;
ba[2] = ID&0x1F;
ba[3] =0xfe;
this->serialSend(ba);
}
void SAM::setPID(quint8 ID, quint8 Pvalue, quint8 Ivalue, quint8 Dvalue)
{
QByteArray ba;
ba.resize(9);
ba[0] = 0xff;
ba[1]=0xaa;
ba[2] = ID&0x1F;
ba[3] = ((Pvalue&0x80)>>5)+((Ivalue&0x80)>>6)+((Dvalue&0x80)>>7);
ba[4] = Pvalue&0x7F;
ba[5] = Ivalue&0x7F;
ba[6] = Dvalue&0x7F;
ba[7] = (ba.at(2)^ba.at(3)^ba.at(4)^ba.at(5)^ba.at(6))&0x7F;
ba[8] =0xfe;
this->serialSend(ba);
}
void SAM::setPDQuick(quint8 ID, quint8 Pvalue, quint8 Dvalue)
{
QByteArray ba;
ba.resize(7);
ba[0] = 0xff;
ba[1]=0xbb;
ba[2] = (ID&0x1F)+((Pvalue&0x80)>>1)+((Dvalue&0x80)>>2);
ba[3] = Pvalue&0x7F;
ba[4] = Dvalue&0x7F;
ba[5] = (ba.at(2)^ba.at(3)^ba.at(4))&0x7F;
ba[6] =0xfe;
this->serialSend(ba);
}
void SAM::getAllPos12()
{
QByteArray ba;
ba.resize(3);
ba[0] = 0xff;
ba[1] = 0xcc;
ba[2] =0xfe;
this->serialSend(ba);
}
void SAM::getAllPos12Full()
{
QByteArray ba;
ba.resize(3);
ba[0] = 0xff;
ba[1] = 0x99;
ba[2] =0xfe;
this->serialSend(ba);
}
void SAM::getAllPos8Torq8()
{
QByteArray ba;
ba.resize(3);
ba[0] = 0xff;
ba[1] = 0xec;
ba[2] =0xfe;
this->serialSend(ba);
}
void SAM::setAllPassive()
{
QByteArray ba;
ba.resize(3);
ba[0] = 0xff;
ba[1] = 0x88;
ba[2] =0xfe;
this->serialSend(ba);
}
void SAM::SAM_Power_enable(quint8 state)
{
if(state)
state=1;
else
state=0;
QByteArray ba;
ba.resize(4);
ba[0] = 0xff;
ba[1] = 0x81;
ba[2] = state;
ba[3] =0xfe;
this->serialSend(ba);
}
void SAM::setAllPos12(quint16 *Pos, quint8 numOfSam)
{
QByteArray ba;
ba.resize(numOfSam*4+3);
ba[0] = 0xff;
ba[1] = 0xf0;
quint8 refIndex=2;
for(quint8 i=0; i<numOfSam;i++)
{
if((*(Pos+i)>400)&&(*(Pos+i)<3701))
{
ba[refIndex++]=i;//id
ba[refIndex++]=(*(Pos+i)>>7)&0x7F;
ba[refIndex++]=*(Pos+i)&0x7F;
ba[refIndex++]=(ba.at(refIndex-3)^ba.at(refIndex-2)^ba.at(refIndex-1))&0x7F;
}
}
ba[refIndex] =0xfe;
this->serialSend(ba);
}
void SAM::setAllAverageTorque(quint16 *Atorq, quint8 numOfSam)
{
QByteArray ba;
ba.resize(numOfSam+3);
ba[0] = 0xff;
ba[1] = 0xbd;
quint8 refIndex=2;
for(quint8 i=0; i<numOfSam;i++)
{
if(*(Atorq+i)<4001)
{
ba[refIndex++]=i;//id
ba[refIndex++]=(*(Atorq+i)>>7)&0x7F;
ba[refIndex++]=*(Atorq+i)&0x7F;
ba[refIndex++]=(ba.at(refIndex-3)^ba.at(refIndex-2)^ba.at(refIndex-1))&0x7F;
}
}
ba[refIndex] =0xfe;
this->serialSend(ba);
}
void SAM::getAllAverageTorque()
{
QByteArray ba;
ba.resize(3);
ba[0] = 0xff;
ba[1] = 0xbf;
ba[2] =0xfe;
this->serialSend(ba);
}
void SAM::setAllPDQuick(quint8 *Pvalue, quint8 *Dvalue, quint8 numOfSam)
{
QByteArray ba;
ba.resize(numOfSam+3);
ba[0] = 0xff;
ba[1] = 0xc1;
quint8 refIndex=2;
for(quint8 i=0; i<numOfSam;i++)
{
ba[refIndex++]=(i&0x1F)+(((*(Pvalue+i))&0x80)>>1)+(((*(Dvalue+i))&0x80)>>2);//id
ba[refIndex++]=(*(Pvalue+i))&0x7F;
ba[refIndex++]=(*(Dvalue+i))&0x7F;
ba[refIndex++]=(ba.at(refIndex-3)^ba.at(refIndex-2)^ba.at(refIndex-1))&0x7F;
}
ba[refIndex] =0xfe;
this->serialSend(ba);
}
void SAM::getAllPDQuick()
{
QByteArray ba;
ba.resize(3);
ba[0] = 0xff;
ba[1] = 0xc3;
ba[2] =0xfe;
this->serialSend(ba);
}
void SAM::serialReceived()
{
QByteArray myData;
myData=serial->readAll();
qDebug()<<"size: "<<myData.size()<<" Data: "<<myData;
myData.remove(0,myData.indexOf(0xff));
qDebug()<<myData;
if((myData.at(0)==(char)0xff)&&(myData.at(myData.size()-1)==(char)0xfe))
{
emit packageAvailable(myData);
//
}
else{
qDebug()<<"error receive package: "<<myData.at(0)<<" "<<myData.at(myData.size()-1);
}
// QString mystring;
// mystring=serial->readAll();
// qDebug()<<mystring << " "<<mystring.indexOf("\r\n") <<" "<<mystring.count();
}
|
7f8634f74133fb0c87d4cc732a5891ae799a568e | 27a7b51c853902d757c50cb6fc5774310d09385a | /[Client]LUNA/ExitManager.cpp | 66d0d8971922b840c8cf7398f86454ba82fc830a | [] | no_license | WildGenie/LUNAPlus | f3ce20cf5b685efe98ab841eb1068819d2314cf3 | a1d6c24ece725df097ac9a975a94139117166124 | refs/heads/master | 2021-01-11T05:24:16.253566 | 2015-06-19T21:34:46 | 2015-06-19T21:34:46 | 71,666,622 | 4 | 2 | null | 2016-10-22T21:27:35 | 2016-10-22T21:27:34 | null | UHC | C++ | false | false | 6,347 | cpp | ExitManager.cpp | // ExitManager.cpp: implementation of the CExitManager class.
//
//////////////////////////////////////////////////////////////////////
#include "stdafx.h"
#include "ExitManager.h"
#include "ChatManager.h"
#include "ObjectManager.h"
#include "ObjectStateManager.h"
#include "MoveManager.h"
#include "WindowIDEnum.h"
#include "./Interface/cWindowManager.h"
#include "cMsgBox.h"
#include "MainGame.h"
#include "PKManager.h"
#include "MHTimeManager.h"
extern HWND _g_hWnd;
// 070122 LYW --- Include header file.
#include "cResourceManager.h"
#include "StreetStallManager.h"
#include "ItemManager.h"
GLOBALTON(CExitManager);
//////////////////////////////////////////////////////////////////////
// Construction/Destruction
//////////////////////////////////////////////////////////////////////
CExitManager::CExitManager()
{
m_bExitProcessing = FALSE;
m_dwStartTime = 0;
m_nExitCount = EXIT_COUNT;
m_nCount = 0;
m_bExitSync = FALSE;
}
CExitManager::~CExitManager()
{
}
int CExitManager::CanExit()
{
if( HERO->IsPKMode() ) //PK모드중엔 종료할 수 없습니다.
return eEXITCODE_PKMODE;
if( PKMGR->IsPKLooted() ) //PK루팅을 당하는 중에는 종료할 수 없다.
return eEXITCODE_LOOTING;
if( HERO->GetState() == eObjectState_Exchange ) //교환중엔 종료할 수 없다.
return eEXITCODE_NOT_ALLOW_STATE;
if( HERO->GetState() == eObjectState_StreetStall_Owner ||
HERO->GetState() == eObjectState_StreetStall_Guest ) //노점중엔 종료할 수 없다.
return eEXITCODE_NOT_ALLOW_STATE;
if( HERO->GetState() == eObjectState_Deal ) //상점 이용중엔 종료할 수 없다.
return eEXITCODE_NOT_ALLOW_STATE;
return eEXITCODE_OK;
}
BOOL CExitManager::SendExitMsg( int nExitKind )
{
if( m_bExitSync || m_bExitProcessing ) return FALSE;
m_nExitKind = nExitKind;
m_bExitSync = TRUE;
////
if( HERO->GetState() == eObjectState_StreetStall_Owner )
{
STREETSTALLMGR->CloseStreetStall();
}
HERO->DisableAutoAttack(); //자동 공격 취소
HERO->SetNextAction(NULL); //스킬 취소
MOVEMGR->HeroMoveStop(); //이동멈춤
OBJECTSTATEMGR->StartObjectState( HERO, eObjectState_Exit );
////
MSGBASE msg;
msg.Category = MP_CHAR;
msg.Protocol = MP_CHAR_EXITSTART_SYN;
msg.dwObjectID = HEROID;
NETWORK->Send( &msg, sizeof(msg) );
return TRUE;
}
void CExitManager::StartExit() //Start_Ack
{
ITEMMGR->SetDisableDialog(TRUE, eItemTable_Inventory);
ITEMMGR->SetDisableDialog(TRUE, eItemTable_Storage);
//m_bExitSync = FALSE; //여기선 false로 만들지 않는다. 카운트끝나고씀
m_bExitProcessing = TRUE;
DWORD dwCurTime = MHTIMEMGR->GetNewCalcCurTime();
m_dwStartTime = dwCurTime - 1000; //시작하자마자 카운트를 하기위해서 -1000
m_nCount = m_nExitCount;
}
void CExitManager::RejectExit( int nExitCode ) //Start_Nack
{
m_bExitSync = FALSE;
OBJECTSTATEMGR->EndObjectState( HERO, eObjectState_Exit );
ITEMMGR->SetDisableDialog(FALSE, eItemTable_Inventory);
ITEMMGR->SetDisableDialog(FALSE, eItemTable_Storage);
switch( nExitCode )
{
case eEXITCODE_PKMODE:
CHATMGR->AddMsg( CTC_SYSMSG, CHATMGR->GetChatMsg(552) ); // "살기를 드러낸 상태에서는 종료할 수 없습니다."
break;
case eEXITCODE_LOOTING:
CHATMGR->AddMsg( CTC_SYSMSG, CHATMGR->GetChatMsg(553) ); //"루팅을 당하는 중에는 종료할 수 없습니다."
break;
default:
// 070622 LYW --- GlobalEventFunc : 메시지 번호 수정.
CHATMGR->AddMsg( CTC_SYSMSG, CHATMGR->GetChatMsg(219) ); //"종료할 수 없는 상태입니다."
break;
}
}
void CExitManager::Exit()
{
if( m_nExitKind == eEK_GAMEEXIT )
{
// MAINGAME->SetGameState( eGAMESTATE_END );
WINDOWMGR->MsgBox( MBI_NOBTNMSGBOX, MBT_NOBTN, CHATMGR->GetChatMsg( 307 ) );
PostMessage( _g_hWnd, WM_CLOSE, NULL, NULL );
}
else if( m_nExitKind == eEK_CHARSEL )
{
MSGBASE data;
data.Category = MP_USERCONN;
data.Protocol = MP_USERCONN_BACKTOCHARSEL_SYN;
data.dwObjectID = HEROID;
NETWORK->Send(&data,sizeof(data));
WINDOWMGR->MsgBox(
MBI_NOBTNMSGBOX,
MBT_NOBTN,
RESRCMGR->GetMsg(262));
}
m_bExitSync = FALSE; //확실하게 하려면....?
}
void CExitManager::CancelExit( int nErrorCode ) //죽거나 기타요인에 의해서 취소됨
{
m_bExitProcessing = FALSE;
m_bExitSync = FALSE;
OBJECTSTATEMGR->EndObjectState( HERO, eObjectState_Exit );
ITEMMGR->SetDisableDialog(FALSE, eItemTable_Inventory);
ITEMMGR->SetDisableDialog(FALSE, eItemTable_Storage);
switch( nErrorCode )
{
case eEXITCODE_PKMODE:
CHATMGR->AddMsg( CTC_SYSMSG, CHATMGR->GetChatMsg(552) );
break;
case eEXITCODE_LOOTING:
CHATMGR->AddMsg( CTC_SYSMSG, CHATMGR->GetChatMsg(553) );
break;
case eEXITCODE_SPEEDHACK:
CHATMGR->AddMsg( CTC_SYSMSG, CHATMGR->GetChatMsg(556) );
break;
case eEXITCODE_DIEONEXIT:
CHATMGR->AddMsg( CTC_SYSMSG, CHATMGR->GetChatMsg(555) );
break;
default:
// 070622 LYW --- GlobalEventFunc : 메시지 번호 수정.
CHATMGR->AddMsg( CTC_SYSMSG, CHATMGR->GetChatMsg(219) );
break;
}
}
void CExitManager::Process()
{
if( !m_bExitProcessing || !m_bExitSync ) return;
if( gCurTime - m_dwStartTime >= 1000 ) //1초마다 체크
{
m_dwStartTime += 1000;
if( m_nCount <= 0 )
{
m_bExitProcessing = FALSE;
MSGBASE msg;
msg.Category = MP_CHAR;
msg.Protocol = MP_CHAR_EXIT_SYN;
msg.dwObjectID = HEROID;
NETWORK->Send( &msg, sizeof(msg) );
}
else
{
// 070125 LYW --- Modified this part.
/*
if( m_nExitKind == eEK_GAMEEXIT )
CHATMGR->AddMsg( CTC_SYSMSG, CHATMGR->GetChatMsg( 540 ), m_nCount );
else if( m_nExitKind == eEK_CHARSEL )
CHATMGR->AddMsg( CTC_SYSMSG, CHATMGR->GetChatMsg( 541 ), m_nCount );
*/
// 080922 LYW --- ExitManager : 접속종료/캐릭터 선택화면은 단축창과 메인창에 모두 출력되도록 수정(원상미)
//if( m_nExitKind == eEK_GAMEEXIT )
// CHATMGR->AddMsg( CTC_SYSMSG, CHATMGR->GetChatMsg( 300 ), m_nCount );
//else if( m_nExitKind == eEK_CHARSEL )
// CHATMGR->AddMsg( CTC_SYSMSG, CHATMGR->GetChatMsg( 218 ), m_nCount );
if( m_nExitKind == eEK_GAMEEXIT )
CHATMGR->AddMsg( CTC_EXITCOUNT, CHATMGR->GetChatMsg( 300 ), m_nCount );
else if( m_nExitKind == eEK_CHARSEL )
CHATMGR->AddMsg( CTC_EXITCOUNT, CHATMGR->GetChatMsg( 218 ), m_nCount );
}
--m_nCount; //카운트다운
}
}
|
e91e042c5ba8bb3716cfa1840754b051ed343a6e | b6027f686e77978c3cc238c4b4af3fb7c4872b57 | /Go.cpp | 0dfa660e0de1bcfad1dd854c63b6229f5fa84b60 | [] | no_license | udalov/russianaicup2015 | 13cb7f61c329a4a6be49161b2aa0f521ed4498da | 7ca5e5ba69a84984824f26be172950c886632cac | refs/heads/master | 2020-09-13T10:54:46.078142 | 2016-08-24T19:29:03 | 2016-08-24T19:29:03 | 66,493,454 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 1,498 | cpp | Go.cpp | #include "Go.h"
#include <sstream>
using namespace std;
bool Go::operator==(const Go& other) const {
return enginePower == other.enginePower &&
wheelTurn == other.wheelTurn &&
brake == other.brake &&
throwProjectile == other.throwProjectile &&
useNitro == other.useNitro &&
spillOil == other.spillOil;
}
void Go::applyTo(const Car& car, Move& move) const {
move.setEnginePower(enginePower);
switch (wheelTurn) {
case WheelTurnDirection::TURN_LEFT: move.setWheelTurn(-1.0); break;
case WheelTurnDirection::KEEP: move.setWheelTurn(car.getWheelTurn()); break;
case WheelTurnDirection::TURN_RIGHT: move.setWheelTurn(1.0); break;
}
move.setBrake(brake);
move.setThrowProjectile(throwProjectile);
move.setUseNitro(useNitro);
move.setSpillOil(spillOil);
}
string Go::toString() const {
ostringstream ss;
ss.precision(3);
ss << fixed << "(" << enginePower << " ";
switch (wheelTurn) {
case WheelTurnDirection::TURN_LEFT: ss << "TURN_LEFT"; break;
case WheelTurnDirection::KEEP: ss << "KEEP"; break;
case WheelTurnDirection::TURN_RIGHT: ss << "TURN_RIGHT"; break;
}
if (brake) ss << " BRAKE";
if (throwProjectile) ss << " FIRE";
if (useNitro) ss << " NITRO";
if (spillOil) ss << " OIL";
ss << ")";
return ss.str();
}
ostream& operator<<(ostream& out, const Go& move) {
out << move.toString();
return out;
}
|
c36cfbbb80d21894b8bd2d6c5107a9f4bddec592 | 6f224b734744e38062a100c42d737b433292fb47 | /libc/src/__support/OSUtil/fuchsia/io.h | 150d92d56eb6508bb86def2e5cd06e0930f3ad7c | [
"NCSA",
"LLVM-exception",
"Apache-2.0"
] | permissive | smeenai/llvm-project | 1af036024dcc175c29c9bd2901358ad9b0e6610e | 764287f1ad69469cc264bb094e8fcdcfdd0fcdfb | refs/heads/main | 2023-09-01T04:26:38.516584 | 2023-08-29T21:11:41 | 2023-08-31T22:16:12 | 216,062,316 | 0 | 0 | Apache-2.0 | 2019-10-18T16:12:03 | 2019-10-18T16:12:03 | null | UTF-8 | C++ | false | false | 849 | h | io.h | //===------------- Fuchsia implementation of IO utils -----------*- C++ -*-===//
//
// 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
//
//===----------------------------------------------------------------------===//
#ifndef LLVM_LIBC_SRC_SUPPORT_OSUTIL_FUCHSIA_IO_H
#define LLVM_LIBC_SRC_SUPPORT_OSUTIL_FUCHSIA_IO_H
#ifndef LIBC_COPT_TEST_USE_FUCHSIA
#error this file should only be used by tests
#endif
#include "src/__support/CPP/string_view.h"
#include <zircon/sanitizer.h>
namespace __llvm_libc {
LIBC_INLINE void write_to_stderr(cpp::string_view msg) {
__sanitizer_log_write(msg.data(), msg.size());
}
} // namespace __llvm_libc
#endif // LLVM_LIBC_SRC_SUPPORT_OSUTIL_FUCHSIA_IO_H
|
c67983ebad6a20af2869678a5489858ed05854f3 | 98b1e51f55fe389379b0db00365402359309186a | /homework_6/problem_2/100x100/0.03/T | 80dc25596e6de51dfc6b67c6a42b87eede2c4c4d | [] | no_license | taddyb/597-009 | f14c0e75a03ae2fd741905c4c0bc92440d10adda | 5f67e7d3910e3ec115fb3f3dc89a21dcc9a1b927 | refs/heads/main | 2023-01-23T08:14:47.028429 | 2020-12-03T13:24:27 | 2020-12-03T13:24:27 | 311,713,551 | 1 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 115,563 | T | /*--------------------------------*- C++ -*----------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | Website: https://openfoam.org
\\ / A nd | Version: 8
\\/ M anipulation |
\*---------------------------------------------------------------------------*/
FoamFile
{
version 2.0;
format ascii;
class volScalarField;
location "0.03";
object T;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
dimensions [0 0 0 1 0 0 0];
internalField nonuniform List<scalar>
10000
(
49.9301
5.59246
-4.6841
-3.01305
-0.441153
0.556263
0.563846
0.325327
0.142318
0.0508893
0.015186
0.00371532
0.000674728
4.53886e-05
-3.09247e-05
-1.9541e-05
-7.66501e-06
-2.45871e-06
-6.93861e-07
-1.77578e-07
-4.18288e-08
-9.13135e-09
-1.84995e-09
-3.46292e-10
-5.91097e-11
-8.9119e-12
-1.08636e-12
-6.98793e-14
1.42382e-14
7.74241e-15
2.30725e-15
5.61803e-16
1.22006e-16
2.44392e-17
4.58763e-18
8.13333e-19
1.36602e-19
2.17193e-20
3.25294e-21
4.53659e-22
5.74591e-23
6.21631e-24
4.61146e-25
-1.49042e-26
-1.61593e-26
-4.58208e-27
-1.00054e-27
-1.92343e-28
-3.40501e-29
-5.66297e-30
-8.93545e-31
-1.34355e-31
-1.92643e-32
-2.62643e-33
-3.37891e-34
-4.03679e-35
-4.3241e-36
-3.77592e-37
-1.66535e-38
3.07773e-39
1.19459e-39
2.69135e-40
5.04464e-41
8.54206e-42
1.3489e-42
2.01629e-43
2.87357e-44
3.91542e-45
5.09677e-46
6.30948e-47
7.35233e-48
7.89474e-49
7.43567e-50
5.26126e-51
4.06985e-53
-8.36624e-53
-2.2569e-53
-4.39356e-54
-7.4309e-55
-1.15432e-55
-1.68616e-56
-2.34252e-57
-3.11147e-58
-3.95651e-59
-4.80594e-60
-5.54036e-61
-5.97913e-62
-5.86673e-63
-4.86112e-64
-2.52637e-65
1.66656e-66
8.32682e-67
1.81127e-67
3.16769e-68
4.95813e-69
7.21753e-70
9.94326e-71
1.30741e-71
1.64853e-72
1.80636e-73
94.5118
49.6606
13.432
-2.32037
-4.86883
-3.09836
-1.30316
-0.380411
-0.0557877
0.0173488
0.0185976
0.00965714
0.00386601
0.00131766
0.000397563
0.000108169
2.6757e-05
6.01949e-06
1.22053e-06
2.17223e-07
3.14818e-08
2.68014e-09
-3.73138e-10
-2.75613e-10
-9.48838e-11
-2.59967e-11
-6.27581e-12
-1.38622e-12
-2.85142e-13
-5.51038e-14
-1.00417e-14
-1.72519e-15
-2.78142e-16
-4.16096e-17
-5.63426e-18
-6.49403e-19
-5.10511e-20
1.82153e-21
2.03239e-21
6.07284e-22
1.3964e-22
2.82232e-23
5.24405e-24
9.13866e-25
1.50847e-25
2.36906e-26
3.54259e-27
5.02971e-28
6.72882e-29
8.34724e-30
9.26897e-31
8.36953e-32
3.77252e-33
-7.44834e-34
-2.96009e-34
-6.86921e-35
-1.32644e-35
-2.31263e-36
-3.75749e-37
-5.77443e-38
-8.45411e-39
-1.18238e-39
-1.5785e-40
-2.00225e-41
-2.38821e-42
-2.62127e-43
-2.51752e-44
-1.80299e-45
-9.20877e-48
3.13032e-47
8.51752e-48
1.68519e-48
2.90069e-49
4.58664e-50
6.81831e-51
9.63587e-52
1.30126e-52
1.68114e-53
2.07295e-54
2.42299e-55
2.64637e-56
2.6187e-57
2.1682e-58
1.0695e-59
-9.58772e-61
-4.25008e-61
-9.17647e-62
-1.61214e-62
-2.54348e-63
-3.73652e-64
-5.19652e-65
-6.8967e-66
-8.76265e-67
-1.06538e-67
-1.23428e-68
-1.34937e-69
-1.36417e-70
-1.21771e-71
-8.31958e-73
-1.73196e-74
105.183
86.1616
49.0994
18.3297
2.59124
-2.17713
-2.24197
-1.28956
-0.567854
-0.207111
-0.0642295
-0.0169035
-0.00362488
-0.000534724
5.84873e-06
4.30166e-05
2.11827e-05
7.51384e-06
2.26061e-06
6.08278e-07
1.49912e-07
3.42512e-08
7.29665e-09
1.45107e-09
2.68415e-10
4.5695e-11
6.98519e-12
9.00686e-13
7.77366e-14
-3.68226e-15
-4.02817e-15
-1.31244e-15
-3.29826e-16
-7.27067e-17
-1.46922e-17
-2.77629e-18
-4.95472e-19
-8.39003e-20
-1.34928e-20
-2.05544e-21
-2.94448e-22
-3.9055e-23
-4.6354e-24
-4.49033e-25
-2.26596e-26
4.10731e-27
1.79581e-27
4.43387e-28
9.05022e-29
1.66272e-29
2.84081e-30
4.58342e-31
7.03603e-32
1.03078e-32
1.44052e-33
1.91247e-34
2.3893e-35
2.75412e-36
2.80052e-37
2.19519e-38
4.34635e-40
-3.19997e-40
-9.68213e-41
-2.0261e-41
-3.64445e-42
-5.99184e-43
-9.23644e-44
-1.35135e-44
-1.88733e-45
-2.52039e-46
-3.21241e-47
-3.88431e-48
-4.39854e-49
-4.53879e-50
-3.98801e-51
-2.30725e-52
1.08064e-53
6.89692e-54
1.59943e-54
2.93158e-55
4.78121e-56
7.2304e-57
1.03273e-57
1.4057e-58
1.83022e-59
2.27943e-60
2.70548e-61
3.03297e-62
3.15209e-63
2.91229e-64
2.11759e-65
5.24985e-67
-2.15195e-67
-6.23183e-68
-1.20438e-68
-1.98922e-69
-3.00047e-70
-4.24601e-71
-5.71845e-72
-6.63357e-73
103.26
103.444
80.8597
48.3253
22.1936
7.57971
1.56977
-0.151072
-0.351631
-0.218872
-0.0990918
-0.0373989
-0.0123543
-0.00365393
-0.000978025
-0.00023755
-5.205e-05
-1.00831e-05
-1.63327e-06
-1.80422e-07
6.14753e-09
1.16528e-08
4.61555e-09
1.37303e-09
3.53636e-10
8.27127e-11
1.79518e-11
3.65561e-12
7.02303e-13
1.27517e-13
2.18458e-14
3.50995e-15
5.21877e-16
6.97403e-17
7.76893e-18
5.28757e-19
-5.1397e-20
-3.21353e-20
-9.05621e-21
-2.04548e-21
-4.11088e-22
-7.63645e-23
-1.33447e-23
-2.21323e-24
-3.49786e-25
-5.27129e-26
-7.55496e-27
-1.02265e-27
-1.2886e-28
-1.46532e-29
-1.38772e-30
-7.74645e-32
8.2013e-33
4.06456e-33
9.90606e-34
1.96176e-34
3.48103e-35
5.73792e-36
8.9334e-37
1.32449e-37
1.87653e-38
2.54052e-39
3.27503e-40
3.98612e-41
4.5012e-42
4.53662e-43
3.66026e-44
1.2522e-45
-3.53106e-46
-1.17795e-46
-2.48263e-47
-4.41997e-48
-7.15055e-49
-1.08211e-49
-1.55296e-50
-2.12735e-51
-2.78778e-52
-3.49006e-53
-4.15156e-54
-4.63737e-55
-4.74528e-56
-4.19072e-57
-2.59407e-58
5.26365e-60
5.75135e-60
1.37418e-60
2.5197e-61
4.07816e-62
6.10136e-63
8.61034e-64
1.15739e-64
1.48814e-65
1.83094e-66
2.14843e-67
2.38424e-68
2.45901e-69
2.26721e-70
1.67535e-71
5.16361e-73
-1.10772e-73
99.85
107.504
99.745
73.8994
44.145
21.7567
8.99156
3.12613
0.896452
0.195347
0.0205284
-0.00794792
-0.0065852
-0.00299565
-0.00108786
-0.000344135
-9.82433e-05
-2.57641e-05
-6.26691e-06
-1.42066e-06
-3.00405e-07
-5.90532e-08
-1.06866e-08
-1.74069e-09
-2.41339e-10
-2.34684e-11
4.73297e-13
1.0738e-12
3.83291e-13
1.02531e-13
2.38607e-14
5.07269e-15
1.00696e-15
1.8873e-16
3.35894e-17
5.68934e-18
9.16472e-19
1.3984e-19
2.00304e-20
2.64401e-21
3.08548e-22
2.82169e-23
8.94113e-25
-4.36928e-25
-1.57021e-25
-3.7328e-26
-7.54321e-27
-1.38581e-27
-2.3792e-28
-3.8684e-29
-5.99658e-30
-8.88638e-31
-1.25843e-31
-1.69675e-32
-2.15999e-33
-2.55227e-34
-2.69664e-35
-2.29792e-36
-8.97696e-38
2.17565e-38
7.8557e-39
1.73743e-39
3.22679e-40
5.43273e-41
8.54563e-42
1.27391e-42
1.81225e-43
2.46679e-44
3.2104e-45
3.97736e-46
4.64491e-47
5.01095e-48
4.76878e-49
3.48098e-50
5.55981e-52
-4.76675e-52
-1.34151e-52
-2.64551e-53
-4.50204e-54
-7.01838e-55
-1.02753e-55
-1.42968e-56
-1.90094e-57
-2.41881e-58
-2.93906e-59
-3.38802e-60
-3.65425e-61
-3.5802e-62
-2.95507e-63
-1.51058e-64
1.07828e-65
5.18454e-66
1.12092e-66
1.95464e-67
3.05287e-68
4.43501e-69
6.09625e-70
7.99427e-71
1.00464e-71
1.09401e-72
97.95
106.477
107.922
89.879
60.9893
34.5326
16.7247
7.06583
2.64079
0.880814
0.263052
0.0700634
0.0163674
0.00319732
0.000442098
-7.71388e-07
-2.96372e-05
-1.41753e-05
-4.88068e-06
-1.43399e-06
-3.79575e-07
-9.27605e-08
-2.12017e-08
-4.56535e-09
-9.29637e-10
-1.79216e-10
-3.26577e-11
-5.59686e-12
-8.92347e-13
-1.29375e-13
-1.61559e-14
-1.44994e-15
1.27147e-17
4.98898e-17
1.66464e-17
4.1274e-18
8.91347e-19
1.76388e-19
3.27095e-20
5.7491e-21
9.63399e-22
1.54306e-22
2.36187e-23
3.44443e-24
4.75272e-25
6.11882e-26
7.13787e-27
7.00767e-28
4.30196e-29
-3.33137e-30
-1.95452e-30
-4.97187e-31
-1.01377e-31
-1.84493e-32
-3.11492e-33
-4.96668e-34
-7.54599e-35
-1.09702e-35
-1.5274e-36
-2.03251e-37
-2.56986e-38
-3.05044e-39
-3.31599e-40
-3.11087e-41
-2.04974e-42
4.16513e-44
5.03131e-44
1.27513e-44
2.47416e-45
4.23294e-46
6.68959e-47
9.96756e-48
1.41435e-48
1.91994e-49
2.49562e-50
3.09855e-51
3.6501e-52
4.02289e-53
4.02672e-54
3.39442e-55
1.76998e-56
-1.29809e-57
-6.35372e-58
-1.4015e-58
-2.49337e-59
-3.97248e-60
-5.88576e-61
-8.24989e-62
-1.10304e-62
-1.41146e-63
-1.72796e-64
-2.01548e-65
-2.21825e-66
-2.25789e-67
-2.03023e-68
-1.40346e-69
-2.18729e-71
1.70543e-71
4.58013e-72
7.54498e-73
97.3079
104.771
110.423
97.8333
71.0979
43.2491
22.5906
10.3548
4.23662
1.56766
0.529846
0.164776
0.0473895
0.0126399
0.00312756
0.00071564
0.000150094
2.82742e-05
4.55165e-06
5.31667e-07
1.89247e-09
-2.48247e-08
-1.0449e-08
-3.1764e-09
-8.30649e-10
-1.9736e-10
-4.3653e-11
-9.10364e-12
-1.80294e-12
-3.40432e-13
-6.1389e-14
-1.05685e-14
-1.73249e-15
-2.68854e-16
-3.90465e-17
-5.18585e-18
-5.96677e-19
-4.97693e-20
2.9746e-22
1.44306e-21
4.52271e-22
1.05291e-22
2.13967e-23
3.99472e-24
7.00775e-25
1.16834e-25
1.86224e-26
2.84517e-27
4.16687e-28
5.83486e-29
7.76498e-30
9.70383e-31
1.11142e-31
1.10149e-32
7.77039e-34
-1.17144e-35
-1.95781e-35
-5.27384e-36
-1.07715e-36
-1.9344e-37
-3.20509e-38
-5.00444e-39
-7.44146e-40
-1.05916e-40
-1.44533e-41
-1.88838e-42
-2.35092e-43
-2.76067e-44
-2.99571e-45
-2.86711e-46
-2.10024e-47
-3.16512e-49
2.98065e-49
8.41068e-50
1.67042e-50
2.86655e-51
4.50969e-52
6.66716e-53
9.37404e-54
1.26056e-54
1.62407e-55
2.00144e-56
2.34627e-57
2.58575e-58
2.61408e-59
2.2861e-60
1.4126e-61
-2.41357e-63
-2.95297e-63
-7.03046e-64
-1.27911e-64
-2.05254e-65
-3.04431e-66
-4.25995e-67
-5.67978e-68
-7.24691e-69
-8.85292e-70
-1.0322e-70
-1.14026e-71
-1.07712e-72
97.2107
103.671
110.795
101.113
76.1443
48.1316
26.1834
12.5311
5.37018
2.08958
0.746372
0.246856
0.0761233
0.0220062
0.00598928
0.00153952
0.000374555
8.6343e-05
1.88551e-05
3.89299e-06
7.56528e-07
1.3713e-07
2.27695e-08
3.32652e-09
3.80761e-10
1.6195e-11
-8.39009e-12
-3.75715e-12
-1.09089e-12
-2.67402e-13
-5.93414e-14
-1.22726e-14
-2.4002e-15
-4.47542e-16
-7.99285e-17
-1.37048e-17
-2.25733e-18
-3.56754e-19
-5.39225e-20
-7.7445e-21
-1.04419e-21
-1.29015e-22
-1.38056e-23
-1.05868e-24
1.32266e-26
2.95276e-26
8.60139e-27
1.88764e-27
3.63498e-28
6.45199e-29
1.07883e-29
1.71823e-30
2.6216e-31
3.84147e-32
5.40606e-33
7.28834e-34
9.35821e-35
1.13132e-35
1.25829e-36
1.2205e-37
8.67273e-39
-2.39456e-41
-1.76551e-40
-4.77509e-41
-9.58383e-42
-1.68299e-42
-2.72269e-43
-4.14948e-44
-6.02341e-45
-8.37274e-46
-1.11644e-46
-1.42627e-47
-1.73756e-48
-1.99864e-49
-2.12742e-50
-2.00255e-51
-1.45462e-52
-2.58759e-54
1.86947e-54
5.27193e-55
1.03359e-55
1.74674e-56
2.70453e-57
3.93486e-58
5.44531e-59
7.2091e-60
9.14705e-61
1.11056e-61
1.28317e-62
1.3945e-63
1.39116e-64
1.20206e-65
7.37139e-67
-1.12436e-68
-1.4714e-68
-3.47408e-69
-6.25325e-70
-9.92275e-71
-1.45813e-71
-1.80926e-72
97.2529
103.156
110.653
102.249
78.3148
50.4777
28.0558
13.745
6.04206
2.41691
0.889689
0.304104
0.0972253
0.0292479
0.00831955
0.00224672
0.000577937
0.000141994
3.33916e-05
7.528e-06
1.62875e-06
3.38347e-07
6.74686e-08
1.28995e-08
2.35898e-09
4.10798e-10
6.75884e-11
1.03551e-11
1.43415e-12
1.66728e-13
1.20748e-14
-1.11261e-15
-7.64787e-16
-2.28391e-16
-5.46154e-17
-1.16475e-17
-2.30398e-18
-4.3065e-19
-7.68296e-20
-1.31576e-20
-2.16991e-21
-3.45084e-22
-5.29126e-23
-7.80874e-24
-1.10487e-24
-1.48813e-25
-1.88299e-26
-2.18027e-27
-2.16955e-28
-1.48331e-29
4.77381e-31
4.63632e-31
1.23508e-31
2.55253e-32
4.67081e-33
7.91353e-34
1.26663e-34
1.93504e-35
2.83647e-36
3.99813e-37
5.4175e-38
7.03662e-39
8.70538e-40
1.0132e-40
1.08197e-41
9.98949e-43
6.49387e-44
-1.27239e-45
-1.54497e-45
-3.87581e-46
-7.44766e-47
-1.26314e-47
-1.98117e-48
-2.93341e-49
-4.14213e-50
-5.60496e-51
-7.27782e-52
-9.05245e-53
-1.07285e-53
-1.19807e-54
-1.23221e-55
-1.10678e-56
-7.30235e-58
1.40368e-60
1.26755e-59
3.19301e-60
5.96541e-61
9.75604e-62
1.47073e-62
2.08965e-63
2.82857e-64
3.66586e-65
4.55417e-66
5.41132e-67
6.11039e-68
6.46965e-69
6.24352e-70
5.11661e-71
2.68984e-72
-9.84507e-74
97.2972
102.961
110.499
102.577
79.1367
51.4717
28.9128
14.3365
6.38793
2.59411
0.971033
0.338105
0.110322
0.0339407
0.00989553
0.00274581
0.000727741
0.000184792
4.50723e-05
1.05828e-05
2.39636e-06
5.24097e-07
1.1084e-07
2.26878e-08
4.49728e-09
8.63506e-10
1.60569e-10
2.88958e-11
5.02561e-12
8.42745e-13
1.35729e-13
2.0861e-14
3.026e-15
4.0569e-16
4.80106e-17
4.3723e-18
9.53568e-20
-8.88088e-20
-3.12044e-20
-7.62579e-21
-1.60568e-21
-3.09733e-22
-5.61838e-23
-9.7122e-24
-1.61192e-24
-2.57951e-25
-3.98894e-26
-5.96492e-27
-8.61906e-28
-1.20063e-28
-1.605e-29
-2.04225e-30
-2.43658e-31
-2.6436e-32
-2.41566e-33
-1.35717e-34
1.12945e-35
5.90464e-36
1.41526e-36
2.74301e-37
4.76844e-38
7.72095e-39
1.18501e-39
1.73951e-40
2.45319e-41
3.32894e-42
4.34249e-43
5.42516e-44
6.441e-45
7.15803e-46
7.21402e-47
6.07864e-48
3.01516e-49
-2.95231e-50
-1.30573e-50
-2.87822e-51
-5.18061e-52
-8.38869e-53
-1.26652e-53
-1.81272e-54
-2.47978e-55
-3.25411e-56
-4.09768e-57
-4.93751e-58
-5.65334e-59
-6.06409e-60
-5.91419e-61
-4.86145e-62
-2.4691e-63
1.79459e-64
8.54476e-65
1.84508e-65
3.21834e-66
5.03314e-67
7.32805e-68
1.01049e-68
1.33077e-69
1.67963e-70
2.03397e-71
2.13609e-72
97.3211
102.898
110.416
102.651
79.4144
51.85
29.2646
14.5943
6.54658
2.67925
1.01185
0.355878
0.117443
0.0365922
0.0108201
0.00304964
0.000822347
0.000212828
5.30094e-05
1.27365e-05
2.95803e-06
6.65235e-07
1.45085e-07
3.07261e-08
6.32563e-09
1.26708e-09
2.47128e-10
4.69556e-11
8.69459e-12
1.56913e-12
2.75973e-13
4.72807e-14
7.88421e-15
1.27794e-15
2.00928e-16
3.05464e-17
4.46784e-18
6.23614e-19
8.18879e-20
9.83649e-21
1.01052e-21
6.91594e-23
-3.44971e-24
-2.72672e-24
-7.46387e-25
-1.61164e-25
-3.1002e-26
-5.5434e-27
-9.39654e-28
-1.52582e-28
-2.38756e-29
-3.61205e-30
-5.29133e-31
-7.50645e-32
-1.02989e-32
-1.36242e-33
-1.72806e-34
-2.08069e-35
-2.33415e-36
-2.34374e-37
-1.88336e-38
-6.18697e-40
1.92159e-40
6.3732e-41
1.35559e-41
2.44767e-42
4.03022e-43
6.22838e-44
9.16107e-45
1.29164e-45
1.75141e-46
2.2851e-47
2.8628e-48
3.42542e-49
3.87303e-50
4.05123e-51
3.73641e-52
2.62132e-53
3.03154e-55
-3.72233e-55
-1.00562e-55
-1.93747e-56
-3.2384e-57
-4.97411e-58
-7.19331e-59
-9.9103e-60
-1.30816e-60
-1.65757e-61
-2.01368e-62
-2.33419e-63
-2.55547e-64
-2.58797e-65
-2.31214e-66
-1.57579e-67
-1.93949e-69
2.04735e-69
5.38173e-70
1.00451e-70
1.62862e-71
2.15831e-72
97.331
102.881
110.382
102.662
79.4988
51.981
29.3961
14.6964
6.61259
2.71627
1.03032
0.364235
0.120916
0.0379316
0.0113033
0.00321387
0.000875199
0.000229009
5.77411e-05
1.40625e-05
3.31516e-06
7.57922e-07
1.68317e-07
3.63609e-08
7.65053e-09
1.56954e-09
3.14264e-10
6.14628e-11
1.17498e-11
2.19683e-12
4.01898e-13
7.19673e-14
1.26168e-14
2.16566e-15
3.63937e-16
5.98612e-17
9.63244e-18
1.51517e-18
2.32711e-19
3.48387e-20
5.07127e-21
7.15102e-22
9.71249e-23
1.25879e-23
1.53129e-24
1.69083e-25
1.5555e-26
8.12689e-28
-1.04498e-28
-4.80379e-29
-1.16339e-29
-2.32123e-30
-4.18537e-31
-7.06306e-32
-1.13447e-32
-1.75009e-33
-2.60614e-34
-3.75635e-35
-5.24542e-36
-7.09273e-37
-9.26694e-38
-1.1649e-38
-1.39806e-39
-1.57963e-40
-1.63373e-41
-1.44485e-42
-8.46325e-44
3.91462e-45
2.57146e-45
6.07614e-46
1.13656e-46
1.89624e-47
2.9415e-48
4.32338e-49
6.07855e-50
8.21395e-51
1.06852e-51
1.3368e-52
1.60225e-53
1.82497e-54
1.94434e-55
1.87386e-56
1.49643e-57
6.60677e-59
-8.20265e-60
-3.16602e-60
-6.62023e-61
-1.14333e-61
-1.7834e-62
-2.59865e-63
-3.59309e-64
-4.75037e-65
-6.0238e-66
-7.32435e-67
-8.50693e-68
-9.35576e-69
-9.56993e-70
-8.75125e-71
-6.38546e-72
-2.11455e-73
97.3344
102.878
110.369
102.66
79.5219
52.0227
29.4414
14.7336
6.63783
2.73103
1.03798
0.367826
0.122461
0.0385471
0.0115326
0.00329424
0.000901863
0.000237421
6.02744e-05
1.47935e-05
3.51785e-06
8.1207e-07
1.82287e-07
3.98486e-08
8.4947e-09
1.76796e-09
3.59619e-10
7.15584e-11
1.39407e-11
2.66092e-12
4.97936e-13
9.1401e-14
1.64652e-14
2.912e-15
5.05778e-16
8.62926e-17
1.44643e-17
2.3821e-18
3.85428e-19
6.12607e-20
9.56207e-21
1.46507e-21
2.20199e-22
3.24354e-23
4.67634e-24
6.58697e-25
9.04145e-26
1.20483e-26
1.54976e-27
1.90659e-28
2.20747e-29
2.32894e-30
2.06446e-31
1.08855e-32
-1.08798e-33
-5.17049e-34
-1.21376e-34
-2.3296e-35
-4.03205e-36
-6.52609e-37
-1.00486e-37
-1.48524e-38
-2.11753e-39
-2.91854e-40
-3.88975e-41
-5.0048e-42
-6.19213e-43
-7.31177e-44
-8.1257e-45
-8.26184e-46
-7.17262e-47
-4.09053e-48
2.01473e-49
1.24703e-49
2.89145e-50
5.32765e-51
8.77015e-52
1.34397e-52
1.95372e-53
2.72033e-54
3.64612e-55
4.71387e-56
5.87685e-57
7.04663e-58
8.07886e-59
8.75791e-60
8.78146e-61
7.74725e-62
5.14475e-63
3.56131e-65
-7.3286e-65
-1.86755e-65
-3.44426e-66
-5.52784e-67
-8.15764e-68
-1.13275e-68
-1.49602e-69
-1.88749e-70
-2.27767e-71
-2.37023e-72
97.3355
102.877
110.365
102.659
79.5275
52.035
29.4559
14.7462
6.64679
2.73648
1.04091
0.369253
0.123094
0.0388077
0.0116327
0.00333035
0.000914191
0.00024142
6.15126e-05
1.51606e-05
3.62242e-06
8.40757e-07
1.89886e-07
4.17965e-08
8.97871e-09
1.88475e-09
3.87024e-10
7.78216e-11
1.53364e-11
2.96454e-12
5.6248e-13
1.04822e-13
1.9197e-14
3.45678e-15
6.12293e-16
1.06724e-16
1.83114e-17
3.09357e-18
5.14721e-19
8.43592e-20
1.36205e-20
2.16657e-21
3.39528e-22
5.2416e-23
7.97027e-24
1.19342e-24
1.75901e-25
2.55085e-26
3.63702e-27
5.09405e-28
7.00023e-29
9.42293e-30
1.23968e-30
1.58894e-31
1.97501e-32
2.36369e-33
2.69176e-34
2.85417e-35
2.6881e-36
1.95443e-37
3.17805e-39
-2.6725e-39
-7.5966e-40
-1.51666e-40
-2.62086e-41
-4.16105e-42
-6.22188e-43
-8.86626e-44
-1.21077e-44
-1.587e-45
-1.99302e-46
-2.38429e-47
-2.6843e-48
-2.77259e-49
-2.47066e-50
-1.52644e-51
4.018e-53
3.76009e-53
9.10935e-54
1.71281e-54
2.86019e-55
4.43941e-56
6.53886e-57
9.23982e-58
1.26028e-58
1.66487e-59
2.13341e-60
2.65205e-61
3.19386e-62
3.71479e-63
4.14958e-64
4.40814e-65
4.37292e-66
3.89852e-67
2.8147e-68
9.34419e-70
-1.93102e-70
-5.94719e-71
-1.12527e-71
-1.56973e-72
97.3358
102.877
110.364
102.658
79.5287
52.0384
29.4602
14.7502
6.64976
2.73837
1.04197
0.369781
0.123337
0.0389104
0.0116732
0.00334541
0.000919473
0.00024318
6.20718e-05
1.53306e-05
3.67209e-06
8.54731e-07
1.9368e-07
4.27931e-08
9.23244e-09
1.94747e-09
4.02103e-10
8.13517e-11
1.61423e-11
3.14412e-12
6.0159e-13
1.13153e-13
2.09349e-14
3.812e-15
6.8349e-16
1.20727e-16
2.1016e-17
3.60679e-18
6.10458e-19
1.01924e-19
1.67915e-20
2.73011e-21
4.38151e-22
6.94189e-23
1.08589e-23
1.67714e-24
2.55763e-25
3.8511e-26
5.72504e-27
8.40172e-28
1.21696e-28
1.73939e-29
2.4524e-30
3.4094e-31
4.67115e-32
6.3028e-33
8.36812e-34
1.092e-34
1.39856e-35
1.75456e-36
2.15054e-37
2.56585e-38
2.96418e-39
3.28851e-40
3.45591e-41
3.35309e-42
2.83401e-43
1.72175e-44
-1.82373e-46
-3.07835e-46
-7.13005e-47
-1.24042e-47
-1.87771e-48
-2.58004e-49
-3.2514e-50
-3.71983e-51
-3.70544e-52
-2.7808e-53
-3.23762e-55
4.53659e-55
1.29784e-55
2.65462e-56
4.72045e-57
7.73773e-58
1.19962e-58
1.78302e-59
2.561e-60
3.57262e-61
4.85626e-62
6.44597e-63
8.36636e-64
1.06262e-64
1.32112e-65
1.60752e-66
1.91325e-67
2.22506e-68
2.52462e-69
2.78869e-70
2.99196e-71
2.86643e-72
97.3359
102.877
110.364
102.658
79.5289
52.0392
29.4614
14.7514
6.65069
2.73898
1.04232
0.369965
0.123424
0.0389483
0.0116886
0.00335129
0.000921589
0.000243903
6.23073e-05
1.5404e-05
3.69405e-06
8.61054e-07
1.95437e-07
4.32655e-08
9.3555e-09
1.97859e-09
4.09755e-10
8.31837e-11
1.65699e-11
3.24158e-12
6.23292e-13
1.17881e-13
2.19433e-14
4.02277e-15
7.26696e-16
1.29419e-16
2.27333e-17
3.94019e-18
6.74104e-19
1.13877e-19
1.90008e-20
3.13222e-21
5.10251e-22
8.2159e-23
1.30782e-23
2.0584e-24
3.20376e-25
4.93161e-26
7.50847e-27
1.13078e-27
1.68455e-28
2.48244e-29
3.61874e-30
5.21805e-31
7.44224e-32
1.0498e-32
1.46441e-33
2.01981e-34
2.75401e-35
3.71134e-36
4.94187e-37
6.49994e-38
8.4417e-39
1.08211e-39
1.36848e-40
1.70649e-41
2.0972e-42
2.53869e-43
3.02552e-44
3.54873e-45
4.09672e-46
4.65802e-47
5.2266e-48
5.81136e-49
6.45128e-50
7.2386e-51
8.35249e-52
1.01063e-52
1.30119e-53
1.78641e-54
2.58494e-55
3.86812e-56
5.87634e-57
8.93824e-58
1.34925e-58
2.01116e-59
2.95265e-60
4.26504e-61
6.05999e-62
8.47106e-63
1.16543e-63
1.57878e-64
2.10694e-65
2.77127e-66
3.59411e-67
4.59803e-68
5.80495e-69
7.23514e-70
8.91823e-71
9.85196e-72
97.3359
102.877
110.364
102.658
79.529
52.0394
29.4617
14.7517
6.65097
2.73917
1.04244
0.370026
0.123453
0.0389615
0.0116942
0.00335345
0.000922387
0.000244182
6.24004e-05
1.54338e-05
3.70315e-06
8.63735e-07
1.96199e-07
4.34748e-08
9.41123e-09
1.99299e-09
4.13371e-10
8.40681e-11
1.67808e-11
3.29064e-12
6.3445e-13
1.20363e-13
2.24837e-14
4.1381e-15
7.50833e-16
1.34377e-16
2.37334e-17
4.13847e-18
7.12756e-19
1.2129e-19
2.04005e-20
3.39249e-21
5.57933e-22
9.07698e-23
1.46116e-23
2.32776e-24
3.67066e-25
5.73047e-26
8.85807e-27
1.35596e-27
2.05573e-28
3.08699e-29
4.59193e-30
6.76666e-31
9.87868e-32
1.42886e-32
2.04767e-33
2.90751e-34
4.09054e-35
5.70218e-36
7.87598e-37
1.07788e-37
1.46162e-38
1.96382e-39
2.61441e-40
3.44875e-41
4.50805e-42
5.83973e-43
7.49786e-44
9.54378e-45
1.20472e-45
1.50884e-46
1.8762e-47
2.31845e-48
2.85056e-49
3.49278e-50
4.27361e-51
5.23432e-52
6.43546e-53
7.96627e-54
9.9576e-55
1.25995e-55
1.61646e-56
2.10386e-57
2.77586e-58
3.70619e-59
4.99452e-60
6.77353e-61
9.21729e-62
1.25509e-62
1.70611e-63
2.31085e-64
3.11399e-65
4.17021e-66
5.54549e-67
7.31858e-68
9.58228e-69
1.24447e-69
1.60551e-70
1.85449e-71
97.3359
102.877
110.364
102.658
79.529
52.0395
29.4618
14.7518
6.65105
2.73923
1.04247
0.370045
0.123463
0.0389659
0.011696
0.0033542
0.000922671
0.000244284
6.24353e-05
1.54451e-05
3.70671e-06
8.64806e-07
1.9651e-07
4.35621e-08
9.43495e-09
1.99925e-09
4.14975e-10
8.44684e-11
1.68782e-11
3.31376e-12
6.39811e-13
1.21579e-13
2.27538e-14
4.19687e-15
7.63374e-16
1.37004e-16
2.42737e-17
4.24769e-18
7.34466e-19
1.25536e-19
2.12179e-20
3.5475e-21
5.86897e-22
9.6105e-23
1.55808e-23
2.50146e-24
3.9779e-25
6.267e-26
9.78335e-27
1.5136e-27
2.3211e-28
3.52857e-29
5.31833e-30
7.94832e-31
1.17799e-31
1.73147e-32
2.52426e-33
3.6503e-34
5.23639e-35
7.45201e-36
1.05216e-36
1.47394e-37
2.04879e-38
2.82596e-39
3.86825e-40
5.25507e-41
7.08595e-42
9.48465e-43
1.2604e-43
1.66313e-44
2.17954e-45
2.83749e-46
3.67083e-47
4.72084e-48
6.03807e-49
7.68499e-50
9.7396e-51
1.23007e-51
1.54954e-52
1.94895e-53
2.45023e-54
3.08273e-55
3.88602e-56
4.91372e-57
6.23862e-58
7.95941e-59
1.02095e-59
1.31681e-60
1.7075e-61
2.22477e-62
2.91042e-63
3.81893e-64
5.02073e-65
6.60605e-66
8.68944e-67
1.14151e-67
1.49629e-68
1.95553e-69
2.55061e-70
2.98573e-71
97.3359
102.877
110.364
102.657
79.529
52.0395
29.4618
14.7519
6.65107
2.73924
1.04248
0.37005
0.123466
0.0389673
0.0116967
0.00335445
0.000922768
0.00024432
6.24477e-05
1.54493e-05
3.70803e-06
8.65212e-07
1.96631e-07
4.35965e-08
9.44451e-09
2.00182e-09
4.15648e-10
8.46394e-11
1.69206e-11
3.32401e-12
6.42235e-13
1.22139e-13
2.28806e-14
4.22498e-15
7.69485e-16
1.38308e-16
2.45468e-17
4.30391e-18
7.45849e-19
1.27803e-19
2.16625e-20
3.63336e-21
6.03237e-22
9.91706e-23
1.6148e-23
2.60501e-24
4.16451e-25
6.59901e-26
1.03668e-26
1.61489e-27
2.49491e-28
3.82337e-29
5.81278e-30
8.76855e-31
1.3126e-31
1.95006e-32
2.87556e-33
4.2092e-34
6.11673e-35
8.82516e-36
1.26428e-36
1.79855e-37
2.54092e-38
3.56521e-39
4.96869e-40
6.87856e-41
9.46005e-42
1.29262e-42
1.75501e-43
2.36795e-44
3.17548e-45
4.23311e-46
5.61049e-47
7.39478e-48
9.69479e-49
1.26462e-49
1.64185e-50
2.12232e-51
2.73261e-52
3.50618e-53
4.48545e-54
5.72446e-55
7.29264e-56
9.2796e-57
1.18018e-57
1.50113e-58
1.91073e-59
2.43514e-60
3.10877e-61
3.97683e-62
5.09864e-63
6.55185e-64
8.43773e-65
1.08878e-65
1.4072e-66
1.8209e-67
2.35782e-68
3.05346e-69
3.95901e-70
4.6203e-71
97.3359
102.877
110.364
102.657
79.529
52.0395
29.4618
14.7519
6.65107
2.73925
1.04248
0.370052
0.123466
0.0389677
0.0116968
0.00335453
0.000922799
0.000244331
6.24519e-05
1.54507e-05
3.7085e-06
8.65359e-07
1.96675e-07
4.36095e-08
9.44816e-09
2.00282e-09
4.15915e-10
8.47087e-11
1.69381e-11
3.32832e-12
6.43273e-13
1.22384e-13
2.29369e-14
4.23768e-15
7.72294e-16
1.38917e-16
2.46768e-17
4.33115e-18
7.51461e-19
1.28941e-19
2.18894e-20
3.67795e-21
6.1187e-22
1.00819e-22
1.64582e-23
2.66264e-24
4.27017e-25
6.79029e-26
1.07088e-26
1.67532e-27
2.60043e-28
4.00554e-29
6.1238e-30
9.29378e-31
1.40036e-31
2.09517e-32
3.11308e-33
4.5941e-34
6.73439e-35
9.80686e-36
1.41885e-36
2.03967e-37
2.91366e-38
4.13629e-39
5.83597e-40
8.18434e-41
1.14093e-41
1.58119e-42
2.17867e-43
2.98489e-44
4.0667e-45
5.51039e-46
7.42683e-47
9.95787e-48
1.32843e-48
1.76358e-49
2.33033e-50
3.06549e-51
4.01553e-52
5.23916e-53
6.8105e-54
8.82329e-55
1.13963e-55
1.46803e-56
1.88672e-57
2.42023e-58
3.09996e-59
3.96625e-60
5.07106e-61
6.48147e-62
8.28413e-63
1.05912e-63
1.35477e-64
1.73413e-65
2.22141e-66
2.84785e-67
3.65361e-68
4.69011e-69
6.03261e-70
6.99215e-71
97.3359
102.877
110.364
102.657
79.529
52.0395
29.4618
14.7519
6.65107
2.73925
1.04248
0.370052
0.123467
0.0389678
0.0116969
0.00335456
0.000922809
0.000244335
6.24532e-05
1.54512e-05
3.70865e-06
8.65409e-07
1.9669e-07
4.36141e-08
9.4495e-09
2.00319e-09
4.16016e-10
8.47354e-11
1.69449e-11
3.33005e-12
6.43695e-13
1.22485e-13
2.29606e-14
4.24312e-15
7.73519e-16
1.39188e-16
2.47355e-17
4.34365e-18
7.54078e-19
1.2948e-19
2.19988e-20
3.6998e-21
6.16171e-22
1.01653e-22
1.6618e-23
2.6928e-24
4.32637e-25
6.89371e-26
1.08968e-26
1.70909e-27
2.66036e-28
4.11073e-29
6.30637e-30
9.60724e-31
1.45361e-31
2.18472e-32
3.26212e-33
4.83974e-34
7.13535e-35
1.04551e-35
1.5227e-36
2.20451e-37
3.17298e-38
4.54068e-39
6.46118e-40
9.14279e-41
1.28665e-41
1.8009e-42
2.50731e-43
3.47259e-44
4.78481e-45
6.55966e-46
8.94845e-47
1.21481e-47
1.64139e-48
2.20756e-49
2.95573e-50
3.94031e-51
5.23089e-52
6.91631e-53
9.1097e-54
1.1955e-54
1.56351e-55
2.03825e-56
2.64925e-57
3.43404e-58
4.44038e-59
5.7291e-60
7.37773e-61
9.48528e-62
1.21783e-62
1.56189e-63
2.00144e-64
2.5631e-65
3.28099e-66
4.19885e-67
5.37279e-68
6.87447e-69
8.80955e-70
1.0169e-70
97.3359
102.877
110.364
102.657
79.529
52.0395
29.4618
14.7519
6.65107
2.73925
1.04248
0.370052
0.123467
0.0389679
0.0116969
0.00335456
0.000922812
0.000244336
6.24536e-05
1.54513e-05
3.70871e-06
8.65426e-07
1.96696e-07
4.36157e-08
9.44997e-09
2.00333e-09
4.16053e-10
8.47453e-11
1.69475e-11
3.33071e-12
6.4386e-13
1.22525e-13
2.29701e-14
4.24535e-15
7.74029e-16
1.39302e-16
2.47607e-17
4.3491e-18
7.55238e-19
1.29723e-19
2.20489e-20
3.70996e-21
6.18203e-22
1.02054e-22
1.66958e-23
2.70772e-24
4.35462e-25
6.94651e-26
1.09943e-26
1.72687e-27
2.69243e-28
4.16789e-29
6.40713e-30
9.78296e-31
1.48394e-31
2.23651e-32
3.34969e-33
4.98637e-34
7.37849e-35
1.08545e-35
1.58771e-36
2.30937e-37
3.34062e-38
4.80638e-39
6.87872e-40
9.79348e-41
1.38722e-41
1.9551e-42
2.74187e-43
3.82662e-44
5.31507e-45
7.34793e-46
1.01116e-46
1.3852e-47
1.88922e-48
2.56547e-49
3.46907e-50
4.67157e-51
6.26564e-52
8.3709e-53
1.11413e-53
1.47746e-54
1.95243e-55
2.57144e-56
3.37592e-57
4.41869e-58
5.76713e-59
7.50708e-60
9.74791e-61
1.26289e-61
1.63277e-62
2.10704e-63
2.71454e-64
3.49208e-65
4.48659e-66
5.75795e-67
7.38263e-68
9.45794e-69
1.21274e-69
1.3993e-70
97.3359
102.877
110.364
102.657
79.529
52.0395
29.4618
14.7519
6.65107
2.73925
1.04248
0.370052
0.123467
0.0389679
0.0116969
0.00335457
0.000922813
0.000244337
6.24538e-05
1.54514e-05
3.70872e-06
8.65431e-07
1.96697e-07
4.36162e-08
9.45013e-09
2.00337e-09
4.16066e-10
8.47488e-11
1.69485e-11
3.33095e-12
6.43921e-13
1.2254e-13
2.29738e-14
4.24622e-15
7.74231e-16
1.39348e-16
2.4771e-17
4.35137e-18
7.55729e-19
1.29827e-19
2.20707e-20
3.71446e-21
6.19116e-22
1.02236e-22
1.67319e-23
2.71475e-24
4.36812e-25
6.97211e-26
1.10423e-26
1.73575e-27
2.70868e-28
4.19729e-29
6.45973e-30
9.87607e-31
1.50024e-31
2.26477e-32
3.3982e-33
5.0688e-34
7.51723e-35
1.10859e-35
1.62593e-36
2.37195e-37
3.44219e-38
4.96981e-39
7.13947e-40
1.02061e-40
1.45197e-41
2.05592e-42
2.89762e-43
4.06538e-44
5.67832e-45
7.89649e-46
1.0934e-46
1.50761e-47
2.07012e-48
2.83099e-49
3.85613e-50
5.23204e-51
7.07187e-52
9.52317e-53
1.27777e-53
1.70841e-54
2.27638e-55
3.02312e-56
4.00199e-57
5.28152e-58
6.94958e-59
9.11869e-60
1.19327e-60
1.55755e-61
2.02818e-62
2.63507e-63
3.41641e-64
4.42084e-65
5.71035e-66
7.36392e-67
9.48215e-68
1.21929e-68
1.56842e-69
1.81349e-70
97.3359
102.877
110.364
102.657
79.529
52.0395
29.4618
14.7519
6.65107
2.73925
1.04248
0.370052
0.123467
0.0389679
0.0116969
0.00335457
0.000922813
0.000244337
6.24538e-05
1.54514e-05
3.70873e-06
8.65433e-07
1.96698e-07
4.36164e-08
9.45018e-09
2.00339e-09
4.1607e-10
8.475e-11
1.69488e-11
3.33104e-12
6.43943e-13
1.22545e-13
2.29751e-14
4.24654e-15
7.74308e-16
1.39366e-16
2.47751e-17
4.35228e-18
7.55928e-19
1.2987e-19
2.20798e-20
3.71636e-21
6.19509e-22
1.02316e-22
1.67478e-23
2.7179e-24
4.37427e-25
6.98395e-26
1.10648e-26
1.73997e-27
2.71652e-28
4.21167e-29
6.48584e-30
9.92294e-31
1.50857e-31
2.27941e-32
3.42368e-33
5.11271e-34
7.59219e-35
1.12126e-35
1.64717e-36
2.40722e-37
3.50026e-38
5.06458e-39
7.29285e-40
1.04523e-40
1.49117e-41
2.11784e-42
2.99466e-43
4.2163e-44
5.91129e-45
8.25349e-46
1.14771e-46
1.58964e-47
2.19317e-48
3.0143e-49
4.12735e-50
5.63071e-51
7.65406e-52
1.03679e-52
1.39957e-53
1.88295e-54
2.52498e-55
3.37511e-56
4.49745e-57
5.97495e-58
7.91465e-59
1.04544e-59
1.37717e-60
1.8094e-61
2.37132e-62
3.1003e-63
4.04413e-64
5.26386e-65
6.83743e-66
8.86425e-67
1.14711e-67
1.48189e-68
1.91445e-69
2.221e-70
97.3359
102.877
110.364
102.657
79.529
52.0395
29.4618
14.7519
6.65107
2.73925
1.04248
0.370052
0.123467
0.0389679
0.0116969
0.00335457
0.000922813
0.000244337
6.24538e-05
1.54514e-05
3.70873e-06
8.65433e-07
1.96698e-07
4.36165e-08
9.45019e-09
2.00339e-09
4.16071e-10
8.47504e-11
1.69489e-11
3.33107e-12
6.4395e-13
1.22547e-13
2.29756e-14
4.24666e-15
7.74336e-16
1.39373e-16
2.47766e-17
4.35263e-18
7.56006e-19
1.29887e-19
2.20835e-20
3.71714e-21
6.19671e-22
1.02349e-22
1.67546e-23
2.71926e-24
4.37695e-25
6.98918e-26
1.10748e-26
1.74189e-27
2.72013e-28
4.21839e-29
6.49821e-30
9.94544e-31
1.51262e-31
2.28663e-32
3.43642e-33
5.13497e-34
7.6307e-35
1.12787e-35
1.65838e-36
2.4261e-37
3.53175e-38
5.11668e-39
7.37832e-40
1.05913e-40
1.51361e-41
2.15377e-42
3.05175e-43
4.30631e-44
6.05216e-45
8.47232e-46
1.18146e-46
1.64133e-47
2.27178e-48
3.13304e-49
4.30552e-50
5.89626e-51
8.04732e-52
1.09466e-52
1.4842e-53
2.00595e-54
2.70266e-55
3.63027e-56
4.86176e-57
6.49213e-58
8.64475e-59
1.14795e-59
1.52031e-60
2.00823e-61
2.64611e-62
3.47814e-63
4.56114e-64
5.96793e-65
7.79179e-66
1.01521e-66
1.32013e-67
1.71338e-68
2.22345e-69
2.58907e-70
97.3359
102.877
110.364
102.657
79.529
52.0395
29.4618
14.7519
6.65107
2.73925
1.04248
0.370052
0.123467
0.0389679
0.0116969
0.00335457
0.000922813
0.000244337
6.24538e-05
1.54514e-05
3.70873e-06
8.65433e-07
1.96698e-07
4.36165e-08
9.4502e-09
2.00339e-09
4.16072e-10
8.47505e-11
1.69489e-11
3.33107e-12
6.43953e-13
1.22548e-13
2.29758e-14
4.2467e-15
7.74346e-16
1.39375e-16
2.47772e-17
4.35276e-18
7.56035e-19
1.29894e-19
2.20849e-20
3.71744e-21
6.19735e-22
1.02363e-22
1.67574e-23
2.71982e-24
4.37807e-25
6.9914e-26
1.10792e-26
1.74273e-27
2.72173e-28
4.2214e-29
6.50382e-30
9.95579e-31
1.51451e-31
2.29004e-32
3.44251e-33
5.14575e-34
7.6496e-35
1.13115e-35
1.66403e-36
2.43573e-37
3.54803e-38
5.14396e-39
7.42366e-40
1.0666e-40
1.52583e-41
2.17358e-42
3.08364e-43
4.35725e-44
6.13292e-45
8.59942e-46
1.20132e-46
1.67214e-47
2.31926e-48
3.2057e-49
4.41597e-50
6.06307e-51
8.29762e-52
1.13198e-52
1.5395e-53
2.08739e-54
2.82188e-55
3.80377e-56
5.1128e-57
6.85328e-58
9.16142e-59
1.22146e-59
1.62433e-60
2.15467e-61
2.85118e-62
3.76389e-63
4.95732e-64
6.51457e-65
8.54248e-66
1.11783e-66
1.45978e-67
1.90259e-68
2.47921e-69
2.89712e-70
97.3359
102.877
110.364
102.657
79.529
52.0395
29.4618
14.7519
6.65107
2.73925
1.04248
0.370052
0.123467
0.0389679
0.0116969
0.00335457
0.000922813
0.000244337
6.24538e-05
1.54514e-05
3.70873e-06
8.65433e-07
1.96698e-07
4.36165e-08
9.4502e-09
2.00339e-09
4.16072e-10
8.47505e-11
1.69489e-11
3.33108e-12
6.43954e-13
1.22548e-13
2.29758e-14
4.24672e-15
7.7435e-16
1.39376e-16
2.47774e-17
4.3528e-18
7.56045e-19
1.29896e-19
2.20854e-20
3.71756e-21
6.1976e-22
1.02368e-22
1.67584e-23
2.72004e-24
4.37852e-25
6.99231e-26
1.1081e-26
1.74308e-27
2.72241e-28
4.2227e-29
6.50626e-30
9.96036e-31
1.51535e-31
2.29158e-32
3.44531e-33
5.15076e-34
7.65849e-35
1.13271e-35
1.66675e-36
2.44043e-37
3.55608e-38
5.15762e-39
7.44664e-40
1.07044e-40
1.53218e-41
2.18401e-42
3.10063e-43
4.38472e-44
6.17701e-45
8.66968e-46
1.21243e-46
1.6896e-47
2.3465e-48
3.24791e-49
4.48095e-50
6.16243e-51
8.44859e-52
1.15477e-52
1.5737e-53
2.13839e-54
2.89748e-55
3.91518e-56
5.27601e-57
7.09106e-58
9.50587e-59
1.27109e-59
1.69545e-60
2.25604e-61
2.99494e-62
3.96671e-63
5.24204e-64
6.91233e-65
9.09552e-66
1.19436e-66
1.56521e-67
2.04718e-68
2.67703e-69
3.13797e-70
97.3359
102.877
110.364
102.657
79.529
52.0395
29.4618
14.7519
6.65107
2.73925
1.04248
0.370052
0.123467
0.0389679
0.0116969
0.00335457
0.000922813
0.000244337
6.24538e-05
1.54514e-05
3.70873e-06
8.65433e-07
1.96698e-07
4.36165e-08
9.4502e-09
2.00339e-09
4.16072e-10
8.47506e-11
1.69489e-11
3.33108e-12
6.43954e-13
1.22548e-13
2.29759e-14
4.24672e-15
7.74351e-16
1.39376e-16
2.47774e-17
4.35282e-18
7.56049e-19
1.29897e-19
2.20856e-20
3.7176e-21
6.19769e-22
1.0237e-22
1.67589e-23
2.72013e-24
4.3787e-25
6.99267e-26
1.10817e-26
1.74323e-27
2.72269e-28
4.22324e-29
6.50729e-30
9.9623e-31
1.51571e-31
2.29226e-32
3.44654e-33
5.15299e-34
7.66251e-35
1.13343e-35
1.66801e-36
2.44263e-37
3.5599e-38
5.16418e-39
7.4578e-40
1.07232e-40
1.53534e-41
2.18926e-42
3.10928e-43
4.39889e-44
6.20003e-45
8.7068e-46
1.21838e-46
1.69905e-47
2.36142e-48
3.2713e-49
4.51738e-50
6.21882e-51
8.53528e-52
1.16802e-52
1.59381e-53
2.16874e-54
2.94301e-55
3.98307e-56
5.37668e-57
7.23947e-58
9.72346e-59
1.30281e-59
1.74146e-60
2.32241e-61
3.09017e-62
4.10267e-63
5.43519e-64
7.18537e-65
9.47963e-66
1.24814e-66
1.64017e-67
2.15119e-68
2.82098e-69
3.31504e-70
97.3359
102.877
110.364
102.657
79.529
52.0395
29.4618
14.7519
6.65107
2.73925
1.04248
0.370052
0.123467
0.0389679
0.0116969
0.00335457
0.000922813
0.000244337
6.24538e-05
1.54514e-05
3.70873e-06
8.65433e-07
1.96698e-07
4.36165e-08
9.4502e-09
2.00339e-09
4.16072e-10
8.47506e-11
1.69489e-11
3.33108e-12
6.43954e-13
1.22548e-13
2.29759e-14
4.24672e-15
7.74351e-16
1.39377e-16
2.47775e-17
4.35282e-18
7.5605e-19
1.29897e-19
2.20857e-20
3.71761e-21
6.19772e-22
1.02371e-22
1.6759e-23
2.72016e-24
4.37877e-25
6.9928e-26
1.1082e-26
1.74328e-27
2.7228e-28
4.22345e-29
6.50771e-30
9.9631e-31
1.51587e-31
2.29254e-32
3.44706e-33
5.15395e-34
7.66426e-35
1.13374e-35
1.66857e-36
2.44363e-37
3.56164e-38
5.16721e-39
7.46302e-40
1.07322e-40
1.53685e-41
2.1918e-42
3.11352e-43
4.40591e-44
6.21156e-45
8.72561e-46
1.22142e-46
1.70395e-47
2.36924e-48
3.28371e-49
4.53693e-50
6.24941e-51
8.58286e-52
1.17537e-52
1.6051e-53
2.18597e-54
2.96916e-55
4.02253e-56
5.43585e-57
7.3277e-58
9.85429e-59
1.3221e-59
1.76976e-60
2.3637e-61
3.15009e-62
4.1892e-63
5.55952e-64
7.36311e-65
9.73251e-66
1.28395e-66
1.69064e-67
2.22199e-68
2.92007e-69
3.43817e-70
97.3359
102.877
110.364
102.657
79.529
52.0395
29.4618
14.7519
6.65107
2.73925
1.04248
0.370052
0.123467
0.0389679
0.0116969
0.00335457
0.000922813
0.000244337
6.24538e-05
1.54514e-05
3.70873e-06
8.65433e-07
1.96698e-07
4.36165e-08
9.4502e-09
2.00339e-09
4.16072e-10
8.47506e-11
1.69489e-11
3.33108e-12
6.43954e-13
1.22548e-13
2.29759e-14
4.24672e-15
7.74352e-16
1.39377e-16
2.47775e-17
4.35283e-18
7.56051e-19
1.29897e-19
2.20857e-20
3.71762e-21
6.19773e-22
1.02371e-22
1.67591e-23
2.72017e-24
4.37879e-25
6.99286e-26
1.10821e-26
1.7433e-27
2.72284e-28
4.22354e-29
6.50787e-30
9.96341e-31
1.51593e-31
2.29265e-32
3.44728e-33
5.15435e-34
7.66499e-35
1.13388e-35
1.66882e-36
2.44406e-37
3.56241e-38
5.16856e-39
7.46537e-40
1.07362e-40
1.53754e-41
2.19298e-42
3.11552e-43
4.40925e-44
6.21711e-45
8.73477e-46
1.22292e-46
1.70639e-47
2.37318e-48
3.29002e-49
4.54699e-50
6.26534e-51
8.6079e-52
1.17929e-52
1.61118e-53
2.19535e-54
2.98355e-55
4.04447e-56
5.46912e-57
7.37785e-58
9.92947e-59
1.33331e-59
1.78638e-60
2.38821e-61
3.18607e-62
4.24171e-63
5.63578e-64
7.47333e-65
9.89103e-66
1.30664e-66
1.72296e-67
2.26782e-68
2.98491e-69
3.51951e-70
97.3359
102.877
110.364
102.657
79.529
52.0395
29.4618
14.7519
6.65107
2.73925
1.04248
0.370052
0.123467
0.0389679
0.0116969
0.00335457
0.000922813
0.000244337
6.24538e-05
1.54514e-05
3.70873e-06
8.65433e-07
1.96698e-07
4.36165e-08
9.4502e-09
2.00339e-09
4.16072e-10
8.47506e-11
1.69489e-11
3.33108e-12
6.43954e-13
1.22548e-13
2.29759e-14
4.24672e-15
7.74352e-16
1.39377e-16
2.47775e-17
4.35283e-18
7.56051e-19
1.29897e-19
2.20857e-20
3.71762e-21
6.19774e-22
1.02371e-22
1.67591e-23
2.72018e-24
4.3788e-25
6.99287e-26
1.10821e-26
1.74331e-27
2.72285e-28
4.22357e-29
6.50793e-30
9.96353e-31
1.51595e-31
2.2927e-32
3.44736e-33
5.15452e-34
7.66529e-35
1.13393e-35
1.66892e-36
2.44424e-37
3.56274e-38
5.16914e-39
7.46639e-40
1.0738e-40
1.53785e-41
2.19352e-42
3.11643e-43
4.41079e-44
6.2197e-45
8.73907e-46
1.22364e-46
1.70756e-47
2.37509e-48
3.29312e-49
4.55198e-50
6.27331e-51
8.62058e-52
1.18129e-52
1.61432e-53
2.20025e-54
2.99115e-55
4.05618e-56
5.48707e-57
7.4052e-58
9.9709e-59
1.33955e-59
1.79573e-60
2.40215e-61
3.20674e-62
4.27221e-63
5.68053e-64
7.53868e-65
9.986e-66
1.32037e-66
1.74274e-67
2.29615e-68
3.0254e-69
3.57077e-70
97.3359
102.877
110.364
102.657
79.529
52.0395
29.4618
14.7519
6.65107
2.73925
1.04248
0.370052
0.123467
0.0389679
0.0116969
0.00335457
0.000922813
0.000244337
6.24538e-05
1.54514e-05
3.70873e-06
8.65433e-07
1.96698e-07
4.36165e-08
9.4502e-09
2.00339e-09
4.16072e-10
8.47506e-11
1.69489e-11
3.33108e-12
6.43954e-13
1.22548e-13
2.29759e-14
4.24672e-15
7.74352e-16
1.39377e-16
2.47775e-17
4.35283e-18
7.56051e-19
1.29897e-19
2.20857e-20
3.71762e-21
6.19774e-22
1.02371e-22
1.67591e-23
2.72018e-24
4.3788e-25
6.99288e-26
1.10821e-26
1.74331e-27
2.72286e-28
4.22358e-29
6.50796e-30
9.96358e-31
1.51596e-31
2.29272e-32
3.4474e-33
5.15458e-34
7.66541e-35
1.13395e-35
1.66896e-36
2.44432e-37
3.56287e-38
5.16938e-39
7.46683e-40
1.07388e-40
1.53799e-41
2.19375e-42
3.11683e-43
4.41147e-44
6.22085e-45
8.74102e-46
1.22396e-46
1.7081e-47
2.37598e-48
3.29459e-49
4.55436e-50
6.27717e-51
8.62677e-52
1.18227e-52
1.61589e-53
2.20272e-54
2.99501e-55
4.0622e-56
5.49638e-57
7.41954e-58
9.99285e-59
1.3429e-59
1.80079e-60
2.40977e-61
3.21814e-62
4.2892e-63
5.70573e-64
7.57586e-65
1.00406e-65
1.32835e-66
1.75433e-67
2.31292e-68
3.04961e-69
3.6017e-70
97.3359
102.877
110.364
102.657
79.529
52.0395
29.4618
14.7519
6.65107
2.73925
1.04248
0.370052
0.123467
0.0389679
0.0116969
0.00335457
0.000922813
0.000244337
6.24538e-05
1.54514e-05
3.70873e-06
8.65433e-07
1.96698e-07
4.36165e-08
9.4502e-09
2.00339e-09
4.16072e-10
8.47506e-11
1.69489e-11
3.33108e-12
6.43954e-13
1.22548e-13
2.29759e-14
4.24672e-15
7.74352e-16
1.39377e-16
2.47775e-17
4.35283e-18
7.56051e-19
1.29897e-19
2.20857e-20
3.71762e-21
6.19774e-22
1.02371e-22
1.67591e-23
2.72018e-24
4.3788e-25
6.99288e-26
1.10821e-26
1.74331e-27
2.72286e-28
4.22358e-29
6.50796e-30
9.9636e-31
1.51596e-31
2.29272e-32
3.44741e-33
5.1546e-34
7.66546e-35
1.13396e-35
1.66897e-36
2.44435e-37
3.56292e-38
5.16948e-39
7.467e-40
1.07391e-40
1.53804e-41
2.19384e-42
3.117e-43
4.41176e-44
6.22136e-45
8.74188e-46
1.22411e-46
1.70834e-47
2.37639e-48
3.29526e-49
4.55546e-50
6.27897e-51
8.62969e-52
1.18275e-52
1.61664e-53
2.20392e-54
2.99691e-55
4.06518e-56
5.50105e-57
7.42679e-58
1.00041e-58
1.34462e-59
1.80342e-60
2.41378e-61
3.2242e-62
4.29832e-63
5.71939e-64
7.59619e-65
1.00707e-65
1.33279e-66
1.76085e-67
2.32246e-68
3.06351e-69
3.61962e-70
97.3359
102.877
110.364
102.657
79.529
52.0395
29.4618
14.7519
6.65107
2.73925
1.04248
0.370052
0.123467
0.0389679
0.0116969
0.00335457
0.000922813
0.000244337
6.24538e-05
1.54514e-05
3.70873e-06
8.65433e-07
1.96698e-07
4.36165e-08
9.4502e-09
2.00339e-09
4.16072e-10
8.47506e-11
1.69489e-11
3.33108e-12
6.43954e-13
1.22548e-13
2.29759e-14
4.24672e-15
7.74352e-16
1.39377e-16
2.47775e-17
4.35283e-18
7.56051e-19
1.29897e-19
2.20857e-20
3.71762e-21
6.19774e-22
1.02371e-22
1.67591e-23
2.72018e-24
4.3788e-25
6.99288e-26
1.10821e-26
1.74331e-27
2.72286e-28
4.22358e-29
6.50797e-30
9.9636e-31
1.51596e-31
2.29273e-32
3.44741e-33
5.15461e-34
7.66547e-35
1.13396e-35
1.66898e-36
2.44436e-37
3.56295e-38
5.16951e-39
7.46707e-40
1.07392e-40
1.53806e-41
2.19388e-42
3.11707e-43
4.41189e-44
6.22157e-45
8.74225e-46
1.22417e-46
1.70845e-47
2.37657e-48
3.29555e-49
4.55596e-50
6.27978e-51
8.63102e-52
1.18296e-52
1.61699e-53
2.20448e-54
2.99781e-55
4.06661e-56
5.50331e-57
7.43033e-58
1.00096e-58
1.34548e-59
1.80475e-60
2.41581e-61
3.22731e-62
4.30304e-63
5.72652e-64
7.60692e-65
1.00868e-65
1.33518e-66
1.7644e-67
2.32768e-68
3.0712e-69
3.62962e-70
97.3359
102.877
110.364
102.657
79.529
52.0395
29.4618
14.7519
6.65107
2.73925
1.04248
0.370052
0.123467
0.0389679
0.0116969
0.00335457
0.000922813
0.000244337
6.24538e-05
1.54514e-05
3.70873e-06
8.65433e-07
1.96698e-07
4.36165e-08
9.4502e-09
2.00339e-09
4.16072e-10
8.47506e-11
1.69489e-11
3.33108e-12
6.43954e-13
1.22548e-13
2.29759e-14
4.24672e-15
7.74352e-16
1.39377e-16
2.47775e-17
4.35283e-18
7.56051e-19
1.29897e-19
2.20857e-20
3.71762e-21
6.19774e-22
1.02371e-22
1.67591e-23
2.72018e-24
4.37881e-25
6.99288e-26
1.10821e-26
1.74331e-27
2.72286e-28
4.22359e-29
6.50797e-30
9.9636e-31
1.51596e-31
2.29273e-32
3.44742e-33
5.15461e-34
7.66548e-35
1.13397e-35
1.66898e-36
2.44436e-37
3.56295e-38
5.16953e-39
7.4671e-40
1.07393e-40
1.53807e-41
2.1939e-42
3.11709e-43
4.41194e-44
6.22166e-45
8.7424e-46
1.2242e-46
1.70849e-47
2.37664e-48
3.29568e-49
4.55617e-50
6.28014e-51
8.63161e-52
1.18306e-52
1.61715e-53
2.20474e-54
2.99823e-55
4.06728e-56
5.50436e-57
7.43201e-58
1.00122e-58
1.34589e-59
1.80539e-60
2.41681e-61
3.22885e-62
4.30541e-63
5.73013e-64
7.61239e-65
1.0095e-65
1.33643e-66
1.76625e-67
2.33045e-68
3.07531e-69
3.635e-70
97.3359
102.877
110.364
102.657
79.529
52.0395
29.4618
14.7519
6.65107
2.73925
1.04248
0.370052
0.123467
0.0389679
0.0116969
0.00335457
0.000922813
0.000244337
6.24538e-05
1.54514e-05
3.70873e-06
8.65433e-07
1.96698e-07
4.36165e-08
9.4502e-09
2.00339e-09
4.16072e-10
8.47506e-11
1.69489e-11
3.33108e-12
6.43954e-13
1.22548e-13
2.29759e-14
4.24672e-15
7.74352e-16
1.39377e-16
2.47775e-17
4.35283e-18
7.56051e-19
1.29897e-19
2.20857e-20
3.71762e-21
6.19774e-22
1.02371e-22
1.67591e-23
2.72018e-24
4.37881e-25
6.99288e-26
1.10821e-26
1.74331e-27
2.72286e-28
4.22359e-29
6.50797e-30
9.96361e-31
1.51596e-31
2.29273e-32
3.44742e-33
5.15462e-34
7.66548e-35
1.13397e-35
1.66898e-36
2.44436e-37
3.56296e-38
5.16954e-39
7.46711e-40
1.07393e-40
1.53808e-41
2.19391e-42
3.11711e-43
4.41196e-44
6.22169e-45
8.74246e-46
1.22421e-46
1.70851e-47
2.37667e-48
3.29574e-49
4.55626e-50
6.28029e-51
8.63186e-52
1.1831e-52
1.61722e-53
2.20485e-54
2.99841e-55
4.06757e-56
5.50485e-57
7.43278e-58
1.00135e-58
1.34609e-59
1.8057e-60
2.41729e-61
3.22959e-62
4.30655e-63
5.73189e-64
7.61509e-65
1.00991e-65
1.33705e-66
1.76719e-67
2.33186e-68
3.07742e-69
3.63779e-70
97.3359
102.877
110.364
102.657
79.529
52.0395
29.4618
14.7519
6.65107
2.73925
1.04248
0.370052
0.123467
0.0389679
0.0116969
0.00335457
0.000922813
0.000244337
6.24538e-05
1.54514e-05
3.70873e-06
8.65433e-07
1.96698e-07
4.36165e-08
9.4502e-09
2.00339e-09
4.16072e-10
8.47506e-11
1.69489e-11
3.33108e-12
6.43954e-13
1.22548e-13
2.29759e-14
4.24672e-15
7.74352e-16
1.39377e-16
2.47775e-17
4.35283e-18
7.56051e-19
1.29897e-19
2.20857e-20
3.71762e-21
6.19774e-22
1.02371e-22
1.67591e-23
2.72018e-24
4.37881e-25
6.99288e-26
1.10821e-26
1.74331e-27
2.72286e-28
4.22359e-29
6.50797e-30
9.96361e-31
1.51596e-31
2.29273e-32
3.44742e-33
5.15462e-34
7.66548e-35
1.13397e-35
1.66898e-36
2.44436e-37
3.56296e-38
5.16954e-39
7.46711e-40
1.07393e-40
1.53808e-41
2.19391e-42
3.11711e-43
4.41196e-44
6.22171e-45
8.74248e-46
1.22421e-46
1.70852e-47
2.37669e-48
3.29576e-49
4.5563e-50
6.28035e-51
8.63197e-52
1.18312e-52
1.61725e-53
2.2049e-54
2.99849e-55
4.06771e-56
5.50506e-57
7.43312e-58
1.0014e-58
1.34617e-59
1.80584e-60
2.41751e-61
3.22994e-62
4.30709e-63
5.73273e-64
7.61639e-65
1.01011e-65
1.33735e-66
1.76766e-67
2.33256e-68
3.07848e-69
3.6392e-70
97.3359
102.877
110.364
102.657
79.529
52.0395
29.4618
14.7519
6.65107
2.73925
1.04248
0.370052
0.123467
0.0389679
0.0116969
0.00335457
0.000922813
0.000244337
6.24538e-05
1.54514e-05
3.70873e-06
8.65433e-07
1.96698e-07
4.36165e-08
9.4502e-09
2.00339e-09
4.16072e-10
8.47506e-11
1.69489e-11
3.33108e-12
6.43954e-13
1.22548e-13
2.29759e-14
4.24672e-15
7.74352e-16
1.39377e-16
2.47775e-17
4.35283e-18
7.56051e-19
1.29897e-19
2.20857e-20
3.71762e-21
6.19774e-22
1.02371e-22
1.67591e-23
2.72018e-24
4.37881e-25
6.99288e-26
1.10821e-26
1.74331e-27
2.72286e-28
4.22359e-29
6.50797e-30
9.96361e-31
1.51596e-31
2.29273e-32
3.44742e-33
5.15462e-34
7.66548e-35
1.13397e-35
1.66898e-36
2.44437e-37
3.56296e-38
5.16954e-39
7.46711e-40
1.07393e-40
1.53808e-41
2.19391e-42
3.11711e-43
4.41197e-44
6.22171e-45
8.74249e-46
1.22421e-46
1.70852e-47
2.37669e-48
3.29577e-49
4.55631e-50
6.28038e-51
8.63201e-52
1.18313e-52
1.61726e-53
2.20492e-54
2.99853e-55
4.06776e-56
5.50515e-57
7.43327e-58
1.00143e-58
1.34621e-59
1.8059e-60
2.4176e-61
3.2301e-62
4.30734e-63
5.73311e-64
7.61699e-65
1.01021e-65
1.3375e-66
1.76788e-67
2.3329e-68
3.079e-69
3.63989e-70
97.3359
102.877
110.364
102.657
79.529
52.0395
29.4618
14.7519
6.65107
2.73925
1.04248
0.370052
0.123467
0.0389679
0.0116969
0.00335457
0.000922813
0.000244337
6.24538e-05
1.54514e-05
3.70873e-06
8.65433e-07
1.96698e-07
4.36165e-08
9.4502e-09
2.00339e-09
4.16072e-10
8.47506e-11
1.69489e-11
3.33108e-12
6.43954e-13
1.22548e-13
2.29759e-14
4.24672e-15
7.74352e-16
1.39377e-16
2.47775e-17
4.35283e-18
7.56051e-19
1.29897e-19
2.20857e-20
3.71762e-21
6.19774e-22
1.02371e-22
1.67591e-23
2.72018e-24
4.37881e-25
6.99288e-26
1.10821e-26
1.74331e-27
2.72286e-28
4.22359e-29
6.50797e-30
9.96361e-31
1.51596e-31
2.29273e-32
3.44742e-33
5.15462e-34
7.66548e-35
1.13397e-35
1.66898e-36
2.44437e-37
3.56296e-38
5.16954e-39
7.46711e-40
1.07393e-40
1.53808e-41
2.19391e-42
3.11711e-43
4.41197e-44
6.22171e-45
8.7425e-46
1.22421e-46
1.70852e-47
2.37669e-48
3.29577e-49
4.55632e-50
6.28039e-51
8.63203e-52
1.18313e-52
1.61726e-53
2.20493e-54
2.99854e-55
4.06778e-56
5.50519e-57
7.43334e-58
1.00144e-58
1.34623e-59
1.80593e-60
2.41765e-61
3.23016e-62
4.30745e-63
5.73329e-64
7.61726e-65
1.01025e-65
1.33756e-66
1.76798e-67
2.33306e-68
3.07924e-69
3.64022e-70
97.3359
102.877
110.364
102.657
79.529
52.0395
29.4618
14.7519
6.65107
2.73925
1.04248
0.370052
0.123467
0.0389679
0.0116969
0.00335457
0.000922813
0.000244337
6.24538e-05
1.54514e-05
3.70873e-06
8.65433e-07
1.96698e-07
4.36165e-08
9.4502e-09
2.00339e-09
4.16072e-10
8.47506e-11
1.69489e-11
3.33108e-12
6.43954e-13
1.22548e-13
2.29759e-14
4.24672e-15
7.74352e-16
1.39377e-16
2.47775e-17
4.35283e-18
7.56051e-19
1.29897e-19
2.20857e-20
3.71762e-21
6.19774e-22
1.02371e-22
1.67591e-23
2.72018e-24
4.37881e-25
6.99288e-26
1.10821e-26
1.74331e-27
2.72286e-28
4.22359e-29
6.50797e-30
9.96361e-31
1.51596e-31
2.29273e-32
3.44742e-33
5.15462e-34
7.66548e-35
1.13397e-35
1.66898e-36
2.44437e-37
3.56296e-38
5.16954e-39
7.46711e-40
1.07393e-40
1.53808e-41
2.19391e-42
3.11711e-43
4.41197e-44
6.22171e-45
8.7425e-46
1.22421e-46
1.70852e-47
2.37669e-48
3.29577e-49
4.55632e-50
6.28039e-51
8.63204e-52
1.18313e-52
1.61727e-53
2.20494e-54
2.99855e-55
4.06779e-56
5.5052e-57
7.43336e-58
1.00144e-58
1.34624e-59
1.80594e-60
2.41767e-61
3.23019e-62
4.30749e-63
5.73336e-64
7.61738e-65
1.01027e-65
1.33759e-66
1.76803e-67
2.33313e-68
3.07935e-69
3.64037e-70
97.3359
102.877
110.364
102.657
79.529
52.0395
29.4618
14.7519
6.65107
2.73925
1.04248
0.370052
0.123467
0.0389679
0.0116969
0.00335457
0.000922813
0.000244337
6.24538e-05
1.54514e-05
3.70873e-06
8.65433e-07
1.96698e-07
4.36165e-08
9.4502e-09
2.00339e-09
4.16072e-10
8.47506e-11
1.69489e-11
3.33108e-12
6.43954e-13
1.22548e-13
2.29759e-14
4.24672e-15
7.74352e-16
1.39377e-16
2.47775e-17
4.35283e-18
7.56051e-19
1.29897e-19
2.20857e-20
3.71762e-21
6.19774e-22
1.02371e-22
1.67591e-23
2.72018e-24
4.37881e-25
6.99288e-26
1.10821e-26
1.74331e-27
2.72286e-28
4.22359e-29
6.50797e-30
9.96361e-31
1.51596e-31
2.29273e-32
3.44742e-33
5.15462e-34
7.66548e-35
1.13397e-35
1.66898e-36
2.44437e-37
3.56296e-38
5.16954e-39
7.46711e-40
1.07393e-40
1.53808e-41
2.19391e-42
3.11711e-43
4.41197e-44
6.22171e-45
8.7425e-46
1.22421e-46
1.70852e-47
2.37669e-48
3.29577e-49
4.55632e-50
6.28039e-51
8.63204e-52
1.18313e-52
1.61727e-53
2.20494e-54
2.99855e-55
4.0678e-56
5.50521e-57
7.43337e-58
1.00144e-58
1.34624e-59
1.80594e-60
2.41767e-61
3.23021e-62
4.30752e-63
5.73339e-64
7.61743e-65
1.01028e-65
1.33761e-66
1.76805e-67
2.33316e-68
3.0794e-69
3.64044e-70
97.3359
102.877
110.364
102.657
79.529
52.0395
29.4618
14.7519
6.65107
2.73925
1.04248
0.370052
0.123467
0.0389679
0.0116969
0.00335457
0.000922813
0.000244337
6.24538e-05
1.54514e-05
3.70873e-06
8.65433e-07
1.96698e-07
4.36165e-08
9.4502e-09
2.00339e-09
4.16072e-10
8.47506e-11
1.69489e-11
3.33108e-12
6.43954e-13
1.22548e-13
2.29759e-14
4.24672e-15
7.74352e-16
1.39377e-16
2.47775e-17
4.35283e-18
7.56051e-19
1.29897e-19
2.20857e-20
3.71762e-21
6.19774e-22
1.02371e-22
1.67591e-23
2.72018e-24
4.37881e-25
6.99288e-26
1.10821e-26
1.74331e-27
2.72286e-28
4.22359e-29
6.50797e-30
9.96361e-31
1.51596e-31
2.29273e-32
3.44742e-33
5.15462e-34
7.66548e-35
1.13397e-35
1.66898e-36
2.44437e-37
3.56296e-38
5.16954e-39
7.46711e-40
1.07393e-40
1.53808e-41
2.19391e-42
3.11711e-43
4.41197e-44
6.22171e-45
8.7425e-46
1.22421e-46
1.70852e-47
2.37669e-48
3.29577e-49
4.55632e-50
6.28039e-51
8.63204e-52
1.18313e-52
1.61727e-53
2.20494e-54
2.99855e-55
4.0678e-56
5.50521e-57
7.43338e-58
1.00144e-58
1.34624e-59
1.80594e-60
2.41768e-61
3.23021e-62
4.30752e-63
5.73341e-64
7.61745e-65
1.01028e-65
1.33761e-66
1.76806e-67
2.33317e-68
3.07942e-69
3.64047e-70
97.3359
102.877
110.364
102.657
79.529
52.0395
29.4618
14.7519
6.65107
2.73925
1.04248
0.370052
0.123467
0.0389679
0.0116969
0.00335457
0.000922813
0.000244337
6.24538e-05
1.54514e-05
3.70873e-06
8.65433e-07
1.96698e-07
4.36165e-08
9.4502e-09
2.00339e-09
4.16072e-10
8.47506e-11
1.69489e-11
3.33108e-12
6.43954e-13
1.22548e-13
2.29759e-14
4.24672e-15
7.74352e-16
1.39377e-16
2.47775e-17
4.35283e-18
7.56051e-19
1.29897e-19
2.20857e-20
3.71762e-21
6.19774e-22
1.02371e-22
1.67591e-23
2.72018e-24
4.37881e-25
6.99288e-26
1.10821e-26
1.74331e-27
2.72286e-28
4.22359e-29
6.50797e-30
9.96361e-31
1.51596e-31
2.29273e-32
3.44742e-33
5.15462e-34
7.66548e-35
1.13397e-35
1.66898e-36
2.44437e-37
3.56296e-38
5.16954e-39
7.46711e-40
1.07393e-40
1.53808e-41
2.19391e-42
3.11711e-43
4.41197e-44
6.22171e-45
8.7425e-46
1.22421e-46
1.70852e-47
2.37669e-48
3.29577e-49
4.55632e-50
6.28039e-51
8.63204e-52
1.18313e-52
1.61727e-53
2.20494e-54
2.99855e-55
4.0678e-56
5.50521e-57
7.43338e-58
1.00144e-58
1.34624e-59
1.80594e-60
2.41768e-61
3.23021e-62
4.30753e-63
5.73341e-64
7.61746e-65
1.01028e-65
1.33761e-66
1.76806e-67
2.33318e-68
3.07943e-69
3.64049e-70
97.3359
102.877
110.364
102.657
79.529
52.0395
29.4618
14.7519
6.65107
2.73925
1.04248
0.370052
0.123467
0.0389679
0.0116969
0.00335457
0.000922813
0.000244337
6.24538e-05
1.54514e-05
3.70873e-06
8.65433e-07
1.96698e-07
4.36165e-08
9.4502e-09
2.00339e-09
4.16072e-10
8.47506e-11
1.69489e-11
3.33108e-12
6.43954e-13
1.22548e-13
2.29759e-14
4.24672e-15
7.74352e-16
1.39377e-16
2.47775e-17
4.35283e-18
7.56051e-19
1.29897e-19
2.20857e-20
3.71762e-21
6.19774e-22
1.02371e-22
1.67591e-23
2.72018e-24
4.37881e-25
6.99288e-26
1.10821e-26
1.74331e-27
2.72286e-28
4.22359e-29
6.50797e-30
9.96361e-31
1.51596e-31
2.29273e-32
3.44742e-33
5.15462e-34
7.66548e-35
1.13397e-35
1.66898e-36
2.44437e-37
3.56296e-38
5.16954e-39
7.46711e-40
1.07393e-40
1.53808e-41
2.19391e-42
3.11711e-43
4.41197e-44
6.22171e-45
8.7425e-46
1.22421e-46
1.70852e-47
2.37669e-48
3.29577e-49
4.55632e-50
6.28039e-51
8.63204e-52
1.18313e-52
1.61727e-53
2.20494e-54
2.99855e-55
4.0678e-56
5.50521e-57
7.43338e-58
1.00144e-58
1.34624e-59
1.80594e-60
2.41768e-61
3.23021e-62
4.30753e-63
5.73341e-64
7.61747e-65
1.01028e-65
1.33761e-66
1.76806e-67
2.33318e-68
3.07944e-69
3.64049e-70
97.3359
102.877
110.364
102.657
79.529
52.0395
29.4618
14.7519
6.65107
2.73925
1.04248
0.370052
0.123467
0.0389679
0.0116969
0.00335457
0.000922813
0.000244337
6.24538e-05
1.54514e-05
3.70873e-06
8.65433e-07
1.96698e-07
4.36165e-08
9.4502e-09
2.00339e-09
4.16072e-10
8.47506e-11
1.69489e-11
3.33108e-12
6.43954e-13
1.22548e-13
2.29759e-14
4.24672e-15
7.74352e-16
1.39377e-16
2.47775e-17
4.35283e-18
7.56051e-19
1.29897e-19
2.20857e-20
3.71762e-21
6.19774e-22
1.02371e-22
1.67591e-23
2.72018e-24
4.37881e-25
6.99288e-26
1.10821e-26
1.74331e-27
2.72286e-28
4.22359e-29
6.50797e-30
9.96361e-31
1.51596e-31
2.29273e-32
3.44742e-33
5.15462e-34
7.66548e-35
1.13397e-35
1.66898e-36
2.44437e-37
3.56296e-38
5.16954e-39
7.46711e-40
1.07393e-40
1.53808e-41
2.19391e-42
3.11711e-43
4.41197e-44
6.22171e-45
8.7425e-46
1.22421e-46
1.70852e-47
2.37669e-48
3.29577e-49
4.55632e-50
6.28039e-51
8.63204e-52
1.18313e-52
1.61727e-53
2.20494e-54
2.99855e-55
4.0678e-56
5.50521e-57
7.43338e-58
1.00144e-58
1.34624e-59
1.80594e-60
2.41768e-61
3.23021e-62
4.30753e-63
5.73341e-64
7.61747e-65
1.01028e-65
1.33761e-66
1.76806e-67
2.33318e-68
3.07944e-69
3.64049e-70
97.3359
102.877
110.364
102.657
79.529
52.0395
29.4618
14.7519
6.65107
2.73925
1.04248
0.370052
0.123467
0.0389679
0.0116969
0.00335457
0.000922813
0.000244337
6.24538e-05
1.54514e-05
3.70873e-06
8.65433e-07
1.96698e-07
4.36165e-08
9.4502e-09
2.00339e-09
4.16072e-10
8.47506e-11
1.69489e-11
3.33108e-12
6.43954e-13
1.22548e-13
2.29759e-14
4.24672e-15
7.74352e-16
1.39377e-16
2.47775e-17
4.35283e-18
7.56051e-19
1.29897e-19
2.20857e-20
3.71762e-21
6.19774e-22
1.02371e-22
1.67591e-23
2.72018e-24
4.37881e-25
6.99288e-26
1.10821e-26
1.74331e-27
2.72286e-28
4.22359e-29
6.50797e-30
9.96361e-31
1.51596e-31
2.29273e-32
3.44742e-33
5.15462e-34
7.66548e-35
1.13397e-35
1.66898e-36
2.44437e-37
3.56296e-38
5.16954e-39
7.46711e-40
1.07393e-40
1.53808e-41
2.19391e-42
3.11711e-43
4.41197e-44
6.22171e-45
8.7425e-46
1.22421e-46
1.70852e-47
2.37669e-48
3.29577e-49
4.55632e-50
6.28039e-51
8.63204e-52
1.18313e-52
1.61727e-53
2.20494e-54
2.99855e-55
4.0678e-56
5.50521e-57
7.43338e-58
1.00144e-58
1.34624e-59
1.80594e-60
2.41768e-61
3.23021e-62
4.30753e-63
5.73342e-64
7.61747e-65
1.01028e-65
1.33761e-66
1.76806e-67
2.33318e-68
3.07944e-69
3.64049e-70
97.3359
102.877
110.364
102.657
79.529
52.0395
29.4618
14.7519
6.65107
2.73925
1.04248
0.370052
0.123467
0.0389679
0.0116969
0.00335457
0.000922813
0.000244337
6.24538e-05
1.54514e-05
3.70873e-06
8.65433e-07
1.96698e-07
4.36165e-08
9.4502e-09
2.00339e-09
4.16072e-10
8.47506e-11
1.69489e-11
3.33108e-12
6.43954e-13
1.22548e-13
2.29759e-14
4.24672e-15
7.74352e-16
1.39377e-16
2.47775e-17
4.35283e-18
7.56051e-19
1.29897e-19
2.20857e-20
3.71762e-21
6.19774e-22
1.02371e-22
1.67591e-23
2.72018e-24
4.37881e-25
6.99288e-26
1.10821e-26
1.74331e-27
2.72286e-28
4.22359e-29
6.50797e-30
9.96361e-31
1.51596e-31
2.29273e-32
3.44742e-33
5.15462e-34
7.66548e-35
1.13397e-35
1.66898e-36
2.44437e-37
3.56296e-38
5.16954e-39
7.46711e-40
1.07393e-40
1.53808e-41
2.19391e-42
3.11711e-43
4.41197e-44
6.22171e-45
8.7425e-46
1.22421e-46
1.70852e-47
2.37669e-48
3.29577e-49
4.55632e-50
6.28039e-51
8.63204e-52
1.18313e-52
1.61727e-53
2.20494e-54
2.99855e-55
4.0678e-56
5.50521e-57
7.43338e-58
1.00144e-58
1.34624e-59
1.80594e-60
2.41768e-61
3.23021e-62
4.30753e-63
5.73342e-64
7.61747e-65
1.01028e-65
1.33761e-66
1.76806e-67
2.33318e-68
3.07944e-69
3.64049e-70
97.3359
102.877
110.364
102.657
79.529
52.0395
29.4618
14.7519
6.65107
2.73925
1.04248
0.370052
0.123467
0.0389679
0.0116969
0.00335457
0.000922813
0.000244337
6.24538e-05
1.54514e-05
3.70873e-06
8.65433e-07
1.96698e-07
4.36165e-08
9.4502e-09
2.00339e-09
4.16072e-10
8.47506e-11
1.69489e-11
3.33108e-12
6.43954e-13
1.22548e-13
2.29759e-14
4.24672e-15
7.74352e-16
1.39377e-16
2.47775e-17
4.35283e-18
7.56051e-19
1.29897e-19
2.20857e-20
3.71762e-21
6.19774e-22
1.02371e-22
1.67591e-23
2.72018e-24
4.37881e-25
6.99288e-26
1.10821e-26
1.74331e-27
2.72286e-28
4.22359e-29
6.50797e-30
9.96361e-31
1.51596e-31
2.29273e-32
3.44742e-33
5.15462e-34
7.66548e-35
1.13397e-35
1.66898e-36
2.44437e-37
3.56296e-38
5.16954e-39
7.46711e-40
1.07393e-40
1.53808e-41
2.19391e-42
3.11711e-43
4.41197e-44
6.22171e-45
8.7425e-46
1.22421e-46
1.70852e-47
2.37669e-48
3.29577e-49
4.55632e-50
6.28039e-51
8.63204e-52
1.18313e-52
1.61727e-53
2.20494e-54
2.99855e-55
4.0678e-56
5.50521e-57
7.43338e-58
1.00144e-58
1.34624e-59
1.80594e-60
2.41768e-61
3.23021e-62
4.30753e-63
5.73342e-64
7.61747e-65
1.01028e-65
1.33761e-66
1.76806e-67
2.33318e-68
3.07944e-69
3.64049e-70
97.3359
102.877
110.364
102.657
79.529
52.0395
29.4618
14.7519
6.65107
2.73925
1.04248
0.370052
0.123467
0.0389679
0.0116969
0.00335457
0.000922813
0.000244337
6.24538e-05
1.54514e-05
3.70873e-06
8.65433e-07
1.96698e-07
4.36165e-08
9.4502e-09
2.00339e-09
4.16072e-10
8.47506e-11
1.69489e-11
3.33108e-12
6.43954e-13
1.22548e-13
2.29759e-14
4.24672e-15
7.74352e-16
1.39377e-16
2.47775e-17
4.35283e-18
7.56051e-19
1.29897e-19
2.20857e-20
3.71762e-21
6.19774e-22
1.02371e-22
1.67591e-23
2.72018e-24
4.37881e-25
6.99288e-26
1.10821e-26
1.74331e-27
2.72286e-28
4.22359e-29
6.50797e-30
9.96361e-31
1.51596e-31
2.29273e-32
3.44742e-33
5.15462e-34
7.66548e-35
1.13397e-35
1.66898e-36
2.44437e-37
3.56296e-38
5.16954e-39
7.46711e-40
1.07393e-40
1.53808e-41
2.19391e-42
3.11711e-43
4.41197e-44
6.22171e-45
8.7425e-46
1.22421e-46
1.70852e-47
2.37669e-48
3.29577e-49
4.55632e-50
6.28039e-51
8.63204e-52
1.18313e-52
1.61727e-53
2.20494e-54
2.99855e-55
4.0678e-56
5.50521e-57
7.43338e-58
1.00144e-58
1.34624e-59
1.80594e-60
2.41768e-61
3.23021e-62
4.30753e-63
5.73342e-64
7.61747e-65
1.01028e-65
1.33761e-66
1.76806e-67
2.33318e-68
3.07944e-69
3.64049e-70
97.3359
102.877
110.364
102.657
79.529
52.0395
29.4618
14.7519
6.65107
2.73925
1.04248
0.370052
0.123467
0.0389679
0.0116969
0.00335457
0.000922813
0.000244337
6.24538e-05
1.54514e-05
3.70873e-06
8.65433e-07
1.96698e-07
4.36165e-08
9.4502e-09
2.00339e-09
4.16072e-10
8.47506e-11
1.69489e-11
3.33108e-12
6.43954e-13
1.22548e-13
2.29759e-14
4.24672e-15
7.74352e-16
1.39377e-16
2.47775e-17
4.35283e-18
7.56051e-19
1.29897e-19
2.20857e-20
3.71762e-21
6.19774e-22
1.02371e-22
1.67591e-23
2.72018e-24
4.37881e-25
6.99288e-26
1.10821e-26
1.74331e-27
2.72286e-28
4.22359e-29
6.50797e-30
9.96361e-31
1.51596e-31
2.29273e-32
3.44742e-33
5.15462e-34
7.66548e-35
1.13397e-35
1.66898e-36
2.44437e-37
3.56296e-38
5.16954e-39
7.46711e-40
1.07393e-40
1.53808e-41
2.19391e-42
3.11711e-43
4.41197e-44
6.22171e-45
8.7425e-46
1.22421e-46
1.70852e-47
2.37669e-48
3.29577e-49
4.55632e-50
6.28039e-51
8.63204e-52
1.18313e-52
1.61727e-53
2.20494e-54
2.99855e-55
4.0678e-56
5.50521e-57
7.43338e-58
1.00144e-58
1.34624e-59
1.80594e-60
2.41768e-61
3.23021e-62
4.30753e-63
5.73342e-64
7.61747e-65
1.01028e-65
1.33761e-66
1.76806e-67
2.33318e-68
3.07944e-69
3.64049e-70
97.3359
102.877
110.364
102.657
79.529
52.0395
29.4618
14.7519
6.65107
2.73925
1.04248
0.370052
0.123467
0.0389679
0.0116969
0.00335457
0.000922813
0.000244337
6.24538e-05
1.54514e-05
3.70873e-06
8.65433e-07
1.96698e-07
4.36165e-08
9.4502e-09
2.00339e-09
4.16072e-10
8.47506e-11
1.69489e-11
3.33108e-12
6.43954e-13
1.22548e-13
2.29759e-14
4.24672e-15
7.74352e-16
1.39377e-16
2.47775e-17
4.35283e-18
7.56051e-19
1.29897e-19
2.20857e-20
3.71762e-21
6.19774e-22
1.02371e-22
1.67591e-23
2.72018e-24
4.37881e-25
6.99288e-26
1.10821e-26
1.74331e-27
2.72286e-28
4.22359e-29
6.50797e-30
9.96361e-31
1.51596e-31
2.29273e-32
3.44742e-33
5.15462e-34
7.66548e-35
1.13397e-35
1.66898e-36
2.44437e-37
3.56296e-38
5.16954e-39
7.46711e-40
1.07393e-40
1.53808e-41
2.19391e-42
3.11711e-43
4.41197e-44
6.22171e-45
8.7425e-46
1.22421e-46
1.70852e-47
2.37669e-48
3.29577e-49
4.55632e-50
6.28039e-51
8.63204e-52
1.18313e-52
1.61727e-53
2.20494e-54
2.99855e-55
4.0678e-56
5.50521e-57
7.43338e-58
1.00144e-58
1.34624e-59
1.80594e-60
2.41768e-61
3.23021e-62
4.30753e-63
5.73342e-64
7.61747e-65
1.01028e-65
1.33761e-66
1.76806e-67
2.33318e-68
3.07944e-69
3.64049e-70
97.3359
102.877
110.364
102.657
79.529
52.0395
29.4618
14.7519
6.65107
2.73925
1.04248
0.370052
0.123467
0.0389679
0.0116969
0.00335457
0.000922813
0.000244337
6.24538e-05
1.54514e-05
3.70873e-06
8.65433e-07
1.96698e-07
4.36165e-08
9.4502e-09
2.00339e-09
4.16072e-10
8.47506e-11
1.69489e-11
3.33108e-12
6.43954e-13
1.22548e-13
2.29759e-14
4.24672e-15
7.74352e-16
1.39377e-16
2.47775e-17
4.35283e-18
7.56051e-19
1.29897e-19
2.20857e-20
3.71762e-21
6.19774e-22
1.02371e-22
1.67591e-23
2.72018e-24
4.37881e-25
6.99288e-26
1.10821e-26
1.74331e-27
2.72286e-28
4.22359e-29
6.50797e-30
9.96361e-31
1.51596e-31
2.29273e-32
3.44742e-33
5.15462e-34
7.66548e-35
1.13397e-35
1.66898e-36
2.44437e-37
3.56296e-38
5.16954e-39
7.46711e-40
1.07393e-40
1.53808e-41
2.19391e-42
3.11711e-43
4.41197e-44
6.22171e-45
8.7425e-46
1.22421e-46
1.70852e-47
2.37669e-48
3.29577e-49
4.55632e-50
6.28039e-51
8.63204e-52
1.18313e-52
1.61727e-53
2.20494e-54
2.99855e-55
4.0678e-56
5.50521e-57
7.43338e-58
1.00144e-58
1.34624e-59
1.80594e-60
2.41768e-61
3.23021e-62
4.30753e-63
5.73342e-64
7.61747e-65
1.01028e-65
1.33761e-66
1.76806e-67
2.33318e-68
3.07944e-69
3.64049e-70
97.3359
102.877
110.364
102.657
79.529
52.0395
29.4618
14.7519
6.65107
2.73925
1.04248
0.370052
0.123467
0.0389679
0.0116969
0.00335457
0.000922813
0.000244337
6.24538e-05
1.54514e-05
3.70873e-06
8.65433e-07
1.96698e-07
4.36165e-08
9.4502e-09
2.00339e-09
4.16072e-10
8.47506e-11
1.69489e-11
3.33108e-12
6.43954e-13
1.22548e-13
2.29759e-14
4.24672e-15
7.74352e-16
1.39377e-16
2.47775e-17
4.35283e-18
7.56051e-19
1.29897e-19
2.20857e-20
3.71762e-21
6.19774e-22
1.02371e-22
1.67591e-23
2.72018e-24
4.37881e-25
6.99288e-26
1.10821e-26
1.74331e-27
2.72286e-28
4.22359e-29
6.50797e-30
9.96361e-31
1.51596e-31
2.29273e-32
3.44742e-33
5.15462e-34
7.66548e-35
1.13397e-35
1.66898e-36
2.44437e-37
3.56296e-38
5.16954e-39
7.46711e-40
1.07393e-40
1.53808e-41
2.19391e-42
3.11711e-43
4.41197e-44
6.22171e-45
8.7425e-46
1.22421e-46
1.70852e-47
2.37669e-48
3.29577e-49
4.55632e-50
6.28039e-51
8.63204e-52
1.18313e-52
1.61727e-53
2.20494e-54
2.99855e-55
4.0678e-56
5.50521e-57
7.43338e-58
1.00144e-58
1.34624e-59
1.80594e-60
2.41768e-61
3.23021e-62
4.30753e-63
5.73342e-64
7.61747e-65
1.01028e-65
1.33761e-66
1.76806e-67
2.33318e-68
3.07944e-69
3.64049e-70
97.3359
102.877
110.364
102.657
79.529
52.0395
29.4618
14.7519
6.65107
2.73925
1.04248
0.370052
0.123467
0.0389679
0.0116969
0.00335457
0.000922813
0.000244337
6.24538e-05
1.54514e-05
3.70873e-06
8.65433e-07
1.96698e-07
4.36165e-08
9.4502e-09
2.00339e-09
4.16072e-10
8.47506e-11
1.69489e-11
3.33108e-12
6.43954e-13
1.22548e-13
2.29759e-14
4.24672e-15
7.74352e-16
1.39377e-16
2.47775e-17
4.35283e-18
7.56051e-19
1.29897e-19
2.20857e-20
3.71762e-21
6.19774e-22
1.02371e-22
1.67591e-23
2.72018e-24
4.37881e-25
6.99288e-26
1.10821e-26
1.74331e-27
2.72286e-28
4.22359e-29
6.50797e-30
9.96361e-31
1.51596e-31
2.29273e-32
3.44742e-33
5.15462e-34
7.66548e-35
1.13397e-35
1.66898e-36
2.44437e-37
3.56296e-38
5.16954e-39
7.46711e-40
1.07393e-40
1.53808e-41
2.19391e-42
3.11711e-43
4.41197e-44
6.22171e-45
8.7425e-46
1.22421e-46
1.70852e-47
2.37669e-48
3.29577e-49
4.55632e-50
6.28039e-51
8.63204e-52
1.18313e-52
1.61727e-53
2.20494e-54
2.99855e-55
4.0678e-56
5.50521e-57
7.43338e-58
1.00144e-58
1.34624e-59
1.80594e-60
2.41768e-61
3.23021e-62
4.30753e-63
5.73342e-64
7.61747e-65
1.01028e-65
1.33761e-66
1.76806e-67
2.33318e-68
3.07944e-69
3.64049e-70
97.3359
102.877
110.364
102.657
79.529
52.0395
29.4618
14.7519
6.65107
2.73925
1.04248
0.370052
0.123467
0.0389679
0.0116969
0.00335457
0.000922813
0.000244337
6.24538e-05
1.54514e-05
3.70873e-06
8.65433e-07
1.96698e-07
4.36165e-08
9.4502e-09
2.00339e-09
4.16072e-10
8.47506e-11
1.69489e-11
3.33108e-12
6.43954e-13
1.22548e-13
2.29759e-14
4.24672e-15
7.74352e-16
1.39377e-16
2.47775e-17
4.35283e-18
7.56051e-19
1.29897e-19
2.20857e-20
3.71762e-21
6.19774e-22
1.02371e-22
1.67591e-23
2.72018e-24
4.37881e-25
6.99288e-26
1.10821e-26
1.74331e-27
2.72286e-28
4.22359e-29
6.50797e-30
9.96361e-31
1.51596e-31
2.29273e-32
3.44742e-33
5.15462e-34
7.66548e-35
1.13397e-35
1.66898e-36
2.44437e-37
3.56296e-38
5.16954e-39
7.46711e-40
1.07393e-40
1.53808e-41
2.19391e-42
3.11711e-43
4.41197e-44
6.22171e-45
8.7425e-46
1.22421e-46
1.70852e-47
2.37669e-48
3.29577e-49
4.55632e-50
6.28039e-51
8.63204e-52
1.18313e-52
1.61727e-53
2.20494e-54
2.99855e-55
4.0678e-56
5.50521e-57
7.43338e-58
1.00144e-58
1.34624e-59
1.80594e-60
2.41768e-61
3.23021e-62
4.30753e-63
5.73342e-64
7.61747e-65
1.01028e-65
1.33761e-66
1.76806e-67
2.33318e-68
3.07944e-69
3.64049e-70
97.3359
102.877
110.364
102.657
79.529
52.0395
29.4618
14.7519
6.65107
2.73925
1.04248
0.370052
0.123467
0.0389679
0.0116969
0.00335457
0.000922813
0.000244337
6.24538e-05
1.54514e-05
3.70873e-06
8.65433e-07
1.96698e-07
4.36165e-08
9.4502e-09
2.00339e-09
4.16072e-10
8.47506e-11
1.69489e-11
3.33108e-12
6.43954e-13
1.22548e-13
2.29759e-14
4.24672e-15
7.74352e-16
1.39377e-16
2.47775e-17
4.35283e-18
7.56051e-19
1.29897e-19
2.20857e-20
3.71762e-21
6.19774e-22
1.02371e-22
1.67591e-23
2.72018e-24
4.37881e-25
6.99288e-26
1.10821e-26
1.74331e-27
2.72286e-28
4.22359e-29
6.50797e-30
9.96361e-31
1.51596e-31
2.29273e-32
3.44742e-33
5.15462e-34
7.66548e-35
1.13397e-35
1.66898e-36
2.44437e-37
3.56296e-38
5.16954e-39
7.46711e-40
1.07393e-40
1.53808e-41
2.19391e-42
3.11711e-43
4.41197e-44
6.22171e-45
8.7425e-46
1.22421e-46
1.70852e-47
2.37669e-48
3.29577e-49
4.55632e-50
6.28039e-51
8.63204e-52
1.18313e-52
1.61727e-53
2.20494e-54
2.99855e-55
4.0678e-56
5.50521e-57
7.43338e-58
1.00144e-58
1.34624e-59
1.80594e-60
2.41768e-61
3.23021e-62
4.30753e-63
5.73342e-64
7.61747e-65
1.01028e-65
1.33761e-66
1.76806e-67
2.33318e-68
3.07944e-69
3.64049e-70
97.3359
102.877
110.364
102.657
79.529
52.0395
29.4618
14.7519
6.65107
2.73925
1.04248
0.370052
0.123467
0.0389679
0.0116969
0.00335457
0.000922813
0.000244337
6.24538e-05
1.54514e-05
3.70873e-06
8.65433e-07
1.96698e-07
4.36165e-08
9.4502e-09
2.00339e-09
4.16072e-10
8.47506e-11
1.69489e-11
3.33108e-12
6.43954e-13
1.22548e-13
2.29759e-14
4.24672e-15
7.74352e-16
1.39377e-16
2.47775e-17
4.35283e-18
7.56051e-19
1.29897e-19
2.20857e-20
3.71762e-21
6.19774e-22
1.02371e-22
1.67591e-23
2.72018e-24
4.37881e-25
6.99288e-26
1.10821e-26
1.74331e-27
2.72286e-28
4.22359e-29
6.50797e-30
9.96361e-31
1.51596e-31
2.29273e-32
3.44742e-33
5.15462e-34
7.66548e-35
1.13397e-35
1.66898e-36
2.44437e-37
3.56296e-38
5.16954e-39
7.46711e-40
1.07393e-40
1.53808e-41
2.19391e-42
3.11711e-43
4.41197e-44
6.22171e-45
8.7425e-46
1.22421e-46
1.70852e-47
2.37669e-48
3.29577e-49
4.55632e-50
6.28039e-51
8.63204e-52
1.18313e-52
1.61727e-53
2.20494e-54
2.99855e-55
4.0678e-56
5.50521e-57
7.43338e-58
1.00144e-58
1.34624e-59
1.80594e-60
2.41768e-61
3.23021e-62
4.30753e-63
5.73342e-64
7.61747e-65
1.01028e-65
1.33761e-66
1.76806e-67
2.33318e-68
3.07944e-69
3.64049e-70
97.3359
102.877
110.364
102.657
79.529
52.0395
29.4618
14.7519
6.65107
2.73925
1.04248
0.370052
0.123467
0.0389679
0.0116969
0.00335457
0.000922813
0.000244337
6.24538e-05
1.54514e-05
3.70873e-06
8.65433e-07
1.96698e-07
4.36165e-08
9.4502e-09
2.00339e-09
4.16072e-10
8.47506e-11
1.69489e-11
3.33108e-12
6.43954e-13
1.22548e-13
2.29759e-14
4.24672e-15
7.74352e-16
1.39377e-16
2.47775e-17
4.35283e-18
7.56051e-19
1.29897e-19
2.20857e-20
3.71762e-21
6.19774e-22
1.02371e-22
1.67591e-23
2.72018e-24
4.37881e-25
6.99288e-26
1.10821e-26
1.74331e-27
2.72286e-28
4.22359e-29
6.50797e-30
9.96361e-31
1.51596e-31
2.29273e-32
3.44742e-33
5.15462e-34
7.66548e-35
1.13397e-35
1.66898e-36
2.44437e-37
3.56296e-38
5.16954e-39
7.46711e-40
1.07393e-40
1.53808e-41
2.19391e-42
3.11711e-43
4.41197e-44
6.22171e-45
8.7425e-46
1.22421e-46
1.70852e-47
2.37669e-48
3.29577e-49
4.55632e-50
6.28039e-51
8.63204e-52
1.18313e-52
1.61727e-53
2.20494e-54
2.99855e-55
4.0678e-56
5.50521e-57
7.43338e-58
1.00144e-58
1.34624e-59
1.80594e-60
2.41768e-61
3.23021e-62
4.30753e-63
5.73342e-64
7.61747e-65
1.01028e-65
1.33761e-66
1.76806e-67
2.33318e-68
3.07944e-69
3.64049e-70
97.3359
102.877
110.364
102.657
79.529
52.0395
29.4618
14.7519
6.65107
2.73925
1.04248
0.370052
0.123467
0.0389679
0.0116969
0.00335457
0.000922813
0.000244337
6.24538e-05
1.54514e-05
3.70873e-06
8.65433e-07
1.96698e-07
4.36165e-08
9.4502e-09
2.00339e-09
4.16072e-10
8.47506e-11
1.69489e-11
3.33108e-12
6.43954e-13
1.22548e-13
2.29759e-14
4.24672e-15
7.74352e-16
1.39377e-16
2.47775e-17
4.35283e-18
7.56051e-19
1.29897e-19
2.20857e-20
3.71762e-21
6.19774e-22
1.02371e-22
1.67591e-23
2.72018e-24
4.37881e-25
6.99288e-26
1.10821e-26
1.74331e-27
2.72286e-28
4.22359e-29
6.50797e-30
9.96361e-31
1.51596e-31
2.29273e-32
3.44742e-33
5.15462e-34
7.66548e-35
1.13397e-35
1.66898e-36
2.44437e-37
3.56296e-38
5.16954e-39
7.46711e-40
1.07393e-40
1.53808e-41
2.19391e-42
3.11711e-43
4.41197e-44
6.22171e-45
8.7425e-46
1.22421e-46
1.70852e-47
2.37669e-48
3.29577e-49
4.55632e-50
6.28039e-51
8.63204e-52
1.18313e-52
1.61727e-53
2.20494e-54
2.99855e-55
4.0678e-56
5.50521e-57
7.43338e-58
1.00144e-58
1.34624e-59
1.80594e-60
2.41768e-61
3.23021e-62
4.30753e-63
5.73342e-64
7.61747e-65
1.01028e-65
1.33761e-66
1.76806e-67
2.33318e-68
3.07944e-69
3.64049e-70
97.3359
102.877
110.364
102.657
79.529
52.0395
29.4618
14.7519
6.65107
2.73925
1.04248
0.370052
0.123467
0.0389679
0.0116969
0.00335457
0.000922813
0.000244337
6.24538e-05
1.54514e-05
3.70873e-06
8.65433e-07
1.96698e-07
4.36165e-08
9.4502e-09
2.00339e-09
4.16072e-10
8.47506e-11
1.69489e-11
3.33108e-12
6.43954e-13
1.22548e-13
2.29759e-14
4.24672e-15
7.74352e-16
1.39377e-16
2.47775e-17
4.35283e-18
7.56051e-19
1.29897e-19
2.20857e-20
3.71762e-21
6.19774e-22
1.02371e-22
1.67591e-23
2.72018e-24
4.37881e-25
6.99288e-26
1.10821e-26
1.74331e-27
2.72286e-28
4.22359e-29
6.50797e-30
9.96361e-31
1.51596e-31
2.29273e-32
3.44742e-33
5.15462e-34
7.66548e-35
1.13397e-35
1.66898e-36
2.44437e-37
3.56296e-38
5.16954e-39
7.46711e-40
1.07393e-40
1.53808e-41
2.19391e-42
3.11711e-43
4.41197e-44
6.22171e-45
8.7425e-46
1.22421e-46
1.70852e-47
2.37669e-48
3.29577e-49
4.55632e-50
6.28039e-51
8.63204e-52
1.18313e-52
1.61727e-53
2.20494e-54
2.99855e-55
4.0678e-56
5.50521e-57
7.43338e-58
1.00144e-58
1.34624e-59
1.80594e-60
2.41768e-61
3.23021e-62
4.30753e-63
5.73342e-64
7.61747e-65
1.01028e-65
1.33761e-66
1.76806e-67
2.33318e-68
3.07944e-69
3.64049e-70
97.3359
102.877
110.364
102.657
79.529
52.0395
29.4618
14.7519
6.65107
2.73925
1.04248
0.370052
0.123467
0.0389679
0.0116969
0.00335457
0.000922813
0.000244337
6.24538e-05
1.54514e-05
3.70873e-06
8.65433e-07
1.96698e-07
4.36165e-08
9.4502e-09
2.00339e-09
4.16072e-10
8.47506e-11
1.69489e-11
3.33108e-12
6.43954e-13
1.22548e-13
2.29759e-14
4.24672e-15
7.74352e-16
1.39377e-16
2.47775e-17
4.35283e-18
7.56051e-19
1.29897e-19
2.20857e-20
3.71762e-21
6.19774e-22
1.02371e-22
1.67591e-23
2.72018e-24
4.37881e-25
6.99288e-26
1.10821e-26
1.74331e-27
2.72286e-28
4.22359e-29
6.50797e-30
9.96361e-31
1.51596e-31
2.29273e-32
3.44742e-33
5.15462e-34
7.66548e-35
1.13397e-35
1.66898e-36
2.44437e-37
3.56296e-38
5.16954e-39
7.46711e-40
1.07393e-40
1.53808e-41
2.19391e-42
3.11711e-43
4.41197e-44
6.22171e-45
8.7425e-46
1.22421e-46
1.70852e-47
2.37669e-48
3.29577e-49
4.55632e-50
6.28039e-51
8.63204e-52
1.18313e-52
1.61727e-53
2.20494e-54
2.99855e-55
4.0678e-56
5.50521e-57
7.43338e-58
1.00144e-58
1.34624e-59
1.80594e-60
2.41768e-61
3.23021e-62
4.30753e-63
5.73342e-64
7.61747e-65
1.01028e-65
1.33761e-66
1.76806e-67
2.33318e-68
3.07944e-69
3.64049e-70
97.3359
102.877
110.364
102.657
79.529
52.0395
29.4618
14.7519
6.65107
2.73925
1.04248
0.370052
0.123467
0.0389679
0.0116969
0.00335457
0.000922813
0.000244337
6.24538e-05
1.54514e-05
3.70873e-06
8.65433e-07
1.96698e-07
4.36165e-08
9.4502e-09
2.00339e-09
4.16072e-10
8.47506e-11
1.69489e-11
3.33108e-12
6.43954e-13
1.22548e-13
2.29759e-14
4.24672e-15
7.74352e-16
1.39377e-16
2.47775e-17
4.35283e-18
7.56051e-19
1.29897e-19
2.20857e-20
3.71762e-21
6.19774e-22
1.02371e-22
1.67591e-23
2.72018e-24
4.37881e-25
6.99288e-26
1.10821e-26
1.74331e-27
2.72286e-28
4.22359e-29
6.50797e-30
9.96361e-31
1.51596e-31
2.29273e-32
3.44742e-33
5.15462e-34
7.66548e-35
1.13397e-35
1.66898e-36
2.44437e-37
3.56296e-38
5.16954e-39
7.46711e-40
1.07393e-40
1.53808e-41
2.19391e-42
3.11711e-43
4.41197e-44
6.22171e-45
8.7425e-46
1.22421e-46
1.70852e-47
2.37669e-48
3.29577e-49
4.55632e-50
6.28039e-51
8.63204e-52
1.18313e-52
1.61727e-53
2.20494e-54
2.99855e-55
4.0678e-56
5.50521e-57
7.43338e-58
1.00144e-58
1.34624e-59
1.80594e-60
2.41768e-61
3.23021e-62
4.30753e-63
5.73342e-64
7.61747e-65
1.01028e-65
1.33761e-66
1.76806e-67
2.33318e-68
3.07944e-69
3.64049e-70
97.3359
102.877
110.364
102.657
79.529
52.0395
29.4618
14.7519
6.65107
2.73925
1.04248
0.370052
0.123467
0.0389679
0.0116969
0.00335457
0.000922813
0.000244337
6.24538e-05
1.54514e-05
3.70873e-06
8.65433e-07
1.96698e-07
4.36165e-08
9.4502e-09
2.00339e-09
4.16072e-10
8.47506e-11
1.69489e-11
3.33108e-12
6.43954e-13
1.22548e-13
2.29759e-14
4.24672e-15
7.74352e-16
1.39377e-16
2.47775e-17
4.35283e-18
7.56051e-19
1.29897e-19
2.20857e-20
3.71762e-21
6.19774e-22
1.02371e-22
1.67591e-23
2.72018e-24
4.37881e-25
6.99288e-26
1.10821e-26
1.74331e-27
2.72286e-28
4.22359e-29
6.50797e-30
9.96361e-31
1.51596e-31
2.29273e-32
3.44742e-33
5.15462e-34
7.66548e-35
1.13397e-35
1.66898e-36
2.44437e-37
3.56296e-38
5.16954e-39
7.46711e-40
1.07393e-40
1.53808e-41
2.19391e-42
3.11711e-43
4.41197e-44
6.22171e-45
8.7425e-46
1.22421e-46
1.70852e-47
2.37669e-48
3.29577e-49
4.55632e-50
6.28039e-51
8.63204e-52
1.18313e-52
1.61727e-53
2.20494e-54
2.99855e-55
4.0678e-56
5.50521e-57
7.43338e-58
1.00144e-58
1.34624e-59
1.80594e-60
2.41768e-61
3.23022e-62
4.30753e-63
5.73342e-64
7.61747e-65
1.01028e-65
1.33762e-66
1.76806e-67
2.33318e-68
3.07944e-69
3.6405e-70
97.3359
102.877
110.364
102.657
79.529
52.0395
29.4618
14.7519
6.65107
2.73925
1.04248
0.370052
0.123467
0.0389679
0.0116969
0.00335457
0.000922813
0.000244337
6.24538e-05
1.54514e-05
3.70873e-06
8.65433e-07
1.96698e-07
4.36165e-08
9.4502e-09
2.00339e-09
4.16072e-10
8.47506e-11
1.69489e-11
3.33108e-12
6.43954e-13
1.22548e-13
2.29759e-14
4.24672e-15
7.74352e-16
1.39377e-16
2.47775e-17
4.35283e-18
7.56051e-19
1.29897e-19
2.20857e-20
3.71762e-21
6.19774e-22
1.02371e-22
1.67591e-23
2.72018e-24
4.37881e-25
6.99288e-26
1.10821e-26
1.74331e-27
2.72286e-28
4.22359e-29
6.50797e-30
9.96361e-31
1.51596e-31
2.29273e-32
3.44742e-33
5.15462e-34
7.66548e-35
1.13397e-35
1.66898e-36
2.44437e-37
3.56296e-38
5.16954e-39
7.46711e-40
1.07393e-40
1.53808e-41
2.19391e-42
3.11711e-43
4.41197e-44
6.22171e-45
8.7425e-46
1.22421e-46
1.70852e-47
2.37669e-48
3.29577e-49
4.55632e-50
6.28039e-51
8.63204e-52
1.18313e-52
1.61727e-53
2.20494e-54
2.99855e-55
4.0678e-56
5.50521e-57
7.43338e-58
1.00144e-58
1.34624e-59
1.80594e-60
2.41768e-61
3.23021e-62
4.30753e-63
5.73341e-64
7.61747e-65
1.01028e-65
1.33761e-66
1.76806e-67
2.33318e-68
3.07944e-69
3.64049e-70
97.3359
102.877
110.364
102.657
79.529
52.0395
29.4618
14.7519
6.65107
2.73925
1.04248
0.370052
0.123467
0.0389679
0.0116969
0.00335457
0.000922813
0.000244337
6.24538e-05
1.54514e-05
3.70873e-06
8.65433e-07
1.96698e-07
4.36165e-08
9.4502e-09
2.00339e-09
4.16072e-10
8.47506e-11
1.69489e-11
3.33108e-12
6.43954e-13
1.22548e-13
2.29759e-14
4.24672e-15
7.74352e-16
1.39377e-16
2.47775e-17
4.35283e-18
7.56051e-19
1.29897e-19
2.20857e-20
3.71762e-21
6.19774e-22
1.02371e-22
1.67591e-23
2.72018e-24
4.37881e-25
6.99288e-26
1.10821e-26
1.74331e-27
2.72286e-28
4.22359e-29
6.50797e-30
9.96361e-31
1.51596e-31
2.29273e-32
3.44742e-33
5.15462e-34
7.66548e-35
1.13397e-35
1.66898e-36
2.44437e-37
3.56296e-38
5.16954e-39
7.46711e-40
1.07393e-40
1.53808e-41
2.19391e-42
3.11711e-43
4.41197e-44
6.22171e-45
8.7425e-46
1.22421e-46
1.70852e-47
2.37669e-48
3.29577e-49
4.55632e-50
6.28039e-51
8.63204e-52
1.18313e-52
1.61727e-53
2.20494e-54
2.99855e-55
4.0678e-56
5.50522e-57
7.43338e-58
1.00144e-58
1.34624e-59
1.80595e-60
2.41768e-61
3.23022e-62
4.30753e-63
5.73342e-64
7.61747e-65
1.01028e-65
1.33762e-66
1.76806e-67
2.33319e-68
3.07944e-69
3.6405e-70
97.3359
102.877
110.364
102.657
79.529
52.0395
29.4618
14.7519
6.65107
2.73925
1.04248
0.370052
0.123467
0.0389679
0.0116969
0.00335457
0.000922813
0.000244337
6.24538e-05
1.54514e-05
3.70873e-06
8.65433e-07
1.96698e-07
4.36165e-08
9.4502e-09
2.00339e-09
4.16072e-10
8.47506e-11
1.69489e-11
3.33108e-12
6.43954e-13
1.22548e-13
2.29759e-14
4.24672e-15
7.74352e-16
1.39377e-16
2.47775e-17
4.35283e-18
7.56051e-19
1.29897e-19
2.20857e-20
3.71762e-21
6.19774e-22
1.02371e-22
1.67591e-23
2.72018e-24
4.37881e-25
6.99288e-26
1.10821e-26
1.74331e-27
2.72286e-28
4.22359e-29
6.50797e-30
9.96361e-31
1.51596e-31
2.29273e-32
3.44742e-33
5.15462e-34
7.66548e-35
1.13397e-35
1.66898e-36
2.44437e-37
3.56296e-38
5.16954e-39
7.46711e-40
1.07393e-40
1.53808e-41
2.19391e-42
3.11711e-43
4.41197e-44
6.22171e-45
8.7425e-46
1.22421e-46
1.70852e-47
2.37669e-48
3.29577e-49
4.55632e-50
6.28039e-51
8.63204e-52
1.18313e-52
1.61727e-53
2.20494e-54
2.99855e-55
4.0678e-56
5.50521e-57
7.43338e-58
1.00144e-58
1.34624e-59
1.80594e-60
2.41768e-61
3.23021e-62
4.30752e-63
5.73341e-64
7.61745e-65
1.01028e-65
1.33761e-66
1.76806e-67
2.33318e-68
3.07943e-69
3.64048e-70
97.3359
102.877
110.364
102.657
79.529
52.0395
29.4618
14.7519
6.65107
2.73925
1.04248
0.370052
0.123467
0.0389679
0.0116969
0.00335457
0.000922813
0.000244337
6.24538e-05
1.54514e-05
3.70873e-06
8.65433e-07
1.96698e-07
4.36165e-08
9.4502e-09
2.00339e-09
4.16072e-10
8.47506e-11
1.69489e-11
3.33108e-12
6.43954e-13
1.22548e-13
2.29759e-14
4.24672e-15
7.74352e-16
1.39377e-16
2.47775e-17
4.35283e-18
7.56051e-19
1.29897e-19
2.20857e-20
3.71762e-21
6.19774e-22
1.02371e-22
1.67591e-23
2.72018e-24
4.37881e-25
6.99288e-26
1.10821e-26
1.74331e-27
2.72286e-28
4.22359e-29
6.50797e-30
9.96361e-31
1.51596e-31
2.29273e-32
3.44742e-33
5.15462e-34
7.66548e-35
1.13397e-35
1.66898e-36
2.44437e-37
3.56296e-38
5.16954e-39
7.46712e-40
1.07393e-40
1.53808e-41
2.19391e-42
3.11711e-43
4.41197e-44
6.22171e-45
8.7425e-46
1.22421e-46
1.70853e-47
2.3767e-48
3.29577e-49
4.55633e-50
6.2804e-51
8.63205e-52
1.18313e-52
1.61727e-53
2.20494e-54
2.99855e-55
4.0678e-56
5.50522e-57
7.43339e-58
1.00144e-58
1.34624e-59
1.80595e-60
2.41768e-61
3.23022e-62
4.30754e-63
5.73344e-64
7.6175e-65
1.01029e-65
1.33762e-66
1.76807e-67
2.3332e-68
3.07946e-69
3.64053e-70
97.3359
102.877
110.364
102.657
79.529
52.0395
29.4618
14.7519
6.65107
2.73925
1.04248
0.370052
0.123467
0.0389679
0.0116969
0.00335457
0.000922813
0.000244337
6.24538e-05
1.54514e-05
3.70873e-06
8.65433e-07
1.96698e-07
4.36165e-08
9.4502e-09
2.00339e-09
4.16072e-10
8.47506e-11
1.69489e-11
3.33108e-12
6.43954e-13
1.22548e-13
2.29759e-14
4.24672e-15
7.74352e-16
1.39377e-16
2.47775e-17
4.35283e-18
7.56051e-19
1.29897e-19
2.20857e-20
3.71762e-21
6.19774e-22
1.02371e-22
1.67591e-23
2.72018e-24
4.37881e-25
6.99288e-26
1.10821e-26
1.74331e-27
2.72286e-28
4.22359e-29
6.50797e-30
9.96361e-31
1.51596e-31
2.29273e-32
3.44742e-33
5.15462e-34
7.66548e-35
1.13397e-35
1.66898e-36
2.44437e-37
3.56296e-38
5.16954e-39
7.46711e-40
1.07393e-40
1.53808e-41
2.19391e-42
3.11711e-43
4.41197e-44
6.22171e-45
8.7425e-46
1.22421e-46
1.70852e-47
2.37669e-48
3.29577e-49
4.55632e-50
6.28039e-51
8.63203e-52
1.18313e-52
1.61727e-53
2.20493e-54
2.99854e-55
4.06779e-56
5.5052e-57
7.43336e-58
1.00144e-58
1.34623e-59
1.80594e-60
2.41767e-61
3.23019e-62
4.3075e-63
5.73337e-64
7.61739e-65
1.01027e-65
1.3376e-66
1.76804e-67
2.33315e-68
3.07939e-69
3.64042e-70
97.3359
102.877
110.364
102.657
79.529
52.0395
29.4618
14.7519
6.65107
2.73925
1.04248
0.370052
0.123467
0.0389679
0.0116969
0.00335457
0.000922813
0.000244337
6.24538e-05
1.54514e-05
3.70873e-06
8.65433e-07
1.96698e-07
4.36165e-08
9.4502e-09
2.00339e-09
4.16072e-10
8.47506e-11
1.69489e-11
3.33108e-12
6.43954e-13
1.22548e-13
2.29759e-14
4.24672e-15
7.74352e-16
1.39377e-16
2.47775e-17
4.35283e-18
7.56051e-19
1.29897e-19
2.20857e-20
3.71762e-21
6.19774e-22
1.02371e-22
1.67591e-23
2.72018e-24
4.37881e-25
6.99288e-26
1.10821e-26
1.74331e-27
2.72286e-28
4.22359e-29
6.50797e-30
9.96361e-31
1.51596e-31
2.29273e-32
3.44742e-33
5.15462e-34
7.66548e-35
1.13397e-35
1.66898e-36
2.44437e-37
3.56296e-38
5.16954e-39
7.46712e-40
1.07393e-40
1.53808e-41
2.19391e-42
3.11711e-43
4.41197e-44
6.22172e-45
8.7425e-46
1.22421e-46
1.70853e-47
2.3767e-48
3.29578e-49
4.55633e-50
6.28041e-51
8.63206e-52
1.18313e-52
1.61727e-53
2.20495e-54
2.99856e-55
4.06782e-56
5.50525e-57
7.43343e-58
1.00145e-58
1.34625e-59
1.80596e-60
2.41771e-61
3.23026e-62
4.3076e-63
5.73352e-64
7.61762e-65
1.01031e-65
1.33765e-66
1.76811e-67
2.33326e-68
3.07955e-69
3.64064e-70
97.3359
102.877
110.364
102.657
79.529
52.0395
29.4618
14.7519
6.65107
2.73925
1.04248
0.370052
0.123467
0.0389679
0.0116969
0.00335457
0.000922813
0.000244337
6.24538e-05
1.54514e-05
3.70873e-06
8.65433e-07
1.96698e-07
4.36165e-08
9.4502e-09
2.00339e-09
4.16072e-10
8.47506e-11
1.69489e-11
3.33108e-12
6.43954e-13
1.22548e-13
2.29759e-14
4.24672e-15
7.74352e-16
1.39377e-16
2.47775e-17
4.35283e-18
7.56051e-19
1.29897e-19
2.20857e-20
3.71762e-21
6.19774e-22
1.02371e-22
1.67591e-23
2.72018e-24
4.37881e-25
6.99288e-26
1.10821e-26
1.74331e-27
2.72286e-28
4.22359e-29
6.50797e-30
9.96361e-31
1.51596e-31
2.29273e-32
3.44742e-33
5.15462e-34
7.66548e-35
1.13397e-35
1.66898e-36
2.44436e-37
3.56296e-38
5.16954e-39
7.46711e-40
1.07393e-40
1.53808e-41
2.19391e-42
3.11711e-43
4.41196e-44
6.22171e-45
8.74248e-46
1.22421e-46
1.70852e-47
2.37669e-48
3.29576e-49
4.55631e-50
6.28037e-51
8.632e-52
1.18312e-52
1.61726e-53
2.20492e-54
2.99852e-55
4.06775e-56
5.50514e-57
7.43326e-58
1.00142e-58
1.34621e-59
1.8059e-60
2.41762e-61
3.23012e-62
4.30738e-63
5.7332e-64
7.61715e-65
1.01023e-65
1.33754e-66
1.76796e-67
2.33303e-68
3.07922e-69
3.64021e-70
97.3359
102.877
110.364
102.657
79.529
52.0395
29.4618
14.7519
6.65107
2.73925
1.04248
0.370052
0.123467
0.0389679
0.0116969
0.00335457
0.000922813
0.000244337
6.24538e-05
1.54514e-05
3.70873e-06
8.65433e-07
1.96698e-07
4.36165e-08
9.4502e-09
2.00339e-09
4.16072e-10
8.47506e-11
1.69489e-11
3.33108e-12
6.43954e-13
1.22548e-13
2.29759e-14
4.24672e-15
7.74352e-16
1.39377e-16
2.47775e-17
4.35283e-18
7.56051e-19
1.29897e-19
2.20857e-20
3.71762e-21
6.19774e-22
1.02371e-22
1.67591e-23
2.72018e-24
4.37881e-25
6.99288e-26
1.10821e-26
1.74331e-27
2.72286e-28
4.22359e-29
6.50797e-30
9.96361e-31
1.51596e-31
2.29273e-32
3.44742e-33
5.15462e-34
7.66549e-35
1.13397e-35
1.66898e-36
2.44437e-37
3.56296e-38
5.16954e-39
7.46712e-40
1.07393e-40
1.53808e-41
2.19391e-42
3.11712e-43
4.41198e-44
6.22173e-45
8.74253e-46
1.22422e-46
1.70853e-47
2.37671e-48
3.2958e-49
4.55636e-50
6.28046e-51
8.63215e-52
1.18315e-52
1.61729e-53
2.20498e-54
2.99861e-55
4.0679e-56
5.50537e-57
7.43362e-58
1.00148e-58
1.3463e-59
1.80603e-60
2.41781e-61
3.23041e-62
4.30782e-63
5.73385e-64
7.6181e-65
1.01038e-65
1.33775e-66
1.76826e-67
2.33347e-68
3.07986e-69
3.64103e-70
97.3359
102.877
110.364
102.657
79.529
52.0395
29.4618
14.7519
6.65107
2.73925
1.04248
0.370052
0.123467
0.0389679
0.0116969
0.00335457
0.000922813
0.000244337
6.24538e-05
1.54514e-05
3.70873e-06
8.65433e-07
1.96698e-07
4.36165e-08
9.4502e-09
2.00339e-09
4.16072e-10
8.47506e-11
1.69489e-11
3.33108e-12
6.43954e-13
1.22548e-13
2.29759e-14
4.24672e-15
7.74352e-16
1.39377e-16
2.47775e-17
4.35283e-18
7.56051e-19
1.29897e-19
2.20857e-20
3.71762e-21
6.19774e-22
1.02371e-22
1.67591e-23
2.72018e-24
4.3788e-25
6.99288e-26
1.10821e-26
1.74331e-27
2.72286e-28
4.22359e-29
6.50797e-30
9.9636e-31
1.51596e-31
2.29273e-32
3.44742e-33
5.15461e-34
7.66548e-35
1.13397e-35
1.66898e-36
2.44436e-37
3.56295e-38
5.16953e-39
7.4671e-40
1.07393e-40
1.53807e-41
2.1939e-42
3.1171e-43
4.41194e-44
6.22167e-45
8.74242e-46
1.2242e-46
1.7085e-47
2.37666e-48
3.29572e-49
4.55624e-50
6.28025e-51
8.63182e-52
1.1831e-52
1.61721e-53
2.20485e-54
2.99841e-55
4.06759e-56
5.50489e-57
7.43288e-58
1.00137e-58
1.34613e-59
1.80577e-60
2.41742e-61
3.22984e-62
4.30697e-63
5.73259e-64
7.61626e-65
1.01011e-65
1.33736e-66
1.76769e-67
2.33265e-68
3.07868e-69
3.63953e-70
97.3359
102.877
110.364
102.657
79.529
52.0395
29.4618
14.7519
6.65107
2.73925
1.04248
0.370052
0.123467
0.0389679
0.0116969
0.00335457
0.000922813
0.000244337
6.24538e-05
1.54514e-05
3.70873e-06
8.65433e-07
1.96698e-07
4.36165e-08
9.4502e-09
2.00339e-09
4.16072e-10
8.47506e-11
1.69489e-11
3.33108e-12
6.43954e-13
1.22548e-13
2.29759e-14
4.24672e-15
7.74352e-16
1.39377e-16
2.47775e-17
4.35283e-18
7.56051e-19
1.29897e-19
2.20857e-20
3.71762e-21
6.19774e-22
1.02371e-22
1.67591e-23
2.72018e-24
4.37881e-25
6.99288e-26
1.10821e-26
1.74331e-27
2.72286e-28
4.22359e-29
6.50797e-30
9.96361e-31
1.51596e-31
2.29273e-32
3.44742e-33
5.15462e-34
7.6655e-35
1.13397e-35
1.66899e-36
2.44437e-37
3.56297e-38
5.16956e-39
7.46716e-40
1.07394e-40
1.53809e-41
2.19393e-42
3.11715e-43
4.41203e-44
6.22182e-45
8.74267e-46
1.22424e-46
1.70857e-47
2.37677e-48
3.29589e-49
4.55651e-50
6.28069e-51
8.63251e-52
1.1832e-52
1.61738e-53
2.20512e-54
2.99882e-55
4.06822e-56
5.50585e-57
7.43434e-58
1.00159e-58
1.34646e-59
1.80627e-60
2.41816e-61
3.23092e-62
4.30857e-63
5.73493e-64
7.61967e-65
1.0106e-65
1.33807e-66
1.76872e-67
2.33412e-68
3.08077e-69
3.64217e-70
97.3359
102.877
110.364
102.657
79.529
52.0395
29.4618
14.7519
6.65107
2.73925
1.04248
0.370052
0.123467
0.0389679
0.0116969
0.00335457
0.000922813
0.000244337
6.24538e-05
1.54514e-05
3.70873e-06
8.65433e-07
1.96698e-07
4.36165e-08
9.4502e-09
2.00339e-09
4.16072e-10
8.47506e-11
1.69489e-11
3.33108e-12
6.43954e-13
1.22548e-13
2.29759e-14
4.24672e-15
7.74352e-16
1.39377e-16
2.47775e-17
4.35283e-18
7.56051e-19
1.29897e-19
2.20857e-20
3.71762e-21
6.19774e-22
1.02371e-22
1.67591e-23
2.72018e-24
4.3788e-25
6.99288e-26
1.10821e-26
1.74331e-27
2.72286e-28
4.22358e-29
6.50796e-30
9.96359e-31
1.51596e-31
2.29272e-32
3.44741e-33
5.1546e-34
7.66545e-35
1.13396e-35
1.66897e-36
2.44435e-37
3.56293e-38
5.16948e-39
7.46702e-40
1.07391e-40
1.53805e-41
2.19386e-42
3.11703e-43
4.41184e-44
6.2215e-45
8.74214e-46
1.22416e-46
1.70843e-47
2.37654e-48
3.29553e-49
4.55595e-50
6.2798e-51
8.63111e-52
1.18299e-52
1.61704e-53
2.20459e-54
2.99803e-55
4.06701e-56
5.50402e-57
7.43158e-58
1.00117e-58
1.34584e-59
1.80536e-60
2.41682e-61
3.22895e-62
4.3057e-63
5.73077e-64
7.61365e-65
1.00974e-65
1.33683e-66
1.76695e-67
2.33162e-68
3.07723e-69
3.63773e-70
97.3359
102.877
110.364
102.657
79.529
52.0395
29.4618
14.7519
6.65107
2.73925
1.04248
0.370052
0.123467
0.0389679
0.0116969
0.00335457
0.000922813
0.000244337
6.24538e-05
1.54514e-05
3.70873e-06
8.65433e-07
1.96698e-07
4.36165e-08
9.4502e-09
2.00339e-09
4.16072e-10
8.47506e-11
1.69489e-11
3.33108e-12
6.43954e-13
1.22548e-13
2.29759e-14
4.24672e-15
7.74352e-16
1.39377e-16
2.47775e-17
4.35283e-18
7.56051e-19
1.29897e-19
2.20857e-20
3.71762e-21
6.19774e-22
1.02371e-22
1.67591e-23
2.72018e-24
4.37881e-25
6.99289e-26
1.10821e-26
1.74332e-27
2.72287e-28
4.22359e-29
6.50799e-30
9.96364e-31
1.51597e-31
2.29274e-32
3.44744e-33
5.15466e-34
7.66556e-35
1.13398e-35
1.66901e-36
2.44441e-37
3.56303e-38
5.16966e-39
7.46732e-40
1.07396e-40
1.53814e-41
2.19401e-42
3.11728e-43
4.41224e-44
6.22216e-45
8.74322e-46
1.22433e-46
1.70871e-47
2.37699e-48
3.29624e-49
4.55706e-50
6.28154e-51
8.63381e-52
1.1834e-52
1.61768e-53
2.20557e-54
2.99951e-55
4.06924e-56
5.50737e-57
7.43658e-58
1.00192e-58
1.34694e-59
1.80696e-60
2.41916e-61
3.23236e-62
4.31062e-63
5.73784e-64
7.62378e-65
1.01118e-65
1.33888e-66
1.76985e-67
2.33569e-68
3.08294e-69
3.64484e-70
97.3359
102.877
110.364
102.657
79.529
52.0395
29.4618
14.7519
6.65107
2.73925
1.04248
0.370052
0.123467
0.0389679
0.0116969
0.00335457
0.000922813
0.000244337
6.24538e-05
1.54514e-05
3.70873e-06
8.65433e-07
1.96698e-07
4.36165e-08
9.4502e-09
2.00339e-09
4.16072e-10
8.47506e-11
1.69489e-11
3.33108e-12
6.43954e-13
1.22548e-13
2.29759e-14
4.24672e-15
7.74352e-16
1.39377e-16
2.47775e-17
4.35283e-18
7.56051e-19
1.29897e-19
2.20857e-20
3.71762e-21
6.19773e-22
1.02371e-22
1.67591e-23
2.72017e-24
4.3788e-25
6.99287e-26
1.10821e-26
1.74331e-27
2.72285e-28
4.22356e-29
6.50793e-30
9.96353e-31
1.51595e-31
2.2927e-32
3.44737e-33
5.15453e-34
7.66532e-35
1.13394e-35
1.66893e-36
2.44428e-37
3.56281e-38
5.16928e-39
7.46668e-40
1.07385e-40
1.53796e-41
2.19371e-42
3.11678e-43
4.41143e-44
6.22084e-45
8.74109e-46
1.22399e-46
1.70817e-47
2.37613e-48
3.2949e-49
4.55496e-50
6.2783e-51
8.62883e-52
1.18264e-52
1.61653e-53
2.20382e-54
2.99688e-55
4.06531e-56
5.50153e-57
7.42796e-58
1.00065e-58
1.34508e-59
1.80427e-60
2.41526e-61
3.22675e-62
4.30258e-63
5.72638e-64
7.60751e-65
1.00888e-65
1.33565e-66
1.76532e-67
2.32937e-68
3.07415e-69
3.63398e-70
97.3359
102.877
110.364
102.657
79.529
52.0395
29.4618
14.7519
6.65107
2.73925
1.04248
0.370052
0.123467
0.0389679
0.0116969
0.00335457
0.000922813
0.000244337
6.24538e-05
1.54514e-05
3.70873e-06
8.65433e-07
1.96698e-07
4.36165e-08
9.4502e-09
2.00339e-09
4.16072e-10
8.47506e-11
1.69489e-11
3.33108e-12
6.43954e-13
1.22548e-13
2.29759e-14
4.24672e-15
7.74352e-16
1.39377e-16
2.47775e-17
4.35283e-18
7.56051e-19
1.29897e-19
2.20857e-20
3.71762e-21
6.19775e-22
1.02371e-22
1.67591e-23
2.72019e-24
4.37882e-25
6.99292e-26
1.10822e-26
1.74333e-27
2.72289e-28
4.22364e-29
6.50806e-30
9.96378e-31
1.516e-31
2.29279e-32
3.44752e-33
5.15481e-34
7.66582e-35
1.13403e-35
1.66909e-36
2.44454e-37
3.56326e-38
5.17006e-39
7.46798e-40
1.07407e-40
1.53832e-41
2.1943e-42
3.11775e-43
4.41299e-44
6.22336e-45
8.74511e-46
1.22463e-46
1.70917e-47
2.3777e-48
3.29733e-49
4.55872e-50
6.28405e-51
8.63759e-52
1.18397e-52
1.61852e-53
2.20681e-54
3.00132e-55
4.07189e-56
5.5112e-57
7.44211e-58
1.00271e-58
1.34807e-59
1.80857e-60
2.42143e-61
3.23555e-62
4.31507e-63
5.74405e-64
7.63238e-65
1.01236e-65
1.34051e-66
1.77207e-67
2.33872e-68
3.08706e-69
3.64982e-70
97.3359
102.877
110.364
102.657
79.529
52.0395
29.4618
14.7519
6.65107
2.73925
1.04248
0.370052
0.123467
0.0389679
0.0116969
0.00335457
0.000922813
0.000244337
6.24538e-05
1.54514e-05
3.70873e-06
8.65433e-07
1.96698e-07
4.36165e-08
9.4502e-09
2.00339e-09
4.16072e-10
8.47506e-11
1.69489e-11
3.33108e-12
6.43954e-13
1.22548e-13
2.29759e-14
4.24672e-15
7.74351e-16
1.39377e-16
2.47774e-17
4.35282e-18
7.5605e-19
1.29897e-19
2.20856e-20
3.71761e-21
6.19772e-22
1.02371e-22
1.6759e-23
2.72016e-24
4.37876e-25
6.9928e-26
1.1082e-26
1.74328e-27
2.7228e-28
4.22348e-29
6.50776e-30
9.96323e-31
1.51589e-31
2.2926e-32
3.44719e-33
5.15422e-34
7.66479e-35
1.13385e-35
1.66878e-36
2.44401e-37
3.56236e-38
5.16854e-39
7.46546e-40
1.07366e-40
1.53763e-41
2.19319e-42
3.11596e-43
4.41012e-44
6.21879e-45
8.7379e-46
1.2235e-46
1.70741e-47
2.37498e-48
3.29314e-49
4.55233e-50
6.27436e-51
8.62297e-52
1.18178e-52
1.61526e-53
2.20197e-54
2.99419e-55
4.06144e-56
5.49598e-57
7.42004e-58
9.99526e-59
1.3435e-59
1.80205e-60
2.41216e-61
3.22243e-62
4.2966e-63
5.71814e-64
7.5962e-65
1.00733e-65
1.33354e-66
1.76246e-67
2.32551e-68
3.06894e-69
3.62771e-70
97.3359
102.877
110.364
102.657
79.529
52.0395
29.4618
14.7519
6.65107
2.73925
1.04248
0.370052
0.123467
0.0389679
0.0116969
0.00335457
0.000922813
0.000244337
6.24538e-05
1.54514e-05
3.70873e-06
8.65434e-07
1.96698e-07
4.36165e-08
9.4502e-09
2.00339e-09
4.16072e-10
8.47506e-11
1.69489e-11
3.33108e-12
6.43954e-13
1.22548e-13
2.29759e-14
4.24673e-15
7.74352e-16
1.39377e-16
2.47775e-17
4.35284e-18
7.56053e-19
1.29898e-19
2.20858e-20
3.71764e-21
6.19779e-22
1.02372e-22
1.67593e-23
2.72022e-24
4.3789e-25
6.99306e-26
1.10825e-26
1.74338e-27
2.72299e-28
4.22382e-29
6.5084e-30
9.96438e-31
1.5161e-31
2.29298e-32
3.44786e-33
5.15539e-34
7.66682e-35
1.1342e-35
1.66937e-36
2.44502e-37
3.56405e-38
5.17135e-39
7.47009e-40
1.07441e-40
1.53886e-41
2.19516e-42
3.11911e-43
4.41511e-44
6.22664e-45
8.75016e-46
1.2254e-46
1.71034e-47
2.37946e-48
3.29997e-49
4.56264e-50
6.28984e-51
8.64608e-52
1.18521e-52
1.62032e-53
2.2094e-54
3.00503e-55
4.07717e-56
5.5187e-57
7.45268e-58
1.00419e-58
1.35014e-59
1.81145e-60
2.42541e-61
3.24104e-62
4.32261e-63
5.75435e-64
7.64642e-65
1.01427e-65
1.34309e-66
1.77556e-67
2.34341e-68
3.09338e-69
3.65741e-70
97.3359
102.877
110.364
102.657
79.529
52.0395
29.4618
14.7519
6.65107
2.73925
1.04248
0.370052
0.123467
0.0389679
0.0116969
0.00335457
0.000922813
0.000244337
6.24538e-05
1.54514e-05
3.70873e-06
8.65433e-07
1.96698e-07
4.36165e-08
9.4502e-09
2.00339e-09
4.16072e-10
8.47505e-11
1.69489e-11
3.33108e-12
6.43953e-13
1.22548e-13
2.29758e-14
4.24671e-15
7.7435e-16
1.39376e-16
2.47774e-17
4.3528e-18
7.56045e-19
1.29896e-19
2.20854e-20
3.71756e-21
6.19762e-22
1.02369e-22
1.67586e-23
2.72008e-24
4.37861e-25
6.99251e-26
1.10814e-26
1.74318e-27
2.72261e-28
4.22312e-29
6.50713e-30
9.96209e-31
1.51569e-31
2.29225e-32
3.44659e-33
5.15318e-34
7.66303e-35
1.13355e-35
1.66829e-36
2.4432e-37
3.56104e-38
5.16641e-39
7.46204e-40
1.07311e-40
1.53677e-41
2.19185e-42
3.11387e-43
4.40691e-44
6.21387e-45
8.73044e-46
1.22237e-46
1.70573e-47
2.37248e-48
3.28945e-49
4.54691e-50
6.26645e-51
8.61151e-52
1.18013e-52
1.61289e-53
2.1986e-54
2.98942e-55
4.05471e-56
5.48654e-57
7.40686e-58
9.97693e-59
1.34096e-59
1.79854e-60
2.40734e-61
3.21584e-62
4.2876e-63
5.70588e-64
7.57955e-65
1.00508e-65
1.33049e-66
1.75834e-67
2.31995e-68
3.06143e-69
3.61866e-70
97.3359
102.877
110.364
102.657
79.529
52.0395
29.4618
14.7519
6.65107
2.73925
1.04248
0.370052
0.123467
0.0389679
0.0116969
0.00335457
0.000922813
0.000244337
6.24538e-05
1.54514e-05
3.70873e-06
8.65434e-07
1.96698e-07
4.36165e-08
9.4502e-09
2.00339e-09
4.16072e-10
8.47506e-11
1.6949e-11
3.33108e-12
6.43955e-13
1.22549e-13
2.2976e-14
4.24674e-15
7.74357e-16
1.39378e-16
2.47777e-17
4.35289e-18
7.56064e-19
1.299e-19
2.20863e-20
3.71774e-21
6.19799e-22
1.02376e-22
1.67601e-23
2.72038e-24
4.37919e-25
6.99363e-26
1.10835e-26
1.74358e-27
2.72334e-28
4.22446e-29
6.50954e-30
9.9664e-31
1.51645e-31
2.29358e-32
3.44889e-33
5.15713e-34
7.66972e-35
1.13468e-35
1.67016e-36
2.4463e-37
3.56611e-38
5.17463e-39
7.47527e-40
1.07522e-40
1.54012e-41
2.19711e-42
3.12208e-43
4.41964e-44
6.23346e-45
8.76037e-46
1.22691e-46
1.71258e-47
2.38275e-48
3.30476e-49
4.56958e-50
6.29984e-51
8.6604e-52
1.18725e-52
1.62321e-53
2.21347e-54
3.01076e-55
4.08518e-56
5.52985e-57
7.46815e-58
1.00633e-58
1.35309e-59
1.81551e-60
2.43098e-61
3.24866e-62
4.33304e-63
5.76858e-64
7.66582e-65
1.01691e-65
1.34669e-66
1.78044e-67
2.35004e-68
3.10239e-69
3.66835e-70
97.3359
102.877
110.364
102.657
79.529
52.0395
29.4618
14.7519
6.65107
2.73925
1.04248
0.370052
0.123467
0.0389679
0.0116969
0.00335457
0.000922813
0.000244337
6.24538e-05
1.54514e-05
3.70873e-06
8.65433e-07
1.96698e-07
4.36165e-08
9.45019e-09
2.00339e-09
4.16071e-10
8.47504e-11
1.69489e-11
3.33107e-12
6.43951e-13
1.22548e-13
2.29757e-14
4.24668e-15
7.7434e-16
1.39374e-16
2.47769e-17
4.3527e-18
7.56023e-19
1.29891e-19
2.20845e-20
3.71737e-21
6.19722e-22
1.02361e-22
1.67571e-23
2.71979e-24
4.37806e-25
6.99148e-26
1.10795e-26
1.74284e-27
2.72199e-28
4.22203e-29
6.50521e-30
9.95876e-31
1.51512e-31
2.29128e-32
3.44496e-33
5.15048e-34
7.6586e-35
1.13283e-35
1.66712e-36
2.44134e-37
3.55809e-38
5.16178e-39
7.45483e-40
1.072e-40
1.53507e-41
2.18925e-42
3.10996e-43
4.40105e-44
6.20517e-45
8.71758e-46
1.22048e-46
1.70298e-47
2.36849e-48
3.28371e-49
4.53868e-50
6.25472e-51
8.59486e-52
1.17777e-52
1.60958e-53
2.19395e-54
2.98292e-55
4.04565e-56
5.47394e-57
7.38938e-58
9.95271e-59
1.33761e-59
1.79392e-60
2.40096e-61
3.20703e-62
4.27547e-63
5.68919e-64
7.5566e-65
1.00192e-65
1.32616e-66
1.7524e-67
2.31181e-68
3.05028e-69
3.60505e-70
97.3359
102.877
110.364
102.657
79.529
52.0395
29.4618
14.7519
6.65107
2.73925
1.04248
0.370052
0.123467
0.0389679
0.0116969
0.00335457
0.000922813
0.000244337
6.24538e-05
1.54514e-05
3.70873e-06
8.65434e-07
1.96698e-07
4.36165e-08
9.45022e-09
2.0034e-09
4.16074e-10
8.4751e-11
1.6949e-11
3.33111e-12
6.43962e-13
1.2255e-13
2.29763e-14
4.24683e-15
7.74376e-16
1.39382e-16
2.47787e-17
4.35309e-18
7.56107e-19
1.29909e-19
2.20881e-20
3.71811e-21
6.19872e-22
1.0239e-22
1.67628e-23
2.72089e-24
4.38014e-25
6.99536e-26
1.10867e-26
1.74414e-27
2.72434e-28
4.22619e-29
6.51252e-30
9.97148e-31
1.51731e-31
2.29501e-32
3.45125e-33
5.16098e-34
7.67596e-35
1.13567e-35
1.67174e-36
2.44879e-37
3.56999e-38
5.18063e-39
7.48446e-40
1.07662e-40
1.54223e-41
2.20027e-42
3.12678e-43
4.42658e-44
6.24366e-45
8.77525e-46
1.22907e-46
1.7157e-47
2.38723e-48
3.31116e-49
4.57871e-50
6.3128e-51
8.67875e-52
1.18984e-52
1.62686e-53
2.2186e-54
3.01796e-55
4.09528e-56
5.54399e-57
7.48794e-58
1.0091e-58
1.35696e-59
1.82091e-60
2.43851e-61
3.25916e-62
4.34764e-63
5.78887e-64
7.69397e-65
1.02081e-65
1.35207e-66
1.78786e-67
2.36024e-68
3.11638e-69
3.68543e-70
97.3359
102.877
110.364
102.657
79.529
52.0395
29.4618
14.7519
6.65107
2.73925
1.04248
0.370052
0.123467
0.0389679
0.0116969
0.00335457
0.000922813
0.000244337
6.24538e-05
1.54514e-05
3.70872e-06
8.65432e-07
1.96698e-07
4.36163e-08
9.45016e-09
2.00338e-09
4.16068e-10
8.47496e-11
1.69487e-11
3.33101e-12
6.43938e-13
1.22544e-13
2.29749e-14
4.24651e-15
7.74302e-16
1.39366e-16
2.47751e-17
4.35232e-18
7.55944e-19
1.29875e-19
2.20812e-20
3.71673e-21
6.19599e-22
1.02337e-22
1.67526e-23
2.71897e-24
4.37656e-25
6.98878e-26
1.10747e-26
1.74199e-27
2.72053e-28
4.21952e-29
6.50097e-30
9.95166e-31
1.51395e-31
2.28936e-32
3.44184e-33
5.14548e-34
7.65063e-35
1.13157e-35
1.66516e-36
2.43832e-37
3.55345e-38
5.15471e-39
7.44416e-40
1.0704e-40
1.53269e-41
2.18573e-42
3.10477e-43
4.39346e-44
6.19411e-45
8.70154e-46
1.21817e-46
1.69964e-47
2.3637e-48
3.27685e-49
4.52887e-50
6.24071e-51
8.57489e-52
1.17493e-52
1.60553e-53
2.18819e-54
2.97473e-55
4.03402e-56
5.45743e-57
7.36598e-58
9.9196e-59
1.33294e-59
1.78732e-60
2.39169e-61
3.19403e-62
4.2573e-63
5.66387e-64
7.52144e-65
9.97061e-66
1.31946e-66
1.74321e-67
2.29927e-68
3.0332e-69
3.58436e-70
97.3359
102.877
110.364
102.657
79.529
52.0395
29.4618
14.7519
6.65107
2.73925
1.04248
0.370052
0.123467
0.0389679
0.0116969
0.00335457
0.000922814
0.000244337
6.24539e-05
1.54514e-05
3.70874e-06
8.65437e-07
1.96699e-07
4.36168e-08
9.4503e-09
2.00342e-09
4.1608e-10
8.47526e-11
1.69495e-11
3.33121e-12
6.43987e-13
1.22556e-13
2.29777e-14
4.24714e-15
7.74445e-16
1.39397e-16
2.47818e-17
4.35375e-18
7.5624e-19
1.29936e-19
2.20933e-20
3.71912e-21
6.20064e-22
1.02426e-22
1.67694e-23
2.72209e-24
4.3823e-25
6.99918e-26
1.10933e-26
1.74528e-27
2.72628e-28
4.22947e-29
6.51797e-30
9.98043e-31
1.51876e-31
2.29735e-32
3.45497e-33
5.16685e-34
7.68512e-35
1.13709e-35
1.67393e-36
2.45212e-37
3.57503e-38
5.1882e-39
7.49578e-40
1.0783e-40
1.54472e-41
2.20394e-42
3.13217e-43
4.43446e-44
6.25516e-45
8.79202e-46
1.23152e-46
1.71925e-47
2.39239e-48
3.31865e-49
4.58957e-50
6.32855e-51
8.70157e-52
1.19314e-52
1.63163e-53
2.22549e-54
3.02787e-55
4.1095e-56
5.56434e-57
7.51697e-58
1.01322e-58
1.36279e-59
1.82913e-60
2.45005e-61
3.27526e-62
4.37001e-63
5.81978e-64
7.73645e-65
1.02662e-65
1.35997e-66
1.79855e-67
2.37461e-68
3.13566e-69
3.70844e-70
97.3359
102.877
110.364
102.657
79.529
52.0395
29.4618
14.7519
6.65107
2.73925
1.04248
0.370052
0.123467
0.0389679
0.0116969
0.00335456
0.000922812
0.000244336
6.24536e-05
1.54513e-05
3.7087e-06
8.65426e-07
1.96696e-07
4.36157e-08
9.44999e-09
2.00333e-09
4.16056e-10
8.47464e-11
1.69479e-11
3.33082e-12
6.43891e-13
1.22534e-13
2.29725e-14
4.24597e-15
7.74187e-16
1.39341e-16
2.477e-17
4.35129e-18
7.55739e-19
1.29835e-19
2.20735e-20
3.71527e-21
6.19328e-22
1.02288e-22
1.67437e-23
2.71737e-24
4.37376e-25
6.98394e-26
1.10665e-26
1.7406e-27
2.71821e-28
4.21569e-29
6.49472e-30
9.9416e-31
1.51234e-31
2.28682e-32
3.43787e-33
5.1393e-34
7.64111e-35
1.13012e-35
1.66294e-36
2.43495e-37
3.54839e-38
5.14711e-39
7.43278e-40
1.0687e-40
1.53015e-41
2.18196e-42
3.09916e-43
4.38512e-44
6.18172e-45
8.68314e-46
1.21544e-46
1.69559e-47
2.35771e-48
3.26798e-49
4.5158e-50
6.2215e-51
8.54673e-52
1.17082e-52
1.59955e-53
2.17954e-54
2.96228e-55
4.01618e-56
5.43202e-57
7.32998e-58
9.8689e-59
1.32584e-59
1.77745e-60
2.37803e-61
3.17526e-62
4.23166e-63
5.62906e-64
7.47448e-65
9.90763e-66
1.31107e-66
1.73209e-67
2.28461e-68
3.01396e-69
3.56183e-70
97.3359
102.877
110.364
102.657
79.529
52.0395
29.4618
14.7519
6.65108
2.73925
1.04248
0.370053
0.123467
0.0389679
0.0116969
0.00335457
0.000922816
0.000244338
6.24543e-05
1.54515e-05
3.70878e-06
8.6545e-07
1.96703e-07
4.3618e-08
9.45062e-09
2.00351e-09
4.16102e-10
8.47583e-11
1.69509e-11
3.33155e-12
6.44064e-13
1.22574e-13
2.29816e-14
4.24797e-15
7.7462e-16
1.39433e-16
2.47892e-17
4.3552e-18
7.56523e-19
1.2999e-19
2.21035e-20
3.721e-21
6.20405e-22
1.02487e-22
1.67802e-23
2.72397e-24
4.38552e-25
7.00462e-26
1.11024e-26
1.74679e-27
2.72875e-28
4.23345e-29
6.52434e-30
9.99055e-31
1.52036e-31
2.29985e-32
3.45885e-33
5.17286e-34
7.69439e-35
1.13852e-35
1.67611e-36
2.45546e-37
3.58013e-38
5.19601e-39
7.50771e-40
1.08013e-40
1.5475e-41
2.20818e-42
3.13864e-43
4.4443e-44
6.27009e-45
8.8146e-46
1.23492e-46
1.72435e-47
2.40001e-48
3.32998e-49
4.6063e-50
6.35311e-51
8.73741e-52
1.19833e-52
1.63911e-53
2.23618e-54
3.04305e-55
4.13091e-56
5.59432e-57
7.55866e-58
1.01898e-58
1.37068e-59
1.83987e-60
2.46458e-61
3.29478e-62
4.39605e-63
5.85431e-64
7.78195e-65
1.03258e-65
1.36773e-66
1.8086e-67
2.38757e-68
3.15231e-69
3.72759e-70
97.3359
102.877
110.364
102.657
79.529
52.0395
29.4618
14.7519
6.65107
2.73925
1.04248
0.370052
0.123467
0.0389678
0.0116969
0.00335455
0.000922806
0.000244334
6.24529e-05
1.54511e-05
3.70862e-06
8.65401e-07
1.96688e-07
4.36137e-08
9.44943e-09
2.00319e-09
4.16019e-10
8.47372e-11
1.69457e-11
3.33031e-12
6.43776e-13
1.22508e-13
2.2967e-14
4.24482e-15
7.73951e-16
1.39294e-16
2.47607e-17
4.34948e-18
7.55395e-19
1.29771e-19
2.20618e-20
3.71315e-21
6.18952e-22
1.02222e-22
1.67323e-23
2.71544e-24
4.37051e-25
6.97853e-26
1.10576e-26
1.73915e-27
2.71586e-28
4.21192e-29
6.48869e-30
9.932e-31
1.51082e-31
2.28441e-32
3.43406e-33
5.13328e-34
7.6316e-35
1.12861e-35
1.66057e-36
2.43121e-37
3.54248e-38
5.13782e-39
7.4182e-40
1.06642e-40
1.5266e-41
2.17645e-42
3.09068e-43
4.37213e-44
6.16195e-45
8.65328e-46
1.21096e-46
1.68892e-47
2.34785e-48
3.25355e-49
4.4948e-50
6.19121e-51
8.50339e-52
1.16466e-52
1.59089e-53
2.16744e-54
2.94549e-55
3.99309e-56
5.40049e-57
7.28726e-58
9.81144e-59
1.31816e-59
1.76727e-60
2.36461e-61
3.15769e-62
4.20877e-63
5.59942e-64
7.43626e-65
9.85856e-66
1.30479e-66
1.72407e-67
2.27439e-68
3.00091e-69
3.54685e-70
97.3359
102.877
110.364
102.657
79.529
52.0395
29.4618
14.7519
6.65108
2.73925
1.04248
0.370053
0.123467
0.038968
0.011697
0.0033546
0.000922827
0.000244342
6.24556e-05
1.5452e-05
3.70892e-06
8.65492e-07
1.96715e-07
4.36213e-08
9.45149e-09
2.00373e-09
4.16157e-10
8.47715e-11
1.69539e-11
3.33224e-12
6.44216e-13
1.22606e-13
2.29884e-14
4.24937e-15
7.74899e-16
1.39488e-16
2.47996e-17
4.35717e-18
7.56888e-19
1.30056e-19
2.21154e-20
3.7231e-21
6.20771e-22
1.0255e-22
1.67909e-23
2.72578e-24
4.38854e-25
7.00966e-26
1.11108e-26
1.74817e-27
2.73102e-28
4.23719e-29
6.5305e-30
1.00007e-30
1.52203e-31
2.30259e-32
3.46335e-33
5.18023e-34
7.70643e-35
1.14048e-35
1.67928e-36
2.46056e-37
3.58829e-38
5.20895e-39
7.52809e-40
1.08331e-40
1.55243e-41
2.21575e-42
3.15015e-43
4.46167e-44
6.29605e-45
8.85305e-46
1.24056e-46
1.73256e-47
2.41184e-48
3.34688e-49
4.63024e-50
6.38672e-51
8.78419e-52
1.20479e-52
1.64795e-53
2.24819e-54
3.05924e-55
4.15257e-56
5.62309e-57
7.59662e-58
1.02396e-58
1.37718e-59
1.84831e-60
2.47548e-61
3.30883e-62
4.41413e-63
5.87755e-64
7.81184e-65
1.03643e-65
1.37271e-66
1.81506e-67
2.396e-68
3.1634e-69
3.74072e-70
97.3359
102.877
110.364
102.657
79.529
52.0395
29.4618
14.7519
6.65107
2.73925
1.04248
0.370051
0.123466
0.0389675
0.0116968
0.0033545
0.000922788
0.000244327
6.24506e-05
1.54503e-05
3.7084e-06
8.65337e-07
1.96671e-07
4.3609e-08
9.44822e-09
2.00289e-09
4.15947e-10
8.47206e-11
1.69419e-11
3.32949e-12
6.436e-13
1.22472e-13
2.29596e-14
4.24334e-15
7.73662e-16
1.39238e-16
2.47503e-17
4.34756e-18
7.55045e-19
1.29708e-19
2.20505e-20
3.71117e-21
6.18604e-22
1.02161e-22
1.67218e-23
2.71361e-24
4.36734e-25
6.97304e-26
1.10481e-26
1.7375e-27
2.71303e-28
4.20706e-29
6.48037e-30
9.91783e-31
1.50842e-31
2.28038e-32
3.42734e-33
5.12218e-34
7.61343e-35
1.12567e-35
1.65584e-36
2.42369e-37
3.53064e-38
5.11937e-39
7.38975e-40
1.06208e-40
1.52004e-41
2.16665e-42
3.07616e-43
4.35084e-44
6.13104e-45
8.60883e-46
1.20463e-46
1.67999e-47
2.33536e-48
3.23623e-49
4.47101e-50
6.15878e-51
8.45954e-52
1.15878e-52
1.58305e-53
2.15706e-54
2.93184e-55
3.9752e-56
5.37717e-57
7.25692e-58
9.77206e-59
1.31305e-59
1.76063e-60
2.35597e-61
3.14641e-62
4.19397e-63
5.57989e-64
7.41036e-65
9.82399e-66
1.30015e-66
1.71782e-67
2.26593e-68
2.9894e-69
3.53285e-70
97.3359
102.877
110.364
102.657
79.529
52.0395
29.4618
14.7519
6.65108
2.73925
1.04249
0.370055
0.123468
0.0389685
0.0116972
0.00335468
0.000922857
0.000244352
6.2459e-05
1.5453e-05
3.70923e-06
8.65578e-07
1.96738e-07
4.36273e-08
9.45298e-09
2.00409e-09
4.16241e-10
8.47903e-11
1.6958e-11
3.33312e-12
6.44401e-13
1.22644e-13
2.29959e-14
4.25086e-15
7.75188e-16
1.39543e-16
2.48101e-17
4.35915e-18
7.57257e-19
1.30125e-19
2.21281e-20
3.72544e-21
6.21202e-22
1.02629e-22
1.68054e-23
2.7284e-24
4.39328e-25
7.01815e-26
1.11259e-26
1.75083e-27
2.73567e-28
4.24523e-29
6.54425e-30
1.00239e-30
1.52592e-31
2.30901e-32
3.47386e-33
5.1972e-34
7.73354e-35
1.14476e-35
1.68596e-36
2.47087e-37
3.60403e-38
5.23271e-39
7.56359e-40
1.08856e-40
1.5601e-41
2.22685e-42
3.16606e-43
4.48424e-44
6.32777e-45
8.89721e-46
1.24665e-46
1.7409e-47
2.42315e-48
3.36209e-49
4.65057e-50
6.41371e-51
8.81983e-52
1.20947e-52
1.65408e-53
2.2562e-54
3.06967e-55
4.16618e-56
5.64087e-57
7.61989e-58
1.02702e-58
1.38121e-59
1.85365e-60
2.48259e-61
3.31833e-62
4.42686e-63
5.89466e-64
7.83485e-65
1.03952e-65
1.37686e-66
1.82061e-67
2.40339e-68
3.17319e-69
3.75231e-70
97.3359
102.877
110.364
102.657
79.529
52.0395
29.4618
14.7518
6.65106
2.73924
1.04248
0.370048
0.123464
0.0389667
0.0116964
0.00335438
0.000922743
0.000244312
6.24459e-05
1.54489e-05
3.708e-06
8.65228e-07
1.96642e-07
4.36018e-08
9.44647e-09
2.00248e-09
4.15852e-10
8.46993e-11
1.69373e-11
3.32849e-12
6.43389e-13
1.22428e-13
2.29505e-14
4.2415e-15
7.7329e-16
1.39164e-16
2.47355e-17
4.34464e-18
7.54475e-19
1.29597e-19
2.20293e-20
3.70713e-21
6.17843e-22
1.02019e-22
1.66957e-23
2.70887e-24
4.35883e-25
6.95796e-26
1.10217e-26
1.73295e-27
2.70526e-28
4.19399e-29
6.45867e-30
9.88225e-31
1.50266e-31
2.27117e-32
3.41279e-33
5.09947e-34
7.57841e-35
1.12033e-35
1.6478e-36
2.41172e-37
3.51303e-38
5.09374e-39
7.35285e-40
1.05682e-40
1.51263e-41
2.15631e-42
3.06189e-43
4.33132e-44
6.10461e-45
8.57335e-46
1.1999e-46
1.67376e-47
2.3272e-48
3.22561e-49
4.45728e-50
6.14113e-51
8.43695e-52
1.1559e-52
1.57938e-53
2.15241e-54
2.92595e-55
3.96776e-56
5.36778e-57
7.24513e-58
9.75733e-59
1.31123e-59
1.7584e-60
2.3533e-61
3.14329e-62
4.1905e-63
5.57631e-64
7.40716e-65
9.82211e-66
1.30026e-66
1.71848e-67
2.26758e-68
2.99273e-69
3.53805e-70
97.3359
102.877
110.364
102.657
79.529
52.0395
29.4619
14.7519
6.6511
2.73927
1.0425
0.370061
0.123471
0.0389698
0.0116977
0.00335487
0.000922923
0.000244374
6.24657e-05
1.5455e-05
3.70978e-06
8.65726e-07
1.96777e-07
4.3637e-08
9.45538e-09
2.00466e-09
4.16375e-10
8.48213e-11
1.69651e-11
3.33468e-12
6.44742e-13
1.22718e-13
2.30117e-14
4.25416e-15
7.75873e-16
1.39683e-16
2.48383e-17
4.36474e-18
7.58352e-19
1.30336e-19
2.21682e-20
3.73294e-21
6.22584e-22
1.0288e-22
1.68503e-23
2.73631e-24
4.40703e-25
7.04171e-26
1.11657e-26
1.75745e-27
2.74653e-28
4.26282e-29
6.57234e-30
1.00682e-30
1.5328e-31
2.31958e-32
3.48985e-33
5.22111e-34
7.76881e-35
1.14989e-35
1.69334e-36
2.48134e-37
3.61868e-38
5.25293e-39
7.5911e-40
1.09225e-40
1.56497e-41
2.23318e-42
3.17412e-43
4.49429e-44
6.34e-45
8.91163e-46
1.24829e-46
1.74263e-47
2.42482e-48
3.36338e-49
4.65094e-50
6.41227e-51
8.81516e-52
1.20846e-52
1.65217e-53
2.25286e-54
3.06411e-55
4.15715e-56
5.62653e-57
7.5975e-58
1.02356e-58
1.37594e-59
1.84567e-60
2.4706e-61
3.30046e-62
4.40041e-63
5.85575e-64
7.77798e-65
1.03126e-65
1.36492e-66
1.80348e-67
2.37893e-68
3.13841e-69
3.70855e-70
97.3359
102.877
110.364
102.658
79.529
52.0395
29.4618
14.7518
6.65101
2.7392
1.04245
0.370036
0.123459
0.0389644
0.0116955
0.00335405
0.000922632
0.000244276
6.24348e-05
1.54457e-05
3.70708e-06
8.64976e-07
1.96575e-07
4.35846e-08
9.44215e-09
2.00142e-09
4.156e-10
8.46403e-11
1.69238e-11
3.32546e-12
6.42723e-13
1.22284e-13
2.29202e-14
4.23519e-15
7.72005e-16
1.38907e-16
2.4685e-17
4.3349e-18
7.52627e-19
1.29253e-19
2.19662e-20
3.69575e-21
6.15827e-22
1.01668e-22
1.66354e-23
2.6987e-24
4.34195e-25
6.93037e-26
1.09773e-26
1.72593e-27
2.69433e-28
4.17725e-29
6.43346e-30
9.84497e-31
1.49725e-31
2.26347e-32
3.40207e-33
5.08491e-34
7.55922e-35
1.11789e-35
1.64485e-36
2.40838e-37
3.50968e-38
5.09118e-39
7.3526e-40
1.0573e-40
1.51406e-41
2.15944e-42
3.06791e-43
4.34212e-44
6.12308e-45
8.60394e-46
1.20485e-46
1.68161e-47
2.33947e-48
3.24456e-49
4.48623e-50
6.18497e-51
8.50284e-52
1.16573e-52
1.59398e-53
2.17394e-54
2.95754e-55
4.0139e-56
5.43485e-57
7.34215e-58
9.89703e-59
1.33125e-59
1.78698e-60
2.39389e-61
3.20069e-62
4.2713e-63
5.68954e-64
7.56513e-65
1.00415e-65
1.33059e-66
1.76025e-67
2.32483e-68
3.07102e-69
3.63335e-70
97.3359
102.877
110.364
102.657
79.5289
52.0395
29.462
14.752
6.65122
2.73935
1.04254
0.370084
0.123482
0.0389743
0.0116994
0.0033555
0.000923136
0.000244442
6.24867e-05
1.54612e-05
3.71153e-06
8.66207e-07
1.96904e-07
4.36695e-08
9.46346e-09
2.00662e-09
4.16835e-10
8.49269e-11
1.69887e-11
3.33984e-12
6.45845e-13
1.22948e-13
2.30587e-14
4.26356e-15
7.77711e-16
1.40035e-16
2.49045e-17
4.37691e-18
7.60544e-19
1.30723e-19
2.22352e-20
3.74429e-21
6.24467e-22
1.03186e-22
1.68987e-23
2.74379e-24
4.41826e-25
7.05803e-26
1.11885e-26
1.76047e-27
2.75025e-28
4.26685e-29
6.57561e-30
1.00683e-30
1.53202e-31
2.31711e-32
3.48411e-33
5.20934e-34
7.74639e-35
1.14583e-35
1.68622e-36
2.46921e-37
3.59846e-38
5.21985e-39
7.5378e-40
1.08377e-40
1.55166e-41
2.21248e-42
3.14224e-43
4.4456e-44
6.26619e-45
8.80053e-46
1.23167e-46
1.71793e-47
2.38829e-48
3.30968e-49
4.57237e-50
6.29789e-51
8.64944e-52
1.18456e-52
1.61787e-53
2.20386e-54
2.9944e-55
4.05845e-56
5.4874e-57
7.40226e-58
9.96285e-59
1.338e-59
1.79313e-60
2.39817e-61
3.20103e-62
4.26449e-63
5.67072e-64
7.52712e-65
9.97386e-66
1.31936e-66
1.74243e-67
2.29743e-68
3.02979e-69
3.57931e-70
97.3359
102.877
110.364
102.658
79.529
52.0394
29.4615
14.7515
6.65076
2.73904
1.04236
0.36999
0.123438
0.0389561
0.0116924
0.00335293
0.000922258
0.000244159
6.23994e-05
1.54355e-05
3.70427e-06
8.64229e-07
1.96384e-07
4.35373e-08
9.43082e-09
1.99879e-09
4.15008e-10
8.4511e-11
1.68963e-11
3.31979e-12
6.41587e-13
1.22063e-13
2.28782e-14
4.22749e-15
7.70636e-16
1.38672e-16
2.46462e-17
4.32881e-18
7.5173e-19
1.29133e-19
2.19525e-20
3.69479e-21
6.15921e-22
1.01731e-22
1.66542e-23
2.70326e-24
4.35191e-25
6.95077e-26
1.10172e-26
1.73344e-27
2.7081e-28
4.20187e-29
6.4766e-30
9.91915e-31
1.5098e-31
2.2844e-32
3.43651e-33
5.14089e-34
7.64919e-35
1.1322e-35
1.66739e-36
2.44358e-37
3.56417e-38
5.17488e-39
7.48022e-40
1.07662e-40
1.54313e-41
2.20288e-42
3.13244e-43
4.43744e-44
6.26308e-45
8.80846e-46
1.23457e-46
1.72456e-47
2.40124e-48
3.33293e-49
4.61204e-50
6.36318e-51
8.75403e-52
1.20097e-52
1.64315e-53
2.24224e-54
3.05196e-55
4.14378e-56
5.61266e-57
7.58444e-58
1.02256e-58
1.37562e-59
1.84659e-60
2.47366e-61
3.30694e-62
4.41222e-63
5.87565e-64
7.80993e-65
1.03622e-65
1.37245e-66
1.81467e-67
2.39533e-68
3.16219e-69
3.73893e-70
97.3359
102.877
110.364
102.657
79.5289
52.0399
29.4626
14.7526
6.65166
2.73963
1.04269
0.370153
0.123511
0.0389855
0.0117035
0.00335684
0.000923559
0.000244568
6.2522e-05
1.54706e-05
3.71393e-06
8.66785e-07
1.97037e-07
4.36985e-08
9.46943e-09
2.00776e-09
4.17036e-10
8.49572e-11
1.6992e-11
3.33983e-12
6.45685e-13
1.22882e-13
2.30385e-14
4.25819e-15
7.76396e-16
1.39731e-16
2.48372e-17
4.36256e-18
7.5758e-19
1.30127e-19
2.21183e-20
3.72187e-21
6.20253e-22
1.02408e-22
1.67577e-23
2.71864e-24
4.37407e-25
6.9815e-26
1.10577e-26
1.73842e-27
2.7135e-28
4.20631e-29
6.47697e-30
9.90925e-31
1.50662e-31
2.27693e-32
3.42112e-33
5.11144e-34
7.59546e-35
1.12274e-35
1.65118e-36
2.41639e-37
3.51943e-38
5.10238e-39
7.36438e-40
1.05834e-40
1.51459e-41
2.15879e-42
3.06497e-43
4.33508e-44
6.10908e-45
8.57855e-46
1.2005e-46
1.67443e-47
2.32797e-48
3.22655e-49
4.45854e-50
6.14303e-51
8.44014e-52
1.15646e-52
1.5804e-53
2.15424e-54
2.92918e-55
3.97335e-56
5.37722e-57
7.26076e-58
9.78267e-59
1.31527e-59
1.76473e-60
2.36306e-61
3.15815e-62
4.21282e-63
5.60944e-64
7.45581e-65
9.89283e-66
1.31044e-66
1.73302e-67
2.28817e-68
3.02172e-69
3.57437e-70
97.3359
102.877
110.364
102.658
79.5289
52.0387
29.4607
14.7508
6.65034
2.73882
1.04227
0.369955
0.123428
0.0389533
0.0116919
0.00335298
0.000922342
0.000244205
6.24191e-05
1.54428e-05
3.70672e-06
8.64998e-07
1.96611e-07
4.36009e-08
9.44788e-09
2.00319e-09
4.16101e-10
8.47738e-11
1.69576e-11
3.33369e-12
6.44655e-13
1.22723e-13
2.30172e-14
4.25607e-15
7.76393e-16
1.39808e-16
2.48664e-17
4.37068e-18
7.59557e-19
1.30572e-19
2.2213e-20
3.74121e-21
6.24075e-22
1.03143e-22
1.68956e-23
2.74398e-24
4.41977e-25
7.0625e-26
1.1199e-26
1.76271e-27
2.75471e-28
4.27532e-29
6.59117e-30
1.00961e-30
1.53687e-31
2.32542e-32
3.4981e-33
5.23252e-34
7.78425e-35
1.15193e-35
1.69594e-36
2.4845e-37
3.62228e-38
5.25657e-39
7.59387e-40
1.09226e-40
1.56439e-41
2.23142e-42
3.17021e-43
4.48661e-44
6.32589e-45
8.88686e-46
1.24408e-46
1.73566e-47
2.41348e-48
3.34528e-49
4.62243e-50
6.36796e-51
8.74708e-52
1.19811e-52
1.6366e-53
2.22962e-54
3.02974e-55
4.10673e-56
5.55313e-57
7.49141e-58
1.00834e-58
1.35423e-59
1.81492e-60
2.42731e-61
3.23985e-62
4.31602e-63
5.73886e-64
7.61686e-65
1.00916e-65
1.33473e-66
1.76241e-67
2.3233e-68
3.06322e-69
3.61591e-70
97.336
102.877
110.364
102.657
79.5293
52.0403
29.4626
14.7524
6.65129
2.7393
1.04248
0.370034
0.123453
0.0389601
0.0116933
0.00335309
0.000922259
0.000244144
6.23909e-05
1.5432e-05
3.70305e-06
8.63844e-07
1.96271e-07
4.35058e-08
9.42252e-09
1.99669e-09
4.14495e-10
8.43899e-11
1.68686e-11
3.31361e-12
6.40242e-13
1.21777e-13
2.28187e-14
4.21534e-15
7.68199e-16
1.38191e-16
2.4553e-17
4.31097e-18
7.48364e-19
1.28506e-19
2.18373e-20
3.67387e-21
6.12163e-22
1.01063e-22
1.65369e-23
2.68284e-24
4.31674e-25
6.89076e-26
1.09157e-26
1.71645e-27
2.6799e-28
4.15546e-29
6.40086e-30
9.79657e-31
1.49012e-31
2.25304e-32
3.38691e-33
5.06304e-34
7.52782e-35
1.11341e-35
1.63848e-36
2.39939e-37
3.49703e-38
5.07347e-39
7.32791e-40
1.05387e-40
1.50931e-41
2.15287e-42
3.05884e-43
4.32961e-44
6.10581e-45
8.58006e-46
1.20154e-46
1.67698e-47
2.33298e-48
3.23537e-49
4.47313e-50
6.16611e-51
8.47547e-52
1.16173e-52
1.58808e-53
2.16522e-54
2.94459e-55
3.99463e-56
5.40615e-57
7.29945e-58
9.83361e-59
1.32186e-59
1.77311e-60
2.37352e-61
3.17088e-62
4.22789e-63
5.62665e-64
7.47448e-65
9.91152e-66
1.31205e-66
1.73393e-67
2.28766e-68
3.01878e-69
3.56407e-70
97.3358
102.877
110.364
102.657
79.5287
52.0395
29.4623
14.7525
6.65158
2.73958
1.04267
0.37014
0.123504
0.0389824
0.0117021
0.00335626
0.000923336
0.000244488
6.24951e-05
1.5462e-05
3.71132e-06
8.6603e-07
1.96827e-07
4.36427e-08
9.45507e-09
2.0042e-09
4.16177e-10
8.47565e-11
1.69464e-11
3.32972e-12
6.43499e-13
1.2242e-13
2.2943e-14
4.23883e-15
7.72546e-16
1.38979e-16
2.46928e-17
4.33529e-18
7.52504e-19
1.29196e-19
2.19497e-20
3.69174e-21
6.14929e-22
1.01478e-22
1.6597e-23
2.69115e-24
4.32748e-25
6.90324e-26
1.09274e-26
1.71688e-27
2.6782e-28
4.14885e-29
6.38409e-30
9.76013e-31
1.48283e-31
2.23922e-32
3.36171e-33
5.01836e-34
7.45046e-35
1.10027e-35
1.61655e-36
2.36331e-37
3.43844e-38
4.97942e-39
7.17857e-40
1.03038e-40
1.47273e-41
2.09636e-42
2.97225e-43
4.19791e-44
5.90693e-45
8.28176e-46
1.15708e-46
1.61113e-47
2.236e-48
3.09336e-49
4.26626e-50
5.8663e-51
8.04308e-52
1.09966e-52
1.49939e-53
2.03901e-54
2.76576e-55
3.74223e-56
5.05127e-57
6.80231e-58
9.13963e-59
1.22531e-59
1.63924e-60
2.18846e-61
2.91584e-62
3.87745e-63
5.14645e-64
6.81827e-65
9.01714e-66
1.19046e-66
1.56903e-67
2.06456e-68
2.71711e-69
3.1995e-70
)
;
boundaryField
{
left
{
type fixedValue;
value uniform 100;
}
right
{
type zeroGradient;
}
up
{
type zeroGradient;
}
down
{
type fixedValue;
value uniform 0;
}
frontAndBack
{
type empty;
}
}
// ************************************************************************* //
| |
2001a6a164a56b1b35150991aa43a4c6d96878b7 | c0ce32b73f7eb8de3d2079e6f358e6d143f80226 | /hw3d/hw3d/Bounds.cpp | 0d0875dbb1a475eec33f7739d19e50886327cc82 | [] | no_license | lbondi7/ATPlatformerDirectX | f1e8a92be4e203b92db654a6d04d13b31c69be7f | c899543125d85343dafb0fa43537b811eb76723d | refs/heads/master | 2022-06-14T19:18:53.009248 | 2020-05-07T06:51:00 | 2020-05-07T06:51:00 | 214,225,889 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 2,696 | cpp | Bounds.cpp | #include "Bounds.h"
#include "Utilities.h"
#include <algorithm>
using namespace DirectX;
void Bounds::CalculateBoundingBox(const Vec4& pos, const std::vector<Float3>& verts, Matrix& worldMatrix)
{
XMFLOAT3 minVert = XMFLOAT3(FLT_MAX, FLT_MAX, FLT_MAX);
XMFLOAT3 maxVert = XMFLOAT3(FLT_MIN, FLT_MIN, FLT_MIN);
m_Min = { FLT_MAX, FLT_MAX, FLT_MAX };
m_Max = { -FLT_MAX, -FLT_MAX, -FLT_MAX };
Vec4 vec;
for (size_t i = 0; i < verts.size(); i++)
{
vec = Utilities::ConvertToVec4Point(verts[i]);
vec = XMVector3Transform(vec, worldMatrix);
//Get the smallest vertex
m_Min.x = std::min(m_Min.x, XMVectorGetX(vec));
m_Min.y = std::min(m_Min.y, XMVectorGetY(vec));
m_Min.z = std::min(m_Min.z, XMVectorGetZ(vec));
//Get the largest vertex
m_Max.x = std::max(m_Max.x, XMVectorGetX(vec));
m_Max.y = std::max(m_Max.y, XMVectorGetY(vec));
m_Max.z = std::max(m_Max.z, XMVectorGetZ(vec));
}
//mBBMin = { minVert.x, minVert.y, minVert.z };
//mBBMax = { maxVert.x, maxVert.y, maxVert.z };
}
bool Bounds::IsInside(const Float3& objBBMinVertex,
const Float3& objBBMaxVertex)
{
//Is obj1's max X greater than obj2's min X? If not, obj1 is to the LEFT of obj2
if ((m_Max.x > objBBMinVertex.x && m_Min.x < objBBMaxVertex.x) &&
(m_Max.y > objBBMinVertex.y && m_Min.y < objBBMaxVertex.y) &&
(m_Max.z > objBBMinVertex.z && m_Min.z < objBBMaxVertex.z))
return true;
//If the two bounding boxes are not colliding, then return false
return false;
}
bool Bounds::IsInside(const Bounds& other)
{
//Is obj1's max X greater than obj2's min X? If not, obj1 is to the LEFT of obj2
if ((m_Max.x >= other.m_Min.x && m_Min.x <= other.m_Max.x))
if ((m_Max.y >= other.m_Min.y && m_Min.y <= other.m_Max.y))
if ((m_Max.z >= other.m_Min.z && m_Min.z <= other.m_Max.z))
return true;
//If the two bounding boxes are not colliding, then return false
return false;
}
bool Bounds::RayBoxIntersect(Ray& r)
{
float txmin = (m_Min.x - r.Origin().x) * r.InvDirection().x;
float txmax = (m_Max.x - r.Origin().x) * r.InvDirection().x;
float tymin = (m_Min.y - r.Origin().y) * r.InvDirection().y;
float tymax = (m_Max.y - r.Origin().y) * r.InvDirection().y;
float tzmin = (m_Min.z - r.Origin().z) * r.InvDirection().z;
float tzmax = (m_Max.z - r.Origin().z) * r.InvDirection().z;
float tmin = std::max(std::max(std::min(txmin, txmax), std::min(tymin, tymax)), std::min(tzmin, tzmax));
float tmax = std::min(std::min(std::max(txmin, txmax), std::max(tymin, tymax)), std::max(tzmin, tzmax));
if (tmax < 0)
{
r.T(tmax);
return false;
}
if (tmin > tmax)
{
r.T(tmax);
return false;
}
if (tmin < 0) {
r.T(tmax);
}
else {
r.T(tmin);
}
return true;
} |
bd5034023b1f8c797918df648dba062adf51c2b6 | a40e65eb1f6f494b3db0266ec1f7ed7f583927ab | /question6.cpp | c7cbcc310decc61d63c03caf1bf34f1e4b354cf2 | [] | no_license | Txiaobin/coding-interviews | d9dda4aca2376dc546c8370215735bb76d074158 | bb7862c481e415cc76b716f369f2b9de5ecf9496 | refs/heads/master | 2020-06-16T18:30:40.379944 | 2019-08-28T01:49:08 | 2019-08-28T01:49:08 | 195,665,059 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 688 | cpp | question6.cpp | /*
输入一个链表的头结点,从尾到头反过来打印出每个节点的值。
xiaobin9652@163.com;
Xiaobin Tian;
*/
#include<vector>
#include<stack>
using namespace::std;
struct ListNode {
int val;
ListNode *next;
ListNode(int x) : val(x), next(NULL) {}
};
class Solution {
public:
vector<int> printListFromTailToHead(ListNode* head) {
vector<int> mylist;
stack<int> mystack;
auto p = head;
while(p!=nullptr){
mystack.push(p->val);
p = p->next;
}
while(!mystack.empty()){
mylist.push_back(mystack.top());
mystack.pop();
}
return mylist;
}
}; |
634413077d0fd31a4d20f8029fda4e347e7449f7 | 187977453b41b41077d438b7c39a690795fade70 | /cpp/oneapi/dal/table/backend/csr_kernels.cpp | b83f2b4caaf4c19444e2ea2daff121499cb4fec0 | [
"Intel",
"Apache-2.0",
"LicenseRef-scancode-warranty-disclaimer",
"BSD-2-Clause",
"MIT",
"Zlib",
"LicenseRef-scancode-unknown-license-reference"
] | permissive | homksei/oneDAL | d3c26922965528711e9a2a82e4625583bdd3385c | c423627ce86290a37323ef8acb56b35f91099eca | refs/heads/master | 2023-07-06T05:09:42.050776 | 2023-01-04T15:12:15 | 2023-01-04T15:12:15 | 252,134,079 | 0 | 0 | Apache-2.0 | 2020-04-01T09:46:41 | 2020-04-01T09:46:40 | null | UTF-8 | C++ | false | false | 10,646 | cpp | csr_kernels.cpp | /*******************************************************************************
* Copyright 2021 Intel Corporation
*
* 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 "oneapi/dal/table/backend/csr_kernels.hpp"
#include "oneapi/dal/table/backend/convert.hpp"
#include "oneapi/dal/backend/common.hpp"
namespace oneapi::dal::backend {
using error_msg = dal::detail::error_messages;
ONEDAL_FORCEINLINE void check_origin_data(const array<byte_t>& origin_data,
std::int64_t element_count,
std::int64_t origin_dtype_size,
std::int64_t block_dtype_size) {
detail::check_mul_overflow(element_count, std::max(origin_dtype_size, block_dtype_size));
ONEDAL_ASSERT(origin_data.get_count() >= element_count * origin_dtype_size);
}
template <typename Policy, typename BlockData>
void pull_data_impl(const Policy& policy,
const csr_info& origin_info,
const array<byte_t>& origin_data,
const bool same_data_type,
const std::int64_t origin_offset,
const std::int64_t block_size,
detail::csr_block<BlockData>& block,
alloc_kind kind,
bool preserve_mutability) {
constexpr std::int64_t block_dtype_size = sizeof(BlockData);
constexpr data_type block_dtype = detail::make_data_type<BlockData>();
const auto origin_dtype_size = detail::get_data_type_size(origin_info.dtype_);
if (same_data_type && !alloc_kind_requires_copy(get_alloc_kind(origin_data), kind)) {
refer_origin_data(origin_data,
origin_offset * block_dtype_size,
block_size,
block.data,
preserve_mutability);
}
else {
if (block.data.get_count() < block_size || !block.data.has_mutable_data() ||
alloc_kind_requires_copy(get_alloc_kind(block.data), kind)) {
reset_array(policy, block.data, block_size, kind);
}
auto src_data = origin_data.get_data() + origin_offset * origin_dtype_size;
auto dst_data = block.data.get_mutable_data();
backend::convert_vector(policy,
src_data + origin_offset * block_dtype_size,
dst_data,
origin_info.dtype_,
block_dtype,
block_size);
}
}
template <typename Policy, typename BlockData>
void pull_column_indices_impl(const Policy& policy,
const array<std::int64_t>& origin_column_indices,
const std::int64_t origin_offset,
const std::int64_t block_size,
detail::csr_block<BlockData>& block,
alloc_kind kind,
bool preserve_mutability) {
if (!alloc_kind_requires_copy(get_alloc_kind(origin_column_indices), kind)) {
refer_origin_data(origin_column_indices,
origin_offset,
block_size,
block.column_indices,
preserve_mutability);
}
else {
reset_array(policy, block.column_indices, block_size, kind);
const auto dtype_size = sizeof(std::int64_t);
auto src_data = origin_column_indices.get_data() + origin_offset * dtype_size;
auto dst_data = block.column_indices.get_mutable_data();
backend::convert_vector(policy,
src_data + origin_offset * dtype_size,
dst_data,
data_type::int64,
data_type::int64,
block_size);
}
}
template <typename Policy, typename BlockData>
void pull_row_indices_impl(const Policy& policy,
const array<std::int64_t>& origin_row_indices,
const block_info& block_info,
detail::csr_block<BlockData>& block,
alloc_kind kind,
bool preserve_mutability) {
if (block.row_indices.get_count() < block_info.row_count_ + 1 ||
!block.row_indices.has_mutable_data() ||
alloc_kind_requires_copy(get_alloc_kind(block.row_indices), kind)) {
reset_array(policy, block.row_indices, block_info.row_count_ + 1, kind);
}
if (block_info.row_offset_ == 0) {
refer_origin_data(origin_row_indices,
0,
block_info.row_count_,
block.row_indices,
preserve_mutability);
}
else {
auto src_row_indices = origin_row_indices.get_data();
auto dst_row_indices = block.row_indices.get_mutable_data();
for (std::int64_t i = 0; i < block_info.row_count_ + 1; i++) {
dst_row_indices[i] = src_row_indices[block_info.row_offset_ + i] -
src_row_indices[block_info.row_offset_] + 1;
}
}
}
template <typename Policy, typename BlockData>
void pull_csr_block_impl(const Policy& policy,
const csr_info& origin_info,
const block_info& block_info,
const array<byte_t>& origin_data,
const array<std::int64_t>& origin_column_indices,
const array<std::int64_t>& origin_row_indices,
detail::csr_block<BlockData>& block,
alloc_kind kind,
bool preserve_mutability) {
constexpr std::int64_t block_dtype_size = sizeof(BlockData);
constexpr data_type block_dtype = detail::make_data_type<BlockData>();
const auto origin_dtype_size = detail::get_data_type_size(origin_info.dtype_);
// overflows checked here
check_origin_data(origin_data, origin_info.element_count_, origin_dtype_size, block_dtype_size);
const std::int64_t origin_offset =
origin_row_indices[block_info.row_offset_] - origin_row_indices[0];
ONEDAL_ASSERT(origin_offset >= 0);
const std::int64_t block_size =
origin_row_indices[block_info.row_offset_ + block_info.row_count_] -
origin_row_indices[block_info.row_offset_];
ONEDAL_ASSERT(block_size >= 0);
const bool same_data_type(block_dtype == origin_info.dtype_);
pull_data_impl<Policy, BlockData>(policy,
origin_info,
origin_data,
same_data_type,
origin_offset,
block_size,
block,
kind,
preserve_mutability);
pull_column_indices_impl<Policy, BlockData>(policy,
origin_column_indices,
origin_offset,
block_size,
block,
kind,
preserve_mutability);
pull_row_indices_impl<Policy, BlockData>(policy,
origin_row_indices,
block_info,
block,
kind,
preserve_mutability);
}
template <typename Policy, typename BlockData>
void csr_pull_block(const Policy& policy,
const csr_info& origin_info,
const block_info& block_info,
const array<byte_t>& origin_data,
const array<std::int64_t>& origin_column_indices,
const array<std::int64_t>& origin_row_indices,
detail::csr_block<BlockData>& block,
alloc_kind requested_alloc_kind,
bool preserve_mutability) {
switch (origin_info.layout_) {
case data_layout::row_major:
pull_csr_block_impl(policy,
origin_info,
block_info,
origin_data,
origin_column_indices,
origin_row_indices,
block,
requested_alloc_kind,
preserve_mutability);
break;
default: throw dal::domain_error(error_msg::unsupported_data_layout());
}
}
#define INSTANTIATE(Policy, BlockData) \
template void csr_pull_block(const Policy& policy, \
const csr_info& origin_info, \
const block_info& block_info, \
const array<byte_t>& origin_data, \
const array<std::int64_t>& origin_column_indices, \
const array<std::int64_t>& origin_row_indices, \
detail::csr_block<BlockData>& block, \
alloc_kind requested_alloc_kind, \
bool preserve_mutability);
#define INSTANTIATE_HOST_POLICY(Data) INSTANTIATE(detail::default_host_policy, Data)
INSTANTIATE_HOST_POLICY(float)
INSTANTIATE_HOST_POLICY(double)
INSTANTIATE_HOST_POLICY(std::int32_t)
} // namespace oneapi::dal::backend
|
0d8756ead6e47e63f331550d4d681c0d4ccad778 | 8c10b097e827f6c33250d2081188a6814a9ed303 | /HW/HW-03 Peer Review/Peer 02/Graph.cpp | 4a4c0a7091a12dfec0539bc01efd3f14386ef7e1 | [] | no_license | ktjones/CPP4C_Programmers | b023dc328df93a7530d28bd02656f6b43eda3927 | 6af90d23e8aa63138fa131b58455beb775557b36 | refs/heads/master | 2016-09-06T00:36:52.076836 | 2013-12-28T13:26:21 | 2013-12-28T13:26:21 | null | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 12,474 | cpp | Graph.cpp | #include <iostream>
#include <vector>
#include <stdlib.h>
#include <queue>
#include <fstream>
#include <sstream>
#include <string>
using namespace std;
//~~~~~MY DATA STRUCTURES ARE A LITTLE DIFFERENT FROM THOSE SUGGESTED ON COURSERA, PLEASE TAKE TIME TO READ THROUGH THE CODE~~~~~
//~~~~~THANKS FOR GRADING~~~~~
//~~~~~~MISCELLANEOUS CLASSES AND METHODS~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
//Create an empty nxn matrix
template <class T>
inline vector<vector<T> > create_matrix(int n){
vector<vector<T> > M(n);
for (int i=0;i<n;++i)
M[i].resize(n);
return M;
}
//Print matrix for testing graph
template <class T>
inline void print_matrix(vector<vector<T> > M){
cout << endl;
for(int i=0;i<M.size();++i) {
for(int j=0;j<M[i].size();++j)
cout << M[i][j] << " ";
cout << endl;
}
cout << endl;
}
//Reverse a vector
inline vector<int> reverse(vector<int> sequence){
vector<int> rsequence;
for (int i=sequence.size()-1;0<=i;--i)
rsequence.push_back(sequence[i]);
return rsequence;
}
//A special class to be put in priority-queue, consisting of a vertex number and its current distance from the root
class vert_dist{
public:
int vert;
int dist;
vert_dist(int v, int d){
vert = v;
dist = d;
}
};
//Again to be used in priority-queue, comparing 2 pairs (vert,dist) according to dist
class compare_vert {
public:
bool operator()(vert_dist v1, vert_dist v2)
{
if (v1.dist > v2.dist) return true;
else return false;
}
};
//Defining our priority queue. This will automatically sort the vertices according to their tentative distance from START
typedef priority_queue<vert_dist,vector<vert_dist >,compare_vert > vert_queue;
//Data structure representing a path, consisting of path length and the sequence of vertices in it
class path {
public:
int length;
vector<int> sequence;
path (int l, vector<int> s) {
length = l;
sequence = s;
}
//Display path length and the sequence of vertices
void display(){
cout << "Path length: " << length << endl;
cout << "Sequence";
for (int i=0;i<sequence.size();++i)
cout << " -> " << sequence[i];
cout << endl;
}
};
//Data structure representing a tree
class tree {
public:
int cost;
vector<int> connectivity; //If (i,j) is an edge then connectivity[i] = j
tree(int c,vector<int> cn){
cost = c;
connectivity = cn;
}
void display(){
cout << "Cost: " << cost << endl;
cout << "Edges: " << endl;
for(int i=0;i<connectivity.size();++i){
if (connectivity[i] == i)
cout << "The root is " << i << endl;
else if (connectivity[i] != -1)
cout << "(" << i << "," << connectivity[i] << ")" << endl;
}
}
};
//~~~~~~~~~~~~~~~~~~~~~~~~~~~MAIN GRAPH CLASS~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
class graph{
int nvert; //Number of vertices
vector<vector<bool> > adjacency; //Adjacency matrix
vector<vector<int> > edges; //Matrix storing edge lengths
vector<int> nodevalues; //Node values, so far no use
public:
//Initializer
graph(int n = 0) {
reset(n);
}
//Wipe graph data
void reset(int n){
nvert = n;
adjacency = create_matrix<bool>(n);
edges = create_matrix<int>(n);
nodevalues.resize(nvert);
nodevalues.clear();
}
//Read from file
void read_edge_list(char* filename){
ifstream infile(filename);
string line;
int n,a,b,v;
infile >> n;
reset(n);
while (getline(infile, line)){
infile >> a;
infile >> b;
infile >> v;
set_double_edge(a,b,v);
}
}
//Return size
int size() {
return nvert;
}
//Get edge length
int get_edge(int i,int j) {
return edges[i][j];
}
//Set edge length AND adjacency
void set_edge(int i,int j, int value) {
adjacency[i][j] = true;
edges[i][j] = value;
}
//for double edge
void set_double_edge(int i, int j, int value){
set_edge(i,j,value);
set_edge(j,i,value);
}
//Deleting adjacency, return edge length to 0
void delete_edge(int i, int j) {
adjacency[i][j] = false;
edges[i][j] = 0;
}
//for double edge
void delete_double_edge(int i, int j){
delete_edge(i,j);
delete_edge(j,i);
}
int get_node(int i){
return nodevalues[i];
}
void set_node(int i, int value){
nodevalues[i] = value;
}
//Check if 2 vertices are adjacent
bool adjacent(int i,int j) {
return adjacency[i][j];
}
//Return a vector containing all neighbors of i
vector<int> neighbors(int i) {
vector<int> neigh;
for (int j=0;j<nvert;j++)
if (adjacent(i,j)) neigh.push_back(j);
return neigh;
}
//Return adjacency matrix
vector<vector<bool> > adjacency_matrix() {
return adjacency;
}
//Return the whole matrix with all edge lengths
vector<vector<int> > edge_matrix() {
return edges;
}
//Compute the shortest path between i and j, return a path structure
//Note that we are not implementing shortes_path as a separated class but an inherent function of a given graph
path shortest_path(int i, int j);
//Search for minimum spanning tree
tree minimum_spanning_tree(int root = 0);
//Randomize according to given density and range
void randomize(double density,int range);
};
//Minimum spanning tree, using Prim's algorithm and priority queue
tree graph::minimum_spanning_tree(int root){
int cost=0, current_vert, lookat_vert, new_distance ;
vector<int> connectivity(nvert), y;
vector<bool> done(nvert);
vert_queue myqueue; //This queue updates each unvisited vertex's distance to the nearest visited one
for(int i=0;i<nvert;++i)
connectivity[i] = -1;
connectivity[root] = root; //The root is just connected to itself
myqueue.push(vert_dist(root,0)); //Push the root into the queue as the first element
while(!myqueue.empty()){
current_vert = myqueue.top().vert; //This is the vertex with least distance from the visited ones
if(!done[current_vert]){ //Make sure this is an unvisited vertex
cost += myqueue.top().dist; //Add in the cost
y = neighbors(current_vert); //Now look at the neighbors of this vertex
for(int i=0;i<y.size();++i){
lookat_vert = y[i];
if (!done[lookat_vert]){ //Skip the visited neightbors
new_distance = edges[lookat_vert][current_vert];
if ((connectivity[lookat_vert] == -1) || (edges[lookat_vert][connectivity[lookat_vert]] > new_distance)){
connectivity[lookat_vert] = current_vert; //Update connectivity if a shorter edge is found
myqueue.push(vert_dist(lookat_vert, new_distance)); //Try to update the distance of this neighbor and push that in the queue
}
}
}
done[current_vert] = true; //Mark as visited
}
myqueue.pop(); //And remove from queue
}
return tree(cost,connectivity);
}
//Dijkstra Algorithm for shortest path
path graph::shortest_path (int i, int j) {
vector<int> found_sequence; //The sequence of vertices forming the shortest path
if (i == j) { //The trivial case when START = STOP
found_sequence.push_back(i);
return path(0,found_sequence);
}
else
{
vector<bool> done(nvert); //To keep track of visited vertices
vector<int> precede(nvert); //Which vertex precedes which? For latter use in reconstructing the sequence
vector<int> distance(nvert); //Tentative distance from START
for (int k=0;k<nvert;++k) { //Set everything at distance -1 except START
distance[k] = -1;
precede[k] = -1;
}
distance[i] = 0; //Set START at distance 0
vert_queue my_queue; //Declare an empty queue of nodes with tentative vertices
vert_dist x(i,0); //Current node, having a vertex index and its tentative distance
vector<int> y; //To contain all neighbors of the current node
my_queue.push(x); //Push START with distance 0 to the queue
int current_vert, lookat_vert; //Current vertex and its possible neighbors
int new_distance; //To update distance
while(!my_queue.empty()){
x = my_queue.top(); //Get the node with shortest tentative distance
my_queue.pop(); //And move it out of the queue
current_vert = x.vert; //Get the vertex index
if (done[current_vert] == false){
y = neighbors(current_vert); //Get all neighbors
for (int k=0;k<y.size();++k){
lookat_vert = y[k];
if (!done[lookat_vert]){ //Do this unless visited before
new_distance = distance[current_vert] + edges[current_vert][lookat_vert];
if ((distance[lookat_vert] == -1) || (new_distance < distance[lookat_vert])) { //If a shorter path is known
my_queue.push(vert_dist(lookat_vert,new_distance)); //Push in queue
distance[lookat_vert] = new_distance; //Update distance
precede[lookat_vert] = current_vert; //Update precedence
}
}
}
done[current_vert] = true; //Mark as visited
if (current_vert == j) break; //Break when reach STOP
}
}
if (done[j] == true){ //If a path to j is found, i.e j was visited
found_sequence.push_back(j);
for (int k=0; k<nvert;++k){
if (precede[found_sequence[k]] == -1) break; //Trace back the sequence
else found_sequence.push_back(precede[found_sequence[k]]);
}
found_sequence = reverse(found_sequence); //Reverse the sequence
}
return path(distance[j],found_sequence);
}
}
//For Monte-Carlo randomization
void graph::randomize (double density,int range) {
double pick = 0; //probability variable
edges = create_matrix<int>(nvert);
adjacency = create_matrix<bool>(nvert);
for (int i=0;i<nvert;++i)
for (int j=i+1;j<nvert;++j){
pick = rand() % 100;
pick = pick/100;
if (pick < density)
set_double_edge(i,j,(rand()%range +1));
}
}
//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
int main() {
graph g;
//Put data in "MST_data.txt"
g.read_edge_list("MST_data.txt");
tree t = g.minimum_spanning_tree();
t.display();
cout << endl << endl;
system("PAUSE");
/*HOMEWORK 1 STUFF
graph graph1(50), graph2(50);
double average1, average2;
double final1, final2;
int count1, count2, dist1, dist2;
srand (time(NULL));
//RE-RANDOMIZE 100 TIMES
for (int i=0;i<1000;++i){
graph1.randomize(0.4,10);
graph2.randomize(0.6,10);
average1 = average2 = 0;
count1 = count2 = 0;
for (int j=0;j<50;++j){
dist1 = graph1.shortest_path(0,j).length;
dist2 = graph2.shortest_path(0,j).length;
if (dist1 >= 0){
average1 += dist1;
++count1;
}
if (dist2 >= 0){
average2 += dist2;
++count2;
}
}
average1 /= count1;
average2 /= count2;
cout << "ITERATION " << i << endl;
cout << "Average shortest path length with 0.4 edge density: " << average1 << endl;
cout << "Average shortest path length with 0.6 edge density: " << average2 << endl << endl;
final1 += average1;
final2 += average2;
}
final1 /= 1000;
final2 /= 1000;
cout << endl << "Limit average shortest path with density 0.4 after 100 iterations " << final1 << endl;
cout << endl << "Limit average shortest path with density 0.6 after 100 iterations " << final2 << endl;
*/
/*FINER DENSITY, MORE VERTICES
graph random_graph(100);
double average;
int count, dist;
for (double i=0.01;i<=1;i=i+0.01){
cout << "Density " << i << " " ;
random_graph.randomize(i,10);
average = 0;
count = 0;
for (int j=0; j<random_graph.size();++j){
dist = random_graph.shortest_path(0,j).length;
if (dist >= 0) {
average += dist;
++count;
}
}
average /= count;
cout << "Average path: " << average << endl;
}
*/
/* EXAMPLE IN LECTURE
graph mygraph(9);
mygraph.set_edge(0,1,4);
mygraph.set_double_edge(0,2,3);
mygraph.set_edge(0,4,7);
mygraph.set_edge(1,3,1);
mygraph.set_edge(2,4,4);
mygraph.set_edge(3,4,3);
mygraph.set_edge(3,5,1);
mygraph.set_edge(4,5,1);
mygraph.set_edge(4,6,5);
mygraph.set_edge(4,8,3);
mygraph.set_double_edge(5,7,2);
mygraph.set_edge(5,8,4);
mygraph.set_edge(7,8,3);
mygraph.set_edge(8,6,5);
path p = mygraph.shortest_path(0,8);
p.display();
*/
}
//need to fix:
//multi initializers for class graph
//destructor
//correct pointers for parameters
//class matrix
//class path
//correct public/private
|
42207bcab90a8a8ce7fd8addce6353425a918054 | 3f12a45ae133af9e822c0c58add3cd0a71f7b10a | /programloader.h | 568756a0c48b8be844c6760994c76d684864a9cb | [] | no_license | arturp-a/My_Virtual_CPU_apa_93 | 07c18cf37520470fbb241bd795b2fdff62d03578 | 680a7d7d8ffe0912900e8ff5ccbcf8daffb71cff | refs/heads/master | 2021-06-18T16:17:20.576592 | 2017-06-29T16:00:19 | 2017-06-29T16:00:19 | null | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 555 | h | programloader.h | #ifndef PROGRAMLOADER_H
#define PROGRAMLOADER_H
#include "ram.h"
#include <QFile>
#include <QTextStream>
#include "cpu.h"
#include <QQueue>
#include <QRegExp>
class ProgramLoader
{
private:
int AddressCounter;
int AddressOffset;
RAM *Memory;
public:
ProgramLoader(RAM *mem, int Offset);
void loadFile(QString path);
QString TokenizeString( QQueue<QString> &Tokens, QString LineToParse);
int GetRegEnumNumber(QString RegisterName);
private:
void parse(QString code);
void load(int b);
};
#endif // PROGRAMLOADER_H
|
93bd4f0eaa564d3b0a39a504041f211c866adc86 | 9784d4b5a853f9d720f1c047814ce1f9b863a9a3 | /lib/src/cpp/tfd/tensor.h | 3240aac7b7454b8a172abdee49b7c382aa86ead3 | [
"Apache-2.0"
] | permissive | thosakwe/tensorflow.dart | 2154d7e8da50f921fc59179ab100ef072d54e188 | 3b7b82894d22310683674d431f7b937ae42b5bf1 | refs/heads/master | 2020-03-10T23:05:26.016914 | 2020-02-29T17:47:02 | 2020-02-29T17:47:02 | 129,633,423 | 93 | 14 | null | null | null | null | UTF-8 | C++ | false | false | 321 | h | tensor.h | //
// Created by Tobe on 4/15/18.
//
#ifndef TENSORFLOW_DART_TENSOR_H
#define TENSORFLOW_DART_TENSOR_H
#include <dart_api.h>
#include <tensorflow/c/c_api.h>
namespace tfd
{
void Constant(Dart_NativeArguments arguments);
void Tensors_string(Dart_NativeArguments arguments);
}
#endif //TENSORFLOW_DART_TENSOR_H
|
6cb1a5de8a690961eb1f130aeeaa5a4075bdbbce | 7ad41d46716ac2aa51fbed6a69ac66aa08f9e3a5 | /C++ Competitive Programs/Introductory Problems/NumberSpiral.cpp | 180891c6c9635170ec6654958a4de7ef0e014b06 | [] | no_license | thierryxdp/Competitive-Programs | 00c7d4f75fa2a7f3daaf4c33f5d3fbf5497968f9 | 9f5d1102ab39ba13d5ea010019723b968794766e | refs/heads/master | 2023-02-05T01:36:46.943930 | 2020-12-27T00:26:33 | 2020-12-27T00:26:33 | 289,184,142 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 302 | cpp | NumberSpiral.cpp | #include <bits/stdc++.h>
using namespace std;
int main(void){
int t;
cin >> t;
while (t--){
int y, x;
cin >> y >> x;
if (x >= y){
int diagonal = diagonal(x - 1) + 2*(x-1);
} else {
}
}
return 0;
} |
1b15320e973aa985b1bbf38c0bf54bf46a808c99 | 78ab99b23ef81fc301fb516fa2f10490754960d7 | /day3/socknet/thread/launch_thread.h | d96e4fc3764d5418cc609387e445a0cf4d48a9e1 | [] | no_license | marcinklimek/cpp_rt_2 | d7865caa17d5be8bac554c52654efb67370be3e4 | 0223aad7431e97d400f678e831bba3faaabf1fb3 | refs/heads/master | 2021-01-22T09:32:38.439285 | 2014-04-09T12:22:44 | 2014-04-09T12:22:44 | null | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 142 | h | launch_thread.h | #pragma once
#include <functional>
void launch_thread(pthread_t *id, std::function<void()> f);
void launch_thread(std::function<void()> f);
|
8c326cfc5a73e6bd7e838b774a99094d74712726 | 6dcc73b950483b31227af567dedafaf8857efe6e | /UI/Choiceset/ChoicesetVR.h | 622bd813a4f78358856968cf7668798d390f3c42 | [] | no_license | jafo2128/hmi_sdk | aef424041261412da51bcbd0fe6262503400cac0 | a7065fdda9cbbb486aba3ca54b8dffc31ae579f4 | refs/heads/master | 2021-01-14T08:55:50.746164 | 2016-02-06T00:26:35 | 2016-02-06T00:26:35 | 48,529,688 | 0 | 0 | null | 2015-12-24T06:54:22 | 2015-12-24T06:54:22 | null | UTF-8 | C++ | false | false | 1,190 | h | ChoicesetVR.h | #ifndef CCHOICESETVR_H
#define CCHOICESETVR_H
#include "QLabel"
#include "UI/Common/Button.h"
#include "Common/PopBase.h"
#define PERFORMINTERACTION_TIMEOUT 10
#define PERFORMINTERACTION_CHOICE 0
class CPopBase;
class CChoicesetVR : public CPopBase
{
Q_OBJECT
public:
explicit CChoicesetVR(AppListInterface * pList, QWidget *parent = 0);
~CChoicesetVR();
void execShow();
signals:
void VRmenuClicked(int code, int id, int choiceID);
public slots:
void timeoutSlots();
void label1ClickedSlots(int id);
void label2ClickedSlots(int id);
void label3ClickedSlots(int id);
void label4ClickedSlots(int id);
void VRmenuClickedSlots(int code, int performInteractionID, int choiceID);
private:
void setChoicesetVRText(int textIdx, QString text);
void setChoicesetVRID(int btnIdx, int id);
void setTimeOut(int duration);
void setInteractionID(int id);
private:
QLabel *m_labelVRIcon;
QLabel *m_labelText;
CButton *m_labelSet1;
CButton *m_labelSet2;
CButton *m_labelSet3;
CButton *m_labelSet4;
int m_i_interactionID;
int m_i_defaultID;
void InitLayout();
};
#endif // CCHOICESETVR_H
|
77314e7359949eb5deec3faaa980f0d3f43841dc | 7e000df064e7cbf22fc9812b5142a3598b97fbbf | /domain/fwinit/WilcoFactories.cpp | e4e06664e9949129bfa3821c2b994a5173a4273f | [
"MIT"
] | permissive | carrotsrc/wilco | e74fccf285e418828a637ca08f8cbca104b3d593 | 1d8cc8fec369e1be034c19da2de3d90219de2109 | refs/heads/master | 2021-01-19T18:29:48.181601 | 2014-11-11T09:28:30 | 2014-11-11T09:28:30 | 26,239,454 | 0 | 1 | null | null | null | null | UTF-8 | C++ | false | false | 208 | cpp | WilcoFactories.cpp | #include "domain/Wilco.h"
#include "common.h"
#include "system/factories/DirectoryModelFactory.h"
void Wilco::wireFactories() {
this->megaFactory->registerFactory<DirectoryModel, DirectoryModelFactory>();
}
|
bbe9e6d59877874c36c5f6f5963c08f557d575d7 | 9da899bf6541c6a0514219377fea97df9907f0ae | /Editor/AnimationModifiers/Private/SAnimationModifierContentBrowserWindow.cpp | c1e7bcb7791f04469ec4000a628ea39c7ab81534 | [] | no_license | peichangliang123/UE4 | 1aa4df3418c077dd8f82439ecc808cd2e6de4551 | 20e38f42edc251ee96905ed8e96e1be667bc14a5 | refs/heads/master | 2023-08-17T11:31:53.304431 | 2021-09-15T00:31:03 | 2021-09-15T00:31:03 | null | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 8,571 | cpp | SAnimationModifierContentBrowserWindow.cpp | // Copyright Epic Games, Inc. All Rights Reserved.
#include "SAnimationModifierContentBrowserWindow.h"
#include "AnimationModifierHelpers.h"
#include "Widgets/SOverlay.h"
#include "Widgets/SBoxPanel.h"
#include "Widgets/Layout/SBorder.h"
#include "Widgets/Layout/SUniformGridPanel.h"
#include "Widgets/Input/SComboButton.h"
#include "Widgets/Text/STextBlock.h"
#include "EditorStyleSet.h"
#include "SModifierListview.h"
#include "PropertyEditorModule.h"
#include "Animation/AnimSequence.h"
#include "AnimationModifiersAssetUserData.h"
#include "Misc/MessageDialog.h"
#include "ScopedTransaction.h"
#define LOCTEXT_NAMESPACE "AnimationModifierContentBrowserWindow"
void SAnimationModifierContentBrowserWindow::Construct(const FArguments& InArgs)
{
CreateInstanceDetailsView();
WidgetWindow = InArgs._WidgetWindow;
AnimSequences = InArgs._AnimSequences;
FOnGetContent GetContent = FOnGetContent::CreateLambda(
[this]()
{
return FAnimationModifierHelpers::GetModifierPicker(FOnClassPicked::CreateRaw(this, &SAnimationModifierContentBrowserWindow::OnModifierPicked));
});
this->ChildSlot
[
SNew(SOverlay)
+SOverlay::Slot()
[
SNew(SVerticalBox)
+ SVerticalBox::Slot()
.AutoHeight()
[
SNew(SBorder)
.Padding(2.0f)
.BorderImage(FEditorStyle::GetBrush("ToolPanel.GroupBorder"))
[
SNew(SHorizontalBox)
+ SHorizontalBox::Slot()
.Padding(3.0f, 3.0f)
.AutoWidth()
[
SAssignNew(AddModifierCombobox, SComboButton)
.OnGetMenuContent(GetContent)
.ButtonContent()
[
SNew(STextBlock)
.Text(LOCTEXT("AnimationModifierWindow_AddModifier", "Add Modifier"))
]
]
]
]
+ SVerticalBox::Slot()
[
SNew(SBorder)
.Padding(2.0f)
.BorderImage(FEditorStyle::GetBrush("ToolPanel.GroupBorder"))
[
SNew(SSplitter)
.Orientation(EOrientation::Orient_Vertical)
+ SSplitter::Slot()
.Value(.5f)
[
SNew(SBox)
.Padding(2.0f)
[
SAssignNew(ModifierListView, SModifierListView)
.Items(&ModifierItems)
.InstanceDetailsView(ModifierInstanceDetailsView)
.OnRemoveModifier(FOnModifierArray::CreateSP(this, &SAnimationModifierContentBrowserWindow::RemoveModifiersCallback))
]
]
+ SSplitter::Slot()
.Value(.5f)
[
SNew(SBox)
.Padding(2.0f)
[
ModifierInstanceDetailsView->AsShared()
]
]
]
]
+ SVerticalBox::Slot()
.AutoHeight()
.HAlign(HAlign_Right)
.Padding(2)
[
SNew(SUniformGridPanel)
.SlotPadding(2)
+ SUniformGridPanel::Slot(0, 0)
[
SNew(SButton)
.HAlign(HAlign_Center)
.Text(LOCTEXT("AnimationModifierWindow_Import", "Apply"))
.ToolTipText(LOCTEXT("AnimationModifierWindow_Import_ToolTip", "Apply adding modifiers(s)."))
.IsEnabled(this, &SAnimationModifierContentBrowserWindow::CanApply)
.OnClicked(this, &SAnimationModifierContentBrowserWindow::OnApply)
]
+ SUniformGridPanel::Slot(1, 0)
[
SNew(SButton)
.HAlign(HAlign_Center)
.Text(LOCTEXT("AnimationModifierWindow_Cancel", "Cancel"))
.ToolTipText(LOCTEXT("AnimationModifierWindow_Cancel_ToolTip", "Cancels adding modifiers(s)."))
.OnClicked(this, &SAnimationModifierContentBrowserWindow::OnCancel)
]
]
]
];
}
FReply SAnimationModifierContentBrowserWindow::OnKeyDown(const FGeometry& MyGeometry, const FKeyEvent& InKeyEvent)
{
if (InKeyEvent.GetKey() == EKeys::Escape)
{
return OnCancel();
}
return FReply::Unhandled();
}
void SAnimationModifierContentBrowserWindow::RemoveModifiersCallback(const TArray<TWeakObjectPtr<UAnimationModifier>>& ModifiersToRemove)
{
Modifiers.RemoveAll([&ModifiersToRemove](UAnimationModifier* Modifier) { return ModifiersToRemove.Contains(Modifier); });
ModifierItems.RemoveAll([&ModifiersToRemove](TSharedPtr<FModifierListviewItem> ModifierItem) { return ModifiersToRemove.Contains(ModifierItem->Instance); });
ModifierListView->Refresh();
}
void SAnimationModifierContentBrowserWindow::OnModifierPicked(UClass* PickedClass)
{
UAnimationModifier* Processor = FAnimationModifierHelpers::CreateModifierInstance(GetTransientPackage(), PickedClass);
Modifiers.Add(Processor);
FModifierListviewItem* Item = new FModifierListviewItem();
Item->Instance = Processor;
Item->Class = Processor->GetClass();
Item->Index = Modifiers.Num() - 1;
Item->OuterClass = nullptr;
ModifierItems.Add(ModifierListviewItem(Item));
// Close the combo box
AddModifierCombobox->SetIsOpen(false);
ModifierListView->Refresh();
}
void SAnimationModifierContentBrowserWindow::CreateInstanceDetailsView()
{
// Create a property view
FPropertyEditorModule& EditModule = FModuleManager::Get().GetModuleChecked<FPropertyEditorModule>("PropertyEditor");
FDetailsViewArgs DetailsViewArgs;
DetailsViewArgs.bAllowSearch = false;
DetailsViewArgs.NameAreaSettings = FDetailsViewArgs::HideNameArea;
DetailsViewArgs.bHideSelectionTip = true;
DetailsViewArgs.DefaultsOnlyVisibility = EEditDefaultsOnlyNodeVisibility::Automatic;
DetailsViewArgs.bShowOptions = false;
ModifierInstanceDetailsView = EditModule.CreateDetailView(DetailsViewArgs);
ModifierInstanceDetailsView->SetDisableCustomDetailLayouts(true);
}
FReply SAnimationModifierContentBrowserWindow::OnApply()
{
const FScopedTransaction Transaction(LOCTEXT("UndoAction_ApplyModifiers", "Applying Animation Modifier(s) to Animation Sequence(s)"));
TArray<UAnimationModifiersAssetUserData*> AssetUserData;
bool bCloseWindow = true;
// Retrieve or create asset user data
for (UAnimSequence* AnimationSequence : AnimSequences)
{
UAnimationModifiersAssetUserData* UserData = AnimationSequence->GetAssetUserData<UAnimationModifiersAssetUserData>();
if (!UserData)
{
UserData = NewObject<UAnimationModifiersAssetUserData>(AnimationSequence, UAnimationModifiersAssetUserData::StaticClass());
checkf(UserData, TEXT("Unable to instantiate AssetUserData class"));
UserData->SetFlags(RF_Transactional);
AnimationSequence->AddAssetUserData(UserData);
}
AssetUserData.Add(UserData);
}
// For each added modifier create add a new instance to each of the user data entries, using the one(s) set up in the window as template(s)
for (UAnimationModifier* Modifier : Modifiers)
{
for (UAnimationModifiersAssetUserData* UserData : AssetUserData)
{
const bool bAlreadyContainsModifier = UserData->GetAnimationModifierInstances().ContainsByPredicate([Modifier](UAnimationModifier* TestModifier) { return Modifier->GetClass() == TestModifier->GetClass(); });
bool bUserInputResult = true;
if (bAlreadyContainsModifier)
{
FText MessageFormat = LOCTEXT("AnimationModifierWindow_AlreadyContainsModifierDialogText", "{0} already contains Animation Modifier {1}, are you sure you want to add another instance?");
FText MessageTitle = LOCTEXT("AnimationModifierWindow_AlreadyContainsModifierTitle", "Already contains Animation Modifier!");
bUserInputResult = FMessageDialog::Open(EAppMsgType::YesNo, FText::FormatOrdered(MessageFormat, FText::FromString(UserData->GetOuter()->GetName()), FText::FromString(Modifier->GetClass()->GetName())), &MessageTitle) == EAppReturnType::Yes;
}
bCloseWindow = bUserInputResult;
if (!bAlreadyContainsModifier || bUserInputResult)
{
UObject* Outer = UserData;
UAnimationModifier* Processor = FAnimationModifierHelpers::CreateModifierInstance(Outer, Modifier->GetClass(), Modifier);
UserData->Modify();
UserData->AddAnimationModifier(Processor);
}
}
}
/** For each user data retrieve all modifiers and apply them */
for (int32 Index = 0; Index < AssetUserData.Num(); ++Index)
{
UAnimationModifiersAssetUserData* UserData = AssetUserData[Index];
if (UserData)
{
UAnimSequence* AnimSequence = AnimSequences[Index];
AnimSequence->Modify();
const TArray<UAnimationModifier*>& ModifierInstances = UserData->GetAnimationModifierInstances();
for (UAnimationModifier* Modifier : ModifierInstances)
{
Modifier->ApplyToAnimationSequence(AnimSequence);
}
}
}
if (bCloseWindow && WidgetWindow.IsValid())
{
WidgetWindow.Pin()->RequestDestroyWindow();
}
return FReply::Handled();
}
FReply SAnimationModifierContentBrowserWindow::OnCancel()
{
if (WidgetWindow.IsValid())
{
WidgetWindow.Pin()->RequestDestroyWindow();
}
return FReply::Handled();
}
bool SAnimationModifierContentBrowserWindow::CanApply() const
{
return Modifiers.Num() > 0;
}
#undef LOCTEXT_NAMESPACE // "AnimationModifierContentBrowserWindow" |
3adc7df1fdfac14924483a2e4e4f736c43daf2a5 | e3b28e9d19bae7f0975e2b7a599e6da2c2d313bb | /cpp/basics/vjezba8b.cpp | 8c20940eb9628222566ef395c209db4aead204b9 | [] | no_license | Ivan-Vinski/FOI_C_Cpp | 94402fff543325c958148919d48696fbc0b1ddff | a64fb87627ee8f4ccc57cf7cfcac3be9de584317 | refs/heads/master | 2022-12-22T01:13:33.038790 | 2020-09-28T19:42:32 | 2020-09-28T19:42:32 | 299,413,519 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 3,821 | cpp | vjezba8b.cpp | #include<iostream>
#include<cstring>
#include<cmath>
#include"vrijeme.cc"
using namespace std;
float zbroj_povrsina = 0;
class ctrokut{
public:
static int broj;
bool jest_trokut, pravokutni_trokut;
ctrokut *sljedeci, *prethodni, *zadnji;
float a, b, c, vrijeme;
char naziv[20];
float povrsina(){
s = (a+b+c)/2;
return sqrt(s*(s-a)*(s-b)*(s-c));
}
ctrokut* unos(ctrokut* tekuci){
float pom;
vrijeme1.pocetak();
cout << "Naziv trokuta: " ;
cin.ignore();
cin.getline(tekuci->naziv, 10);
cout << "a: " ;
cin >> tekuci->a;
cout << "b: " ;
cin >> tekuci->b;
cout << "c: ";
cin >> tekuci->c;
vrijeme1.kraj();
tekuci->pravokutni_trokut = false;
if ((tekuci->a > tekuci->b) && (tekuci->a > tekuci->c)){
if (pow(tekuci->a, 2) == pow(tekuci->b,2) + pow(tekuci->c, 2))
tekuci->pravokutni_trokut = true;
}
if ((tekuci->b > tekuci->a) && (tekuci->b > tekuci->c)){
if (pow(tekuci->b, 2) == pow(tekuci->a, 2) + pow(tekuci->c, 2)){
tekuci->pravokutni_trokut = true;
}
}
if ((tekuci->c > tekuci->b) && (tekuci->c > tekuci->a)){
if (pow(tekuci->c, 2) == pow(tekuci->a, 2) + pow(tekuci->b, 2)){
tekuci->pravokutni_trokut = true;
}
}
pom = (int)(vrijeme1.proteklo() / 10);
tekuci->vrijeme = (float)(pom / 100);
if ((a+b > c) && (b+c > a) && (a+c > b)) tekuci->jest_trokut = true;
else tekuci->jest_trokut = false;
return tekuci;
}
void ispis(ctrokut *glava){
ctrokut *tekuci = glava->sljedeci;
while (tekuci){
cout << tekuci->naziv << endl;
cout << "a: " << tekuci->a << endl;
cout << "b: " << tekuci->b << endl;
cout << "c: " << tekuci->c << endl;
if (tekuci->jest_trokut){
zbroj_povrsina += tekuci->povrsina();
cout << "Povrsina: " << tekuci->povrsina() << endl;
}
else if (!tekuci->jest_trokut){
cout << "Nije trokut" << endl;
}
cout << "Vrijeme: " << tekuci->vrijeme << endl;
cout << "---------------------------------------" << endl;
tekuci = tekuci->sljedeci;
}
}
void ispis2(ctrokut *glava){
ctrokut *pompok = glava->sljedeci;
while (pompok){
if (pompok->pravokutni_trokut){
cout << pompok->naziv << endl;
cout << "a: " << pompok->a << endl;
cout << "b: " << pompok->b << endl;
cout << "c: " << pompok->c << endl;
if (pompok->jest_trokut){
cout << "Povrsina: " << pompok->povrsina() << endl;
}
cout << "Vrijeme: " << pompok->vrijeme << endl;
cout << "Pravokutni trokut" << endl;
}
pompok = pompok->sljedeci;
}
}
private:
float s;
cvrijeme vrijeme1;
};
int ctrokut::broj;
int main(){
int i;
ctrokut *glava = new ctrokut;
glava->sljedeci = NULL;
glava->prethodni = NULL;
ctrokut *zadnji = glava;
do{
cout << "1: Unos podataka o trokutima u polju trokuta" << endl;
cout << "2: Ispis podataka o unesenim trokutima" << endl;
cout << "3: Statistika" << endl;
cout << "4: Prepoznavanje odredenih vrsta trokuta" << endl;
cout << "Odabir: " ;
cin >> i;
if (i == 9) break;
switch(i){
case 1:
cout << "Broj trokuta: " ;
cin >> ctrokut::broj;
for (int i=0; i < ctrokut::broj; i++){
ctrokut *tekuci = new ctrokut;
zadnji->sljedeci = tekuci;
tekuci->unos(tekuci);
tekuci->sljedeci = NULL;
zadnji = tekuci;
}
break;
case 2:
cout << "Ispis: " << endl;
glava->ispis(glava);
break;
case 3:
cout << "Broj zapisa: " << ctrokut::broj << endl;
cout << "Zbroj povrsina trokuta: " << zbroj_povrsina<<endl;
break;
case 4:
glava->ispis2(glava);
break;
}
}while(true);
system("pause");
return 0;
}
|
b5af12096f0592e8a6d73da79f847ccd759f78a8 | bb6806e0bd52cbf26fcea2d7090ba6521c9e31ee | /data_structure/adjacency_matrix.cpp | fb3787240850fe7ce92dc1cfb643404df3163bc0 | [] | no_license | wuyexkx/cpp_exercises | 25b8a08ccdf7d8c0a1ca1da7867b16535c7733aa | cf08035f7acf21ccd34cca55fcf6d7b7ab4d436a | refs/heads/master | 2021-07-12T21:19:36.710739 | 2020-08-25T08:37:26 | 2020-08-25T08:37:26 | 196,787,290 | 4 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 2,033 | cpp | adjacency_matrix.cpp | #include <iostream>
using namespace std;
// 用邻接矩阵表示图, 顶点 边
// 邻接矩阵为对称阵(两个定点相互是相连的), 对角元素为0(顶点与自己的边用0表示)
// 简单,但是有一半的空间浪费,并且稀疏0很多.
# define MAXVERTEX_NUMS 20
// 顶点的类型,可以不用这么绕弯子,也没啥用
class Vertex
{
public:
Vertex(const int& dt): data(dt) { }
private:
char data;
};
// 图的类型
class Graph
{
public:
Graph(): nVertex(0) // 都初始化0
{
for(int i=0; i<MAXVERTEX_NUMS; i++)
for(int j=0; j<MAXVERTEX_NUMS; j++)
adjMat[i][j] = 0;
}
void addVertex(const char& v); // 主要是 使nVertex++
void addEdge(const char& st, const char& end); // 添加顶点之间的关系
void print() const;
~Graph()
{
for(int i=0; i<nVertex; i++)
delete vertexTable[i]; // 顶点表里的数据是 new的Vertex指针, 需要一次释放
}
private:
Vertex* vertexTable[MAXVERTEX_NUMS]; // 可以不用这么麻烦
bool adjMat[MAXVERTEX_NUMS][MAXVERTEX_NUMS]; // 邻接矩阵
int nVertex; // 记录顶点个数
};
void Graph::addVertex(const char& v)
{
vertexTable[nVertex] = new Vertex(v);
nVertex++;
}
void Graph::addEdge(const char& st, const char& end)
{
adjMat[st-65][end-65] = 1; // 对称阵
adjMat[end-65][st-65] = 1;
}
void Graph::print() const
{
for(int i=0; i<nVertex; i++)
{
for(int j=0; j<nVertex; j++)
std::cout << adjMat[i][j] << " ";
std::cout << endl;
}
}
int main()
{
Graph G;
G.addVertex('A');
G.addVertex('B');
G.addVertex('C');
G.addVertex('D');
G.addVertex('E');
G.addEdge('A', 'B');
G.addEdge('A', 'D');
G.addEdge('B', 'E');
G.addEdge('D', 'E');
G.addEdge('C', 'E');
G.print();
// output:
// 0 1 0 1 0
// 1 0 0 0 1
// 0 0 0 0 1
// 1 0 0 0 1
// 0 1 1 1 0
return 0;
} |
12645c4d6985be4e021e0c21f66e1f11792f9846 | 50019f39ac619b99c3ad0ca37c24dc10ed48e0d9 | /Data Structures/Polynomial Calculator/polynomial.hpp | 3d974936a8d53ee8129e2eb13e17436295524b2b | [] | no_license | k48shah/Assignments | 3e4124b17bdf9d6bac32d9708aec64193206ac81 | c2d638ff489ba7f0af36dfcf0e41ef941906a42f | refs/heads/master | 2020-04-29T10:13:21.073541 | 2019-03-17T05:17:38 | 2019-03-17T05:17:38 | 176,053,533 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 425 | hpp | polynomial.hpp | #ifndef POLYNOMIAL_HPP
#define POLYNOMIAL_HPP
#include <iostream>
#include <string>
class Polynomial {
int dataSize = 0;
int* data = NULL;
public:
Polynomial();
Polynomial(int a[], int size);
Polynomial(std::string fileName);
~Polynomial();
void add(const Polynomial& second);
void subtract(const Polynomial& second);
void multiply(const Polynomial& second);
int* GetData();
int GetSize();
};
#endif
|
66c16996d9c177bd7981eb747208e3d92898dd5c | a4c25da4877a5af2f404e7ddc2b2bf12e2db3372 | /hpvm/projects/hpvm-tensor-rt/tensor_runtime/include/tensor_runtime.cc | 083d733b14d4f335f4365503e5ecdb5c3de0a2fb | [
"LLVM-exception",
"NCSA",
"Apache-2.0"
] | permissive | vzyrianov/hpvm-autograd | ff2d2d2b83e886f07690ef42b693259765abf147 | 521cc3b684531548aea75f9fe3cc673aaa4a2e90 | refs/heads/main | 2023-04-29T03:30:11.948340 | 2021-05-20T02:30:25 | 2021-05-20T02:30:25 | 359,849,964 | 0 | 1 | null | null | null | null | UTF-8 | C++ | false | false | 2,693 | cc | tensor_runtime.cc |
#include <cmath>
#include <cstdlib>
#include <memory>
#include <stdio.h>
#include <string>
#ifndef CUDNN_HEADER
#define CUDNN_HEADER
extern "C" {
/**** Initialization Routine - Must be inserted at program start (in the
* backend) ****/
void llvm_hpvm_initTensorRt(int gpuid = 0);
void llvm_hpvm_cleanupTensorRt();
// Routine to moving tensor data (from and to GPU,CPU)
void hpvm_request_tensor(void *tensor, int destination);
/****** Profiling API - defines profiling scope */
void startProfiling();
void stopProfiling();
/****** Routines for tensor creation and initialization *******/
void *create2DTensor(int data_type, size_t dim1_size, size_t dim2_size);
void *create3DTensor(int data_type, size_t dim1_size, size_t dim2_size,
size_t dim3_size);
// NOTE: Currently only using 4-D tensors - 2D and 3D tensors not supported for
// cuDNN operations NOTE: The only data format supported as of now is:
// CUDNN_NCHW
void *create4DTensor(int data_type, int data_format, size_t dim1_size,
size_t dim2_size, size_t dim3_size, size_t dim4_size);
void initTensorData(void *tensor, void *data_ptr, size_t size_in_bytes);
/********** Tensor Operation API ******/
void **tensorSplit(void *tensor, int num_splits, int split_dim);
void *tensorConcat(void **tensors, int num_splits, int split_dim);
// NOTE: For conv_mode, only value '1' is supported
void *tensorConvolution(void *input, void *filter, int vertical_pad,
int horizontal_pad, int vertical_stride,
int horizontal_stride, int conv_mode,
int compute_precision);
void *tensorHConvolution(void *input, void *filter, int vertical_pad,
int horizontal_pad, int vertical_stride,
int horizontal_stride, int conv_mode,
int compute_precision);
void *tensorPooling(void *input, int poolFunction, int window_height,
int window_width, int vertical_pad, int horizontal_pad,
int vertical_stride, int horizontal_stride);
void *tensorLRN(void *input, unsigned int LRN_window, double LRN_alpha,
double LRN_beta, double LRN_k);
/* 4 different Gemm versions */
void *tensorGemm(void *lhs, void *rhs);
void *tensorGemmCPU(void *lhs, void *rhs);
void *tensorGemmGPU(void *lhs, void *rhs);
void *tensorHgemm(void *lhs, void *rhs);
// NOTE: In-place operation
void *tensorGemmBias(void *input, void *bias);
// NOTE: In place operation
void *tensorAdd(void *x, void *bias);
// NOTE: In-place operation
void *tensorRelu(void *input);
// NOTE: In-place operation
void *tensorSoftmax(void *input);
}
#endif
|
02be6bcff6ba2c2a93f034a7ae8a8a585d42553c | 637756ec2b19bb1654e4f290fc296fbe7d702609 | /include/cyclon/contacts.hpp | b308903506285ab7e153de6268bfdcd776920314 | [] | no_license | devprofile98/shm-physics | a3f5925cffe7f47b898ff48c15e86eae51f71cfe | 5b8d13526d70511d4097dd4050422a6059d091d3 | refs/heads/main | 2023-07-15T08:51:09.287999 | 2021-08-25T14:21:04 | 2021-08-25T14:21:04 | 377,780,887 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 270 | hpp | contacts.hpp | #ifndef CYCLON_CONTACTS_H
#define CYCLON_CONTACTS_H
#include "core.hpp"
namespace cyclon {
// data that is needed to be with contacts generated
class Contact{
Vector3 contactPoint;
Vector3 contactNormal;
real penetration;
};
}
#endif //CYCLON_CONTACTS_H
|
90113549dd142a02527696ed5b5a467a6b54ad33 | 42d27eab1400524afbd0466213b374d7ba51f2b3 | /GitGud/DSEffect.cpp | 43e3349b82abf725fbf1216bd453d3488e986c53 | [] | no_license | gitDanilo/GitGud | 08b0bbde0ddf36ebb7c7d396feb7ac9ab12b99b3 | 5826b1c98b3f62a01452868586acf9fb10a5930b | refs/heads/master | 2020-04-16T05:45:40.783454 | 2019-01-21T03:33:09 | 2019-01-21T03:33:09 | 165,319,763 | 1 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 5,982 | cpp | DSEffect.cpp | #include "DSEffect.h"
BOOL DSEffect::ReadDataStruct(EFFECT_STRUCT &EffectData)
{
if (pProcMem->ReadProcMem(EffectData.qwBaseAddr + EFFECT_DURATION_OFFSET, EffectData.fEffectDuration) == false)
return FALSE;
if (pProcMem->ReadProcMem(EffectData.qwBaseAddr + DURATION_INC_OFFSET, EffectData.fDurationIncrease) == false)
return FALSE;
if (pProcMem->ReadProcMem(EffectData.qwBaseAddr + PLAYER_BASICS_OFFSET, reinterpret_cast<PBYTE>(&EffectData.fMaxHPRate), sizeof(FLOAT) * 3) == false)
return FALSE;
if (pProcMem->ReadProcMem(EffectData.qwBaseAddr + RESISTANCE_RED_OFFSET, reinterpret_cast<PBYTE>(&EffectData.fSlashDmgRate), sizeof(FLOAT) * 7) == false)
return FALSE;
if (pProcMem->ReadProcMem(EffectData.qwBaseAddr + ATTACK_PWR_OFFSET, reinterpret_cast<PBYTE>(&EffectData.fPhysicalPower), sizeof(FLOAT) * 4) == false)
return FALSE;
if (pProcMem->ReadProcMem(EffectData.qwBaseAddr + CHANGE_RGN_OFFSET, EffectData.iChangeHP) == false)
return FALSE;
if (pProcMem->ReadProcMem(EffectData.qwBaseAddr + CHANGE_RGN_OFFSET2, EffectData.iChangeFP) == false)
return FALSE;
if (pProcMem->ReadProcMem(EffectData.qwBaseAddr + ATT_SLOT_OFFSET, EffectData.bAttunementSlot) == false)
return FALSE;
if (pProcMem->ReadProcMem(EffectData.qwBaseAddr + ATT_SLOT_OFFSET + 1, EffectData.bAttunementSlot) == false)
return FALSE;
if (pProcMem->ReadProcMem(EffectData.qwBaseAddr + STATUS_BUFF_OFFSET, reinterpret_cast<PBYTE>(&EffectData.bVigorBuff), sizeof(BYTE) * 9) == false)
return FALSE;
if (pProcMem->ReadProcMem(EffectData.qwBaseAddr + POISON_RATE_OFFSET, EffectData.dwPoisonRate) == false)
return FALSE;
if (pProcMem->ReadProcMem(EffectData.qwBaseAddr + FROST_RATE_OFFSET, EffectData.dwFrostRate) == false)
return FALSE;
if (pProcMem->ReadProcMem(EffectData.qwBaseAddr + EFFECT_ID_OFFSET, EffectData.iEffectID) == false)
return FALSE;
if (pProcMem->ReadProcMem(EffectData.qwBaseAddr + WEAPON_BLOOD_OFFSET, EffectData.dwWeaponBlood) == false)
return FALSE;
return TRUE;
}
DSEffect::DSEffect(Memory* pProcMem)
{
this->pProcMem = pProcMem;
}
DSEffect::~DSEffect()
{
}
BOOL DSEffect::AddDataStruct(const TEMP_STRUCT &TempData)
{
return 0;
}
void DSEffect::InvalidateAllData()
{
EffectDataList.clear();
EffectDataBackupList.clear();
}
BOOL DSEffect::OverwriteMemory(BOOL bWithBackup)
{
std::vector<EFFECT_STRUCT>* pEffectDataList = bWithBackup ? &EffectDataBackupList : &EffectDataList;
for (auto const &Effect : *pEffectDataList)
{
if (Effect.FieldEnabled[EffectID::effect_duration])
{
if (pProcMem->WriteProcMem(Effect.BaseAddr + EFFECT_DURATION_OFFSET, Effect.fEffectDuration) == false)
return FALSE;
}
if (Effect.FieldEnabled[EffectID::duration_inc])
{
if (pProcMem->WriteProcMem(Effect.BaseAddr + DURATION_INC_OFFSET, Effect.fDurationIncrease) == false)
return FALSE;
}
if (Effect.FieldEnabled[EffectID::max_hp])
{
if (pProcMem->WriteProcMem(Effect.BaseAddr + PLAYER_BASICS_OFFSET, Effect.fMaxHPRate) == false)
return FALSE;
}
if (Effect.FieldEnabled[EffectID::max_fp])
{
if (pProcMem->WriteProcMem(Effect.BaseAddr + PLAYER_BASICS_OFFSET + 0x4, Effect.fMaxFPRate) == false)
return FALSE;
}
if (Effect.FieldEnabled[EffectID::max_stam])
{
if (pProcMem->WriteProcMem(Effect.BaseAddr + PLAYER_BASICS_OFFSET + 0x8, Effect.fMaxStaminaRate) == false)
return FALSE;
}
//
if (Effect.FieldEnabled[EffectID::slash_dmg_rate])
{
if (pProcMem->WriteProcMem(Effect.BaseAddr + RESISTANCE_RED_OFFSET, Effect.fSlashDmgRate) == false)
return FALSE;
}
if (Effect.FieldEnabled[EffectID::blow_dmg_rate])
{
if (pProcMem->WriteProcMem(Effect.BaseAddr + RESISTANCE_RED_OFFSET + 0x4, Effect.fBlowDmgRate) == false)
return FALSE;
}
if (Effect.FieldEnabled[EffectID::thrust_dmg_rate])
{
if (pProcMem->WriteProcMem(Effect.BaseAddr + RESISTANCE_RED_OFFSET + 0x8, Effect.fThrustDmgRate) == false)
return FALSE;
}
if (Effect.FieldEnabled[EffectID::neutral_dmg_rate])
{
if (pProcMem->WriteProcMem(Effect.BaseAddr + RESISTANCE_RED_OFFSET + 0xC, Effect.fNeutralDmgRate) == false)
return FALSE;
}
if (Effect.FieldEnabled[EffectID::magic_dmg_rate])
{
if (pProcMem->WriteProcMem(Effect.BaseAddr + RESISTANCE_RED_OFFSET + 0x10, Effect.fMagicDmgRate) == false)
return FALSE;
}
if (Effect.FieldEnabled[EffectID::fire_dmg_rate])
{
if (pProcMem->WriteProcMem(Effect.BaseAddr + RESISTANCE_RED_OFFSET + 0x14, Effect.fFireDmgRate) == false)
return FALSE;
}
if (Effect.FieldEnabled[EffectID::lightning_dmg_rate])
{
if (pProcMem->WriteProcMem(Effect.BaseAddr + RESISTANCE_RED_OFFSET + 0x18, Effect.fLightningDmgRate) == false)
return FALSE;
}
// TODO
if (pProcMem->WriteProcMem(Effect.BaseAddr + ATTACK_PWR_OFFSET, reinterpret_cast<PBYTE>(&Effect.fPhysicalPower), sizeof(FLOAT) * 4) == false)
return FALSE;
if (pProcMem->WriteProcMem(Effect.BaseAddr + CHANGE_RGN_OFFSET, Effect.iChangeHP) == false)
return FALSE;
if (pProcMem->WriteProcMem(Effect.BaseAddr + CHANGE_RGN_OFFSET2, Effect.iChangeFP) == false)
return FALSE;
if (pProcMem->WriteProcMem(Effect.BaseAddr + ATT_SLOT_OFFSET, Effect.bAttunementSlot) == false)
return FALSE;
if (pProcMem->WriteProcMem(Effect.BaseAddr + ATT_SLOT_OFFSET + 1, Effect.bAttunementSlot) == false)
return FALSE;
if (pProcMem->WriteProcMem(Effect.BaseAddr + STATUS_BUFF_OFFSET, reinterpret_cast<PBYTE>(&Effect.bVigorBuff), sizeof(BYTE) * 9) == false)
return FALSE;
if (pProcMem->WriteProcMem(Effect.BaseAddr + POISON_RATE_OFFSET, Effect.dwPoisonRate) == false)
return FALSE;
if (pProcMem->WriteProcMem(Effect.BaseAddr + FROST_RATE_OFFSET, Effect.dwFrostRate) == false)
return FALSE;
if (pProcMem->WriteProcMem(Effect.BaseAddr + EFFECT_ID_OFFSET, Effect.iEffectID) == false)
return FALSE;
if (pProcMem->WriteProcMem(Effect.BaseAddr + WEAPON_BLOOD_OFFSET, Effect.dwWeaponBlood) == false)
return FALSE;
}
return TRUE;
}
|
d0de306cb4d99aebc7d7d19e0dde93596c6e2bac | 10d4762f3602390b5b5b1a6eabb89c44b4f5b983 | /scope_ztsh_coords.cpp | 7c2a6fb67fca721230dbf3621bad6fd3900f3bbf | [
"BSD-3-Clause"
] | permissive | olegkutkov/phd2guiding_crao | 7171b7db615ef405f0d7745fa6eb566e11807c56 | 2bbbfbc5bd516a55094ae2b8daaa0c803d16f83c | refs/heads/master | 2021-09-03T13:41:05.905004 | 2018-01-09T13:19:42 | 2018-01-09T13:19:42 | 85,361,634 | 1 | 1 | null | null | null | null | UTF-8 | C++ | false | false | 7,690 | cpp | scope_ztsh_coords.cpp | /*
* scope_ztsh_coords
* PHD Guiding
*
* Module for ZTSH autogude system, Crimean astrophysical observatory
* All rights reserved.
*
* Copyright (c) 2017 Oleg Kutkov
* All rights reserved.
*
* This source code is distributed under the following "BSD" license
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
* Redistributions of source code must retain the above copyright notice,
* this list of conditions and the following disclaimer.
* Redistributions in binary form must reproduce the above copyright notice,
* this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* Neither the name of Craig Stark, Stark Labs nor the names of its
* contributors may be used to endorse or promote products derived from
* this software without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
* ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
* LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
* POSSIBILITY OF SUCH DAMAGE.
*
*/
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
#include <sys/socket.h>
#include <arpa/inet.h>
#include <unistd.h>
#include <errno.h>
#include <iostream>
#include "phd.h"
#include "scope_ztsh_coords.h"
ScopeZtshPosition::ScopeZtshPosition()
: wxThread(wxTHREAD_JOINABLE)
, sock (0)
, thread_done (false)
, last_ha (0)
, last_ra (0)
, last_dec (0)
, last_ra_speed (0)
, last_dec_speed (0)
{
}
ScopeZtshPosition::~ScopeZtshPosition()
{
Disconnect();
}
void ScopeZtshPosition::OnExit()
{
}
wxThread::ExitCode ScopeZtshPosition::Entry()
{
while (!thread_done) {
thread_done |= TestDestroy();
if (Connect("10.1.1.142", 16050)) {
break;
}
usleep(500000);
}
thread_done = TestDestroy();
while (!thread_done) {
UpdateCoordsAndSpeed();
if (pFrame) {
double hour_angle_deg = last_ha * 15;
pMount->UpdatexAngle(hour_angle_deg, last_dec);
pFrame->ScheduleCoordsUpdate(last_ha, last_ra, last_dec, last_ra_speed, last_dec_speed);
}
// last_ha += 0.001;
// last_dec += 0.001;
// last_ra = 20;
thread_done |= TestDestroy();
usleep(500000);
}
pFrame->ScheduleCoordsUpdate(0, 0, 0, 0, 0);
Disconnect();
}
bool ScopeZtshPosition::Connect(std::string host, int port)
{
struct sockaddr_in server;
std::cout << "Connecting to " << host << ":" << port << std::endl;
sock = socket(AF_INET , SOCK_STREAM , 0);
if (sock == -1) {
last_error = std::string("Failed to create socket, error:\n") + strerror(errno);
return false;
}
server.sin_addr.s_addr = inet_addr(host.c_str());
server.sin_family = AF_INET;
server.sin_port = htons(port);
struct timeval tv = {2, 0};
setsockopt(sock, SOL_SOCKET, SO_RCVTIMEO, (char *) &tv, sizeof(tv));
setsockopt(sock, SOL_SOCKET, SO_SNDTIMEO, (char *) &tv, sizeof(tv));
if (connect(sock, (struct sockaddr *)&server , sizeof(server)) < 0) {
last_error = std::string("Failed to connect to the coords server, error:\n") + strerror(errno);
close(sock);
sock = 0;
return false;
}
///
WriteString("<HelloServer>");
std::string srv_answer = ReadString();
if (srv_answer != "<HelloClient>:") {
last_error = "Bad answer from server: " + srv_answer;
Disconnect();
return false;
}
srv_answer = ReadString();
if (srv_answer != "<NumberParameters>:[int32]") {
last_error = "Bad answer from server: " + srv_answer;
Disconnect();
return false;
}
int srv_answer_int = ReadInt32();
for (int i = 0; i < srv_answer_int; i++) {
srv_answer = ReadString();
if (srv_answer == "<ProtocolVersion>:[int32]") {
int version = ReadInt32();
/// log this in future...
} else if (srv_answer == "<InstrumentName>:[string]") {
instrument_name = ReadString();
}
}
return true;
}
bool ScopeZtshPosition::Disconnect()
{
if (sock <= 0) {
return true;
}
std::cout << "Disconnecting from server, sending bye!" << std::endl;
WriteString("<ByeServer>");
close(sock);
sock = 0;
return true;
}
void ScopeZtshPosition::GetScopePosAndSpeed(double &ha, double &ra, double &dec, double &rasp, double &decsp)
{
ha = last_ha;
ra = last_ra;
dec = last_dec;
rasp = last_ra_speed;
decsp = last_dec_speed;
}
double ScopeZtshPosition::GetDeclination()
{
return last_dec;
}
void ScopeZtshPosition::UpdateCoordsAndSpeed()
{
if (!sock) {
return;
}
std::string srv_answer;
WriteString("<" + instrument_name + ".Reflector.GetTelemetry>");
ReadString();
ReadString();
int count = ReadInt32();
last_ha = 0;
last_ra = 0;
last_dec = 0;
last_ra_speed = 0;
last_dec_speed = 0;
for (int i = 0; i < count; i++) {
srv_answer = ReadString();
if (srv_answer == "<HourAngleDeg>:[float64]") {
last_ha = ReadFloat64();
} else if (srv_answer == "<RightAscensionDeg>:[float64]") {
last_ra = ReadFloat64();
} else if (srv_answer == "<DeclinationDeg>:[float64]") {
last_dec = (ReadFloat64());
} else if (srv_answer == "<HourAngleSpeedArcSecPerSec>:[float64]") {
last_ra_speed = ReadFloat64();
} else if (srv_answer == "<DeclinationSpeedArcSecPerSec>:[float64]") {
last_dec_speed = ReadFloat64();
}
}
}
std::string ScopeZtshPosition::GetErrorText()
{
return last_error;
}
char ScopeZtshPosition::SocketReadByte()
{
char byte;
recv(sock, &byte, sizeof(byte), 0);
return byte;
}
int ScopeZtshPosition::Read7BitEncodedInt()
{
int int32 = 0, shift = 0, byteval;
while (((byteval = SocketReadByte()) & 128) != 0 & shift != 35)
{
int32 |= ((byteval & 127) << shift);
shift += 7;
}
return (int32 | (byteval << shift));
}
std::string ScopeZtshPosition::ReadString()
{
int bytes_count = Read7BitEncodedInt();
char *buf = new char[bytes_count + 1];
memset(buf, 0, bytes_count);
recv(sock, (void*)buf, bytes_count, 0);
buf[bytes_count] = '\0';
std::string res = buf;
delete[] buf;
return res;
}
short ScopeZtshPosition::ReadInt16()
{
short res;
recv(sock, &res, sizeof(res), 0);
return res;
}
int ScopeZtshPosition::ReadInt32()
{
int res;
recv(sock, &res, sizeof(res), 0);
return res;
}
long ScopeZtshPosition::ReadInt64()
{
long res;
recv(sock, &res, sizeof(res), 0);
return res;
}
float ScopeZtshPosition::ReadFloat32()
{
float res;
recv(sock, &res, sizeof(res), 0);
return res;
}
double ScopeZtshPosition::ReadFloat64()
{
unsigned char *buff = new unsigned char[8];
recv(sock, buff, 8, 0);
double res = *(double*)buff;
delete buff;
return res;
}
bool ScopeZtshPosition::ReadBool()
{
return SocketReadByte() == 1;
}
void ScopeZtshPosition::SockWriteByte(char byte)
{
send(sock, &byte, 1, 0);
}
void ScopeZtshPosition::Write7BitEncodedInt(int int32)
{
for (; int32 >= 128; int32 >>= 7) {
SockWriteByte((unsigned char)(int32 | 128));
}
SockWriteByte((unsigned char)int32);
}
void ScopeZtshPosition::WriteString(std::string str)
{
int str_len = str.length();
Write7BitEncodedInt(str_len);
send(sock, (void*)str.c_str(), str_len, 0);
}
|
98af8219061a13cfcaaf52b6f93ba5217feb83c5 | 69be5215ff881670a1bde185b9932fb8e520de53 | /src/lib/serialize/decl_serializable.hpp | 297dfcc99fa89bd84bcb33860666167a27a9d287 | [] | no_license | xiangyun-kongxy/genetis | e34e3521e2ab42e69dbdf763fbec2cba5eec23f9 | 8df3f9b7426acac1dc7c1dabb5ecb92e75cb4c43 | refs/heads/master | 2020-03-15T12:28:28.671966 | 2019-04-08T10:20:21 | 2019-04-08T10:20:21 | 132,144,780 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 893 | hpp | decl_serializable.hpp | //
// decl_serializable.h
// lib
//
// Created by 孔祥云 on 7/19/17.
// Copyright © 2017 孔祥云. All rights reserved.
//
#ifndef decl_serializable_h
#define decl_serializable_h
#define DECL_SERIALIZE(class, ar, ins, ...) \
friend serializable& operator << (serializable& ar, const class& ins) { \
__VA_ARGS__; \
return ar; \
}
#define DECL_DESERIALIZE(class, ar, ins, ...) \
friend serializable& operator >> (serializable& ar, class& ins) { \
__VA_ARGS__; \
return ar; \
}
#endif /* decl_serializable_h */
|
8020a7551b90c933ac331cc864a95b7fffa46fac | b93faf4a7bf8c1c61cfcf03ab229293106bda2b2 | /MFC/MFC_practices/MFCPainting/MFCPainting.cpp | 928ec5eb885fd81cc2feba3ad85591fea2d35703 | [] | no_license | specter-executant/c-c- | 9dd588147287ac8094adb9b272294932031833ee | 8ddbeff382b03ee4672096d60dd9475e8df92dea | refs/heads/master | 2022-09-18T03:48:30.837975 | 2020-04-14T08:12:12 | 2020-04-14T08:12:12 | null | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 5,157 | cpp | MFCPainting.cpp |
// MFCPainting.cpp: 定义应用程序的类行为。
//
#include "pch.h"
#include "framework.h"
#include "afxwinappex.h"
#include "afxdialogex.h"
#include "MFCPainting.h"
#include "MainFrm.h"
#include "MFCPaintingDoc.h"
#include "MFCPaintingView.h"
#ifdef _DEBUG
#define new DEBUG_NEW
#endif
// CMFCPaintingApp
BEGIN_MESSAGE_MAP(CMFCPaintingApp, CWinAppEx)
ON_COMMAND(ID_APP_ABOUT, &CMFCPaintingApp::OnAppAbout)
// 基于文件的标准文档命令
ON_COMMAND(ID_FILE_NEW, &CWinAppEx::OnFileNew)
ON_COMMAND(ID_FILE_OPEN, &CWinAppEx::OnFileOpen)
END_MESSAGE_MAP()
// CMFCPaintingApp 构造
CMFCPaintingApp::CMFCPaintingApp() noexcept
{
m_bHiColorIcons = TRUE;
// TODO: 将以下应用程序 ID 字符串替换为唯一的 ID 字符串;建议的字符串格式
//为 CompanyName.ProductName.SubProduct.VersionInformation
SetAppID(_T("MFCPainting.AppID.NoVersion"));
// TODO: 在此处添加构造代码,
// 将所有重要的初始化放置在 InitInstance 中
}
// 唯一的 CMFCPaintingApp 对象
CMFCPaintingApp theApp;
// CMFCPaintingApp 初始化
BOOL CMFCPaintingApp::InitInstance()
{
CWinAppEx::InitInstance();
EnableTaskbarInteraction(FALSE);
// 使用 RichEdit 控件需要 AfxInitRichEdit2()
// AfxInitRichEdit2();
// 标准初始化
// 如果未使用这些功能并希望减小
// 最终可执行文件的大小,则应移除下列
// 不需要的特定初始化例程
// 更改用于存储设置的注册表项
// TODO: 应适当修改该字符串,
// 例如修改为公司或组织名
SetRegistryKey(_T("应用程序向导生成的本地应用程序"));
LoadStdProfileSettings(4); // 加载标准 INI 文件选项(包括 MRU)
InitContextMenuManager();
InitKeyboardManager();
InitTooltipManager();
CMFCToolTipInfo ttParams;
ttParams.m_bVislManagerTheme = TRUE;
theApp.GetTooltipManager()->SetTooltipParams(AFX_TOOLTIP_TYPE_ALL,
RUNTIME_CLASS(CMFCToolTipCtrl), &ttParams);
// 注册应用程序的文档模板。 文档模板
// 将用作文档、框架窗口和视图之间的连接
CSingleDocTemplate* pDocTemplate;
pDocTemplate = new CSingleDocTemplate(
IDR_MAINFRAME,
RUNTIME_CLASS(CMFCPaintingDoc),
RUNTIME_CLASS(CMainFrame), // 主 SDI 框架窗口
RUNTIME_CLASS(CMFCPaintingView));
if (!pDocTemplate)
return FALSE;
AddDocTemplate(pDocTemplate);
// 分析标准 shell 命令、DDE、打开文件操作的命令行
CCommandLineInfo cmdInfo;
ParseCommandLine(cmdInfo);
// 调度在命令行中指定的命令。 如果
// 用 /RegServer、/Register、/Unregserver 或 /Unregister 启动应用程序,则返回 FALSE。
if (!ProcessShellCommand(cmdInfo))
return FALSE;
// 唯一的一个窗口已初始化,因此显示它并对其进行更新
m_pMainWnd->ShowWindow(SW_SHOW);
m_pMainWnd->UpdateWindow();
return TRUE;
}
// CMFCPaintingApp 消息处理程序
// 用于应用程序“关于”菜单项的 CAboutDlg 对话框
class CAboutDlg : public CDialogEx
{
public:
CAboutDlg() noexcept;
// 对话框数据
#ifdef AFX_DESIGN_TIME
enum { IDD = IDD_ABOUTBOX };
#endif
protected:
virtual void DoDataExchange(CDataExchange* pDX); // DDX/DDV 支持
// 实现
protected:
DECLARE_MESSAGE_MAP()
public:
// afx_msg void OnLButtonDown(UINT nFlags, CPoint point);
// afx_msg void OnLButtonUp(UINT nFlags, CPoint point);
protected:
// CPoint ButtonDownPoint;
};
CAboutDlg::CAboutDlg() noexcept : CDialogEx(IDD_ABOUTBOX)
{
}
void CAboutDlg::DoDataExchange(CDataExchange* pDX)
{
CDialogEx::DoDataExchange(pDX);
}
BEGIN_MESSAGE_MAP(CAboutDlg, CDialogEx)
// ON_WM_LBUTTONDOWN()
// ON_WM_LBUTTONUP()
END_MESSAGE_MAP()
// 用于运行对话框的应用程序命令
void CMFCPaintingApp::OnAppAbout()
{
CAboutDlg aboutDlg;
aboutDlg.DoModal();
}
// CMFCPaintingApp 自定义加载/保存方法
void CMFCPaintingApp::PreLoadState()
{
BOOL bNameValid;
CString strName;
bNameValid = strName.LoadString(IDS_EDIT_MENU);
ASSERT(bNameValid);
GetContextMenuManager()->AddMenu(strName, IDR_POPUP_EDIT);
bNameValid = strName.LoadString(IDS_EXPLORER);
ASSERT(bNameValid);
GetContextMenuManager()->AddMenu(strName, IDR_POPUP_EXPLORER);
//加载鼠标右键点击弹出的菜单窗口的资源
GetContextMenuManager()->AddMenu(L"画图", IDR_MENU1);
}
void CMFCPaintingApp::LoadCustomState()
{
}
void CMFCPaintingApp::SaveCustomState()
{
}
// CMFCPaintingApp 消息处理程序
//void CAboutDlg::OnLButtonDown(UINT nFlags, CPoint point)
//{
// // TODO: 在此添加消息处理程序代码和/或调用默认值
// MessageBox(L"Down");
// ButtonDownPoint = point;
// CDialogEx::OnLButtonDown(nFlags, point);
//}
//void CAboutDlg::OnLButtonUp(UINT nFlags, CPoint point)
//{
// // TODO: 在此添加消息处理程序代码和/或调用默认值
// CDC* cdc = GetDC();
//
// cdc->MoveTo(ButtonDownPoint);
// cdc->LineTo(point);
//
// cdc->DeleteDC();
// CDialogEx::OnLButtonUp(nFlags, point);
//}
//程序退出时调用
int CMFCPaintingApp::ExitInstance()
{
// TODO: 在此添加专用代码和/或调用基类
AfxOleTerm(FALSE);
this->CleanState(); //清空注册表信息
return CWinAppEx::ExitInstance();
}
|
7f5bb1b20ace4d40c12b3a11574c3e3d90ad1359 | 1835938ff1e6dd0b8f9c8e34a57dd5d862a9e45b | /中国象棋/main.cpp | bdd9594847b63506d5969cb4f8a8ff3e0722579f | [] | no_license | sweeter-melon/hello-game | 8cb30271b4e134590e876edd40a225b57a2a3209 | f0a2995711a1b48c424297c90329cf5cf363bbf4 | refs/heads/master | 2021-01-21T10:13:58.691617 | 2017-02-28T06:48:43 | 2017-02-28T06:48:43 | 83,398,958 | 0 | 0 | null | null | null | null | GB18030 | C++ | false | false | 45,449 | cpp | main.cpp | #include<graphics.h>
#include<conio.h>
#include<stdlib.h>
#include<iostream>
#include"chess.h"
#include"rule.h"
#pragma comment(lib,"Winmm.lib")
using namespace std;
class Play
{
public:
void show();
void chess();
void qipan();
void update(); //更新棋盘棋子
void startgraph();
void breakrule();
void victory();
void help();
void chushihua();
void control();
};
int i;
int j;
int changex;
int changey;
int rb=1;
int board[10][11]={0};
Blackking bk; Bkrule BK;
Blackadviser1 ba1; Barule BA;
Blackadviser2 ba2;
Blackelephant1 be1; Berule BE;
Blackelephant2 be2;
Blackhorse1 bh1; Bhrule BH;
Blackhorse2 bh2;
Blackcar1 bc1; Bcrule BC;
Blackcar2 bc2;
Blackpawn1 bp1; Bprule BP;
Blackpawn2 bp2;
Blacksolider1 bs1; Bsrule BS;
Blacksolider2 bs2;
Blacksolider3 bs3; //初始化所有棋子对象
Blacksolider4 bs4;
Blacksolider5 bs5;
Redking rk; Rkrule RK;
Redadviser1 ra1; Rarule RA;
Redadviser2 ra2;
Redelephant1 re1; Rerule RE;
Redelephant2 re2;
Redhorse1 rh1; Rhrule RH;
Redhorse2 rh2;
Redcar1 rc1; Rcrule RC;
Redcar2 rc2;
Redpawn1 rp1; Rprule RP;
Redpawn2 rp2;
Redsolider1 rs1; Rsrule RS;
Redsolider2 rs2;
Redsolider3 rs3;
Redsolider4 rs4;
Redsolider5 rs5;
Redchess red; Blackchess black;
Redkill one; Blackkill two;
void Play::chushihua() //初始化棋子坐标
{
board[1][1]=1; rc1.x=1; rc1.y=1; rc1.kill=0; RC.s=0;
board[2][1]=1; rh1.x=2; rh1.y=1; rh1.kill=0; RH.s=0;
board[3][1]=1; re1.x=3; re1.y=1; re1.kill=0; RE.s=0;
board[4][1]=1; ra1.x=4; ra1.y=1; ra1.kill=0; RA.s=0;
board[5][1]=1; rk.x=5; rk.y=1; rk.kill=0; RK.s=0;
board[6][1]=1; ra2.x=6; ra2.y=1; ra2.kill=0;
board[7][1]=1; re2.x=7; re2.y=1; re2.kill=0;
board[8][1]=1; rh2.x=8; rh2.y=1; rh2.kill=0;
board[9][1]=1; rc2.x=9; rc2.y=1; rc2.kill=0;
board[2][3]=1; rp1.x=2; rp1.y=3; rp1.kill=0; RP.s=0;
board[8][3]=1; rp2.x=8; rp2.y=3; rp2.kill=0;
board[1][4]=1; rs1.x=1; rs1.y=4; rs1.kill=0; RS.s=0;
board[3][4]=1; rs2.x=3; rs2.y=4; rs2.kill=0;
board[5][4]=1; rs3.x=5; rs3.y=4; rs3.kill=0;
board[7][4]=1; rs4.x=7; rs4.y=4; rs4.kill=0;
board[9][4]=1; rs5.x=9; rs5.y=4; rs5.kill=0;
board[1][10]=1; bc1.x=1; bc1.y=10; bc1.kill=0; BC.s=0;
board[2][10]=1; bh1.x=2; bh1.y=10; bh1.kill=0; BH.s=0;
board[3][10]=1; be1.x=3; be1.y=10; be1.kill=0; BE.s=0;
board[4][10]=1; ba1.x=4; ba1.y=10; ba1.kill=0; BA.s=0;
board[5][10]=1; bk.x=5; bk.y=10; bk.kill=0; BK.s=0;
board[6][10]=1; ba2.x=6; ba2.y=10; ba2.kill=0;
board[7][10]=1; be2.x=7; be2.y=10; be2.kill=0;
board[8][10]=1; bh2.x=8; bh2.y=10; bh2.kill=0;
board[9][10]=1; bc2.x=9; bc2.y=10; bc2.kill=0;
board[2][8]=1; bp1.x=2; bp1.y=8; bp1.kill=0; BP.s=0;
board[8][8]=1; bp2.x=8; bp2.y=8; bp2.kill=0;
board[1][7]=1; bs1.x=1; bs1.y=7; bs1.kill=0; BS.s=0;
board[3][7]=1; bs2.x=3; bs2.y=7; bs2.kill=0;
board[5][7]=1; bs3.x=5; bs3.y=7; bs3.kill=0;
board[7][7]=1; bs4.x=7; bs4.y=7; bs4.kill=0;
board[9][7]=1; bs5.x=9; bs5.y=7; bs5.kill=0;
red.m=0; black.m=0;
}
void Play::show() //显示所有棋子
{
settextcolor(RED);
setlinecolor(RED);
setfillcolor(RGB(249,210,100));
setlinestyle(PS_SOLID |PS_JOIN_ROUND, 2);
fillcircle(300 , 60 , 25);
settextstyle(36, 0, _T("宋体") );
outtextxy(300-18, 60-18, "帅");
settextcolor(BLACK);
setlinecolor(BLACK);
setfillcolor(RGB(249,210,100));
setlinestyle(PS_SOLID |PS_JOIN_ROUND, 2);
fillcircle(300 , 600 , 25);
settextstyle(36, 0, _T("宋体") );
outtextxy(300-18, 600-18, "将");
settextcolor(RED);
setlinecolor(RED);
setfillcolor(RGB(249,210,100));
setlinestyle(PS_SOLID |PS_JOIN_ROUND, 2); //显示士棋
fillcircle(240 , 60 , 25);
settextstyle(36, 0, _T("宋体") );
outtextxy(240-18, 60-18, "士");
fillcircle(360 , 60 , 25);
settextstyle(36, 0, _T("宋体") );
outtextxy(360-18, 60-18, "士");
settextcolor(BLACK);
setlinecolor(BLACK);
setfillcolor(RGB(249,210,100));
setlinestyle(PS_SOLID |PS_JOIN_ROUND, 2);
fillcircle(240 , 600 , 25);
settextstyle(36, 0, _T("宋体") );
outtextxy(240-18, 600-18, "仕");
fillcircle(360 , 600 , 25);
settextstyle(36, 0, _T("宋体") );
outtextxy(360-18, 600-18, "仕");
settextcolor(RED);
setlinecolor(RED);
setfillcolor(RGB(249,210,100));
setlinestyle(PS_SOLID |PS_JOIN_ROUND, 2); //显示相棋
fillcircle(180 , 60 , 25);
settextstyle(36, 0, _T("宋体") );
outtextxy(180-18, 60-18, "象");
fillcircle(420 , 60 , 25);
settextstyle(36, 0, _T("宋体") );
outtextxy(420-18, 60-18, "象");
settextcolor(BLACK);
setlinecolor(BLACK);
setfillcolor(RGB(249,210,100));
setlinestyle(PS_SOLID |PS_JOIN_ROUND, 2);
fillcircle(180 , 600 , 25);
settextstyle(36, 0, _T("宋体") );
outtextxy(180-18, 600-18, "相");
fillcircle(420 , 600 , 25);
settextstyle(36, 0, _T("宋体") );
outtextxy(420-18, 600-18, "相");
settextcolor(RED);
setlinecolor(RED);
setfillcolor(RGB(249,210,100));
setlinestyle(PS_SOLID |PS_JOIN_ROUND, 2); //显示马棋
fillcircle(120 , 60 , 25);
settextstyle(36, 0, _T("宋体") );
outtextxy(120-18, 60-18, "马");
fillcircle(480 , 60 , 25);
settextstyle(36, 0, _T("宋体") );
outtextxy(480-18, 60-18, "马");
settextcolor(BLACK);
setlinecolor(BLACK);
setfillcolor(RGB(249,210,100));
setlinestyle(PS_SOLID |PS_JOIN_ROUND, 2);
fillcircle(120 , 600 , 25);
settextstyle(36, 0, _T("宋体") );
outtextxy(120-18, 600-18, "马");
fillcircle(480 , 600 , 25);
settextstyle(36, 0, _T("宋体") );
outtextxy(480-18, 600-18, "马");
settextcolor(RED);
setlinecolor(RED);
setfillcolor(RGB(249,210,100));
setlinestyle(PS_SOLID |PS_JOIN_ROUND, 2); //显示车棋
fillcircle(60 , 60 , 25);
settextstyle(36, 0, _T("宋体") );
outtextxy(60-18, 60-18, "车");
fillcircle(540 , 60 , 25);
settextstyle(36, 0, _T("宋体") );
outtextxy(540-18, 60-18, "车");
settextcolor(BLACK);
setlinecolor(BLACK);
setfillcolor(RGB(249,210,100));
setlinestyle(PS_SOLID |PS_JOIN_ROUND, 2);
fillcircle(60 , 600 , 25);
settextstyle(36, 0, _T("宋体") );
outtextxy(60-18, 600-18, "车");
fillcircle(540, 600 , 25);
settextstyle(36, 0, _T("宋体") );
outtextxy(540-18, 600-18, "车");
settextcolor(RED);
setlinecolor(RED);
setfillcolor(RGB(249,210,100));
setlinestyle(PS_SOLID |PS_JOIN_ROUND, 2); //显示炮棋
fillcircle(120 , 180 , 25);
settextstyle(36, 0, _T("宋体") );
outtextxy(120-18, 180-18, "炮");
fillcircle(480 , 180 , 25);
settextstyle(36, 0, _T("宋体") );
outtextxy(480-18, 180-18, "炮");
settextcolor(BLACK);
setlinecolor(BLACK);
setfillcolor(RGB(249,210,100));
setlinestyle(PS_SOLID |PS_JOIN_ROUND, 2);
fillcircle(120 , 480 , 25);
settextstyle(36, 0, _T("宋体") );
outtextxy(120-18, 480-18, "炮");
fillcircle(480 , 480 , 25);
settextstyle(36, 0, _T("宋体") );
outtextxy(480-18, 480-18, "炮");
settextcolor(RED);
setlinecolor(RED);
setfillcolor(RGB(249,210,100));
setlinestyle(PS_SOLID |PS_JOIN_ROUND, 2); //显示兵棋
fillcircle(60 , 240 , 25);
settextstyle(36, 0, _T("宋体") );
outtextxy(60-18, 240-18, "兵");
fillcircle(60+1*120 , 240 , 25);
settextstyle(36, 0, _T("宋体") );
outtextxy(60+1*120-18, 240-18, "兵");
fillcircle(60+2*120 , 240 , 25);
settextstyle(36, 0, _T("宋体") );
outtextxy(60+2*120-18, 240-18, "兵");
fillcircle(60+3*120 , 240 , 25);
settextstyle(36, 0, _T("宋体") );
outtextxy(60+3*120-18, 240-18, "兵");
fillcircle(60+4*120 , 240 , 25);
settextstyle(36, 0, _T("宋体") );
outtextxy(60+4*120-18, 240-18, "兵");
settextcolor(BLACK);
setlinecolor(BLACK);
setfillcolor(RGB(249,210,100));
setlinestyle(PS_SOLID |PS_JOIN_ROUND, 2);
fillcircle(60 , 420 , 25);
settextstyle(36, 0, _T("宋体") );
outtextxy(60-18, 420-18, "卒");
fillcircle(60+1*120 , 420 , 25);
settextstyle(36, 0, _T("宋体") );
outtextxy(60+1*120-18, 420-18, "卒");
fillcircle(60+2*120 , 420 , 25);
settextstyle(36, 0, _T("宋体") );
outtextxy(60+2*120-18, 420-18, "卒");
fillcircle(60+3*120 , 420 , 25);
settextstyle(36, 0, _T("宋体") );
outtextxy(60+3*120-18, 420-18, "卒");
fillcircle(60+4*120 , 420 , 25);
settextstyle(36, 0, _T("宋体") );
outtextxy(60+4*120-18, 420-18, "卒");
settextcolor(RGB(255,0,0));
setlinestyle(PS_SOLID |PS_JOIN_ROUND, 3);
settextstyle(40, 0, _T("方正舒体"));
outtextxy(580, 80, "红");
outtextxy(580, 130, "方");
outtextxy(580, 180, "落");
outtextxy(580, 230, "子");
}
void Play::update() //更新棋盘
{
if(board[bk.x][bk.y]!=0&&bk.kill==0)
{
bk.display();
}
if(board[ba1.x][ba1.y]!=0&&ba1.kill==0)
{
ba1.display();
}
if(board[ba2.x][ba2.y]!=0&&ba2.kill==0)
{
ba2.display();
}
if(board[be1.x][be1.y]!=0&&be1.kill==0)
{
be1.display();
}
if(board[be2.x][be2.y]!=0&&be2.kill==0)
{
be2.display();
}
if(board[bh1.x][bh1.y]!=0&&bh1.kill==0)
{
bh1.display();
}
if(board[bh2.x][bh2.y]!=0&&bh2.kill==0)
{
bh2.display();
}
if(board[bc1.x][bc1.y]!=0&&bc1.kill==0)
{
bc1.display();
}
if(board[bc2.x][bc2.y]!=0&&bc2.kill==0)
{
bc2.display();
}
if(board[bp1.x][bp1.y]!=0&&bp1.kill==0)
{
bp1.display();
}
if(board[bp2.x][bp2.y]!=0&&bp2.kill==0)
{
bp2.display();
}
if(board[bs1.x][bs1.y]!=0&&bs1.kill==0)
{
bs1.display();
}
if(board[bs2.x][bs2.y]!=0&&bs2.kill==0)
{
bs2.display();
}
if(board[bs3.x][bs3.y]!=0&&bs3.kill==0)
{
bs3.display();
}
if(board[bs4.x][bs4.y]!=0&&bs4.kill==0)
{
bs4.display();
}
if(board[bs5.x][bs5.y]!=0&&bs5.kill==0)
{
bs5.display();
}
if(board[rk.x][rk.y]!=0&&rk.kill==0)
{
rk.display();
}
if(board[ra1.x][ra1.y]!=0&&ra1.kill==0)
{
ra1.display();
}
if(board[ra2.x][ra2.y]!=0&&ra2.kill==0)
{
ra2.display();
}
if(board[re1.x][re1.y]!=0&&re1.kill==0)
{
re1.display();
}
if(board[re2.x][re2.y]!=0&&re2.kill==0)
{
re2.display();
}
if(board[rh1.x][rh1.y]!=0&&rh1.kill==0)
{
rh1.display();
}
if(board[rh2.x][rh2.y]!=0&&rh2.kill==0)
{
rh2.display();
}
if(board[rc1.x][rc1.y]!=0&&rc1.kill==0)
{
rc1.display();
}
if(board[rc2.x][rc2.y]!=0&&rc2.kill==0)
{
rc2.display();
}
if(board[rp1.x][rp1.y]!=0&&rp1.kill==0)
{
rp1.display();
}
if(board[rp2.x][rp2.y]!=0&&rp2.kill==0)
{
rp2.display();
}
if(board[rs1.x][rs1.y]!=0&&rs1.kill==0)
{
rs1.display();
}
if(board[rs2.x][rs2.y]!=0&&rs2.kill==0)
{
rs2.display();
}
if(board[rs3.x][rs3.y]!=0&&rs3.kill==0)
{
rs3.display();
}
if(board[rs4.x][rs4.y]!=0&&rs4.kill==0)
{
rs4.display();
}
if(board[rs5.x][rs5.y]!=0&&rs5.kill==0)
{
rs5.display();
}
if(rb==1)
{
settextcolor(RGB(255,0,0));
setlinestyle(PS_SOLID |PS_JOIN_ROUND, 3);
settextstyle(40, 0, _T("方正舒体"));
outtextxy(580, 80, "红");
outtextxy(580, 130, "方");
outtextxy(580, 180, "落");
outtextxy(580, 230, "子");
}
if(rb==0)
{
settextcolor(RGB(0,0,0));
setlinestyle(PS_SOLID |PS_JOIN_ROUND, 3);
settextstyle(40, 0, _T("方正舒体"));
outtextxy(580, 430, "子");
outtextxy(580, 480, "落");
outtextxy(580, 530, "方");
outtextxy(580, 580, "黑");
}
}
void Play::chess() //如何控制落子
{
int p=1;
MOUSEMSG m;
while(1)
{
while(p==1)
{
m=GetMouseMsg();
switch(m.uMsg) //如何鼠标点到位置落子
{
case WM_LBUTTONDOWN:
{
for( i=1;i<10;i++)
{
for( j=1;j<11;j++)
{
if(m.x<(i*60)+20&&m.y<(j*60)+20&&m.x>(i*60)-20&&m.y>(j*60)-20)
{
setlinecolor(RED);
setlinestyle(PS_SOLID | PS_JOIN_BEVEL, 3);
line(60*i-25,60*j-25,60*i-14,60*j-25);
line(60*i+14,60*j-25,60*i+25,60*j-25);
line(60*i-25,60*j+25,60*i-14,60*j+25);
line(60*i+14,60*j+25,60*i+25,60*j+25);
line(60*i-25,60*j-25,60*i-25,60*j-14) ;
line(60*i-25,60*j+14,60*i-25,60*j+25) ;
line(60*i+25,60*j-25,60*i+25,60*j-14) ;
line(60*i+25,60*j+14,60*i+25,60*j+25) ;
changex=i;
changey=j;
p=0;
}
}
}
}
}
}
while(p==0)
{
m=GetMouseMsg();
switch(m.uMsg) //如何鼠标点到位置落子
{
case WM_LBUTTONDOWN:
{
for( i=1;i<10;i++)
{
for( j=1;j<11;j++)
{
if(m.x<(i*60)+20&&m.y<(j*60)+20&&m.x>(i*60)-20&&m.y>(j*60)-20&&changex==rc1.x&&changey==rc1.y)
{
board[rc1.x][rc1.y]=0;
RC.rule();
red.cover();
if(RC.s==1&&red.m==0&&rb==1)
{
mciSendString("play 12 from 0",NULL,0,NULL);
this->qipan();
this->update();
rc1.x=i;
rc1.y=j;
one.kill();
rc1.display();
rb=0;
}
else
{
this->breakrule();
this->qipan();
this->update();
rc1.display();
}
board[rc1.x][rc1.y]=1;
RC.s=0;
red.m=0;
p=1;
}
if(m.x<(i*60)+20&&m.y<(j*60)+20&&m.x>(i*60)-20&&m.y>(j*60)-20&&changex==rh1.x&&changey==rh1.y)
{
board[rh1.x][rh1.y]=0;
RH.rule();
red.cover();
if(RH.s==1&&red.m==0&&rb==1)
{
mciSendString("play 12 from 0",NULL,0,NULL);
this->qipan();
this->update();
rh1.x=i;
rh1.y=j;
one.kill();
rh1.display();
rb=0;
}
else
{
this->breakrule();
this->qipan();
this->update();
rh1.display();
}
board[rh1.x][rh1.y]=1;
RH.s=0;
red.m=0;
p=1;
}
if(m.x<(i*60)+20&&m.y<(j*60)+20&&m.x>(i*60)-20&&m.y>(j*60)-20&&changex==re1.x&&changey==re1.y)
{
board[re1.x][re1.y]=0;
RE.rule();
red.cover();
if(RE.s==1&&red.m==0&&rb==1)
{
mciSendString("play 12 from 0",NULL,0,NULL);
this->qipan();
this->update();
re1.x=i;
re1.y=j;
one.kill();
re1.display();
rb=0;
}
else
{
this->breakrule();
this->qipan();
this->update();
re1.display();
}
board[re1.x][re1.y]=1;
RE.s=0;
red.m=0;
p=1;
}
if(m.x<(i*60)+20&&m.y<(j*60)+20&&m.x>(i*60)-20&&m.y>(j*60)-20&&changex==ra1.x&&changey==ra1.y)
{
board[ra1.x][ra1.y]=0;
RA.rule();
red.cover();
if(RA.s==1&&red.m==0&&rb==1)
{
mciSendString("play 12 from 0",NULL,0,NULL);
this->qipan();
this->update();
ra1.x=i;
ra1.y=j;
one.kill();
ra1.display();
rb=0;
}
else
{
this->breakrule();
this->qipan();
this->update();
ra1.display();
}
board[ra1.x][ra1.y]=1;
RA.s=0;
red.m=0;
p=1;
}
if(m.x<(i*60)+20&&m.y<(j*60)+20&&m.x>(i*60)-20&&m.y>(j*60)-20&&changex==rk.x&&changey==rk.y)
{
board[rk.x][rk.y]=0;
RK.rule();
red.cover();
if(RK.s==1&&red.m==0&&rb==1)
{
mciSendString("play 12 from 0",NULL,0,NULL);
this->qipan();
this->update();
rk.x=i;
rk.y=j;
one.kill();
rk.display();
rb=0;
}
else
{
this->breakrule();
this->qipan();
this->update();
rk.display();
}
board[rk.x][rk.y]=1;
RK.s=0;
red.m=0;
p=1;
}
if(m.x<(i*60)+20&&m.y<(j*60)+20&&m.x>(i*60)-20&&m.y>(j*60)-20&&changex==ra2.x&&changey==ra2.y)
{
board[ra2.x][ra2.y]=0;
RA.rule();
red.cover();
if(RA.s==1&&red.m==0&&rb==1)
{
mciSendString("play 12 from 0",NULL,0,NULL);
this->qipan();
this->update();
ra2.x=i;
ra2.y=j;
one.kill();
ra2.display();
rb=0;
}
else
{
this->breakrule();
this->qipan();
this->update();
ra2.display();
}
board[ra2.x][ra2.y]=1;
RA.s=0;
red.m=0;
p=1;
}
if(m.x<(i*60)+20&&m.y<(j*60)+20&&m.x>(i*60)-20&&m.y>(j*60)-20&&changex==re2.x&&changey==re2.y)
{
board[re2.x][re2.y]=0;
RE.rule();
red.cover();
if(RE.s==1&&red.m==0&&rb==1)
{
mciSendString("play 12 from 0",NULL,0,NULL);
this->qipan();
this->update();
re2.x=i;
re2.y=j;
one.kill();
re2.display();
rb=0;
}
else
{
this->breakrule();
this->qipan();
this->update();
re2.display();
}
board[re2.x][re2.y]=1;
RE.s=0;
red.m=0;
p=1;
}
if(m.x<(i*60)+20&&m.y<(j*60)+20&&m.x>(i*60)-20&&m.y>(j*60)-20&&changex==rh2.x&&changey==rh2.y)
{
board[rh2.x][rh2.y]=0;
RH.rule();
red.cover();
if(RH.s==1&&red.m==0&&rb==1)
{
mciSendString("play 12 from 0",NULL,0,NULL);
this->qipan();
this->update();
rh2.x=i;
rh2.y=j;
one.kill();
rh2.display();
rb=0;
}
else
{
this->breakrule();
this->qipan();
this->update();
rh2.display();
}
board[rh2.x][rh2.y]=1;
RH.s=0;
red.m=0;
p=1;
}
if(m.x<(i*60)+20&&m.y<(j*60)+20&&m.x>(i*60)-20&&m.y>(j*60)-20&&changex==rc2.x&&changey==rc2.y)
{
board[rc2.x][rc2.y]=0;
RC.rule();
red.cover();
if(RC.s==1&&red.m==0&&rb==1)
{
mciSendString("play 12 from 0",NULL,0,NULL);
this->qipan();
this->update();
rc2.x=i;
rc2.y=j;
one.kill();
rc2.display();
rb=0;
}
else
{
this->breakrule();
this->qipan();
this->update();
rc2.display();
}
board[rc2.x][rc2.y]=1;
RC.s=0;
red.m=0;
p=1;
}
if(m.x<(i*60)+20&&m.y<(j*60)+20&&m.x>(i*60)-20&&m.y>(j*60)-20&&changex==rp1.x&&changey==rp1.y)
{
board[rp1.x][rp1.y]=0;
RP.rule();
red.cover();
if(RP.s==1&&red.m==0&&rb==1)
{
mciSendString("play 12 from 0",NULL,0,NULL);
this->qipan();
this->update();
rp1.x=i;
rp1.y=j;
one.kill();
rp1.display();
rb=0;
}
else
{
this->breakrule();
this->qipan();
this->update();
rp1.display();
}
board[rp1.x][rp1.y]=1;
RP.s=0;
red.m=0;
p=1;
}
if(m.x<(i*60)+20&&m.y<(j*60)+20&&m.x>(i*60)-20&&m.y>(j*60)-20&&changex==rp2.x&&changey==rp2.y)
{
board[rp2.x][rp2.y]=0;
RP.rule();
red.cover();
if(RP.s==1&&red.m==0&&rb==1)
{
mciSendString("play 12 from 0",NULL,0,NULL);
this->qipan();
this->update();
rp2.x=i;
rp2.y=j;
one.kill();
rp2.display();
rb=0;
}
else
{
this->breakrule();
this->qipan();
this->update();
rp2.display();
}
board[rp2.x][rp2.y]=1;
RP.s=0;
red.m=0;
p=1;
}
if(m.x<(i*60)+20&&m.y<(j*60)+20&&m.x>(i*60)-20&&m.y>(j*60)-20&&changex==rs1.x&&changey==rs1.y)
{
board[rs1.x][rs1.y]=0;
RS.rule();
red.cover();
if(RS.s==1&&red.m==0&&rb==1)
{
mciSendString("play 12 from 0",NULL,0,NULL);
this->qipan();
this->update();
rs1.x=i;
rs1.y=j;
one.kill();
rs1.display();
rb=0;
}
else
{
this->breakrule();
this->qipan();
this->update();
rs1.display();
}
board[rs1.x][rs1.y]=1;
RS.s=0;
red.m=0;
p=1;
}
if(m.x<(i*60)+20&&m.y<(j*60)+20&&m.x>(i*60)-20&&m.y>(j*60)-20&&changex==rs2.x&&changey==rs2.y)
{
board[rs2.x][rs2.y]=0;
RS.rule();
red.cover();
if(RS.s==1&&red.m==0&&rb==1)
{
mciSendString("play 12 from 0",NULL,0,NULL);
this->qipan();
this->update();
rs2.x=i;
rs2.y=j;
one.kill();
rs2.display();
rb=0;
}
else
{
this->breakrule();
this->qipan();
this->update();
rs2.display();
}
board[rs2.x][rs2.y]=1;
RS.s=0;
red.m=0;
p=1;
}
if(m.x<(i*60)+20&&m.y<(j*60)+20&&m.x>(i*60)-20&&m.y>(j*60)-20&&changex==rs3.x&&changey==rs3.y)
{
board[rs3.x][rs3.y]=0;
RS.rule();
red.cover();
if(RS.s==1&&red.m==0&&rb==1)
{
mciSendString("play 12 from 0",NULL,0,NULL);
this->qipan();
this->update();
rs3.x=i;
rs3.y=j;
one.kill();
rs3.display();
rb=0;
}
else
{
this->breakrule();
this->qipan();
this->update();
rs3.display();
}
board[rs3.x][rs3.y]=1;
RS.s=0;
red.m=0;
p=1;
}
if(m.x<(i*60)+20&&m.y<(j*60)+20&&m.x>(i*60)-20&&m.y>(j*60)-20&&changex==rs4.x&&changey==rs4.y)
{
board[rs4.x][rs4.y]=0;
RS.rule();
red.cover();
if(RS.s==1&&red.m==0&&rb==1)
{
mciSendString("play 12 from 0",NULL,0,NULL);
this->qipan();
this->update();
rs4.x=i;
rs4.y=j;
one.kill();
rs4.display();
rb=0;
}
else
{
this->breakrule();
this->qipan();
this->update();
rs4.display();
}
board[rs4.x][rs4.y]=1;
RS.s=0;
red.m=0;
p=1;
}
if(m.x<(i*60)+20&&m.y<(j*60)+20&&m.x>(i*60)-20&&m.y>(j*60)-20&&changex==rs5.x&&changey==rs5.y)
{
board[rs5.x][rs5.y]=0;
RS.rule();
red.cover();
if(RS.s==1&&red.m==0&&rb==1)
{
mciSendString("play 12 from 0",NULL,0,NULL);
this->qipan();
this->update();
rs5.x=i;
rs5.y=j;
one.kill();
rs5.display();
rb=0;
}
else
{
this->breakrule();
this->qipan();
this->update();
rs5.display();
}
board[rs5.x][rs5.y]=1;
RS.s=0;
red.m=0;
p=1;
}
if(m.x<(i*60)+20&&m.y<(j*60)+20&&m.x>(i*60)-20&&m.y>(j*60)-20&&changex==bc1.x&&changey==bc1.y)
{
board[bc1.x][bc1.y]=0;
BC.rule();
black.cover();
if(BC.s==1&&black.m==0&&rb==0)
{
mciSendString("play 12 from 0",NULL,0,NULL);
this->qipan();
this->update();
bc1.x=i;
bc1.y=j;
two.kill();
bc1.display();
rb=1;
}
else
{
this->breakrule();
this->qipan();
this->update();
bc1.display();
}
board[bc1.x][bc1.y]=1;
black.m=0;
BC.s=0;
p=1;
}
if(m.x<(i*60)+20&&m.y<(j*60)+20&&m.x>(i*60)-20&&m.y>(j*60)-20&&changex==bh1.x&&changey==bh1.y)
{
board[bh1.x][bh1.y]=0;
BH.rule();
black.cover();
if(BH.s==1&&black.m==0&&rb==0)
{
mciSendString("play 12 from 0",NULL,0,NULL);
this->qipan();
this->update();
bh1.x=i;
bh1.y=j;
two.kill();
bh1.display();
rb=1;
}
else
{
this->breakrule();
this->qipan();
this->update();
bh1.display();
}
board[bh1.x][bh1.y]=1;
black.m=0;
BH.s=0;
p=1;
}
if(m.x<(i*60)+20&&m.y<(j*60)+20&&m.x>(i*60)-20&&m.y>(j*60)-20&&changex==be1.x&&changey==be1.y)
{
board[be1.x][be1.y]=0;
BE.rule();
black.cover();
if(BE.s==1&&black.m==0&&rb==0)
{
mciSendString("play 12 from 0",NULL,0,NULL);
this->qipan();
this->update();
be1.x=i;
be1.y=j;
two.kill();
be1.display();
rb=1;
}
else
{
this->breakrule();
this->qipan();
this->update();
be1.display();
}
board[be1.x][be1.y]=1;
black.m=0;
BE.s=0;
p=1;
}
if(m.x<(i*60)+20&&m.y<(j*60)+20&&m.x>(i*60)-20&&m.y>(j*60)-20&&changex==ba1.x&&changey==ba1.y)
{
board[ba1.x][ba1.y]=0;
BA.rule();
black.cover();
if(BA.s==1&&black.m==0&&rb==0)
{
mciSendString("play 12 from 0",NULL,0,NULL);
this->qipan();
this->update();
ba1.x=i;
ba1.y=j;
two.kill();
ba1.display();
rb=1;
}
else
{
this->breakrule();
this->qipan();
this->update();
ba1.display();
}
board[ba1.x][ba1.y]=1;
black.m=0;
BA.s=0;
p=1;
}
if(m.x<(i*60)+20&&m.y<(j*60)+20&&m.x>(i*60)-20&&m.y>(j*60)-20&&changex==bk.x&&changey==bk.y)
{
board[bk.x][bk.y]=0;
BK.rule();
black.cover();
if(BK.s==1&&black.m==0&&rb==0)
{
mciSendString("play 12 from 0",NULL,0,NULL);
this->qipan();
this->update();
bk.x=i;
bk.y=j;
two.kill();
bk.display();
rb=1;
}
else
{
this->breakrule();
this->qipan();
this->update();
bk.display();
}
board[bk.x][bk.y]=1;
black.m=0;
BK.s=0;
p=1;
}
if(m.x<(i*60)+20&&m.y<(j*60)+20&&m.x>(i*60)-20&&m.y>(j*60)-20&&changex==ba2.x&&changey==ba2.y)
{
board[ba2.x][ba2.y]=0;
BA.rule();
black.cover();
if(BA.s==1&&black.m==0&&rb==0)
{
mciSendString("play 12 from 0",NULL,0,NULL);
this->qipan();
this->update();
ba2.x=i;
ba2.y=j;
two.kill();
ba2.display();
rb=1;
}
else
{
this->breakrule();
this->qipan();
this->update();
ba2.display();
}
board[ba2.x][ba2.y]=1;
black.m=0;
BA.s=0;
p=1;
}
if(m.x<(i*60)+20&&m.y<(j*60)+20&&m.x>(i*60)-20&&m.y>(j*60)-20&&changex==be2.x&&changey==be2.y)
{
board[be2.x][be2.y]=0;
BE.rule();
black.cover();
if(BE.s==1&&black.m==0&&rb==0)
{
mciSendString("play 12 from 0",NULL,0,NULL);
this->qipan();
this->update();
be2.x=i;
be2.y=j;
two.kill();
be2.display();
rb=1;
}
else
{
this->breakrule();
this->qipan();
this->update();
be2.display();
}
board[be2.x][be2.y]=1;
black.m=0;
BE.s=0;
p=1;
}
if(m.x<(i*60)+20&&m.y<(j*60)+20&&m.x>(i*60)-20&&m.y>(j*60)-20&&changex==bh2.x&&changey==bh2.y)
{
board[bh2.x][bh2.y]=0;
BH.rule();
black.cover();
if(BH.s==1&&black.m==0&&rb==0)
{
mciSendString("play 12 from 0",NULL,0,NULL);
this->qipan();
this->update();
bh2.x=i;
bh2.y=j;
two.kill();
bh2.display();
rb=1;
}
else
{
this->breakrule();
this->qipan();
this->update();
bh2.display();
}
board[bh2.x][bh2.y]=1;
black.m=0;
BH.s=0;
p=1;
}
if(m.x<(i*60)+20&&m.y<(j*60)+20&&m.x>(i*60)-20&&m.y>(j*60)-20&&changex==bc2.x&&changey==bc2.y)
{
board[bc2.x][bc2.y]=0;
BC.rule();
black.cover();
if(BC.s==1&&black.m==0&&rb==0)
{
mciSendString("play 12 from 0",NULL,0,NULL);
this->qipan();
this->update();
bc2.x=i;
bc2.y=j;
two.kill();
bc2.display();
rb=1;
}
else
{
this->breakrule();
this->qipan();
this->update();
bc2.display();
}
board[bc2.x][bc2.y]=1;
black.m=0;
BC.s=0;
p=1;
}
if(m.x<(i*60)+20&&m.y<(j*60)+20&&m.x>(i*60)-20&&m.y>(j*60)-20&&changex==bp1.x&&changey==bp1.y)
{
board[bp1.x][bp1.y]=0;
BP.rule();
black.cover();
if(BP.s==1&&black.m==0&&rb==0)
{
mciSendString("play 12 from 0",NULL,0,NULL);
this->qipan();
this->update();
bp1.x=i;
bp1.y=j;
two.kill();
bp1.display();
rb=1;
}
else
{
this->breakrule();
this->qipan();
this->update();
bp1.display();
}
board[bp1.x][bp1.y]=1;
black.m=0;
BP.s=0;
p=1;
}
if(m.x<(i*60)+20&&m.y<(j*60)+20&&m.x>(i*60)-20&&m.y>(j*60)-20&&changex==bp2.x&&changey==bp2.y)
{
board[bp2.x][bp2.y]=0;
BP.rule();
black.cover();
if(BP.s==1&&black.m==0&&rb==0)
{
mciSendString("play 12 from 0",NULL,0,NULL);
this->qipan();
this->update();
bp2.x=i;
bp2.y=j;
two.kill();
bp2.display();
rb=1;
}
else
{
this->breakrule();
this->qipan();
this->update();
bp2.display();
}
board[bp2.x][bp2.y]=1;
black.m=0;
BP.s=0;
p=1;
}
if(m.x<(i*60)+20&&m.y<(j*60)+20&&m.x>(i*60)-20&&m.y>(j*60)-20&&changex==bs1.x&&changey==bs1.y)
{
board[bs1.x][bs1.y]=0;
BS.rule();
black.cover();
if(BS.s==1&&black.m==0&&rb==0)
{
mciSendString("play 12 from 0",NULL,0,NULL);
this->qipan();
this->update();
bs1.x=i;
bs1.y=j;
two.kill();
bs1.display();
rb=1;
}
else
{
this->breakrule();
this->qipan();
this->update();
bs1.display();
}
board[bs1.x][bs1.y]=1;
black.m=0;
BS.s=0;
p=1;
}
if(m.x<(i*60)+20&&m.y<(j*60)+20&&m.x>(i*60)-20&&m.y>(j*60)-20&&changex==bs2.x&&changey==bs2.y)
{
board[bs2.x][bs2.y]=0;
BS.rule();
black.cover();
if(BS.s==1&&black.m==0&&rb==0)
{
mciSendString("play 12 from 0",NULL,0,NULL);
this->qipan();
this->update();
bs2.x=i;
bs2.y=j;
two.kill();
bs2.display();
rb=1;
}
else
{
this->breakrule();
this->qipan();
this->update();
bs2.display();
}
board[bs2.x][bs2.y]=1;
black.m=0;
BS.s=0;
p=1;
}
if(m.x<(i*60)+20&&m.y<(j*60)+20&&m.x>(i*60)-20&&m.y>(j*60)-20&&changex==bs3.x&&changey==bs3.y)
{
board[bs3.x][bs3.y]=0;
BS.rule();
black.cover();
if(BS.s==1&&black.m==0&&rb==0)
{
mciSendString("play 12 from 0",NULL,0,NULL);
this->qipan();
this->update();
bs3.x=i;
bs3.y=j;
two.kill();
bs3.display();
rb=1;
}
else
{
this->breakrule();
this->qipan();
this->update();
bs3.display();
}
board[bs3.x][bs3.y]=1;
black.m=0;
BS.s=0;
p=1;
}
if(m.x<(i*60)+20&&m.y<(j*60)+20&&m.x>(i*60)-20&&m.y>(j*60)-20&&changex==bs4.x&&changey==bs4.y)
{
board[bs4.x][bs4.y]=0;
BS.rule();
black.cover();
if(BS.s==1&&black.m==0&&rb==0)
{
mciSendString("play 12 from 0",NULL,0,NULL);
this->qipan();
this->update();
bs4.x=i;
bs4.y=j;
two.kill();
bs4.display();
rb=1;
}
else
{
this->breakrule();
this->qipan();
this->update();
bs4.display();
}
board[bs4.x][bs4.y]=1;
black.m=0;
BS.s=0;
p=1;
}
if(m.x<(i*60)+20&&m.y<(j*60)+20&&m.x>(i*60)-20&&m.y>(j*60)-20&&changex==bs5.x&&changey==bs5.y)
{
board[bs5.x][bs5.y]=0;
BS.rule();
black.cover();
if(BS.s==1&&black.m==0&&rb==0)
{
mciSendString("play 12 from 0",NULL,0,NULL);
this->qipan();
this->update();
bs5.x=i;
bs5.y=j;
two.kill();
bs5.display();
rb=1;
}
else
{
this->breakrule();
this->qipan();
this->update();
bs5.display();
}
board[bs5.x][bs5.y]=1;
black.m=0;
BS.s=0;
p=1;
}
if(m.x<(i*60)+20&&m.y<(j*60)+20&&m.x>(i*60)-20&&m.y>(j*60)-20&&board[changex][changey]==0)
{
this->qipan();
this->update();
p=1;
}
this->victory();
}
}
}
}
}
}
}
void Play::qipan() //棋盘线条
{
loadimage(NULL,"2.jpg",640,660);
setlinecolor(BLACK);
setlinestyle(PS_SOLID | PS_JOIN_BEVEL, 2);
int i;
for (i = 1; i <= 10; i++)
line(60, 60 * i, 540, 60 * i); //横向x轴 //纵向y轴
for (i = 2; i < 10; i++)
line(60 * i, 60, 60 * i, 300);
for (i = 2; i < 9; i++)
line(60 * i, 360, 60 * i, 600);
line(60, 60, 60, 600);
line(540, 60, 540, 600);
line(240, 60, 360, 180);
line(360, 60, 240, 180);
line(240, 600, 360, 480);
line(360, 600, 240, 480);
for(i=0;i<6;i++)
{
line(160+60*i,236,176+60*i,236);
line(160+60*i,244,176+60*i,244);
line(184+60*i,236,200+60*i,236);
line(184+60*i,244,200+60*i,244);
line(176+60*i,220,176+60*i,236);
line(184+60*i,220,184+60*i,236);
line(176+60*i,244,176+60*i,260);
line(184+60*i,244,184+60*i,260);
i++;
}
for(i=0;i<6;i++)
{
line(160+60*i,236+180,176+60*i,236+180);
line(160+60*i,244+180,176+60*i,244+180);
line(184+60*i,236+180,200+60*i,236+180);
line(184+60*i,244+180,200+60*i,244+180);
line(176+60*i,220+180,176+60*i,236+180);
line(184+60*i,220+180,184+60*i,236+180);
line(176+60*i,244+180,176+60*i,260+180);
line(184+60*i,244+180,184+60*i,260+180);
i++;
}
line(184-120,236+180,200-120,236+180);
line(184-120,244+180,200-120,244+180);
line(184-120,220+180,184-120,236+180);
line(184-120,244+180,184-120,260+180);
line(184-120,236,200-120,236);
line(184-120,244,200-120,244);
line(184-120,220,184-120,236);
line(184-120,244,184-120,260);
line(184-120+540-24-60,236+180,200-120+540-24-60,236+180);
line(184-120+540-24-60,244+180,200-120+540-24-60,244+180);
line(184-120+540-8-60,220+180,184-120+540-8-60,236+180 );
line(184-120+540-8-60,244+180,184-120+540-8-60,260+180 );
line(184-120+540-24-60,236,200-120+540-24-60,236);
line(184-120+540-24-60,244,200-120+540-24-60,244);
line(184-120+540-8-60,220,184-120+540-8-60,236);
line(184-120+540-8-60,244,184-120+540-8-60,260);
i=-1;
line(160+60*i,236+60*i,176+60*i,236+60*i);
line(160+60*i,244+60*i,176+60*i,244+60*i);
line(184+60*i,236+60*i,200+60*i,236+60*i);
line(184+60*i,244+60*i,200+60*i,244+60*i);
line(176+60*i,220+60*i,176+60*i,236+60*i);
line(184+60*i,220+60*i,184+60*i,236+60*i);
line(176+60*i,244+60*i,176+60*i,260+60*i);
line(184+60*i,244+60*i,184+60*i,260+60*i);
line(160+60*i,236+180+60,176+60*i,236+180+60);
line(160+60*i,244+180+60,176+60*i,244+180+60);
line(184+60*i,236+180+60,200+60*i,236+180+60);
line(184+60*i,244+180+60,200+60*i,244+180+60);
line(176+60*i,220+180+60,176+60*i,236+180+60);
line(184+60*i,220+180+60,184+60*i,236+180+60);
line(176+60*i,244+180+60,176+60*i,260+180+60);
line(184+60*i,244+180+60,184+60*i,260+180+60);
line(160+60*i+360,236+60*i,176+60*i+360,236+60*i);
line(160+60*i+360,244+60*i,176+60*i+360,244+60*i);
line(184+60*i+360,236+60*i,200+60*i+360,236+60*i);
line(184+60*i+360,244+60*i,200+60*i+360,244+60*i);
line(176+60*i+360,220+60*i,176+60*i+360,236+60*i);
line(184+60*i+360,220+60*i,184+60*i+360,236+60*i);
line(176+60*i+360,244+60*i,176+60*i+360,260+60*i);
line(184+60*i+360,244+60*i,184+60*i+360,260+60*i);
line(160+60*i+360,236+180+60,176+60*i+360,236+180+60);
line(160+60*i+360,244+180+60,176+60*i+360,244+180+60);
line(184+60*i+360,236+180+60,200+60*i+360,236+180+60);
line(184+60*i+360,244+180+60,200+60*i+360,244+180+60);
line(176+60*i+360,220+180+60,176+60*i+360,236+180+60);
line(184+60*i+360,220+180+60,184+60*i+360,236+180+60);
line(176+60*i+360,244+180+60,176+60*i+360,260+180+60);
line(184+60*i+360,244+180+60,184+60*i+360,260+180+60);
setlinestyle(PS_SOLID | PS_JOIN_BEVEL, 3);
line(56, 56, 56, 604);
line(56, 56, 544, 56);
line(544, 56, 544, 604);
line(56, 604, 544, 604);
setbkmode(TRANSPARENT);
settextcolor(BLACK);
setlinestyle(PS_SOLID |PS_JOIN_ROUND, 4);
settextstyle(36, 0, _T("黑体"));
outtextxy(380, 310, "汉 界");
settextcolor(RED);
outtextxy(110, 310, "楚 河");
}
void Play::help() //游戏帮助函数
{
setbkcolor(RGB(64,0,64));
cleardevice();
settextcolor(RGB(249,191,100));
setlinestyle(PS_SOLID |PS_JOIN_ROUND, 3);
settextstyle(50, 0, _T("方正舒体"));
outtextxy(180,50,"象棋游戏规则");
settextcolor(RGB(249,191,100));
setlinestyle(PS_SOLID |PS_JOIN_ROUND, 2);
settextstyle(23, 0, _T("方正舒体"));
outtextxy(70,120,"1.如果红方帅被吃掉,则判断黑方获胜");
outtextxy(70,150,"2.如果黑方将被吃掉,则判断红方获胜");
outtextxy(70,180,"3.帅棋和将棋只能在规定的田字格内上下左右活动");
outtextxy(70,210,"4.士棋只能在田字格内沿着对角线活动");
outtextxy(70,240,"5.象棋不能过河,且只能沿着田字活动");
outtextxy(70,270,"6.马棋只能沿着日字活动");
outtextxy(70,300,"7.车棋能横行和竖行,但前方不能有棋子挡着");
outtextxy(70,330,"8.炮棋能隔着一个棋子攻击对方棋子");
outtextxy(70,360,"9.兵棋没有过河前只能一格一格前进");
outtextxy(70,390,"10.兵棋过河后能够左右摆动,但是不能后退");
outtextxy(70,420,"11.如果填住了象眼,则象棋不能落子");
outtextxy(70,450,"12.如果马棋被拐住了,则不能落子");
settextstyle(32, 0, _T("方正舒体"));
outtextxy(240,600,"返回菜单");
MOUSEMSG h;
while(true)
{
h=GetMouseMsg();
if(h.x<360&&h.x>240&&h.y>600&&h.y<640)
{
if(h.uMsg==WM_LBUTTONDOWN)
{
this->startgraph();
}
}
}
}
void Play::startgraph() //开始界面
{
loadimage(NULL,"3.jpg",640,660);
setbkmode(TRANSPARENT);
settextcolor(RGB(249,192,101));
setlinestyle(PS_SOLID |PS_JOIN_ROUND, 3);
settextstyle(75, 0, _T("方正舒体"));
outtextxy(180, 80, "中国象棋");
settextcolor(RGB(255,0,,0));
setlinestyle(PS_SOLID |PS_JOIN_ROUND, 2);
setfillcolor(RGB(64,0,64));
solidrectangle(230, 300, 430, 350);
solidrectangle(230, 380, 430, 430);
solidrectangle(230, 460, 430, 510);
setlinecolor(RED);
rectangle(225, 295, 435, 355);
rectangle(225, 375, 435, 435);
rectangle(225, 455, 435, 515);
settextstyle(32,0,"黑体");
setbkmode(TRANSPARENT);
outtextxy(250, 310, "1.人人对战");
outtextxy(250, 390, "2.游戏帮助");
outtextxy(250, 470, "3.退出游戏");
mciSendString("stop bk",NULL,0,NULL);
MOUSEMSG s;
while(true)
{
s= GetMouseMsg();
if(s.x >= 250 && s.x <= 430 && s.y >= 300 && s.y <= 350)
{
if(s.uMsg==WM_LBUTTONDOWN )
{
mciSendString( "open ./music/bk.mp3 alias bk", 0, 0, 0 );
mciSendString("play bk repeat",NULL,0,NULL);
mciSendString( "open ./music/12.mp3 alias 12", 0, 0, 0 );
this->qipan();
this->chushihua();
this->show();
this->chess();
}
}
if(s.x >= 250 && s.x <= 430 && s.y >= 380 && s.y <= 430)
{
if(s.uMsg==WM_LBUTTONDOWN)
{
this->help();
}
}
if(s.x >= 250 && s.x <= 430 && s.y >= 460 && s.y <= 510)
{
if(s.uMsg==WM_LBUTTONDOWN)
{
closegraph();
}
}
}
}
void Play::breakrule() //输出落子不符合规则
{
setlinecolor(RGB(249,210,100));
setfillcolor(RGB(249,210,100));
fillrectangle(160, 310, 400, 340);
settextstyle(20,0,"方正舒体");
settextcolor(RGB(249,0,0));
setbkmode(TRANSPARENT);
outtextxy(175,315, "不符合规则,请重新落子");
}
void Play::victory()//判断输赢函数
{
if(bk.kill==1)
{
setlinecolor(RGB(64,64,255));
setfillcolor(RGB(64,64,255));
fillrectangle(200, 290, 400, 370);
settextstyle(40,0,"方正舒体");
settextcolor(RGB(249,0,0));
setbkmode(TRANSPARENT);
outtextxy(220,310, "红方获胜");
getch();
cleardevice();
this->startgraph();
}
if(rk.kill==1)
{
setlinecolor(RGB(64,64,255));
setfillcolor(RGB(64,64,255));
fillrectangle(200, 290, 400, 370);
settextstyle(40,0,"方正舒体");
settextcolor(RGB(255,240,240));
setbkmode(TRANSPARENT);
outtextxy(220,310, "黑方获胜");
getch();
cleardevice();
this->startgraph();
}
}
void main()
{
initgraph(640,660);
cleardevice();
Play pt;
pt.startgraph();
}
/*程序的优化
1.可以利用数组指针来初始化棋子对象,再通过数组指针来调用显示函数,
大大的节省内存空间。
2.还没有判断将军的形势,不能判断王棋是否进入到其他棋子的攻击范围之内
3.悔棋时,目前只能存储上一步的棋子坐标
*/
|
1534ebf93de2c24430056f9599c7777ccd55ea7a | 57e7d44e27b463f153c3cc0a63c4ffb2bc7109e6 | /core/Hardware.h | a8ec9dc8aed06f31a0125a69ac1eaaa8ebf01fe3 | [] | no_license | slagyr/sk8bms | 039b99689cd7bf820519488f3f41e3c69e9d4586 | 03e2ab166648cc9bf75aea9abac597c643e89e20 | refs/heads/master | 2020-04-01T07:28:12.745342 | 2019-02-22T21:46:08 | 2019-02-22T21:46:08 | 152,991,233 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 816 | h | Hardware.h | #ifndef HARDWARE_H
#define HARDWARE_H
#include "common.h"
class Hardware {
public:
virtual void pinToInput(byte pin) = 0;
virtual void pinToOutput(byte pin) = 0;
virtual int readDigitalPin(byte pin) = 0;
virtual int readAnalogPin(byte pin) = 0;
virtual unsigned long getMillis() = 0;
virtual void setPinHigh(byte pin) = 0;
virtual void setPinLow(byte pin) = 0;
virtual void playNote(byte pin, unsigned int frequency, unsigned long duration) = 0;
virtual void sleep(unsigned long duration) = 0;
virtual void print(const char *value) = 0;
virtual void print(int value) = 0;
virtual void print(float value) = 0;
void println(const char *value);
void println(int value);
void println(float value);
void printValue(char* label, int value);
};
#endif
|
213df67775283ad36f9fbd92fc8a9a999ea047a1 | 604336927fa76c9e1cf6b910235db948fbc0af8a | /samples/penalized_gd_solver.cpp | 524ae763e6db36ed93429b589c6e5f00df528f7f | [
"MIT"
] | permissive | hrishikeshkhade/solvers | 32b308e39734bdfa5bfca39672a74cdb9400c43b | 05c44762aae43268fa965104c19ba86c4284c549 | refs/heads/master | 2023-03-15T18:42:20.884773 | 2019-12-29T12:38:49 | 2019-12-29T12:38:49 | null | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 768 | cpp | penalized_gd_solver.cpp | #include "utils/data_generator.cpp"
#include "../src/numerical/gradient_descent/penalized_gd_solver.h"
#include "../src/logging/easylogging++.h"
#include <armadillo>
using arma::mat;
INITIALIZE_EASYLOGGINGPP
mat WEIGHTS = {100, -20, 50, -0.5};
int main(int argc, char *argv[])
{
el::Configurations conf("./logging-config.conf");
el::Loggers::reconfigureLogger("default", conf);
auto data_generator = DataGenerator();
auto L = data_generator.generate_library();
auto s = data_generator.generate_signal(WEIGHTS);
LOG(INFO) << "True: " << WEIGHTS;
PenalizedGDSolver solver = PenalizedGDSolver(L, 100, 500, 0.0000000001, 1000000);
mat result = solver.solve(s);
LOG(INFO) << "Penalized GD solver fit: " << result;
return 0;
} |
b0a842d03073943cd6f1f0c6b8ab9195ce114279 | 56f1a6eb6436dc61305dbc38b94d84324592448e | /src/rain-library-4/network-utility.cpp | 783070242da3be5618e9fe6705320142d9d76ea5 | [] | no_license | GilgameshxZero/tab-space | 971e2ce0fa9313b3c16024a03a601bc58e74df93 | 35788631e6bd3da7c03388e265f5c1f700c0ec93 | refs/heads/master | 2020-12-14T16:30:27.920928 | 2020-01-30T04:51:35 | 2020-01-30T04:51:35 | 234,807,317 | 2 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 3,008 | cpp | network-utility.cpp | #include "network-utility.h"
namespace Rain {
bool WSAStarted() {
SOCKET s = socket(AF_INET, SOCK_STREAM, IPPROTO_TCP);
if (s == INVALID_SOCKET && WSAGetLastError() == WSANOTINITIALISED) {
return false;
}
closesocket(s);
return true;
}
std::string getClientNumIP(SOCKET &clientSock) {
static struct sockaddr clname;
static int clnamesize;
static CHAR clhname[32];
clnamesize = sizeof(clname);
getpeername(clientSock, &clname, &clnamesize);
getnameinfo(&clname, clnamesize, clhname, 32, NULL, NULL, NI_NUMERICHOST);
return std::string(clhname);
}
void sendBlockMessage(Rain::SocketManager &manager, std::string message) {
Rain::sendBlockMessage(manager, &message);
}
void sendBlockMessage(Rain::SocketManager &manager, std::string *message) {
manager.sendRawMessage(Rain::tToStr(message->length()) + " ");
manager.sendRawMessage(message);
}
std::string mapToHTTPHeader(std::map<std::string, std::string> &hMap) {
std::string message;
for (auto it = hMap.begin(); it != hMap.end(); it++)
message += it->first + ": " + it->second + "\n";
return message + "\n";
}
std::string mapToHTTPHeader(std::unordered_map<std::string, std::string> &hMap) {
std::string message;
for (auto it = hMap.begin(); it != hMap.end(); it++)
message += it->first + ": " + it->second + "\n";
return message + "\n";
}
RainWindow *createSendHandler(std::unordered_map<UINT, RainWindow::MSGFC> *msgm) {
RainWindow *rw = new RainWindow();
rw->create(msgm, NULL, NULL, 0, 0, GetModuleHandle(NULL), NULL, NULL, NULL, _T(""), NULL, NULL, _T(""), WS_POPUP, 0, 0, 0, 0, NULL, NULL, RainWindow::NULLCLASSNAME);
return rw;
}
std::map<std::string, std::string> getQueryToMap(std::string query) {
std::size_t start, end;
std::vector<std::string> lines;
start = 0;
end = query.find('&');
while (end != std::string::npos) {
lines.push_back(query.substr(start, end - start));
start = end + 1;
end = query.find('&', start);
}
lines.push_back(query.substr(start, end));
std::map<std::string, std::string> rt;
for (std::size_t a = 0; a < lines.size(); a++) {
std::size_t equals = lines[a].find('=');
rt.insert(std::make_pair(strDecodeURL(lines[a].substr(0, equals)), strDecodeURL(lines[a].substr(equals + 1, lines[a].length()))));
}
return rt;
}
void sendHeadedMessage(Rain::SocketManager &manager, std::string message) {
sendHeadedMessage(manager, &message);
}
void sendHeadedMessage(Rain::SocketManager &manager, std::string *message) {
std::size_t len = message->length();
std::string header;
if (len < 256 * 256) {
//only need 2-byte header
header.push_back((len >> 8) & 0xff);
header.push_back(len & 0xff);
} else {
header.push_back('\0');
header.push_back('\0');
header.push_back((len >> 24) & 0xff);
header.push_back((len >> 16) & 0xff);
header.push_back((len >> 8) & 0xff);
header.push_back(len & 0xff);
}
manager.sendRawMessage(&header);
manager.sendRawMessage(message);
}
} |
b014239c1f8ea05a40d629fa01766b5923cb0cc9 | 63ab1f6373b80ad833490683584a80d00c29278d | /core/simulation/core/streamcallback.h | 1769e6e592c007837ede069d8e3544a39737055e | [] | no_license | copton/lethe | 811986784571a65e1a02100f3bc0c304535ca0ff | 5d18a99a3932a3ecbe59dade8c67cb93f6fcd2ba | refs/heads/master | 2020-05-16T18:01:51.670153 | 2012-08-22T12:33:20 | 2012-08-22T12:33:20 | null | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 1,292 | h | streamcallback.h | #ifndef __CORE__STREAMCALLBACK_H
#define __CORE__STREAMCALLBACK_H
#include "streamcache.h"
namespace Core {
class Reference {
public:
Reference() : _counter(1) { }
bool isZero() { return _counter == 0; }
void inc() { _counter++; }
void dec() { _counter--; assert(_counter >= 0); }
private:
int _counter;
};
class StreamCallback {
public:
StreamCallback(int id, size_t count, StreamCache* cache) :
_id(id), _count(count), _cache(cache), _ref(new Reference())
{ }
StreamCallback(const StreamCallback& callback) :
_id(callback._id), _count(callback._count), _cache(callback._cache), _ref(callback._ref)
{
_ref->inc();
}
~StreamCallback()
{
_ref->dec();
if (_ref->isZero()) {
if (_id == -1) {
_cache->increaseWritePointer(_count);
} else {
_cache->increaseReadPointer(_id, _count);
}
delete _ref;
}
}
private:
void operator=(const StreamCallback& callback) { }
int _id;
size_t _count;
StreamCache* _cache;
Reference* _ref;
};
}
#endif
|
aaf011749db6ee856964c20267189adf769edb4e | 14a238d6285ac124be77ba3aa02b1899ae641e72 | /src/Sphere.h | f8bbb492b225b8ce3df2dc21ad4286f5faeef527 | [] | no_license | yuzepe/proj | cde7407fcd3b1602b7b805805fd7c632360b3c08 | ee4141a4921d291ade15f261bead5fd3dc8ec8fe | refs/heads/master | 2020-04-04T06:43:08.142693 | 2014-04-12T13:18:37 | 2014-04-12T13:18:37 | null | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 709 | h | Sphere.h | /*
* Sphere.h
*
* @author Joseph Zehe
*
*/
#ifndef SPHERE_H
#define SPHERE_H
#include <sstream>
#include <string>
#include "Shape.h"
using namespace std;
class Sphere : public Shape
{
public:
inline Sphere(float radius = 10) : m_radius(radius) {};
inline Sphere(int radius) : Sphere(static_cast<float>(radius)) {};
~Sphere();
inline string toRawString() { ostringstream ostr; ostr << "sphere " << m_radius; return ostr.str(); };
inline string toString() { ostringstream ostr; ostr << "Sphere(r" << m_radius << " cm)"; return ostr.str(); };
inline float getVolume() { return 4.0f * M_PI * pow(m_radius, 3) / 3.0f; }; // Kubikzentimeter cm³
private:
float m_radius; // Zentimeter
};
#endif
|
1a74fedd9ddee71013b0f1482429d7421b6045e7 | bacb98f977ff5908eb3ed36a4aa46c9ffcd1311c | /eu0162.h | c3860d208cc74aaadff7bce2fe63e69555cae33d | [] | no_license | nrey/eulerOld | c0f5177bc9a3df4e1118670af166ea0bc2b001ab | a83e7d5dcae0cb56e930c100f7cb1f9cb864c07b | refs/heads/master | 2021-01-22T12:07:33.608340 | 2012-09-28T06:08:57 | 2012-09-28T06:08:57 | null | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 175 | h | eu0162.h | #ifndef eu0162_h
#define eu0162_h
#include"euler.h"
class eu0162 : public euler{
public:
eu0162(){};
~eu0162(){};
void solucion();
void printsolution();
};
#endif |
b5f42a165bf44aea5cfc8b77b3bb752e95f1f472 | 2eba4d9c89f41f978c01b2e05ec1bdc9a61cd179 | /Src/Terrain3D/Core/ShaderProgram.cpp | 17b0e50a0c1a6a2a14f182c6e8a34a49499970c8 | [
"MIT"
] | permissive | fHachenberg/Terrain3D | e58eeb7ecc285575e8bc90cdb16a2416d9e1b5bb | 9659fca4d11ddfb57834cb851b578d957bae0417 | refs/heads/master | 2021-01-18T04:40:08.470828 | 2016-02-18T03:30:41 | 2016-02-18T03:30:41 | 60,901,679 | 0 | 1 | null | 2016-06-11T10:14:44 | 2016-06-11T10:14:44 | null | UTF-8 | C++ | false | false | 2,866 | cpp | ShaderProgram.cpp | //==================================================================================================================|
// Created 2015.03.17 by Daniel L. Watkins
//
// Copyright (C) 2014-2015 Daniel L. Watkins
// This file is licensed under the MIT License.
//==================================================================================================================|
#include "ShaderProgram.h"
namespace t3d { namespace core {
void ShaderProgram::init()
{
initializeOpenGLFunctions();
loadShaders();
}
void ShaderProgram::addShader(const QString &filename, QOpenGLShader::ShaderType shaderType)
{
QOpenGLShader *shader = new QOpenGLShader(shaderType, mProgram.get());
if (!shader->compileSourceFile(gDefaultPathShaders + filename))
qDebug() << "Error compiling shader " << filename << " of type " << static_cast<int>(shaderType);
if (!mProgram->addShader(shader))
qDebug() << "Error adding shader " << filename << " of type " << static_cast<int>(shaderType);
}
void ShaderProgram::loadShaders()
{
mProgram = makeUnique<QOpenGLShaderProgram>();
addShaders();
if (mProgram->link() == false)
qFatal("Problem linking shaders");
else
qDebug() << "Initialized shaders";
mProgram->bind();
queryUniformLocations();
refreshUniformValues();
flushQueuedUniformValueChanges();
mProgram->release();
}
bool ShaderProgram::bind()
{
if (!mProgram->bind())
{
System::warning("Unable to bind OpenGL ShaderProgram");
return false;
}
flushQueuedUniformValueChanges();
return true;
}
void ShaderProgram::reloadShaders()
{
loadShaders();
}
void ShaderProgram::enqueueUniformValueChange(const GLint *uniformLocation, QVariant value)
{
if (mProgram && mProgram->isLinked())
{
mProgram->bind();
setUniformFromQVariant(*uniformLocation, value);
mProgram->release(); //TODO this can cause issues if used while the program was bound externally
}
else
mQueuedUniformValueChanges.append(QPair<const GLint*, QVariant>(uniformLocation, value));
}
void ShaderProgram::setUniformFromQVariant(GLint location, QVariant &value)
{
switch (static_cast<QMetaType::Type>(value.type()))
{
case QMetaType::Int:
mProgram->setUniformValue(location, static_cast<GLint>(value.toInt())); break;
case QMetaType::Double:
mProgram->setUniformValue(location, static_cast<GLfloat>(value.toDouble())); break;
case QMetaType::Float:
mProgram->setUniformValue(location, static_cast<GLfloat>(value.toFloat())); break;
default:
qFatal("Trying to set a queued shader uniform value for an unknown type");
//TODO this is all we support. Eventuall QOpenGLShaderProgram should support
//setUniformValue directly from a QVariant.
}
}
void ShaderProgram::flushQueuedUniformValueChanges()
{
for (auto pair : mQueuedUniformValueChanges)
{
setUniformFromQVariant(*pair.first, pair.second);
}
mQueuedUniformValueChanges.clear();
}
}}
|
5b37748212bb284bca5f210e2eabe2c964394445 | c16097e4cf266668a4b69f85ff900b369a80ac99 | /sources/gui/src/dirscanwidget.h | bdb43973fdd939893f7731730c7a657aad509498 | [] | no_license | superactive/meduzzza | 63f6487d1f40d53e04c6df15cf83649c5e5df4e8 | e856e2ddb0c83e8fe16827eff652ba35ac17ca43 | refs/heads/master | 2021-01-14T09:49:58.736263 | 2014-11-14T11:02:07 | 2014-11-14T11:02:07 | null | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 2,724 | h | dirscanwidget.h |
/*
* Copyright (C) 2013 Andrey Dudakov
*
* Authors: Andrey "amd00" Dudakov
*
* This file is part of meduzzza-gui.
*
* meduzzza-gui 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.
*
* meduzzza-gui 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 meduzzza-gui. If not, see <http://www.gnu.org/licenses/>.
*/
#ifndef _DIRSCANWIDGET_H_
#define _DIRSCANWIDGET_H_
#include "meduzzzacommonwidget.h"
namespace Ui
{
class DirScanWidget;
}
namespace Meduzzza
{
class MeduzzzaScanModel;
class DirScanWidget : public MeduzzzaCommonWidget
{
Q_OBJECT
private:
Ui::DirScanWidget *m_ui;
MeduzzzaScanModel *m_mod;
public:
DirScanWidget(MainWindow *_med);
~DirScanWidget();
QString text() const { return tr("Directory scan"); }
private:
void fileScanStarted(const QString &_file);
void fileScanCompleted(const QString &_file);
void fileVirusDetected(const QString &_file, const QString &_virname);
void procScanStarted(const QString &_name, Q_PID _pid) {}
void procScanCompleted(const QString &_name, Q_PID _pid) {}
void procVirusDetected(const QString &_name, Q_PID _pid, const QString &_virname) {}
void procScanError(const QString &_name, Q_PID _pid, const QString &_error) {}
void dirScanStarted(const QString &_dir);
void dirScanCompleted(const QString &_dir);
void memScanStarted();
void memScanCompleted();
void fullScanStarted(const QDateTime &_time);
void fullScanCompleted(const QDateTime &_time);
void stopped();
void paused();
void resumed();
void filesFound(quint64 _count);
void procsFound(quint64 _count) {}
void updateStarted(bool _is_full, const QDateTime &_start_time) {}
void updateCompleted(const QDateTime &_start_time, const QDateTime &_end_time) {}
void fileDownloadStarted(const QString &_file, const QDateTime &_start_time) {}
void fileDownloadCompleted(const QString &_file, const QDateTime &_start_time, const QDateTime &_end_time) {}
void fileDownloadProgress(const QString &_file, quint64 _read, quint64 _total) {}
void sigLoadStarted() {}
void sigLoadCompleted(qint32 _count) {}
void sigLoadError() {}
protected Q_SLOTS:
void dirClickedSlot();
void startClickedSlot();
void stopClickedSlot();
};
}
#endif
|
b561d4b2c297e2b4181225a22d0942d24e0ce463 | 4a8318fb3775476b3cb849ef32426ced6bbb86e5 | /cc/063.cc | d87bc28384b50ace0f84d9f6900e1eba863760d6 | [] | no_license | zellyn/project-euler | 422de8387320ebb9b7a978e348dd7e12e1048352 | 087061f007350ac2c210c5ef19f1ccc3d89dea35 | refs/heads/master | 2021-01-21T05:00:15.903675 | 2020-01-17T14:21:44 | 2020-01-17T14:21:44 | 154,268 | 1 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 192 | cc | 063.cc | // Project Euler Problem 063
//
// How many n-digit positive integers exist which are also an nth
// power?
#include <cstdio>
int main(int argc, const char* argv[]) {
printf("%d\n", 0);
}
|
5eda9c812b4c47adf7b7dae8aa4ca7f2ad48dc00 | 87d714204625a38ae7b09e5c9be537811d34268a | /LinkedList/Stack.cpp | 807029464af20188902bb30c5acf181110eaa92d | [] | no_license | Gominbong/List | c1c358c821e20a73c2fc97655ee7d13bd6d96f89 | 9f5ec14a1f9f7d5bd2e83b4a4a289e722ed4de4c | refs/heads/master | 2023-02-12T04:02:40.609957 | 2021-01-08T04:35:55 | 2021-01-08T04:35:55 | 267,345,095 | 0 | 0 | null | null | null | null | UHC | C++ | false | false | 4,052 | cpp | Stack.cpp | #include"Stack.h"
#include<stdlib.h>
#include<stdio.h>
#include<string.h>
#include<ctype.h>
void InitStack(Stack* stack) {
stack->top = NULL;
}
int IsEmpty(Stack* stack) {
if (stack->top == NULL)
return true;
else
return false;
}
void Push(Stack* stack, float data) {
Node_stack* NewNode = (Node_stack*)malloc(sizeof(Node_stack));
if (NewNode != NULL) {
NewNode->data = data;
NewNode->next = stack->top;
stack->top = NewNode;
}
}
float Pop(Stack* stack) {
float data;
Node_stack* node;
if (IsEmpty(stack)) {
printf("stack memory erro1r");
exit(-1);
}
data = stack->top->data;
node = stack->top;
stack->top= stack->top->next;
free(node);
return data;
}
int Peek(Stack* stack) {
if (IsEmpty(stack)) {
printf("stack memory error");
exit(-1);
}
if (stack->top->data == '(') {
return 0;
}
return stack->top->data;
}
int GetPriority(char op) {
switch (op) {
case '*':
case '/': return 5;
case '+':
case '-': return 3;
case '(': return 1;
}
return -1;
}
int WhoPriority(char op1, char op2) {
int op1_Priority = GetPriority(op1);
int op2_Priority = GetPriority(op2);
if (op1_Priority > op2_Priority) {
return 1;
}
else if (op1_Priority < op2_Priority) {
return -1;
}
else{
return 0;
}
}
void PostfixConversion(char exp[]) {
Stack stack;
int ExpLen = strlen(exp)+1;
int count=0;
for (int i = 0; i <ExpLen; i++) {
if (exp[i] == '.' || exp[i] == '+' || exp[i] == '-' || exp[i] == '*' || exp[i] == '/' || exp[i]=='(' || exp[i] ==')' ) {
count += 2;
}
if (exp[i] == '.') {
count += 1;
}
}
ExpLen = ExpLen + count;
char* ConvExp = (char*)malloc(ExpLen);
int index = 0;
char comparison, popOp;
int flag = 1;
memset(ConvExp, 0, sizeof(char ) * ExpLen);
InitStack(&stack);
for (int i = 0; i < ExpLen - count; i++) {
comparison = exp[i];
if (isdigit(comparison) || comparison=='.' ) { //저장된값이 숫자면 T
ConvExp[index++] = comparison;
}
else{
switch (comparison) {
case '(':
Push(&stack, comparison);
break;
case ')':
if (stack.top->data =='(' ) {
Pop(&stack);
flag = 0;
break;
}
while (flag) {
popOp = Pop(&stack);
if (popOp == '(') {
ConvExp[index++] = ' ';
break;
}
ConvExp[index++] = ' ';
ConvExp[index++] = popOp;
} break;
case '+':
case '-':
case '*':
case '/':
while (!IsEmpty(&stack) && WhoPriority(Peek(&stack), comparison) >= 0) {
ConvExp[index++] = ' ';
ConvExp[index++] = Pop(&stack);
}
ConvExp[index++] = ' ';
Push(&stack, comparison);
break;
}
}
}
while (!IsEmpty(&stack)) {
ConvExp[index++] = Pop(&stack);
}
strcpy(exp, ConvExp);
free(ConvExp);
}
float Calculate(char exp[]) {
Stack stack;
int ExpLen = strlen(exp);
char comparison;
float op1=0, op2=0;
InitStack(&stack);
char b[100];
int k = 0;
int num = 0;
for (int i = 0; i<ExpLen; i++) {
comparison = exp[i];
if (isdigit(comparison) || exp[i]=='.' ) {
b[k++] = exp[i];
if (exp[i + 1] == ' ') {
Push(&stack, atof(b));
memset(b, 0, 100);
k = 0;
i++;
}
else if ( !isdigit(exp[i + 1]) ) {
if (exp[i + 1] != '.') {
Push(&stack, atof(b));
memset(b, 0, 100);
k = 0;
}
}
}
else if (exp[i]==' ' || exp[i]=='.') {
Push(&stack, atof(b));
memset(b, 0, 100);
k = 0;
}
else{
op2 = Pop(&stack);
op1 = Pop(&stack);
switch (comparison) {
case '+':
Push(&stack, op1 + op2); while(exp[i+1] == ' ') { i++; } break;
case '-':
Push(&stack, op1 - op2); while (exp[i + 1] == ' ') { i++; } break;
case '*':
Push(&stack, op1 * op2); while (exp[i + 1] == ' ') { i++; } break;
case '/':
Push(&stack, op1 / op2); while (exp[i + 1] == ' ') { i++; } break;
}
}
}
return Pop(&stack);
}
void Start1() {
char str[100];
while (1) {
printf("후위식 바꿀식 : ");
fgets(str, sizeof(str), stdin);
PostfixConversion(str);
printf("후위식 : %s \n", str);
printf("후위식 계산 : %f \n\n\n", Calculate(str));
}
}
|
e9045e8fa5aa45cb306122b644cd85cc78930ec6 | 3efc50ba20499cc9948473ee9ed2ccfce257d79a | /data/code-jam/files/6224486_biltharesatyendra_5686275109552128_0_extracted_pan.cpp | a30d142cb16d6ef97e24047ad1542f1dd59614f9 | [] | no_license | arthurherbout/crypto_code_detection | 7e10ed03238278690d2d9acaa90fab73e52bab86 | 3c9ff8a4b2e4d341a069956a6259bf9f731adfc0 | refs/heads/master | 2020-07-29T15:34:31.380731 | 2019-12-20T13:52:39 | 2019-12-20T13:52:39 | 209,857,592 | 9 | 4 | null | 2019-12-20T13:52:42 | 2019-09-20T18:35:35 | C | UTF-8 | C++ | false | false | 1,474 | cpp | 6224486_biltharesatyendra_5686275109552128_0_extracted_pan.cpp | #include<string.h>
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
int a[1000005];
int n;
int sol(int ans)
{
int st;
for(st = 0; st<=ans;st++)
{
// printf("taking only steps %d\n",st);
multiset<int> ss ;
int i;
for(i=0;i<n;i++)
ss.insert(a[i]);
int j;
multiset<int>::iterator I;
for(j=0;j<st;j++)
{
I = ss.end();
I--;
int cur = *I;
ss.erase(I);
// printf("removed %d and inserted %d %d\n",cur,cur/2,(cur+1)/2);
ss.insert(cur/2);
ss.insert((cur+1)/2);
}
I = ss.end();
I--;
// printf("last element is %d\n",*I);
if(st + *I <=ans)return 1;
}
return 0;
}
int main()
{
int i,j;
int t,ca;
scanf("%d",&t);
for(ca = 1; ca<=t;ca++)
{
int hi = 0;
scanf("%d",&n);
for(i=0;i<n;i++)
{
scanf("%d",&a[i]);
// printf("%d ",a[i]);
if(a[i] > hi)hi = a[i];
}
int lo,ans;
lo = 0;
while(lo<=hi)
{
ans = (lo+hi)/2;
int u = sol(ans);
if(u==0)lo = ans+1;
else {
if(sol(ans-1)==0)break;
hi = ans-1;
}
}
/*
for(ans = 1; ans<=hi;ans++){
// printf("checking for %d\n",ans);
if(sol(ans)==1)break;
}
*/
printf("Case #%d: %d\n",ca,ans);
}
return 0;
}
|
8dec880390c155a0728b7005d2e966f7a434ece8 | 6b09fdc05a6c6c756d6525b5bfe12aa2110f2922 | /STUB/STRUCTURE/database_structure.hpp | 322d66482ec3013fa29876f7c55620c0b4c2f0bf | [] | no_license | roysuman/DatabaseStub | fcf3d4b405f272de521cd016946f133ca3817dfe | c7e07ffe2bdb2fd001d6498398a8918798996030 | refs/heads/master | 2021-01-18T23:00:38.368321 | 2016-05-12T05:38:31 | 2016-05-12T05:38:31 | 25,222,657 | 0 | 2 | null | null | null | null | UTF-8 | C++ | false | false | 1,696 | hpp | database_structure.hpp | /*
* =====================================================================================
*
* Filename: database_structure.hpp
*
* Description: structures to maintain database information, at a particular time only one database will be active
so only one instance of database variable is needed.
*
* Version: 1.0
* Created: Wednesday 06 November 2013 03:06:10 IST
* Revision: none
* Compiler: gcc
*
* Author: Suman Roy (),
* Organization: Cognizant Technological solutions
*
* =====================================================================================
*/
#ifndef DATABASE_STRUCTURE_HPP_
#define DATABASE_STRUCTURE_HPP_
#include <sqlite3.h>
#include <iostream>
//Structure for dtoring database information , like db pointer, database name and path(location) of the database in local machine.
typedef struct _database databaseStruct;
struct _database{
sqlite3 *db;
std::string databaseName;
std::string databasePath;
};
//varibale for stroting information of open sqlite3 database.
extern databaseStruct dbCredentials;
//during capture mode of this tool, we are going to filter network packets regarding to the server IP/Port.
//suppose we are going to capture mysql packets coming from mysql server x.x.x.x and port 3306. This server struct holds the informations of
//client/source of server that is our source of packets.
typedef struct _serverStructure serverStruct;
struct _serverStructure{
std::string serverName;
std::string serverType;
std::string serverIp;
std::string serverPort;
};
//one variable, that will hold the server information.
extern serverStruct serverCredentials;
#endif
|
7d7eb57186d00b7822a1b1d69b822787a1713364 | aa1e3dc577fb616da19902fe3d598081bed88da7 | /12.- Supermercado/Prac12.cpp | 88a2fbb23df55f6cb61e12a12277485b98b5e741 | [] | no_license | cocosabio97/ED | 817ebe18767b453e5120acb41154d71d65bbd192 | b17070c8f877fb09102ffdf3fcb5c7c24ae9c9ab | refs/heads/master | 2022-11-18T07:20:45.213881 | 2020-07-17T08:59:49 | 2020-07-17T08:59:49 | 280,377,322 | 0 | 0 | null | null | null | null | ISO-8859-2 | C++ | false | false | 5,794 | cpp | Prac12.cpp | /*
* ---------------------------------------------------
* ESTRUCTURAS DE DATOS
* ---------------------------------------------------
* Manuel Montenegro Montes
* Facultad de Informática
* Universidad Complutense de Madrid
* ---------------------------------------------------
*/
/*
* Comienza poniendo el nombre de los/as componentes del grupo:
*
* Estudiante 1: Ignacio Pallás Gozálvez
* Estudiante 2: Fernando Hermoso Cara
*/
#include <iostream>
#include <fstream>
#include <unordered_map>
#include <list>
#include <string>
using namespace std;
class Supermercado {
public:
// O(1) ya que como mucho hay 16 cajas
Supermercado(int num_cajas) {
numCajas = num_cajas;
for (int i = 0; i < num_cajas; ++i) {
list<string> aux;
cajas.insert({ i, aux });
}
}
// O(1)
void nuevo_cliente(string cod_cliente, int num_cola) {
if (num_cola > (numCajas - 1)) { // cte
throw domain_error("Cola inexistente");
}
else {
if (cliente_caja.count(cod_cliente) == 1) {//cte
throw domain_error("Cliente duplicado");
}
cajas[num_cola].push_back(cod_cliente);//cte
cliente_caja.insert({ cod_cliente, num_cola });//cte
}
}
// o(n) siendo n el nuemro de personas en la cola
void cambiar_cola(string cod_cliente, int num_cola) {
if (num_cola > (numCajas - 1)) { // cte
throw domain_error("Cola inexistente");
}
if (cliente_caja.count(cod_cliente) == 0) {//cte
throw domain_error("Cliente inexistente");
}
int pos = cliente_caja[cod_cliente];// O(n)
auto it = cajas[pos].begin();
bool ok = false;
while (it != cajas[pos].cend() && !ok) {// O(n) siendo n el numero de personas en la cola
if (*it == cod_cliente) {
ok = true;
}
else
++it;
}
if (pos != num_cola) {
cajas[pos].erase(it);//cte
cajas[num_cola].push_back(cod_cliente);//cte
cliente_caja[cod_cliente] = num_cola;// O(n)
}
}
// O(n) siendo n el numero de personas que hay en todas las colas
int consultar_cliente(string cod_cliente) {
if (cliente_caja.count(cod_cliente) == 0) {
throw domain_error("Cliente inexistente");
}
return cliente_caja[cod_cliente];
}
// O(1)
int cuantos_en_cola(int num_cola) {
if (num_cola > numCajas - 1) {
throw domain_error("Cola inexistente");
}
return cajas[num_cola].size();
}
//O(1) ya que como mucho tendremos 16 cajas
list<string> clientes_en_cola(int num_cola) {
if (num_cola > numCajas - 1) {
throw domain_error("Cola inexistente");
}
return cajas[num_cola];
}
private:
int numCajas;
unordered_map<int, list<string>> cajas;
unordered_map<string, int> cliente_caja;
};
bool tratar_caso() {
int dato1;
string dato;
cin >> dato1;
if (!cin) {
return false;
}
else {
Supermercado super(dato1);
cin >> dato;
while (dato != "FIN") {
if (dato == "nuevo_cliente") {
string c;
cin >> c;
int caja;
cin >> caja;
try {
super.nuevo_cliente(c, caja);
}
catch (exception& e) {
cout << "ERROR: " << e.what() << endl;
}
}
else if (dato == "cuantos_en_cola") {
int d;
cin >> d;
try {
int a = super.cuantos_en_cola(d);
cout << "En la cola " << d << " hay " << a << " clientes\n";
}
catch (exception& e) {
cout << "ERROR: " << e.what() << endl;
}
}
else if (dato == "clientes_en_cola") {
int d;
cin >> d;
try {
list<string> lis = super.clientes_en_cola(d);
cout << "En la cola " << d << " estan: ";
for (auto it = lis.rbegin(); it != lis.rend(); ++it) {
cout << *it << " ";
}
cout << "\n";
}
catch (exception& e) {
cout << "ERROR: " << e.what() << endl;
}
}
else if (dato == "cambiar_cola") {
string a;
int b;
cin >> a;
cin >> b;
try {
super.cambiar_cola(a, b);
}
catch (exception& e) {
cout << "ERROR: " << e.what() << endl;
}
}
else if (dato == "consultar_cliente") {
string a;
cin >> a;
try {
int b = super.consultar_cliente(a);
cout << "El cliente " << a << " esta en la cola " << b << endl;
}
catch (exception& e) {
cout << "ERROR: " << e.what() << endl;
}
}
cin >> dato;
}
cout << "---" << endl;
}
return true;
}
int main() {
#ifndef DOMJUDGE
std::ifstream in("sample.in");
auto cinbuf = std::cin.rdbuf(in.rdbuf());
#endif
while (tratar_caso()) {}
#ifndef DOMJUDGE
std::cin.rdbuf(cinbuf);
// Descomentar si se trabaja en Windows
system("PAUSE");
#endif
return 0;
} |
62310754766f7896068a5d648870c3fba1988848 | b78c255d1c8b917c21bf689f5f9153d765fbe195 | /dogpack/apps/2d/advection/rotating/AfterQinit.cpp | f9475aae57605a0ceaae67e8ad240457cf727c5e | [] | no_license | smoe1/ImplicitExplicit | 8be586bed84b1a661e5fe71f5b063dcd406643fa | 2b9a2d54110ca0f787d4252b9a8cc6d64b23b08d | refs/heads/master | 2016-09-08T02:39:48.371767 | 2015-09-15T21:15:08 | 2015-09-15T21:15:08 | 41,374,555 | 0 | 1 | null | null | null | null | UTF-8 | C++ | false | false | 2,563 | cpp | AfterQinit.cpp | #include<cmath>
#include "dogdefs.h"
#include "DogParamsCart2.h"
#include "DogSolverCart2.h"
// Smooth initial conditions
void AfterQinit(DogSolverCart2& solver)
{
dTensorBC4& aux = solver.get_aux();
dTensorBC4& q = solver.get_q();
const int mx = q.getsize(1);
const int my = q.getsize(2);
const int meqn = q.getsize(3);
const int kmax = q.getsize(4);
const int mbc = q.getmbc();
const int maux = aux.getsize(2);
const int method1 = int((sqrt(1+8*kmax)-1)/2);
double minmod(double,double,double);
const double dx = dogParamsCart2.get_dx();
const double dy = dogParamsCart2.get_dy();
const double M=10.0;
const double Mdx2=M*dx*dx;
const double Mdy2=M*dy*dy;
int m=1;
for (int i=(2-mbc); i<=(mx+mbc-1); i++)
for (int j=(2-mbc); j<=(my+mbc-1); j++)
for (int m=1; m<=meqn; m++)
{
bool limited_linear = false;
// x-direction: limit linear term
double wx_now = q.get(i,j,m,2);
if(fabs(wx_now) > Mdx2) // so the peaks aren't clipped
{
double dwp = q.get(i+1,j,m,1) - q.get(i,j,m,1);
double dwm = q.get(i,j,m,1) - q.get(i-1,j,m,1);
double wx_limited = minmod(wx_now, dwp/2.0, dwm/2.0);
if(fabs(wx_now-wx_limited)>1.0e-15)
{
limited_linear=true;
q.set(i,j,m,2, wx_limited );
}
}
// y-direction: limit linear term
double wy_now = q.get(i,j,m,3);
if(fabs(wy_now) > Mdy2) // so the peaks aren't clipped
{
double dwp = q.get(i,j+1,m,1) - q.get(i,j,m,1);
double dwm = q.get(i,j,m,1) - q.get(i,j-1,m,1);
double wy_limited = minmod(wy_now, dwp/2.0, dwm/2.0);
if(fabs(wy_now-wy_limited)>1.0e-15)
{
limited_linear = true;
q.set(i,j,m,3, wy_limited );
}
}
// if linear limited terms were limited,
// then zero out all high-order terms
if(limited_linear)
{
for (int k=4; k<=kmax; k++)
{
q.set(i,j,m,k, 0.0 );
}
}
}
}
|
3667a1921ba46e093c710af9c204619a8a09119d | e6186d644bc43beb233cefe59633009212643e57 | /serving.cpp | 555cf6fa81c77314f3a287dfced5599ca556de89 | [] | no_license | george-hinkel/MICE_TeamA | 0c9abf127a60c6a79287c1cfd9bfa0444c2e4f40 | dee1664eed12b0c5f8949dfcf6b5073100f51705 | refs/heads/master | 2021-05-15T10:13:28.787856 | 2017-11-30T13:19:48 | 2017-11-30T13:19:48 | 108,171,188 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 1,812 | cpp | serving.cpp | #include "serving.h"
#include <iostream>
void Serving::add_item(Item* item){
_items.push_back(item);
}
Item* Serving::get_item(std::string name){
for(int i=0;i<_items.size();i++){
if(_items[i]->get_name()==name){
return _items[i];
}
}
Item* null_item = (Item*)malloc(sizeof(Item));
null_item = new Item("NULL","NULL",0,0,0,"NULL");
return null_item;
}
void Serving::remove_item(Item* item){
int index=-1;
for(int i=0;i<_items.size();i++){
if(_items[i]==item){
index=i;
}
}
if(index!=-1){
_items.erase(_items.begin()+index);
}
}
std::string Serving::get_id(){
return _serving_id;
}
std::string Serving::to_string(){
std::string output="Serving ID:";
output+= _serving_id;
output+= "\n";
for(int i=0;i<_items.size();i++){
output+= "item #";
output+= std::to_string(i+1);
output+= "\t";
output+= _items[i]->to_string();
}
return output;
}
double Serving::get_retail_price(){
double price=0;
for(int i=0;i<_items.size();i++){
price+=_items[i]->get_retail_price();
}
return price;
}
double Serving::get_wholesale_cost(){
double cost=0;
for(int i=0;i<_items.size();i++){
cost+=_items[i]->get_wholesale_cost();
}
return cost;
}
std::string Serving::to_short_string(){
std::string output="";
for(int i=0;i<_items.size();i++){
output+= "Item ";
output+= std::to_string(i+1);
output+= ": ";
output+= _items[i]->get_name();
output+= "; ";
}
output+="\n";
return output;
}
std::string Serving::to_file_string(){
std::string output = "serving\n"+_serving_id+"\n";
for(int i=0;i<_items.size();i++){
output+= _items[i]->to_file_string(1);
}
output+= "end serving\n";
return output;
}
std::string Serving::serving_summary(){
std::string output="";
for(int i=0;i<_items.size();i++){
output+= "1 x "+_items[i]->get_name()+", ";
}
return output;
}
|
f428712dc582a312cbafa9a1a35db53e1ceae285 | 684b2280d42de5a4fa1bad2d114ddd2699aa21f1 | /src/graphicblock.cpp | 1a83d536e315b012b48238ad3fdb3885f1b6789d | [] | no_license | kashin/Engine2DTest | 1e573e1b69c8551e983396f6795bc9688c0e0f80 | c6603484cbe349cf4a88d4ff0b22f5ce0f138549 | refs/heads/master | 2016-09-11T07:59:10.337004 | 2013-05-29T16:31:05 | 2013-05-29T16:31:05 | null | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 4,095 | cpp | graphicblock.cpp | #include "graphicblock.h"
#include "animator2d.h"
#include <irrlicht/irrlicht.h>
#include <QDebug>
using namespace irr;
using namespace core;
using namespace scene;
using namespace video;
using namespace io;
GraphicBlock::GraphicBlock(IVideoDriver *driver, const CollisionType& type)
: mDriver(0),
mEnableAnimation(true),
mTexture(0),
mCollisionType(type),
mWidth(0),
mHeight(0)
{
mDriver = driver;
setPosition(vector2d<s32>(0,0));
}
GraphicBlock::~GraphicBlock()
{
irr::core::list< Animator2D* >::ConstIterator it = mAnimations.begin();
irr::core::list< Animator2D* >::ConstIterator end = mAnimations.end();
while (it != end)
{
delete *it;
++it;
}
}
void GraphicBlock::setTextureName(const path &textureName)
{
mTextureName = textureName;
if (mTexture)
{
mTexture = 0;
}
if (mDriver)
{
mTexture = mDriver->findTexture(mTextureName);
if (!mTexture)
{
mTexture = mDriver->getTexture(mTextureName);
}
if (mTexture)
{
mWidth = mTexture->getSize().Width;
mHeight = mTexture->getSize().Height;
}
}
}
void GraphicBlock::setPosition(vector2d<s32> position)
{
mCurrentPosition = position;
}
void GraphicBlock::addAnimator(Animator2D *animator)
{
irr::core::list< Animator2D* >::Iterator it = mAnimations.begin();
irr::core::list< Animator2D* >::Iterator end = mAnimations.end();
while (it != end)
{
if ((*it)->type() == animator->type())
{
delete (*it);
mAnimations.erase(it);
break;
}
++it;
}
mAnimations.push_front(animator);
}
void GraphicBlock::drawAll()
{
if (mEnableAnimation && !mAnimations.empty())
{
irr::core::list< Animator2D* >::Iterator it = mAnimations.begin();
irr::core::list< Animator2D* >::Iterator end = mAnimations.end();
irr::core::list< irr::core::list< Animator2D* >::Iterator> deleteAnimsList;
while (it != end)
{
if ((*it)->animationFinished())
{
deleteAnimsList.push_front(it);
++it;
continue;
}
(*it)->runAnimation(this);
++it;
}
irr::core::list< irr::core::list< Animator2D* >::Iterator>::Iterator iter = deleteAnimsList.begin();
while (iter != deleteAnimsList.end())
{
delete *(*iter);
mAnimations.erase((*iter));
++iter;
}
}
draw();
}
void GraphicBlock::draw()
{
if (mTexture && mDriver)
{
mDriver->draw2DImage(mTexture, mCurrentPosition - (vector2d<s32>(mWidth/2, mHeight/2)));
}
}
const irr::core::rect<irr::s32> GraphicBlock::getBoundRect() const
{
vector2d<s32> vect(mWidth/2, mHeight/2);
return rect<irr::s32>(mCurrentPosition - vect,
mCurrentPosition + vect);
}
void GraphicBlock::newEvent(const irr::SEvent &event)
{
switch(event.EventType)
{
case EET_MOUSE_INPUT_EVENT:
{
newMouseEvent(event);
break;
}
case EET_KEY_INPUT_EVENT:
{
newKeyEvent(event);
}
default:
break;
}
}
void GraphicBlock::newKeyEvent(const irr::SEvent &/*event*/)
{
}
void GraphicBlock::newMouseEvent(const irr::SEvent &/*event*/)
{
}
void GraphicBlock::enableAnimations(bool val)
{
mEnableAnimation = val;
}
void GraphicBlock::setTextureSize(irr::u32 width, irr::u32 height)
{
mWidth = width;
mHeight = height;
}
bool GraphicBlock::animationsFinished(Animator2D::AnimationType type)
{
if (type == Animator2D::AllAnimations)
{
return mAnimations.empty();
}
irr::core::list< Animator2D* >::Iterator it = mAnimations.begin();
irr::core::list< Animator2D* >::Iterator end = mAnimations.end();
while (it != end)
{
if ((*it)->type() == type && !(*it)->animationFinished())
{
return false;
}
++it;
}
return true;
}
|
f1f58f5514a09890ab3e65dc44bded22e08d01c4 | 84ecd166c2078c23bc517cbcc02d26d88724e293 | /InheritanceC++-Assignment5/ShapesGood.h | 81de5ab6fd667a604bd593d4ce1a0bc0db3174d1 | [
"MIT"
] | permissive | DanMan259/CMPE_320_Fundamentals_of_Software_Development | 7499ba54e1202a6b231e2c13146585e7ddb2579d | ad53876a42f5c37ea0722c4377ed9fdd9285f742 | refs/heads/master | 2020-08-04T17:04:02.207789 | 2020-01-19T23:30:07 | 2020-01-19T23:30:07 | 212,213,485 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 1,953 | h | ShapesGood.h | #pragma once
#include <string>
using namespace std;
// Shape Class that all the other shapes will inherit
class Shape {
public:
Shape();
Shape(int, int, string);
virtual ~Shape();
int getLength();
int getWidth();
string getOutlineColor() const;
virtual void draw() const;
protected:
void drawColor() const;
private:
const int length, width;
const string outlineColor;
};
// Fill Class that all the other fillable shapes will inherit
class Fillable {
public:
Fillable();
Fillable(string);
~Fillable();
string getFillColor() const;
protected:
void getFillString() const;
private:
const string color;
};
// Text Class that all the other text shapes will inherit
class Text {
public:
Text();
Text(string);
~Text();
string getText() const;
protected:
void textString() const;
private:
const string text;
};
// Square Class
class Square : public Shape {
public:
Square();
Square(int, int, string);
~Square();
virtual void draw() const;
};
// Filled Square Class
class FilledSquare : public Square, Fillable {
public:
FilledSquare();
FilledSquare(int, int, string, string);
~FilledSquare();
virtual void draw() const;
};
// Filled Square with text Class
class FilledTextSquare : public FilledSquare, Text {
public:
FilledTextSquare();
FilledTextSquare(int, int, string, string, string);
~FilledTextSquare();
virtual void draw() const;
};
// Circle Class
class Circle : public Shape {
public:
Circle();
Circle(int, int, string);
~Circle();
virtual void draw() const;
};
// Filled Circle Class
class FilledCircle : public Circle, Fillable {
public:
FilledCircle();
FilledCircle(int, int, string, string);
~FilledCircle();
virtual void draw() const;
};
// Arc Class
class Arc : public Shape {
public:
Arc();
Arc(int, int, string);
~Arc();
virtual void draw() const;
}; |
91d70de8ef7616b20df47e6005c551b756e2748c | f4724bdfcac0ab9380d133e541c03a9d4c57d39b | /Lab1/test.cpp | 0ac9b85b9036f96c3660582eb074e9662dbfa1ea | [] | no_license | Kish29/AlgorithmCourse | a1c06f335a3b328a35ce8d641a4400f26d255500 | d62b5c785a2c2241ecf349616b701e3df20ab484 | refs/heads/master | 2023-02-08T11:06:09.502278 | 2021-01-01T16:07:15 | 2021-01-01T16:07:15 | 312,187,143 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 274 | cpp | test.cpp | //
// Created by 87569 on 2020/12/9.
//
#include "MyAgorithm.h"
int nums[max_n];
int main() {
int len, n;
scanf("%d%d", &len, &n);
for (int i = 0; i < len; ++i) {
scanf("%d", &nums[i]);
}
printf("%d", minDivide(nums, len, n));
return 0;
}
|
cfc43413c9902a65e8f4331de6751b3b70f8bddf | 24fb405cbac1742628826996d353f91ab9c97e91 | /Unit_tests/collectionTests.cpp | 5d32a07528f862c4c4788fdd58d1457aafd5f87b | [] | no_license | MonikaBer/Artificial_life | c2850c39a2f33a0b0e484386b59b585da5eb9d86 | 08ff4f7deb40defd0bd4bb8d6cf7f4c81945548b | refs/heads/master | 2021-05-18T16:54:50.109764 | 2020-06-10T21:23:26 | 2020-06-10T21:23:26 | 251,326,344 | 0 | 0 | null | 2020-04-30T21:30:01 | 2020-03-30T14:14:22 | C++ | UTF-8 | C++ | false | false | 2,946 | cpp | collectionTests.cpp | #define BOOST_TEST_DYN_LINK
#include <boost/test/unit_test.hpp>
#include "../Subjects/Animals/Herbivore.hpp"
#include "../Subjects/Animals/Predator.hpp"
#include "../Subjects/Plants/TypicalPlant.hpp"
#include "../Subjects/SubjectsCollection.hpp"
#include "../helper.hpp"
BOOST_AUTO_TEST_SUITE(test_suite_collection)
BOOST_AUTO_TEST_CASE( testSingletonPattern )
{
SubjectsCollection &collection1 = SubjectsCollection::getInstance();
SubjectsCollection &collection2 = SubjectsCollection::getInstance();
BOOST_CHECK_EQUAL(&collection1, &collection2);
}
BOOST_AUTO_TEST_CASE( testStoredQuantity )
{
Subject *pom;
SubjectsCollection &collection = SubjectsCollection::getInstance();
SubjectsFactory &factory = SubjectsFactory::getInstance();
//check for predators:
int n = 11;
for(int i = 0; i<n; i++)
{
pom = factory.create(PREDATOR, WINDOW_WIDTH/AREA_SIZE, WINDOW_HEIGHT/AREA_SIZE, MAX_LIFE_TIME, VIEW_SIZE);
collection.push(dynamic_cast<Predator*>(pom));
}
BOOST_CHECK_EQUAL(collection.getPredatorsNumber(), n);
BOOST_CHECK_EQUAL(collection.getPlantsNumber(), NULL);
//check for plants:
int m = 12;
for(int i = 0; i<m; i++)
{
pom = factory.create(TYPICAL_PLANT, WINDOW_WIDTH/AREA_SIZE, WINDOW_HEIGHT/AREA_SIZE, MAX_LIFE_TIME, VIEW_SIZE);
collection.push(dynamic_cast<Plant*>(pom));
}
BOOST_CHECK_EQUAL(collection.getPredatorsNumber(), n);
BOOST_CHECK_EQUAL(collection.getPlantsNumber(), m);
}
BOOST_AUTO_TEST_CASE( testDeleteObjects )
{
//check deletion all:
SubjectsCollection &collection = SubjectsCollection::getInstance();
SubjectsFactory &factory = SubjectsFactory::getInstance();
collection.deleteAllSubjects();
BOOST_CHECK_EQUAL(collection.getPredatorsNumber(), NULL);
//check deletion of Herbivore by coordinates
int xHerb(60), yHerb(60), maxLifeTime(20), viewSize(20);
Herbivore* tHerb = new Herbivore(xHerb, yHerb, maxLifeTime, viewSize);
collection.push(tHerb);
BOOST_CHECK_EQUAL(collection.getHerbivoresNumber(), 1);
Coordinates predCoord = std::make_pair(xHerb, yHerb);
collection.deleteHerbivore(predCoord);
BOOST_CHECK_EQUAL(collection.getHerbivoresNumber(), 0);
//check deletion of Predator by index:
Subject *pom;
int n = 7;
for(int i = 0; i<n; i++)
{
pom = factory.create(PREDATOR, WINDOW_WIDTH/AREA_SIZE, WINDOW_HEIGHT/AREA_SIZE, MAX_LIFE_TIME, VIEW_SIZE);
collection.push(dynamic_cast<Predator*>(pom));
}
BOOST_CHECK_EQUAL(collection.getPredatorsNumber(), n);
collection.deletePredator(4);
BOOST_CHECK_EQUAL(collection.getPredatorsNumber(), n-1);
}
BOOST_AUTO_TEST_SUITE_END() |
0723b1330d5d0ae395bda3475b6c472f0d8d3a70 | add246d790e0e8ff9eb49955bfd276c70439e613 | /main/drawCTRSingleBarsComb.cpp | 9f27b73e946fee1de18507d8744ef592d1a98152 | [] | no_license | abenagli/TBStudies | 0bee17521e29272659cfc31927db7dce56a38437 | 2d9c1b2b5cd2ee25ef0c8ad4d37bdcd5aeafe99a | refs/heads/master | 2020-03-30T15:46:52.235302 | 2020-01-19T12:33:53 | 2020-01-19T12:33:53 | 151,378,759 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 70,203 | cpp | drawCTRSingleBarsComb.cpp | #include "interface/FitUtils.h"
#include "interface/TreeUtils.h"
#include "interface/SetTDRStyle.h"
#include "CfgManager/interface/CfgManager.h"
#include "CfgManager/interface/CfgManagerT.h"
#include <iostream>
#include <fstream>
#include <vector>
#include <map>
#include "TFile.h"
#include "TChain.h"
#include "TH1F.h"
#include "TProfile.h"
#include "TProfile2D.h"
#include "TGraphErrors.h"
#include "TF1.h"
#include "TCanvas.h"
#include "TLatex.h"
#include "TLine.h"
#include "TRandom3.h"
struct Event
{
std::map<std::string,float> amps;
std::map<std::string,float> times;
float x;
float y;
};
int main(int argc, char** argv)
{
setTDRStyle();
if( argc < 2 )
{
std::cout << ">>> drawCTRSingles::usage: " << argv[0] << " configFile.cfg" << std::endl;
return -1;
}
TRandom3 r;
//--- parse the config file
CfgManager opts;
opts.ParseConfigFile(argv[1]);
int debugMode = 0;
if( argc > 2 ) debugMode = atoi(argv[2]);
//--- get parameters
std::string plotDir = opts.GetOpt<std::string>("Output.plotDir");
system(Form("mkdir -p %s",plotDir.c_str()));
std::vector<std::string> channels = opts.GetOpt<std::vector<std::string> >("Channels.channels");
int doTracking = opts.GetOpt<int>("Options.doTracking");
int hodoPlane = opts.GetOpt<int>("Options.hodoPlane");
int nFibresMin = opts.GetOpt<int>("Options.nFibresMin");
int nFibresMax = opts.GetOpt<int>("Options.nFibresMax");
float energySmearing = opts.GetOpt<float>("Options.energySmearing");
//--- open input files
std::string inputDir = opts.GetOpt<std::string>("Input.inputDir");
std::string runs = opts.GetOpt<std::string>("Input.runs");
int maxEntries = opts.GetOpt<int>("Input.maxEntries");
std::string treeName = opts.GetOpt<std::string>("Input.treeName");
TChain* h4 = new TChain(treeName.c_str(),treeName.c_str());
std::stringstream ss(runs);
std::string token;
while( std::getline(ss,token,',') )
{
std::stringstream ss2(token);
std::string token2;
int runMin = -1;
int runMax = -1;
while( std::getline(ss2,token2,'-') )
{
if( runMin != -1 && runMax == -1 ) runMax = atoi(token2.c_str());
if( runMin == -1 ) runMin = atoi(token2.c_str());
}
for(int run = runMin; run <= runMax; ++run)
{
// std::string fileName = Form("%s/%d/*.root",inputDir.c_str(),run);
std::string fileName = Form("%s/*%d*.root",inputDir.c_str(),run);
std::cout << ">>> Adding flle " << fileName << std::endl;
h4 -> Add(fileName.c_str());
}
}
std::string goodRunsFile = opts.GetOpt<std::string>("Input.goodRunsFile");
std::ifstream goodRunList(goodRunsFile.c_str(),std::ios::in);
std::map<int,bool> goodRuns;
std::string line;
while(1)
{
getline(goodRunList,line,'\n');
if( !goodRunList.good() ) break;
if( line.at(0) == '#' ) continue;
// std::cout << "Reading line " << line << std::endl;
std::stringstream ss(line);
int run, spill;
ss >> run;
goodRuns[run] = true;
}
//--- define tree branch addresses
TreeVars tv;
InitTreeVars(h4,tv,opts);
//InitTreeVarsFNAL(h4,tv,opts);
int nEntries = h4->GetEntries();
std::cout << ">>> Events read: " << nEntries << std::endl;
//------------------
// define histograms
std::string conf = opts.GetOpt<std::string>("Input.conf");
TFile* outFile = TFile::Open(Form("%s/drawCTRSingles_%s.root",plotDir.c_str(),conf.c_str()),"RECREATE");
outFile -> cd();
TTree* outTree = new TTree("results","results");
std::map<std::string,float> t_CTR_effSigma;
std::map<std::string,float> t_CTR_gausSigma;
std::map<std::string,float> t_CTR_gausSigmaErr;
std::map<std::string,float> t_CTR_ampCorr_effSigma;
std::map<std::string,float> t_CTR_ampCorr_gausSigma;
std::map<std::string,float> t_CTR_ampCorr_gausSigmaErr;
std::map<std::string,float> t_CTR_ampCorr_posCorr_effSigma;
std::map<std::string,float> t_CTR_ampCorr_posCorr_gausSigma;
std::map<std::string,float> t_CTR_ampCorr_posCorr_gausSigmaErr;
for(auto ch : channels)
{
int index = opts.GetOpt<int>(Form("%s.index", ch.c_str()));
if( index < 0 ) continue;
outTree -> Branch(Form("CTR_effSigma_%s",ch.c_str()),&t_CTR_effSigma[ch]);
outTree -> Branch(Form("CTR_gausSigma_%s",ch.c_str()),&t_CTR_gausSigma[ch]);
outTree -> Branch(Form("CTR_gausSigmaErr_%s",ch.c_str()),&t_CTR_gausSigmaErr[ch]);
outTree -> Branch(Form("CTR_ampCorr_effSigma_%s",ch.c_str()),&t_CTR_ampCorr_effSigma[ch]);
outTree -> Branch(Form("CTR_ampCorr_gausSigma_%s",ch.c_str()),&t_CTR_ampCorr_gausSigma[ch]);
outTree -> Branch(Form("CTR_ampCorr_gausSigmaErr_%s",ch.c_str()),&t_CTR_ampCorr_gausSigmaErr[ch]);
outTree -> Branch(Form("CTR_ampCorr_posCorr_effSigma_%s",ch.c_str()),&t_CTR_ampCorr_posCorr_effSigma[ch]);
outTree -> Branch(Form("CTR_ampCorr_posCorr_gausSigma_%s",ch.c_str()),&t_CTR_ampCorr_posCorr_gausSigma[ch]);
outTree -> Branch(Form("CTR_ampCorr_posCorr_gausSigmaErr_%s",ch.c_str()),&t_CTR_ampCorr_posCorr_gausSigmaErr[ch]);
}
std::map<std::string,TProfile*> p_eff_vs_X;
std::map<std::string,TProfile*> p_eff_vs_Y;
std::map<std::string,TProfile2D*> p2_eff_vs_XY;
std::map<std::string,TH1F*> h_amp;
std::map<std::string,TH1F*> h_amp_cut;
std::map<std::string,TProfile*> p_amp_vs_X;
std::map<std::string,TProfile*> p_amp_vs_Y;
std::map<std::string,TProfile2D*> p2_amp_vs_XY;
std::map<std::string,TH1F*> h_b_rms;
std::map<std::string,TH1F*> h_time;
std::map<std::string,TProfile*> p_time_vs_amp;
std::map<std::string,TProfile*> p_time_ampCorr_vs_amp;
std::map<std::string,TProfile*> p_time_ampCorr_vs_X;
std::map<std::string,TProfile*> p_time_ampCorr_vs_Y;
std::map<std::string,TProfile2D*> p2_time_ampCorr_vs_XY;
std::map<std::string,TProfile*> p_time_ampCorr_posCorr_vs_X;
std::map<std::string,TProfile*> p_time_ampCorr_posCorr_vs_Y;
std::map<std::string,TProfile2D*> p2_time_ampCorr_posCorr_vs_XY;
std::map<std::string,TH1F*> h_occupancyX;
std::map<std::string,TH1F*> h_occupancyY;
std::map<std::string,TH2F*> h2_occupancyXY;
std::map<std::string,TH1F*> h_chessOccupancyX;
std::map<std::string,TH1F*> h_chessOccupancyY;
std::map<std::string,TH2F*> h2_chessOccupancyXY;
std::map<std::string,TProfile*> map_p_time_vs_amp;
std::map<std::string,TH1F*> h_CTR_raw;
for(auto ch : channels)
{
int index = opts.GetOpt<int>(Form("%s.index", ch.c_str()));
float xtalXMin = opts.GetOpt<float>(Form("%s.xtalXMin",ch.c_str()));
float xtalXMax = opts.GetOpt<float>(Form("%s.xtalXMax",ch.c_str()));
float xtalYMin = opts.GetOpt<float>(Form("%s.xtalYMin",ch.c_str()));
float xtalYMax = opts.GetOpt<float>(Form("%s.xtalYMax",ch.c_str()));
std::vector<std::string> ampChs = opts.GetOpt<std::vector<std::string> >(Form("%s.ampCh", ch.c_str()));
for( auto ampCh : ampChs )
{
p_eff_vs_X[ch+"_"+ampCh] = new TProfile(Form("p_eff_vs_X_%s",(ch+"_"+ampCh).c_str()),"",100,-10.,40.);
p_eff_vs_Y[ch+"_"+ampCh] = new TProfile(Form("p_eff_vs_Y_%s",(ch+"_"+ampCh).c_str()),"",100,0.,50.);
p2_eff_vs_XY[ch+"_"+ampCh] = new TProfile2D(Form("p2_eff_vs_XY_%s",(ch+"_"+ampCh).c_str()),"",100,-10.,40.,100,0.,50.);
h_amp[ch+"_"+ampCh] = new TH1F(Form("h_amp_%s", (ch+"_"+ampCh).c_str()),"",1000,0.,1.);
h_amp_cut[ch+"_"+ampCh] = new TH1F(Form("h_amp_cut_%s", (ch+"_"+ampCh).c_str()),"",1000,0.,1.);
p_amp_vs_X[ch+"_"+ampCh] = new TProfile(Form("p_amp_vs_X_%s",(ch+"_"+ampCh).c_str()),"",int(2*(xtalXMax-xtalXMin)),xtalXMin,xtalXMax);
p_amp_vs_Y[ch+"_"+ampCh] = new TProfile(Form("p_amp_vs_Y_%s",(ch+"_"+ampCh).c_str()),"",int(2*(xtalYMax-xtalYMin)),xtalYMin,xtalYMax);
p2_amp_vs_XY[ch+"_"+ampCh] = new TProfile2D(Form("p2_amp_vs_XY_%s",(ch+"_"+ampCh).c_str()),"",int(1*(xtalXMax-xtalXMin)),xtalXMin,xtalXMax,int(1*(xtalYMax-xtalYMin)),xtalYMin,xtalYMax);
}
std::vector<std::string> timeMethods = opts.GetOpt<std::vector<std::string> >(Form("%s.timeMethods",ch.c_str()));
std::vector<std::string> timeChs = opts.GetOpt<std::vector<std::string> >(Form("%s.timeCh",ch.c_str()));
int timeIt = 0;
for( auto timeCh : timeChs )
{
float ampMin = opts.GetOpt<std::vector<float> >(Form("%s.ampMin",ch.c_str())).at(timeIt);
float ampMax = opts.GetOpt<std::vector<float> >(Form("%s.ampMax",ch.c_str())).at(timeIt);
std::cout << "creating histogram " << "h_b_rms[" << ch << "+_+" << timeCh << "]" << std::endl;
h_b_rms[ch+"_"+timeCh] = new TH1F(Form("h_b_rms_%s",(ch+"_"+timeCh).c_str()),"",100000,0.,0.5);
for( auto timeMethod : timeMethods )
{
std::string label = ch+"_"+timeCh+"_"+timeMethod;
h_time[label] = new TH1F(Form("h_time_%s",(label).c_str()),"",200,0.,200.);
p_time_vs_amp[label] = new TProfile(Form("p_time_vs_amp_%s",(label).c_str()),"",400,ampMin,ampMax);
p_time_ampCorr_vs_amp[label] = new TProfile(Form("p_time_ampCorr_vs_amp_%s",(label).c_str()),"",400,ampMin,ampMax);
p_time_ampCorr_vs_X[label] = new TProfile(Form("p_time_ampCorr_vs_X_%s",label.c_str()),"",int(2*(xtalXMax-xtalXMin)),xtalXMin,xtalXMax);
p_time_ampCorr_vs_Y[label] = new TProfile(Form("p_time_ampCorr_vs_Y_%s",label.c_str()),"",int(2*(xtalYMax-xtalYMin)),xtalYMin,xtalYMax);
p2_time_ampCorr_vs_XY[label] = new TProfile2D(Form("p2_time_ampCorr_vs_XY_%s",label.c_str()),"",int(1*(xtalXMax-xtalXMin)),xtalXMin,xtalXMax,int(1*(xtalYMax-xtalYMin)),xtalYMin,xtalYMax);
}
++timeIt;
}
for( auto timeMethod : timeMethods )
{
std::string label = ch+"_"+timeMethod+"__avg-ref";
p_time_ampCorr_vs_X[label] = new TProfile(Form("p_time_ampCorr_vs_X_%s",label.c_str()),"",int(2*(xtalXMax-xtalXMin)),xtalXMin,xtalXMax);
p_time_ampCorr_vs_Y[label] = new TProfile(Form("p_time_ampCorr_vs_Y_%s",label.c_str()),"",int(2*(xtalYMax-xtalYMin)),xtalYMin,xtalYMax);
p2_time_ampCorr_vs_XY[label] = new TProfile2D(Form("p2_time_ampCorr_vs_XY_%s",label.c_str()),"",int(1*(xtalXMax-xtalXMin)),xtalXMin,xtalXMax,int(1*(xtalYMax-xtalYMin)),xtalYMin,xtalYMax);
p_time_ampCorr_posCorr_vs_X[label] = new TProfile(Form("p_time_ampCorr_posCorr_vs_X_%s",label.c_str()),"",int(2*(xtalXMax-xtalXMin)),xtalXMin,xtalXMax);
p_time_ampCorr_posCorr_vs_Y[label] = new TProfile(Form("p_time_ampCorr_posCorr_vs_Y_%s",label.c_str()),"",int(2*(xtalYMax-xtalYMin)),xtalYMin,xtalYMax);
p2_time_ampCorr_posCorr_vs_XY[label] = new TProfile2D(Form("p2_time_ampCorr_posCorr_vs_XY_%s",label.c_str()),"",int(1*(xtalXMax-xtalXMin)),xtalXMin,xtalXMax,int(1*(xtalYMax-xtalYMin)),xtalYMin,xtalYMax);
label = ch+"_"+timeMethod+"__diff-ref";
p_time_ampCorr_vs_X[label] = new TProfile(Form("p_time_ampCorr_vs_X_%s",label.c_str()),"",int(2*(xtalXMax-xtalXMin)),xtalXMin,xtalXMax);
p_time_ampCorr_vs_Y[label] = new TProfile(Form("p_time_ampCorr_vs_Y_%s",label.c_str()),"",int(2*(xtalYMax-xtalYMin)),xtalYMin,xtalYMax);
p2_time_ampCorr_vs_XY[label] = new TProfile2D(Form("p2_time_ampCorr_vs_XY_%s",label.c_str()),"",int(1*(xtalXMax-xtalXMin)),xtalXMin,xtalXMax,int(1*(xtalYMax-xtalYMin)),xtalYMin,xtalYMax);
p_time_ampCorr_posCorr_vs_X[label] = new TProfile(Form("p_time_ampCorr_posCorr_vs_X_%s",label.c_str()),"",int(2*(xtalXMax-xtalXMin)),xtalXMin,xtalXMax);
p_time_ampCorr_posCorr_vs_Y[label] = new TProfile(Form("p_time_ampCorr_posCorr_vs_Y_%s",label.c_str()),"",int(2*(xtalYMax-xtalYMin)),xtalYMin,xtalYMax);
p2_time_ampCorr_posCorr_vs_XY[label] = new TProfile2D(Form("p2_time_ampCorr_posCorr_vs_XY_%s",label.c_str()),"",int(1*(xtalXMax-xtalXMin)),xtalXMin,xtalXMax,int(1*(xtalYMax-xtalYMin)),xtalYMin,xtalYMax);
}
for( auto timeMethod : timeMethods )
{
if( index >= 0 )
{
h_CTR_raw[ch+"_"+timeMethod+"__1-ref"] = new TH1F(Form("h_CTR_raw_%s_%s",ch.c_str(),(+"_"+timeMethod+"__1-ref").c_str()),"",20000,-200.,200.);
h_CTR_raw[ch+"_"+timeMethod+"__2-ref"] = new TH1F(Form("h_CTR_raw_%s_%s",ch.c_str(),(+"_"+timeMethod+"__2-ref").c_str()),"",20000,-200.,200.);
h_CTR_raw[ch+"_"+timeMethod+"__avg-ref"] = new TH1F(Form("h_CTR_raw_%s_%s",ch.c_str(),(+"_"+timeMethod+"__avg-ref").c_str()),"",20000,-200.,200.);
h_CTR_raw[ch+"_"+timeMethod+"__diff"] = new TH1F(Form("h_CTR_raw_%s_%s",ch.c_str(),(+"_"+timeMethod+"__diff").c_str()),"",20000,-200.,200.);
}
}
h_occupancyX[ch] = new TH1F(Form("h_occupancyX_%s",ch.c_str()), "",1.*(xtalXMax-xtalXMin),xtalXMin,xtalXMax);
h_occupancyY[ch] = new TH1F(Form("h_occupancyY_%s",ch.c_str()), "",1.*(xtalYMax-xtalYMin),xtalYMin,xtalYMax);
h2_occupancyXY[ch] = new TH2F(Form("h2_occupancyXY_%s",ch.c_str()),"",1.*(xtalXMax-xtalXMin),xtalXMin,xtalXMax,1.*(xtalYMax-xtalYMin),xtalYMin,xtalYMax);
int nBinsX = opts.GetOpt<int>(Form("%s.nBinsX",ch.c_str()));
int nBinsY = opts.GetOpt<int>(Form("%s.nBinsY",ch.c_str()));
if( nBinsX > 0 && nBinsY > 0 )
{
h_chessOccupancyX[ch] = new TH1F(Form("h_chessOccupancyX_%s",ch.c_str()), "",nBinsX,xtalXMin,xtalXMax);
h_chessOccupancyY[ch] = new TH1F(Form("h_chessOccupancyY_%s",ch.c_str()), "",nBinsY,xtalYMin,xtalYMax);
h2_chessOccupancyXY[ch] = new TH2F(Form("h2_chessOccupancyXY_%s",ch.c_str()),"",nBinsX,xtalXMin,xtalXMax,nBinsY,xtalYMin,xtalYMax);
for(int binX = 0; binX < nBinsX; ++binX)
for(int binY = 0; binY < nBinsY; ++binY)
{
std::string label(Form("%s_%d-%d",ch.c_str(),binX,binY));
map_p_time_vs_amp[label] = new TProfile(Form("p_time_vs_amp_%s",label.c_str()),"",50,0.,1.);
}
}
}
TCanvas* c;
TH1F* histo;
TH1F* histoCorr;
TH1F* histoCorr2;
TProfile* prof;
std::map<std::string,TLatex*> latexLabels;
for(auto ch: channels)
{
std::vector<std::string> labelVec = opts.GetOpt<std::vector<std::string> >(Form("%s.label",ch.c_str()));
std::string label = "";
for(auto it: labelVec) label += it + " ";
TLatex* latexLabel = new TLatex(0.16,0.96,Form("%s",label.c_str()));
latexLabel -> SetNDC();
latexLabel -> SetTextFont(42);
latexLabel -> SetTextSize(0.03);
latexLabels[ch] = latexLabel;
}
std::vector<Event> events;
//-----------------------
// 1st loop over events
if( maxEntries > 0 ) nEntries = maxEntries;
for(int entry = 0; entry < nEntries; ++entry)
{
if( entry%1000 == 0 ) std::cout << ">>> 1st loop: reading entry " << entry << " / " << nEntries << "\r" << std::flush;
h4 -> GetEntry(entry);
if( !goodRuns[tv.run] ) continue;
std::map<std::string,float> amps;
std::map<std::string,float> times;
for(auto ch: channels)
{
// reconstruct position
ReconstructHodoPosition(tv,opts,ch,bool(doTracking),hodoPlane);
if( doTracking )
{
if( (tv.nFibresOnX[0] < nFibresMin || tv.nFibresOnX[0] > nFibresMax) ) continue;
if( (tv.nFibresOnX[1] < nFibresMin || tv.nFibresOnX[1] > nFibresMax) ) continue;
if( (tv.nFibresOnY[0] < nFibresMin || tv.nFibresOnY[0] > nFibresMax) ) continue;
if( (tv.nFibresOnY[1] < nFibresMin || tv.nFibresOnY[1] > nFibresMax) ) continue;
}
else
{
if( tv.nTracks != 1 ) continue;
}
// fill amplitude and time plots
std::vector<std::string> ampChs = opts.GetOpt<std::vector<std::string> >(Form("%s.ampCh", ch.c_str()));
std::vector<std::string> timeChs = opts.GetOpt<std::vector<std::string> >(Form("%s.timeCh", ch.c_str()));
std::vector<std::string> timeMethods = opts.GetOpt<std::vector<std::string> >(Form("%s.timeMethods",ch.c_str()));
float xtalXMin = opts.GetOpt<float>(Form("%s.xtalXMin",ch.c_str()));
float xtalXMax = opts.GetOpt<float>(Form("%s.xtalXMax",ch.c_str()));
float xtalYMin = opts.GetOpt<float>(Form("%s.xtalYMin",ch.c_str()));
float xtalYMax = opts.GetOpt<float>(Form("%s.xtalYMax",ch.c_str()));
int ampIt = -1;
for( auto ampCh : ampChs )
{
++ampIt;
float amp = tv.amp_max[tv.channelIds[ampCh]] / 4096.;
h_amp[ch+"_"+ampCh] -> Fill( amp );
float ampMin = opts.GetOpt<std::vector<float> >(Form("%s.ampMin",ch.c_str())).at(ampIt);
float ampMax = opts.GetOpt<std::vector<float> >(Form("%s.ampMax",ch.c_str())).at(ampIt);
if( amp > ampMin && amp < ampMax)
{
if( tv.beamY > xtalYMin && tv.beamY < xtalYMax ) p_eff_vs_X[ch+"_"+ampCh] -> Fill( tv.beamX,1. );
if( tv.beamX > xtalXMin && tv.beamX < xtalXMax ) p_eff_vs_Y[ch+"_"+ampCh] -> Fill( tv.beamY,1. );
p2_eff_vs_XY[ch+"_"+ampCh] -> Fill( tv.beamX,tv.beamY,1. );
if( tv.beamY > xtalYMin && tv.beamY < xtalYMax ) p_amp_vs_X[ch+"_"+ampCh] -> Fill( tv.beamX,amp );
if( tv.beamX > xtalXMin && tv.beamX < xtalXMax ) p_amp_vs_Y[ch+"_"+ampCh] -> Fill( tv.beamY,amp );
p2_amp_vs_XY[ch+"_"+ampCh] -> Fill( tv.beamX,tv.beamY,amp );
}
else
{
if( tv.beamY > xtalYMin && tv.beamY < xtalYMax ) p_eff_vs_X[ch+"_"+ampCh] -> Fill( tv.beamX,0. );
if( tv.beamX > xtalXMin && tv.beamX < xtalXMax ) p_eff_vs_Y[ch+"_"+ampCh] -> Fill( tv.beamY,0. );
p2_eff_vs_XY[ch+"_"+ampCh] -> Fill( tv.beamX,tv.beamY,0. );
}
if( tv.beamX < xtalXMin || tv.beamX > xtalXMax ) continue;
if( tv.beamY < xtalYMin || tv.beamY > xtalYMax ) continue;
if( amp < ampMin || amp > ampMax ) continue;
if( isnan(amp) ) continue;
h_amp_cut[ch+"_"+ampCh] -> Fill( amp );
amps[ch+"_"+ampCh] = amp;
std::string timeCh = timeChs.at(ampIt);
float timeMin = opts.GetOpt<float>(Form("%s.timeMin",ch.c_str()));
float timeMax = opts.GetOpt<float>(Form("%s.timeMax",ch.c_str()));
float b_rms = tv.b_rms[tv.channelIds[timeCh]] / 4096.;
h_b_rms[ch+"_"+timeCh] -> Fill( b_rms );
if( b_rms > 0.002 ) continue;
for( auto timeMethod : timeMethods )
{
float tim = tv.time[tv.channelIds[timeCh]+tv.timeMethodIds[timeMethod]];
h_time[ch+"_"+timeCh+"_"+timeMethod] -> Fill( tim );
if( isinf(tim) ) continue;
if( isnan(tim) ) continue;
if( tim < timeMin || tim > timeMax ) continue;
times[ch+"_"+timeCh+"_"+timeMethod] = tim;
}
}
} // loop over channels
Event aEvent;
aEvent.amps = amps;
aEvent.times = times;
aEvent.x = tv.beamX;
aEvent.y = tv.beamY;
events.push_back( aEvent );
for(auto ch: channels)
{
int index = opts.GetOpt<int>(Form("%s.index", ch.c_str()));
std::vector<std::string> ampChs = opts.GetOpt<std::vector<std::string> >(Form("%s.ampCh", ch.c_str()));
std::vector<std::string> timeChs = opts.GetOpt<std::vector<std::string> >(Form("%s.timeCh", ch.c_str()));
std::vector<std::string> timeMethods = opts.GetOpt<std::vector<std::string> >(Form("%s.timeMethods",ch.c_str()));
if( index < 0 ) continue;
std::string time1Ch = timeChs.at(0);
std::string time2Ch = timeChs.at(1);
std::string refCh = opts.GetOpt<std::string>(Form("%s.refCh", ch.c_str()));
std::string timeChRef = opts.GetOpt<std::string>(Form("%s.timeCh",refCh.c_str()));
std::string timeMethodRef = opts.GetOpt<std::vector<std::string> >(Form("%s.timeMethods",refCh.c_str())).at(0);
for( auto timeMethod : timeMethods )
{
std::string label1 = ch+"_"+time1Ch+"_"+timeMethod;
std::string label2 = ch+"_"+time2Ch+"_"+timeMethod;
std::string labelRef = refCh+"_"+timeChRef+"_"+timeMethodRef;
if( (times.count(label1) > 0) && (times.count(labelRef) > 0) )
h_CTR_raw[ch+"_"+timeMethod+"__1-ref"] -> Fill( times[label1]-times[labelRef] );
if( (times.count(label2) > 0) && (times.count(labelRef) > 0) )
h_CTR_raw[ch+"_"+timeMethod+"__2-ref"] -> Fill( times[label2]-times[labelRef] );
if( (times.count(label1) > 0) && (times.count(label2) > 0) && (times.count(labelRef) > 0) )
h_CTR_raw[ch+"_"+timeMethod+"__avg-ref"] -> Fill( 0.5*(times[label1]+times[label2])-times[labelRef] );
if( (times.count(label1) > 0) && (times.count(label2) > 0) )
h_CTR_raw[ch+"_"+timeMethod+"__diff"] -> Fill( 0.5*(times[label2]-times[label1]) );
}
}
}
std::cout << "\n>>> end 1st loop" << std::endl;
//--- draw 1st plots
for(auto ch: channels)
{
std::vector<std::string> ampChs = opts.GetOpt<std::vector<std::string> >(Form("%s.ampCh", ch.c_str()));
std::vector<std::string> timeChs = opts.GetOpt<std::vector<std::string> >(Form("%s.timeCh", ch.c_str()));
std::vector<std::string> timeMethods = opts.GetOpt<std::vector<std::string> >(Form("%s.timeMethods",ch.c_str()));
int ampIt = 0;
for( auto ampCh : ampChs )
{
float ampMin = opts.GetOpt<std::vector<float> >(Form("%s.ampMin",ch.c_str())).at(ampIt);
float ampMax = opts.GetOpt<std::vector<float> >(Form("%s.ampMax",ch.c_str())).at(ampIt);
float timeMin = opts.GetOpt<float>(Form("%s.timeMin",ch.c_str()));
float timeMax = opts.GetOpt<float>(Form("%s.timeMax",ch.c_str()));
float xtalXMin = opts.GetOpt<float>(Form("%s.xtalXMin",ch.c_str()));
float xtalXMax = opts.GetOpt<float>(Form("%s.xtalXMax",ch.c_str()));
float xtalYMin = opts.GetOpt<float>(Form("%s.xtalYMin",ch.c_str()));
float xtalYMax = opts.GetOpt<float>(Form("%s.xtalYMax",ch.c_str()));
float ampLow = h_amp_cut[ch+"_"+ampCh]->GetMean()-1.*h_amp_cut[ch+"_"+ampCh]->GetRMS();
float ampHig = h_amp_cut[ch+"_"+ampCh]->GetMean()+1.*h_amp_cut[ch+"_"+ampCh]->GetRMS();
TLine* line_min_amp = new TLine(ampMin,h_amp[ch+"_"+ampCh]->GetMinimum(),ampMin,h_amp[ch+"_"+ampCh]->GetMaximum());
TLine* line_max_amp = new TLine(ampMax,h_amp[ch+"_"+ampCh]->GetMinimum(),ampMax,h_amp[ch+"_"+ampCh]->GetMaximum());
std::vector<TLine*> lines_amp;
lines_amp.push_back(line_min_amp);
lines_amp.push_back(line_max_amp);
TLine* line_xtalXLow = new TLine(xtalXMin,xtalYMin,xtalXMax,xtalYMin);
line_xtalXLow -> SetLineStyle(2);
line_xtalXLow -> SetLineWidth(3);
line_xtalXLow -> SetLineColor(kMagenta);
TLine* line_xtalXHig = new TLine(xtalXMin,xtalYMax,xtalXMax,xtalYMax);
line_xtalXHig -> SetLineStyle(2);
line_xtalXHig -> SetLineWidth(3);
line_xtalXHig -> SetLineColor(kMagenta);
TLine* line_xtalYLow = new TLine(xtalXMin,xtalYMin,xtalXMin,xtalYMax);
line_xtalYLow -> SetLineStyle(2);
line_xtalYLow -> SetLineWidth(3);
line_xtalYLow -> SetLineColor(kMagenta);
TLine* line_xtalYHig = new TLine(xtalXMax,xtalYMin,xtalXMax,xtalYMax);
line_xtalYHig -> SetLineStyle(2);
line_xtalYHig -> SetLineWidth(3);
line_xtalYHig -> SetLineColor(kRed);
std::vector<TLine*> lines_xtal;
lines_xtal.push_back(line_xtalXLow);
lines_xtal.push_back(line_xtalXHig);
lines_xtal.push_back(line_xtalYLow);
lines_xtal.push_back(line_xtalYHig);
c = new TCanvas();
std::vector<TH1F*> h_amps;
h_amps.push_back(h_amp[ch+"_"+ampCh]);
h_amps.push_back(h_amp_cut[ch+"_"+ampCh]);
DrawHistogram(opts,ch,h_amps, ";amplitude [V];entries", 0.,1.1*ampMax,4,true,latexLabels[ch],&lines_amp,true,ampMin,0.6);
PrintCanvas(c,opts,ch,plotDir,Form("1_amp_%d",ampIt));
delete c;
std::string timeCh = timeChs.at(ampIt);
c = new TCanvas();
DrawHistogram(opts,ch,h_b_rms[ch+"_"+timeCh], ";baseline RMS [V];entries", 0.00001,0.1,1,true,latexLabels[ch]);
gPad -> SetLogx();
PrintCanvas(c,opts,ch,plotDir,Form("1_b_rms_%d_%s",ampIt,timeCh.c_str()));
delete c;
for( auto timeMethod : timeMethods )
{
TLine* line_min_time = new TLine(timeMin,h_time[ch+"_"+timeCh+"_"+timeMethod]->GetMinimum(),timeMin,h_time[ch+"_"+timeCh+"_"+timeMethod]->GetMaximum());
TLine* line_max_time = new TLine(timeMax,h_time[ch+"_"+timeCh+"_"+timeMethod]->GetMinimum(),timeMax,h_time[ch+"_"+timeCh+"_"+timeMethod]->GetMaximum());
std::vector<TLine*> lines_time;
lines_time.push_back(line_min_time);
lines_time.push_back(line_max_time);
c = new TCanvas();
DrawHistogram(opts,ch,h_time[ch+"_"+timeCh+"_"+timeMethod], ";time [ns];entries", 0.,200., 1,true,latexLabels[ch],&lines_time);
PrintCanvas(c,opts,ch,plotDir,Form("1_time_%d_%s",ampIt,timeMethod.c_str()));
delete c;
}
c = new TCanvas("c","c",2000,600);
c -> Divide(3,1);
c->cd(1); DrawProfile (opts,ch,p_eff_vs_X[ch+"_"+ampCh], ";hodoscope x [mm];efficiency", -10.,40.,0.001,1.1,kBlack,"",latexLabels[ch]);
c->cd(2); DrawProfile (opts,ch,p_eff_vs_Y[ch+"_"+ampCh], ";hodoscope y [mm];efficiency", 0.,50.,0.001,1.1,kBlack,"",latexLabels[ch]);
c->cd(3); DrawProfile2D(opts,ch,p2_eff_vs_XY[ch+"_"+ampCh],";hodoscope x [mm];hodoscope y [mm];efficiency",-10.,40.,0.,50.,0.001,1.1,latexLabels[ch],&lines_xtal);
PrintCanvas(c,opts,ch,plotDir,Form("1_eff_vs_XY_%d",ampIt)); delete c;
c = new TCanvas("c","c",2000,600);
c -> Divide(3,1);
c->cd(1); DrawProfile (opts,ch,p_amp_vs_X[ch+"_"+ampCh], ";hodoscope x [mm];amplitude [V]", xtalXMin,xtalXMax,ampLow,ampHig,kBlack,"",latexLabels[ch]);
c->cd(2); DrawProfile (opts,ch,p_amp_vs_Y[ch+"_"+ampCh], ";hodoscope y [mm];amplitude [V]", xtalYMin,xtalYMax,ampLow,ampHig,kBlack,"",latexLabels[ch]);
c->cd(3); DrawProfile2D(opts,ch,p2_amp_vs_XY[ch+"_"+ampCh],";hodoscope x [mm];hodoscope y [mm];amplitude [V]",xtalXMin,xtalXMax,xtalYMin,xtalYMax,ampLow,ampHig,latexLabels[ch]);
PrintCanvas(c,opts,ch,plotDir,Form("1_amp_vs_XY_%d",ampIt)); delete c;
++ampIt;
}
}
//--- find CTR ranges
std::map<std::string,float> CTRRanges_mean;
std::map<std::string,float> CTRRanges_sigma;
for(auto mapIt : h_CTR_raw)
{
histo = mapIt.second;
float* vals = new float[6];
FindSmallestInterval(vals,histo,0.68);
float mean = vals[0];
float min = vals[4];
float max = vals[5];
float delta = max-min;
float sigma = 0.5*delta;
CTRRanges_mean[mapIt.first] = mean;
CTRRanges_sigma[mapIt.first] = sigma;
std::cout << ">>> " << mapIt.first << " CTR mean: " << CTRRanges_mean[mapIt.first] << " CTR sigma: " << CTRRanges_sigma[mapIt.first] << std::endl;
outFile -> cd();
histo -> Write();
}
//------------------------
//--- 2nd loop over events
int entry = 0;
nEntries = events.size();
for(auto event: events)
{
if( entry%1000 == 0 ) std::cout << ">>> 2nd loop: reading entry " << entry << " / " << nEntries << "\r" << std::flush;
++entry;
std::map<std::string,float> amps = event.amps;
std::map<std::string,float> times = event.times;
for(auto ch: channels)
{
int index = opts.GetOpt<int>(Form("%s.index", ch.c_str()));
if( index < 0 ) continue;
std::vector<std::string> ampChs = opts.GetOpt<std::vector<std::string> >(Form("%s.ampCh", ch.c_str()));
std::vector<std::string> timeChs = opts.GetOpt<std::vector<std::string> >(Form("%s.timeCh",ch.c_str()));
std::vector<std::string> timeMethods = opts.GetOpt<std::vector<std::string> >(Form("%s.timeMethods",ch.c_str()));
std::string refCh = opts.GetOpt<std::string>(Form("%s.refCh", ch.c_str()));
std::string timeChRef = opts.GetOpt<std::string>(Form("%s.timeCh",refCh.c_str()));
std::string timeMethodRef = opts.GetOpt<std::vector<std::string> >(Form("%s.timeMethods",refCh.c_str())).at(0);
int timeIt = 0;
for(auto timeCh : timeChs)
{
std::string ampCh = ampChs.at(timeIt);
for(auto timeMethod : timeMethods)
{
std::string label = ch+"_"+timeCh+"_"+timeMethod;
std::string labelRef = refCh+"_"+timeChRef+"_"+timeMethodRef;
float timeLow = CTRRanges_mean[ch+"_"+timeMethod+Form("__%d-ref",timeIt+1)]-2.*CTRRanges_sigma[ch+"_"+timeMethod+Form("__%d-ref",timeIt+1)];
float timeHig = CTRRanges_mean[ch+"_"+timeMethod+Form("__%d-ref",timeIt+1)]+2.*CTRRanges_sigma[ch+"_"+timeMethod+Form("__%d-ref",timeIt+1)];
if( (times[label]-times[labelRef]) < timeLow ||
(times[label]-times[labelRef]) > timeHig )
continue;
if( (times.count(label) > 0) && (times.count(labelRef) > 0) )
p_time_vs_amp[label] -> Fill( amps[ch+"_"+ampCh],times[label]-times[labelRef] );
}
++timeIt;
}
}
}
std::cout << "\n>>> end 2nd loop" << std::endl;
//--- draw 2nd plots
std::map<std::string,TF1*> fitFunc_corrAmp;
for(auto ch: channels)
{
int index = opts.GetOpt<int>(Form("%s.index", ch.c_str()));
if( index < 0 ) continue;
std::vector<std::string> ampChs = opts.GetOpt<std::vector<std::string> >(Form("%s.ampCh",ch.c_str()));
std::vector<std::string> timeChs = opts.GetOpt<std::vector<std::string> >(Form("%s.timeCh",ch.c_str()));
std::vector<std::string> timeMethods = opts.GetOpt<std::vector<std::string> >(Form("%s.timeMethods",ch.c_str()));
int timeIt = 0;
for(auto timeCh : timeChs)
{
std::string ampCh = ampChs.at(timeIt);
float ampMin = opts.GetOpt<std::vector<float> >(Form("%s.ampMin",ch.c_str())).at(timeIt);
float ampMax = opts.GetOpt<std::vector<float> >(Form("%s.ampMax",ch.c_str())).at(timeIt);
for(auto timeMethod : timeMethods)
{
std::string label = ch+"_"+timeCh+"_"+timeMethod;
prof = p_time_vs_amp[label];
float timeLow = CTRRanges_mean[ch+"_"+timeMethod+Form("__%d-ref",timeIt+1)]-4.*CTRRanges_sigma[ch+"_"+timeMethod+Form("__%d-ref",timeIt+1)];
float timeHig = CTRRanges_mean[ch+"_"+timeMethod+Form("__%d-ref",timeIt+1)]+3.*CTRRanges_sigma[ch+"_"+timeMethod+Form("__%d-ref",timeIt+1)];
std::string fitFunc = opts.GetOpt<std::string>(Form("%s.fitFunc",ch.c_str()));
float fitXMin = opts.GetOpt<float>(Form("%s.fitFunc",ch.c_str()),1);
float fitXMax = opts.GetOpt<float>(Form("%s.fitFunc",ch.c_str()),2);
int nPar = opts.OptExist(Form("%s.fitFunc",ch.c_str()),3) ? opts.GetOpt<int>(Form("%s.fitFunc",ch.c_str()),3) : 0;
fitFunc_corrAmp[label] = new TF1(Form("fitFunc_corrAmp_%s",label.c_str()),fitFunc.c_str(),ampMin,ampMax);
for(int iPar = 0; iPar < nPar; ++iPar)
fitFunc_corrAmp[label] -> SetParameter(iPar,opts.GetOpt<float>(Form("%s.fitFunc",ch.c_str()),4+iPar));
prof -> Fit(fitFunc_corrAmp[label],"QNRS+","",fitXMin,fitXMax);
c = new TCanvas();
DrawProfile(opts,ch,p_time_vs_amp[label],";amplitude [V];#Delta_{t} [ns]",ampMin,ampMax,timeLow,timeHig,kBlack,"",latexLabels[ch],fitFunc_corrAmp[label],h_amp_cut[ch+"_"+ampCh]->GetMean());
PrintCanvas(c,opts,ch,plotDir,Form("2_time_vs_amp_%d_%s",timeIt,timeMethod.c_str()));
delete c;
}
++timeIt;
}
}
//------------------------
//--- 3rd loop over events
std::map<std::string,TH1F*> h_CTR;
std::map<std::string,TH1F*> h_CTR_ampCorr;
for(auto mapIt : h_CTR_raw)
{
h_CTR[mapIt.first] = new TH1F(Form("h_CTR_%s",mapIt.first.c_str()),"",1000,CTRRanges_mean[mapIt.first]-5.*CTRRanges_sigma[mapIt.first],CTRRanges_mean[mapIt.first]+5.*CTRRanges_sigma[mapIt.first]);
h_CTR_ampCorr[mapIt.first] = new TH1F(Form("h_CTR_ampCorr_%s",mapIt.first.c_str()),"",1000,CTRRanges_mean[mapIt.first]-5.*CTRRanges_sigma[mapIt.first],CTRRanges_mean[mapIt.first]+5.*CTRRanges_sigma[mapIt.first]);
}
std::map<std::string,TF1*> fitFunc_corrPos;
entry = 0;
for(auto event: events)
{
if( entry%1000 == 0 ) std::cout << ">>> 3rd loop: reading entry " << entry << " / " << nEntries << "\r" << std::flush;
++entry;
std::map<std::string,float> amps = event.amps;
std::map<std::string,float> times = event.times;
for(auto ch: channels)
{
int index = opts.GetOpt<int>(Form("%s.index", ch.c_str()));
if( index < 0 ) continue;
std::vector<std::string> ampChs = opts.GetOpt<std::vector<std::string> >(Form("%s.ampCh", ch.c_str()));
std::vector<std::string> timeChs = opts.GetOpt<std::vector<std::string> >(Form("%s.timeCh",ch.c_str()));
std::vector<std::string> timeMethods = opts.GetOpt<std::vector<std::string> >(Form("%s.timeMethods",ch.c_str()));
std::string ampCh1 = ampChs.at(0);
std::string ampCh2 = ampChs.at(1);
std::string timeCh1 = timeChs.at(0);
std::string timeCh2 = timeChs.at(1);
std::string refCh = opts.GetOpt<std::string>(Form("%s.refCh", ch.c_str()));
std::string timeChRef = opts.GetOpt<std::string>(Form("%s.timeCh",refCh.c_str()));
std::string timeMethodRef = opts.GetOpt<std::vector<std::string> >(Form("%s.timeMethods",refCh.c_str())).at(0);
for(auto timeMethod : timeMethods)
{
std::string label1 = ch+"_"+timeCh1+"_"+timeMethod;
std::string label2 = ch+"_"+timeCh2+"_"+timeMethod;
std::string labelRef = refCh+"_"+timeChRef+"_"+timeMethodRef;
float timeLow1 = CTRRanges_mean[ch+"_"+timeMethod+"__1-ref"]-4.*CTRRanges_sigma[ch+"_"+timeMethod+"__1-ref"];
float timeHig1 = CTRRanges_mean[ch+"_"+timeMethod+"__1-ref"]+4.*CTRRanges_sigma[ch+"_"+timeMethod+"__1-ref"];
float timeLow2 = CTRRanges_mean[ch+"_"+timeMethod+"__2-ref"]-4.*CTRRanges_sigma[ch+"_"+timeMethod+"__2-ref"];
float timeHig2 = CTRRanges_mean[ch+"_"+timeMethod+"__2-ref"]+4.*CTRRanges_sigma[ch+"_"+timeMethod+"__2-ref"];
float timeLowAvg = CTRRanges_mean[ch+"_"+timeMethod+"__avg-ref"]-4.*CTRRanges_sigma[ch+"_"+timeMethod+"__avg-ref"];
float timeHigAvg = CTRRanges_mean[ch+"_"+timeMethod+"__avg-ref"]+4.*CTRRanges_sigma[ch+"_"+timeMethod+"__avg-ref"];
if( (times.count(label1) > 0) && (times.count(labelRef) > 0) )
{
float CTR = times[label1]-times[labelRef];
if( CTR >= timeLow1 && CTR <= timeHig1 )
{
h_CTR[ch+"_"+timeMethod+"__1-ref"] -> Fill( CTR );
float CTR_ampCorr = CTR - fitFunc_corrAmp[label1]->Eval(amps[ch+"_"+ampCh1]) + fitFunc_corrAmp[label1]->Eval( h_amp_cut[ch+"_"+ampCh1]->GetMean() );
h_CTR_ampCorr[ch+"_"+timeMethod+"__1-ref"] -> Fill( CTR_ampCorr );
p_time_ampCorr_vs_amp[label1] -> Fill( amps[ch+"_"+ampCh1],CTR_ampCorr );
p_time_ampCorr_vs_X[label1] -> Fill( event.x,CTR_ampCorr );
p_time_ampCorr_vs_Y[label1] -> Fill( event.y,CTR_ampCorr );
p2_time_ampCorr_vs_XY[label1] -> Fill( event.x,event.y,CTR_ampCorr );
}
}
if( (times.count(label2) > 0) && (times.count(labelRef) > 0) )
{
float CTR = times[label2]-times[labelRef];
if( CTR >= timeLow2 && CTR <= timeHig2 )
{
h_CTR[ch+"_"+timeMethod+"__2-ref"] -> Fill( CTR );
float CTR_ampCorr = CTR - fitFunc_corrAmp[label2]->Eval(amps[ch+"_"+ampCh2]) + fitFunc_corrAmp[label2]->Eval( h_amp_cut[ch+"_"+ampCh2]->GetMean() );
h_CTR_ampCorr[ch+"_"+timeMethod+"__2-ref"] -> Fill( CTR_ampCorr );
p_time_ampCorr_vs_amp[label2] -> Fill( amps[ch+"_"+ampCh2],CTR_ampCorr );
p_time_ampCorr_vs_X[label2] -> Fill( event.x,CTR_ampCorr );
p_time_ampCorr_vs_Y[label2] -> Fill( event.y,CTR_ampCorr );
p2_time_ampCorr_vs_XY[label2] -> Fill( event.x,event.y,CTR_ampCorr );
}
}
if( (times.count(label1) > 0) && (times.count(label2) > 0) && (times.count(labelRef) > 0) )
{
float CTR = 0.5*(times[label1]+times[label2])-times[labelRef];
if( CTR >= timeLowAvg && CTR <= timeHigAvg )
{
h_CTR[ch+"_"+timeMethod+"__avg-ref"] -> Fill( CTR );
float CTR_ampCorr = CTR - 0.5*fitFunc_corrAmp[label1]->Eval(amps[ch+"_"+ampCh1]) + 0.5*fitFunc_corrAmp[label1]->Eval( h_amp_cut[ch+"_"+ampCh1]->GetMean() )
- 0.5*fitFunc_corrAmp[label2]->Eval(amps[ch+"_"+ampCh2]) + 0.5*fitFunc_corrAmp[label2]->Eval( h_amp_cut[ch+"_"+ampCh2]->GetMean() );
h_CTR_ampCorr[ch+"_"+timeMethod+"__avg-ref"] -> Fill( CTR_ampCorr );
p_time_ampCorr_vs_X[ch+"_"+timeMethod+"__avg-ref"] -> Fill( event.x,CTR_ampCorr );
p_time_ampCorr_vs_Y[ch+"_"+timeMethod+"__avg-ref"] -> Fill( event.y,CTR_ampCorr );
p2_time_ampCorr_vs_XY[ch+"_"+timeMethod+"__avg-ref"] -> Fill( event.x,event.y,CTR_ampCorr );
}
}
}
}
}
std::cout << "\n>>> end 3rd loop" << std::endl;
//--- draw 3rd plots
std::map<std::string,CTRResult> ctrResults_ampCorr;
int rebin = opts.GetOpt<int>("Input.rebin");
TLatex* latexLabel12 = new TLatex(0.13,0.97,Form("%s",""));
std::map<std::string,TGraphErrors*> g_tRes_vs_thr;
for(auto ch: channels)
{
int index = opts.GetOpt<int>(Form("%s.index", ch.c_str()));
std::vector<std::string> ampChs = opts.GetOpt<std::vector<std::string> >(Form("%s.ampCh",ch.c_str()));
std::vector<std::string> timeChs = opts.GetOpt<std::vector<std::string> >(Form("%s.timeCh",ch.c_str()));
std::vector<std::string> timeMethods = opts.GetOpt<std::vector<std::string> >(Form("%s.timeMethods",ch.c_str()));
float xtalXMin = opts.GetOpt<float>(Form("%s.xtalXMin",ch.c_str()));
float xtalXMax = opts.GetOpt<float>(Form("%s.xtalXMax",ch.c_str()));
if( index < 0 ) continue;
int timeIt = 0;
for(auto timeCh : timeChs)
{
std::string ampCh = ampChs.at(timeIt);
float ampMin = opts.GetOpt<std::vector<float> >(Form("%s.ampMin",ch.c_str())).at(timeIt);
float ampMax = opts.GetOpt<std::vector<float> >(Form("%s.ampMax",ch.c_str())).at(timeIt);
for(auto timeMethod : timeMethods)
{
std::string label = ch+"_"+timeCh+"_"+timeMethod;
float timeLow = CTRRanges_mean[ch+"_"+timeMethod+Form("__%d-ref",timeIt+1)]-4.*CTRRanges_sigma[ch+"_"+timeMethod+Form("__%d-ref",timeIt+1)];
float timeHig = CTRRanges_mean[ch+"_"+timeMethod+Form("__%d-ref",timeIt+1)]+3.*CTRRanges_sigma[ch+"_"+timeMethod+Form("__%d-ref",timeIt+1)];
c = new TCanvas();
DrawProfile(opts,ch,p_time_ampCorr_vs_amp[label],";amplitude [V];#Delta_{t} [ns]",ampMin,ampMax,timeLow,timeHig,kBlack,"",latexLabels[ch]);
PrintCanvas(c,opts,ch,plotDir,Form("3_time_ampCorr_vs_amp_%d_%s",timeIt,timeMethod.c_str()));
delete c;
}
++timeIt;
}
for(auto timeMethod : timeMethods)
{
std::string label1 = ch+"_"+timeChs.at(0)+"_"+timeMethod;
std::string label2 = ch+"_"+timeChs.at(1)+"_"+timeMethod;
float timeLow1 = CTRRanges_mean[ch+"_"+timeMethod+Form("__%d-ref",1)]-4.*CTRRanges_sigma[ch+"_"+timeMethod+Form("__%d-ref",1)];
float timeHig1 = CTRRanges_mean[ch+"_"+timeMethod+Form("__%d-ref",1)]+3.*CTRRanges_sigma[ch+"_"+timeMethod+Form("__%d-ref",1)];
float timeLow2 = CTRRanges_mean[ch+"_"+timeMethod+Form("__%d-ref",2)]-4.*CTRRanges_sigma[ch+"_"+timeMethod+Form("__%d-ref",2)];
float timeHig2 = CTRRanges_mean[ch+"_"+timeMethod+Form("__%d-ref",2)]+3.*CTRRanges_sigma[ch+"_"+timeMethod+Form("__%d-ref",2)];
fitFunc_corrPos[ch+"_"+timeMethod+"__avg-ref"] = new TF1(Form("fitFunc_corrPos_%s",(ch+"_"+timeMethod+"__avg-ref").c_str()),"pol2",xtalXMin,xtalXMax);
p_time_ampCorr_vs_X[ch+"_"+timeMethod+"__avg-ref"] -> Fit(fitFunc_corrPos[ch+"_"+timeMethod+"__avg-ref"],"QNRS+","",xtalXMin,xtalXMax);
fitFunc_corrPos[ch+"_"+timeMethod+"__avg-ref"] -> SetLineColor(kBlack);
std::vector<TProfile*> profs;
profs.push_back(p_time_ampCorr_vs_X[label1]);
profs.push_back(p_time_ampCorr_vs_X[label2]);
profs.push_back(p_time_ampCorr_vs_X[ch+"_"+timeMethod+"__avg-ref"]);
std::vector<int> colors;
colors.push_back(kRed);
colors.push_back(kBlue);
colors.push_back(kBlack);
c = new TCanvas();
DrawProfile(opts,ch,profs,";x [mm];#Delta_{t} [ns]",xtalXMin,xtalXMax,std::min(timeLow1,timeLow2),std::max(timeHig1,timeHig2),colors,"",latexLabels[ch]);
fitFunc_corrPos[ch+"_"+timeMethod+"__avg-ref"] -> Draw("same");
PrintCanvas(c,opts,ch,plotDir,Form("3_time_ampCorr_vs_X_%s",timeMethod.c_str()));
delete c;
}
float intrinsic = opts.GetOpt<float>(Form("%s.intrinsic",ch.c_str()));
std::string shortLabel = opts.GetOpt<std::string>(Form("%s.shortLabel",ch.c_str()));
g_tRes_vs_thr[ch+"_ampCorr"] = new TGraphErrors();
for(auto timeMethod : timeMethods)
{
c = new TCanvas(Form("c_CTR_ampCorr"),Form("c_CTR_ampCorr"));
TH1F* histoAvg = h_CTR_ampCorr[ch+"_"+timeMethod+"__avg-ref"];
TH1F* histo1 = h_CTR_ampCorr[ch+"_"+timeMethod+"__1-ref"];
TH1F* histo2 = h_CTR_ampCorr[ch+"_"+timeMethod+"__2-ref"];
if( intrinsic < 0 )
{
ctrResults_ampCorr[ch+"_"+timeMethod+"__1-ref"] = drawCTRPlot(histo1,"amp. walk corr.",rebin,false,false,-1.,Form(";#Deltat [ns]"),latexLabel12,NULL,"",NULL,"");
ctrResults_ampCorr[ch+"_"+timeMethod+"__2-ref"] = drawCTRPlot(histo2,"amp. walk corr.",rebin,false,false,-1.,Form(";#Deltat [ns]"),latexLabel12,NULL,"",NULL,"");
ctrResults_ampCorr[ch+"_"+timeMethod+"__avg-ref"] = drawCTRPlot(histoAvg,"amp. walk corr.",rebin,false,false,-1.,Form(";#Deltat [ns]"),latexLabel12,histo1,"1",histo2,"2");
}
else
{
ctrResults_ampCorr[ch+"_"+timeMethod+"__1-ref"] = drawCTRPlot(histo1,"amp. walk corr.",rebin,false,true,intrinsic,Form(";#Deltat [ns]"),latexLabel12,NULL,"",NULL,"");
ctrResults_ampCorr[ch+"_"+timeMethod+"__2-ref"] = drawCTRPlot(histo2,"amp. walk corr.",rebin,false,true,intrinsic,Form(";#Deltat [ns]"),latexLabel12,NULL,"",NULL,"");
ctrResults_ampCorr[ch+"_"+timeMethod+"__avg-ref"] = drawCTRPlot(histoAvg,"amp. walk corr.",rebin,false,true,intrinsic,Form(";#Deltat [ns]"),latexLabel12,histo1,"1",histo2,"2");
}
// t_CTR_ampCorr_effSigma[ch] = ctrResults.effSigma;
// t_CTR_ampCorr_gausSigma[ch] = ctrResults.gausSigma;
// t_CTR_ampCorr_gausSigmaErr[ch] = ctrResults.gausSigmaErr;
latexLabels[ch] -> Draw("same");
gPad -> Update();
c -> Print(Form("%s/c_3_tRes_ampCorr_%s_%s.png",plotDir.c_str(),timeMethod.c_str(),shortLabel.c_str()));
c -> Print(Form("%s/c_3_tRes_ampCorr_%s_%s.pdf",plotDir.c_str(),timeMethod.c_str(),shortLabel.c_str()));
std::string tm(timeMethod);
double x = atof((tm.erase(0,3)).c_str())/4096.;
g_tRes_vs_thr[ch+"_ampCorr"] -> SetPoint(g_tRes_vs_thr[ch+"_ampCorr"]->GetN(),x,ctrResults_ampCorr[ch+"_"+timeMethod+"__avg-ref"].gausSigma);
g_tRes_vs_thr[ch+"_ampCorr"] -> SetPointError(g_tRes_vs_thr[ch+"_ampCorr"]->GetN()-1,0.,ctrResults_ampCorr[ch+"_"+timeMethod+"__avg-ref"].gausSigmaErr);
delete c;
}
}
//------------------------
//--- 4th loop over events
std::map<std::string,TH1F*> h_CTR_ampCorr_posCorr;
std::map<std::string,TH1F*> h_CTR_ampCorr_posCorr_weighted;
for(auto mapIt : h_CTR_raw)
{
h_CTR_ampCorr_posCorr[mapIt.first] = new TH1F(Form("h_CTR_ampCorr_posCorr_%s",mapIt.first.c_str()),"",1000,CTRRanges_mean[mapIt.first]-5.*CTRRanges_sigma[mapIt.first],CTRRanges_mean[mapIt.first]+5.*CTRRanges_sigma[mapIt.first]);
h_CTR_ampCorr_posCorr_weighted[mapIt.first] = new TH1F(Form("h_CTR_ampCorr_posCorr_weighted_%s",mapIt.first.c_str()),"",1000,CTRRanges_mean[mapIt.first]-5.*CTRRanges_sigma[mapIt.first],CTRRanges_mean[mapIt.first]+5.*CTRRanges_sigma[mapIt.first]);
}
entry = 0;
for(auto event: events)
{
if( entry%1000 == 0 ) std::cout << ">>> 4th loop: reading entry " << entry << " / " << nEntries << "\r" << std::flush;
++entry;
std::map<std::string,float> amps = event.amps;
std::map<std::string,float> times = event.times;
for(auto ch: channels)
{
int index = opts.GetOpt<int>(Form("%s.index", ch.c_str()));
if( index < 0 ) continue;
std::vector<std::string> ampChs = opts.GetOpt<std::vector<std::string> >(Form("%s.ampCh", ch.c_str()));
std::vector<std::string> timeChs = opts.GetOpt<std::vector<std::string> >(Form("%s.timeCh",ch.c_str()));
std::vector<std::string> timeMethods = opts.GetOpt<std::vector<std::string> >(Form("%s.timeMethods",ch.c_str()));
float xtalXMin = opts.GetOpt<float>(Form("%s.xtalXMin",ch.c_str()));
float xtalXMax = opts.GetOpt<float>(Form("%s.xtalXMax",ch.c_str()));
std::string ampCh1 = ampChs.at(0);
std::string ampCh2 = ampChs.at(1);
std::string timeCh1 = timeChs.at(0);
std::string timeCh2 = timeChs.at(1);
std::string refCh = opts.GetOpt<std::string>(Form("%s.refCh", ch.c_str()));
std::string timeChRef = opts.GetOpt<std::string>(Form("%s.timeCh",refCh.c_str()));
std::string timeMethodRef = opts.GetOpt<std::vector<std::string> >(Form("%s.timeMethods",refCh.c_str())).at(0);
for(auto timeMethod : timeMethods)
{
std::string label1 = ch+"_"+timeCh1+"_"+timeMethod;
std::string label2 = ch+"_"+timeCh2+"_"+timeMethod;
std::string labelRef = refCh+"_"+timeChRef+"_"+timeMethodRef;
float timeLow1 = CTRRanges_mean[ch+"_"+timeMethod+"__1-ref"]-4.*CTRRanges_sigma[ch+"_"+timeMethod+"__1-ref"];
float timeHig1 = CTRRanges_mean[ch+"_"+timeMethod+"__1-ref"]+4.*CTRRanges_sigma[ch+"_"+timeMethod+"__1-ref"];
float timeLow2 = CTRRanges_mean[ch+"_"+timeMethod+"__2-ref"]-4.*CTRRanges_sigma[ch+"_"+timeMethod+"__2-ref"];
float timeHig2 = CTRRanges_mean[ch+"_"+timeMethod+"__2-ref"]+4.*CTRRanges_sigma[ch+"_"+timeMethod+"__2-ref"];
float timeLowAvg = CTRRanges_mean[ch+"_"+timeMethod+"__avg-ref"]-4.*CTRRanges_sigma[ch+"_"+timeMethod+"__avg-ref"];
float timeHigAvg = CTRRanges_mean[ch+"_"+timeMethod+"__avg-ref"]+4.*CTRRanges_sigma[ch+"_"+timeMethod+"__avg-ref"];
if( (times.count(label1) > 0) && (times.count(label2) > 0) && (times.count(labelRef) > 0) )
{
float CTR = 0.5*(times[label1]+times[label2])-times[labelRef];
if( CTR >= timeLowAvg && CTR <= timeHigAvg )
{
h_CTR[ch+"_"+timeMethod+"__avg-ref"] -> Fill( CTR );
float CTR_ampCorr = CTR - 0.5*fitFunc_corrAmp[label1]->Eval(amps[ch+"_"+ampCh1]) + 0.5*fitFunc_corrAmp[label1]->Eval( h_amp_cut[ch+"_"+ampCh1]->GetMean() )
- 0.5*fitFunc_corrAmp[label2]->Eval(amps[ch+"_"+ampCh2]) + 0.5*fitFunc_corrAmp[label2]->Eval( h_amp_cut[ch+"_"+ampCh2]->GetMean() );
float CTR_ampCorr_posCorr = CTR_ampCorr - fitFunc_corrPos[ch+"_"+timeMethod+"__avg-ref"]->Eval(event.x) + fitFunc_corrPos[ch+"_"+timeMethod+"__avg-ref"]->Eval(0.5*(xtalXMin+xtalXMax));
h_CTR_ampCorr_posCorr[ch+"_"+timeMethod+"__avg-ref"] -> Fill( CTR_ampCorr_posCorr );
float sigma1 = ctrResults_ampCorr[ch+"_"+timeMethod+"__1-ref"].gausSigma;
float sigma2 = ctrResults_ampCorr[ch+"_"+timeMethod+"__2-ref"].gausSigma;
float time1 = times[label1] - fitFunc_corrAmp[label1]->Eval(amps[ch+"_"+ampCh1]) + fitFunc_corrAmp[label1]->Eval( h_amp_cut[ch+"_"+ampCh1]->GetMean() );
float time2 = times[label2] - fitFunc_corrAmp[label2]->Eval(amps[ch+"_"+ampCh2]) + fitFunc_corrAmp[label2]->Eval( h_amp_cut[ch+"_"+ampCh2]->GetMean() );
float CTR_ampCorr_posCorr_weighted = ( time1/pow(sigma1,2) + time2/pow(sigma2,2) ) / ( 1/pow(sigma1,2) + 1/pow(sigma2,2) ) - times[labelRef] - fitFunc_corrPos[ch+"_"+timeMethod+"__avg-ref"]->Eval(event.x) + fitFunc_corrPos[ch+"_"+timeMethod+"__avg-ref"]->Eval(0.5*(xtalXMin+xtalXMax));
h_CTR_ampCorr_posCorr_weighted[ch+"_"+timeMethod+"__avg-ref"] -> Fill( CTR_ampCorr_posCorr_weighted );
}
}
}
}
}
std::cout << "\n>>> end 4th loop" << std::endl;
//--- draw 4th plots
std::map<std::string,CTRResult> ctrResults_ampCorr_posCorr;
std::map<std::string,CTRResult> ctrResults_ampCorr_posCorr_weighted;
for(auto ch: channels)
{
int index = opts.GetOpt<int>(Form("%s.index", ch.c_str()));
std::vector<std::string> ampChs = opts.GetOpt<std::vector<std::string> >(Form("%s.ampCh",ch.c_str()));
std::vector<std::string> timeChs = opts.GetOpt<std::vector<std::string> >(Form("%s.timeCh",ch.c_str()));
std::vector<std::string> timeMethods = opts.GetOpt<std::vector<std::string> >(Form("%s.timeMethods",ch.c_str()));
if( index < 0 ) continue;
float intrinsic = opts.GetOpt<float>(Form("%s.intrinsic",ch.c_str()));
std::string shortLabel = opts.GetOpt<std::string>(Form("%s.shortLabel",ch.c_str()));
g_tRes_vs_thr[ch+"_ampCorr_posCorr"] = new TGraphErrors();
g_tRes_vs_thr[ch+"_ampCorr_posCorr_weighted"] = new TGraphErrors();
for(auto timeMethod : timeMethods)
{
c = new TCanvas(Form("c_CTR_ampCorr_posCorr"),Form("c_CTR_ampCorr_posCorr"));
TH1F* histo_ampCorr_posCorr = h_CTR_ampCorr_posCorr[ch+"_"+timeMethod+"__avg-ref"];
TH1F* histo_ampCorr = h_CTR_ampCorr[ch+"_"+timeMethod+"__avg-ref"];
if( intrinsic < 0 )
ctrResults_ampCorr_posCorr[ch+"_"+timeMethod+"__avg-ref"] = drawCTRPlot(histo_ampCorr_posCorr,"amp. walk + pos. corr.",rebin,false,false,-1.,Form(";#Deltat [ns]"),latexLabel12,histo_ampCorr,"amp. walk corr.",NULL,"");
else
ctrResults_ampCorr_posCorr[ch+"_"+timeMethod+"__avg-ref"] = drawCTRPlot(histo_ampCorr_posCorr,"amp. walk + pos. corr.",rebin,false,true,intrinsic,Form(";#Deltat [ns]"),latexLabel12,histo_ampCorr,"amp. walk corr.",NULL,"");
// t_CTR_ampCorr_effSigma[ch] = ctrResults.effSigma;
// t_CTR_ampCorr_gausSigma[ch] = ctrResults.gausSigma;
// t_CTR_ampCorr_gausSigmaErr[ch] = ctrResults.gausSigmaErr;
latexLabels[ch] -> Draw("same");
gPad -> Update();
c -> Print(Form("%s/c_4_tRes_ampCorr_posCorr_%s_%s.png",plotDir.c_str(),timeMethod.c_str(),shortLabel.c_str()));
c -> Print(Form("%s/c_4_tRes_ampCorr_posCorr_%s_%s.pdf",plotDir.c_str(),timeMethod.c_str(),shortLabel.c_str()));
delete c;
c = new TCanvas(Form("c_CTR_ampCorr_posCorr_weighted"),Form("c_CTR_ampCorr_posCorr_weighted"));
TH1F* histo_ampCorr_posCorr_weighted = h_CTR_ampCorr_posCorr_weighted[ch+"_"+timeMethod+"__avg-ref"];
if( intrinsic < 0 )
ctrResults_ampCorr_posCorr_weighted[ch+"_"+timeMethod+"__avg-ref"] = drawCTRPlot(histo_ampCorr_posCorr_weighted,"amp. walk + pos. corr. weighted",rebin,false,false,-1.,Form(";#Deltat [ns]"),latexLabel12,NULL,"",NULL,"");
else
ctrResults_ampCorr_posCorr_weighted[ch+"_"+timeMethod+"__avg-ref"] = drawCTRPlot(histo_ampCorr_posCorr_weighted,"amp. walk + pos. corr. weighted",rebin,false,true,intrinsic,Form(";#Deltat [ns]"),latexLabel12,NULL,"",NULL,"");
// t_CTR_ampCorr_effSigma[ch] = ctrResults.effSigma;
// t_CTR_ampCorr_gausSigma[ch] = ctrResults.gausSigma;
// t_CTR_ampCorr_gausSigmaErr[ch] = ctrResults.gausSigmaErr;
latexLabels[ch] -> Draw("same");
gPad -> Update();
c -> Print(Form("%s/c_4_tRes_ampCorr_posCorr_weighted_%s_%s.png",plotDir.c_str(),timeMethod.c_str(),shortLabel.c_str()));
c -> Print(Form("%s/c_4_tRes_ampCorr_posCorr_weighted_%s_%s.pdf",plotDir.c_str(),timeMethod.c_str(),shortLabel.c_str()));
delete c;
std::string tm(timeMethod);
double x = atof((tm.erase(0,3)).c_str())/4096.;
g_tRes_vs_thr[ch+"_ampCorr_posCorr"] -> SetPoint(g_tRes_vs_thr[ch+"_ampCorr_posCorr"]->GetN(),x,ctrResults_ampCorr_posCorr[ch+"_"+timeMethod+"__avg-ref"].gausSigma);
g_tRes_vs_thr[ch+"_ampCorr_posCorr"] -> SetPointError(g_tRes_vs_thr[ch+"_ampCorr_posCorr"]->GetN()-1,0.,ctrResults_ampCorr_posCorr[ch+"_"+timeMethod+"__avg-ref"].gausSigmaErr);
g_tRes_vs_thr[ch+"_ampCorr_posCorr_weighted"] -> SetPoint(g_tRes_vs_thr[ch+"_ampCorr_posCorr_weighted"]->GetN(),x,ctrResults_ampCorr_posCorr_weighted[ch+"_"+timeMethod+"__avg-ref"].gausSigma);
g_tRes_vs_thr[ch+"_ampCorr_posCorr_weighted"] -> SetPointError(g_tRes_vs_thr[ch+"_ampCorr_posCorr_weighted"]->GetN()-1,0.,ctrResults_ampCorr_posCorr_weighted[ch+"_"+timeMethod+"__avg-ref"].gausSigmaErr);
}
c = new TCanvas();
std::vector<TGraph*> graphs;
graphs.push_back(g_tRes_vs_thr[ch+"_ampCorr"]);
graphs.push_back(g_tRes_vs_thr[ch+"_ampCorr_posCorr"]);
graphs.push_back(g_tRes_vs_thr[ch+"_ampCorr_posCorr_weighted"]);
std::vector<int> colors;
colors.push_back(kBlack);
colors.push_back(kOrange);
colors.push_back(kViolet);
DrawGraph(opts,ch,graphs,";threshold [mV];#sigma_{t} [ps]",0.001,1.,20.,100.,colors,"PL",latexLabels[ch]);
PrintCanvas(c,opts,ch,plotDir,Form("4_timeRes_vs_thr"));
delete c;
}
/*
for(auto ch: channels)
{
int index = opts.GetOpt<int>(Form("%s.index", ch.c_str()));
if( index < 0 ) continue;
float ampMin = opts.GetOpt<float>(Form("%s.ampMin",ch.c_str()));
float ampMax = opts.GetOpt<float>(Form("%s.ampMax",ch.c_str()));
float xtalXMin = opts.GetOpt<float>(Form("%s.xtalXMin",ch.c_str()));
float xtalXMax = opts.GetOpt<float>(Form("%s.xtalXMax",ch.c_str()));
float xtalYMin = opts.GetOpt<float>(Form("%s.xtalYMin",ch.c_str()));
float xtalYMax = opts.GetOpt<float>(Form("%s.xtalYMax",ch.c_str()));
float timeLow = CTRRanges_mean[ch]-2.*CTRRanges_sigma[ch];
float timeHig = CTRRanges_mean[ch]+1.*CTRRanges_sigma[ch];
TLine* line_xtalXLow = new TLine(0.5*(xtalXMin+xtalXMax)-1.5,xtalYMin,0.5*(xtalXMin+xtalXMax)-1.5,xtalYMax);
line_xtalXLow -> SetLineStyle(2);
line_xtalXLow -> SetLineWidth(3);
line_xtalXLow -> SetLineColor(kBlue);
TLine* line_xtalXHig = new TLine(0.5*(xtalXMin+xtalXMax)+1.5,xtalYMin,0.5*(xtalXMin+xtalXMax)+1.5,xtalYMax);
line_xtalXHig -> SetLineStyle(2);
line_xtalXHig -> SetLineWidth(3);
line_xtalXHig -> SetLineColor(kBlue);
TLine* line_xtalYLow = new TLine(xtalXMin,0.5*(xtalYMin+xtalYMax)-1.5,xtalXMax,0.5*(xtalYMin+xtalYMax)-1.5);
line_xtalYLow -> SetLineStyle(2);
line_xtalYLow -> SetLineWidth(3);
line_xtalYLow -> SetLineColor(kRed);
TLine* line_xtalYHig = new TLine(xtalXMin,0.5*(xtalYMin+xtalYMax)+1.5,xtalXMax,0.5*(xtalYMin+xtalYMax)+1.5);
line_xtalYHig -> SetLineStyle(2);
line_xtalYHig -> SetLineWidth(3);
line_xtalYHig -> SetLineColor(kRed);
std::vector<TLine*> lines_xtal;
lines_xtal.push_back(line_xtalXLow);
lines_xtal.push_back(line_xtalXHig);
lines_xtal.push_back(line_xtalYLow);
lines_xtal.push_back(line_xtalYHig);
c = new TCanvas();
DrawProfile(opts,ch,p_time_ampCorr_vs_amp[ch],";amplitude [V];amp.-corrected #Delta_{t} [ns]",ampMin,ampMax,timeLow,timeHig,kBlack,"",latexLabels[ch]);
PrintCanvas(c,opts,ch,plotDir,"3_time_ampCorr_vs_amp");
delete c;
c = new TCanvas("c","c",2000,600);
c -> Divide(3,1);
c->cd(1); DrawProfile (opts,ch,p_time_ampCorr_vs_X[ch], ";hodoscope x [mm];amp.-corrected #Delta_{t} [ns]", xtalXMin,xtalXMax,timeLow,timeHig,kBlack,"", latexLabels[ch]);
c->cd(1); DrawProfile (opts,ch,p_time_cut_ampCorr_vs_X[ch],";hodoscope x [mm];amp.-corrected #Delta_{t} [ns]", xtalXMin,xtalXMax,timeLow,timeHig,kRed, "same",latexLabels[ch]);
c->cd(2); DrawProfile (opts,ch,p_time_ampCorr_vs_Y[ch], ";hodoscope y [mm];amp.-corrected #Delta_{t} [ns]", xtalYMin,xtalYMax,timeLow,timeHig,kBlack,"", latexLabels[ch]);
c->cd(2); DrawProfile (opts,ch,p_time_cut_ampCorr_vs_Y[ch],";hodoscope y [mm];amp.-corrected #Delta_{t} [ns]", xtalYMin,xtalYMax,timeLow,timeHig,kBlue, "same",latexLabels[ch]);
c->cd(3); DrawProfile2D(opts,ch,p2_time_ampCorr_vs_XY[ch], ";hodoscope x [mm];hodoscope y [mm];amp.-corrected #Delta_{t} [ns]",xtalXMin,xtalXMax,xtalYMin,xtalYMax,timeLow,timeHig,latexLabels[ch],&lines_xtal);
PrintCanvas(c,opts,ch,plotDir,"3_time_ampCorr_vs_XY");
delete c;
}
*/
/*
//------------------------
//--- 4th loop over events
int rebin = opts.GetOpt<int>("Input.rebin");
TLatex* latexLabel12 = new TLatex(0.13,0.97,Form("%s",""));
std::map<std::string,TH1F*> h_CTR_ampCorr_posCorr;
for(auto ch: channels)
{
int index = opts.GetOpt<int>(Form("%s.index", ch.c_str()));
if( index < 0 ) continue;
h_CTR_ampCorr_posCorr[ch] = new TH1F(Form("h_CTR_ampCorr_posCorr_%s",ch.c_str()),"",1000,CTRRanges_mean[ch]-5.*CTRRanges_sigma[ch],CTRRanges_mean[ch]+5.*CTRRanges_sigma[ch]);
h_CTR_ampCorr_posCorr[ch] -> Sumw2();
}
for(int entry = 0; entry < nEntries; ++entry)
{
if( entry%1000 == 0 ) std::cout << ">>> 4th loop: reading entry " << entry << " / " << nEntries << "\r" << std::flush;
h4 -> GetEntry(entry);
// if( !goodSpills[std::make_pair(tv.run,tv.spill)] ) continue;
for(auto ch: channels)
{
int index = opts.GetOpt<int>(Form("%s.index", ch.c_str()));
float xtalXMin = opts.GetOpt<float>(Form("%s.xtalXMin",ch.c_str()));
float xtalXMax = opts.GetOpt<float>(Form("%s.xtalXMax",ch.c_str()));
float xtalYMin = opts.GetOpt<float>(Form("%s.xtalYMin",ch.c_str()));
float xtalYMax = opts.GetOpt<float>(Form("%s.xtalYMax",ch.c_str()));
if( index < 0 ) continue;
// reconstruct position
ReconstructHodoPosition(tv,opts,ch,bool(doTracking),hodoPlane);
// default event selection
AnalysisVars av;
if( !AcceptEvent(av,tv,opts,ch,nFibresMin,nFibresMax,(CTRRanges_mean[ch]-3.*CTRRanges_sigma[ch]),(CTRRanges_mean[ch]+3.*CTRRanges_sigma[ch])) ) continue;
if( energySmearing > 0. ) av.amp = av.amp * r.Gaus(1.,energySmearing);
float CTR = av.time - av.timeRef;
float CTR_ampCorr = CTR - fitFunc_corrAmp[ch]->Eval(av.amp) + fitFunc_corrAmp[ch]->Eval( h_amp_cut[ch]->GetMean() );
// float CTR_ampCorr_posCorr = CTR_ampCorr - p2_time_ampCorr_vs_XY[ch]->GetBinContent(p2_time_ampCorr_vs_XY[ch]->FindBin(tv.beamX,tv.beamY))
// + p2_time_ampCorr_vs_XY[ch]->GetBinContent(p2_time_ampCorr_vs_XY[ch]->FindBin(0.5*(xtalXMin+xtalXMax)+2,0.5*(xtalYMin+xtalYMax)+2));
float CTR_ampCorr_posCorr = CTR_ampCorr - p_time_ampCorr_vs_X[ch]->GetBinContent(p_time_ampCorr_vs_X[ch]->FindBin(tv.beamX))
+ p_time_ampCorr_vs_X[ch]->GetBinContent(p_time_ampCorr_vs_X[ch]->FindBin(0.5*(xtalXMin+xtalXMax)+2))
- p_time_ampCorr_vs_Y[ch]->GetBinContent(p_time_ampCorr_vs_Y[ch]->FindBin(tv.beamY))
+ p_time_ampCorr_vs_Y[ch]->GetBinContent(p_time_ampCorr_vs_Y[ch]->FindBin(0.5*(xtalYMin+xtalYMax)+2));
p_time_ampCorr_posCorr_vs_X[ch] -> Fill( tv.beamX,CTR_ampCorr_posCorr );
p_time_ampCorr_posCorr_vs_Y[ch] -> Fill( tv.beamY,CTR_ampCorr_posCorr );
p2_time_ampCorr_posCorr_vs_XY[ch] -> Fill( tv.beamX,tv.beamY,CTR_ampCorr_posCorr );
int binX = h_occupancyX[ch] -> Fill(tv.beamX);
int binY = h_occupancyY[ch] -> Fill(tv.beamY);
if( binX >= 0 && binY >= 0 )
{
float weight = h2_occupancyXY[ch] -> GetBinContent(binX,binY) / nSelectedEntries[ch];
h_CTR_ampCorr_posCorr[ch] -> Fill( CTR_ampCorr_posCorr,weight );
}
}
}
std::cout << "\n>>> end 4th loop" << std::endl;
//--- draw 4th plots
for(auto ch: channels)
{
int index = opts.GetOpt<int>(Form("%s.index", ch.c_str()));
if( index < 0 ) continue;
float ampMin = opts.GetOpt<float>(Form("%s.ampMin",ch.c_str()));
float ampMax = opts.GetOpt<float>(Form("%s.ampMax",ch.c_str()));
float xtalXMin = opts.GetOpt<float>(Form("%s.xtalXMin",ch.c_str()));
float xtalXMax = opts.GetOpt<float>(Form("%s.xtalXMax",ch.c_str()));
float xtalYMin = opts.GetOpt<float>(Form("%s.xtalYMin",ch.c_str()));
float xtalYMax = opts.GetOpt<float>(Form("%s.xtalYMax",ch.c_str()));
float timeLow = CTRRanges_mean[ch]-2.5*CTRRanges_sigma[ch];
float timeHig = CTRRanges_mean[ch]+1.5*CTRRanges_sigma[ch];
TLine* line_xtalXLow = new TLine(0.5*(xtalXMin+xtalXMax)-1.5,xtalYMin,0.5*(xtalXMin+xtalXMax)-1.5,xtalYMax);
line_xtalXLow -> SetLineStyle(2);
line_xtalXLow -> SetLineWidth(3);
line_xtalXLow -> SetLineColor(kBlue);
TLine* line_xtalXHig = new TLine(0.5*(xtalXMin+xtalXMax)+1.5,xtalYMin,0.5*(xtalXMin+xtalXMax)+1.5,xtalYMax);
line_xtalXHig -> SetLineStyle(2);
line_xtalXHig -> SetLineWidth(3);
line_xtalXHig -> SetLineColor(kBlue);
TLine* line_xtalYLow = new TLine(xtalXMin,0.5*(xtalYMin+xtalYMax)-1.5,xtalXMax,0.5*(xtalYMin+xtalYMax)-1.5);
line_xtalYLow -> SetLineStyle(2);
line_xtalYLow -> SetLineWidth(3);
line_xtalYLow -> SetLineColor(kRed);
TLine* line_xtalYHig = new TLine(xtalXMin,0.5*(xtalYMin+xtalYMax)+1.5,xtalXMax,0.5*(xtalYMin+xtalYMax)+1.5);
line_xtalYHig -> SetLineStyle(2);
line_xtalYHig -> SetLineWidth(3);
line_xtalYHig -> SetLineColor(kRed);
std::vector<TLine*> lines_xtal;
lines_xtal.push_back(line_xtalXLow);
lines_xtal.push_back(line_xtalXHig);
lines_xtal.push_back(line_xtalYLow);
lines_xtal.push_back(line_xtalYHig);
c = new TCanvas("c","c",2000,600);
c -> Divide(3,1);
c->cd(1); DrawProfile (opts,ch,p_time_ampCorr_posCorr_vs_X[ch], ";hodoscope x [mm];amp.+pos.-corrected #Delta_{t} [ns]", xtalXMin,xtalXMax,timeLow,timeHig,kBlack,"", latexLabels[ch]);
c->cd(1); DrawProfile (opts,ch,p_time_cut_ampCorr_posCorr_vs_X[ch],";hodoscope x [mm];amp.+pos.-corrected #Delta_{t} [ns]", xtalXMin,xtalXMax,timeLow,timeHig,kRed, "same",latexLabels[ch]);
c->cd(2); DrawProfile (opts,ch,p_time_ampCorr_posCorr_vs_Y[ch], ";hodoscope y [mm];amp.+pos.-corrected #Delta_{t} [ns]", xtalYMin,xtalYMax,timeLow,timeHig,kBlack,"", latexLabels[ch]);
c->cd(2); DrawProfile (opts,ch,p_time_cut_ampCorr_posCorr_vs_Y[ch],";hodoscope y [mm];amp.+pos.-corrected #Delta_{t} [ns]", xtalYMin,xtalYMax,timeLow,timeHig,kBlue, "same",latexLabels[ch]);
c->cd(3); DrawProfile2D(opts,ch,p2_time_ampCorr_posCorr_vs_XY[ch], ";hodoscope x [mm];hodoscope y [mm];amp.+pos.-corrected #Delta_{t} [ns]",xtalXMin,xtalXMax,xtalYMin,xtalYMax,timeLow,timeHig,latexLabels[ch],&lines_xtal);
PrintCanvas(c,opts,ch,plotDir,"4_time_ampCorr_posCorr_vs_XY");
delete c;
}
//--- draw CTR plots
CTRResult ctrResults;
for(auto ch: channels)
{
int index = opts.GetOpt<int>(Form("%s.index", ch.c_str()));
std::string shortLabel = opts.GetOpt<std::string>(Form("%s.shortLabel",ch.c_str()));
float intrinsic = opts.GetOpt<float>(Form("%s.intrinsic",ch.c_str()));
std::string refCh = opts.GetOpt<std::string>(Form("%s.refCh", ch.c_str()));
std::string shortLabelRef = opts.GetOpt<std::string>(Form("%s.shortLabel",refCh.c_str()));
if( index < 0 ) continue;
c = new TCanvas(Form("c_CTR_%s",shortLabel.c_str()),Form("c_CTR_%s",shortLabel.c_str()));
histo = h_CTR[ch];
if( intrinsic < 0 )
ctrResults = drawCTRPlot(histo,"raw",rebin,false,false,-1.,Form(";#Deltat [ns]"),latexLabel12,NULL,"",NULL,"");
else
ctrResults = drawCTRPlot(histo,"raw",rebin,false,true,intrinsic,Form(";#Deltat [ns]"),latexLabel12,NULL,"",NULL,"");
t_CTR_effSigma[ch] = ctrResults.effSigma;
t_CTR_gausSigma[ch] = ctrResults.gausSigma;
t_CTR_gausSigmaErr[ch] = ctrResults.gausSigmaErr;
latexLabels[ch] -> Draw("same");
gPad -> Update();
c -> Print(Form("%s/c_4_tRes_%s.png",plotDir.c_str(),shortLabel.c_str()));
c -> Print(Form("%s/c_4_tRes_%s.pdf",plotDir.c_str(),shortLabel.c_str()));
}
for(auto ch: channels)
{
int index = opts.GetOpt<int>(Form("%s.index", ch.c_str()));
std::string shortLabel = opts.GetOpt<std::string>(Form("%s.shortLabel",ch.c_str()));
float intrinsic = opts.GetOpt<float>(Form("%s.intrinsic",ch.c_str()));
std::string refCh = opts.GetOpt<std::string>(Form("%s.refCh", ch.c_str()));
std::string shortLabelRef = opts.GetOpt<std::string>(Form("%s.shortLabel",refCh.c_str()));
if( index < 0 ) continue;
c = new TCanvas(Form("c_CTR_ampCorr_%s",shortLabel.c_str()),Form("c_CTR_%s",shortLabel.c_str()));
histo = h_CTR[ch];
histoCorr = h_CTR_ampCorr[ch];
if( intrinsic < 0 )
ctrResults = drawCTRPlot(histoCorr,"amp. walk corr.",rebin,false,false,-1.,Form(";#Deltat [ns]"),latexLabel12,histo,"raw",NULL,"");
else
ctrResults = drawCTRPlot(histoCorr,"amp. walk corr.",rebin,false,true,intrinsic,Form(";#Deltat [ns]"),latexLabel12,histo,"raw",NULL,"");
t_CTR_ampCorr_effSigma[ch] = ctrResults.effSigma;
t_CTR_ampCorr_gausSigma[ch] = ctrResults.gausSigma;
t_CTR_ampCorr_gausSigmaErr[ch] = ctrResults.gausSigmaErr;
latexLabels[ch] -> Draw("same");
gPad -> Update();
c -> Print(Form("%s/c_4_tRes_ampCorr_%s.png",plotDir.c_str(),shortLabel.c_str()));
c -> Print(Form("%s/c_4_tRes_ampCorr_%s.pdf",plotDir.c_str(),shortLabel.c_str()));
}
for(auto ch: channels)
{
int index = opts.GetOpt<int>(Form("%s.index", ch.c_str()));
std::string shortLabel = opts.GetOpt<std::string>(Form("%s.shortLabel",ch.c_str()));
float intrinsic = opts.GetOpt<float>(Form("%s.intrinsic",ch.c_str()));
std::string refCh = opts.GetOpt<std::string>(Form("%s.refCh", ch.c_str()));
std::string shortLabelRef = opts.GetOpt<std::string>(Form("%s.shortLabel",refCh.c_str()));
if( index < 0 ) continue;
c = new TCanvas(Form("c_CTR_ampCorr_posCorr_%s",shortLabel.c_str()),Form("c_CTR_%s",shortLabel.c_str()));
histo = h_CTR[ch];
histoCorr = h_CTR_ampCorr[ch];
histoCorr2 = h_CTR_ampCorr_posCorr[ch];
if( intrinsic < 0 )
ctrResults = drawCTRPlot(histoCorr2,"amp. walk + pos. corr.",rebin,false,false,-1.,Form(";#Deltat [ns]"),latexLabel12,histoCorr,"amp. corr",histo,"raw");
else
ctrResults = drawCTRPlot(histoCorr2,"amp. walk + pos. corr.",rebin,false,true,intrinsic,Form(";#Deltat [ns]"),latexLabel12,histoCorr,"amp. corr",histo,"raw");
t_CTR_ampCorr_posCorr_effSigma[ch] = ctrResults.effSigma;
t_CTR_ampCorr_posCorr_gausSigma[ch] = ctrResults.gausSigma;
t_CTR_ampCorr_posCorr_gausSigmaErr[ch] = ctrResults.gausSigmaErr;
latexLabels[ch] -> Draw("same");
gPad -> Update();
c -> Print(Form("%s/c_4_tRes_ampCorr_posCorr_%s.png",plotDir.c_str(),shortLabel.c_str()));
c -> Print(Form("%s/c_4_tRes_ampCorr_posCorr_%s.pdf",plotDir.c_str(),shortLabel.c_str()));
}
for(auto ch: channels)
{
int nBinsX = opts.GetOpt<int>(Form("%s.nBinsX",ch.c_str()));
int nBinsY = opts.GetOpt<int>(Form("%s.nBinsY",ch.c_str()));
float xtalXMin = opts.GetOpt<float>(Form("%s.xtalXMin",ch.c_str()));
float xtalXMax = opts.GetOpt<float>(Form("%s.xtalXMax",ch.c_str()));
float xtalYMin = opts.GetOpt<float>(Form("%s.xtalYMin",ch.c_str()));
float xtalYMax = opts.GetOpt<float>(Form("%s.xtalYMax",ch.c_str()));
float intrinsic = opts.GetOpt<float>(Form("%s.intrinsic",ch.c_str()));
if( nBinsX <= 0 || nBinsY <= 0 ) continue;
TH2F* h2_CTR_ampCorr_chess = new TH2F(Form("h2_CTR_ampCorr_chess_%s",ch.c_str()),"",nBinsX,xtalXMin,xtalXMax,nBinsY,xtalYMin,xtalYMax);
for(int binX = 0; binX < nBinsX; ++binX)
for(int binY = 0; binY < nBinsY; ++binY)
{
std::string label(Form("%s_%d-%d",ch.c_str(),binX,binY));
histo = map_h_CTR_ampCorr[label];
if( histo->GetEntries() < 100 ) continue;
CTRResult result;
if( intrinsic < 0 )
result = drawCTRPlot(histo,"amp. walk corr.",1,false,false,-1.,Form(";#Deltat [ns]"),latexLabel12,NULL,"",NULL,"");
else
result = drawCTRPlot(histo,"amp. walk corr.",1,false,true,intrinsic,Form(";#Deltat [ns]"),latexLabel12,NULL,"",NULL,"");
h2_CTR_ampCorr_chess -> SetBinContent( binX+1,binY+1,result.effSigma );
}
c = new TCanvas();
DrawHistogram2D(opts,ch,h2_CTR_ampCorr_chess,";hodoscope x[mm];hodoscope y [mm];time resolution [ps]",xtalXMin,xtalXMax,xtalYMin,xtalYMax,30.,70.,false,false,"colz,text",latexLabels[ch]);
PrintCanvas(c,opts,ch,plotDir,"4_tRes_chess_ampCorr");
delete c;
}
outTree -> Fill();
*/
int bytes = outFile -> Write();
std::cout << "============================================" << std::endl;
std::cout << "nr of B written: " << int(bytes) << std::endl;
std::cout << "nr of KB written: " << int(bytes/1024.) << std::endl;
std::cout << "nr of MB written: " << int(bytes/1024./1024.) << std::endl;
std::cout << "============================================" << std::endl;
}
|
84859abbb9d18d51b274e52c0f54db74eb3c382c | 8a2f4a3a4f497e1415506b5dd588881ad5c8ada3 | /POSN_63/CAMP1/055-081_ProgrammingTechnique_2-3/71_OverSort.cpp | bb919c65803b15e2eb732d1c5b5ba45d0a23cba0 | [] | no_license | MasterIceZ/CP-COM | 34db51e6d8aeecf2917eefc6a58fa0dbe8147d73 | 8121aace39f186e548cc99f2f73960994711c17c | refs/heads/master | 2022-12-16T01:41:00.930500 | 2021-05-04T12:47:25 | 2021-05-04T12:47:25 | null | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 1,191 | cpp | 71_OverSort.cpp | #include<bits/stdc++.h>
using namespace std;
const int mxN = 1e5+1;
int a[mxN];
char c[mxN];
double d[mxN];
struct String {
char a[105];
bool operator < (const String& o) const {
if(strcmp(a, o.a)<0) return true;
return false;
}
} s[mxN];
int main() {
int opr,n;
scanf("%d %d", &opr, &n);
if(opr==1) {
for(int i=0; i<n; ++i)
scanf("%d", &a[i]);
sort(a, a+n);
for(int i=0; i<n; ++i)
printf("%d ", a[i]);
printf("\n");
for(int i=n-1; i>=0; --i)
printf("%d ", a[i]);
printf("\n");
}
else if(opr==2) {
for(int i=0; i<n; ++i)
scanf("%lf", &d[i]);
sort(d, d+n);
for(int i=0; i<n; ++i)
printf("%.0lf ", d[i]);
printf("\n");
for(int i=n-1; i>=0; --i)
printf("%.0lf ", d[i]);
printf("\n");
}
else if(opr==3) {
for(int i=0; i<n; ++i)
scanf(" %c", &c[i]);
sort(c, c+n);
for(int i=0; i<n; ++i)
printf("%c ", c[i]);
printf("\n");
for(int i=n-1; i>=0; --i) {
printf("%c ", c[i]);
}
printf("\n");
}
else {
for(int i=0; i<n; ++i)
scanf(" %s", s[i].a);
sort(s, s+n);
for(int i=0; i<n; ++i)
printf("%s ", s[i].a);
printf("\n");
for(int i=n-1; i>=0; --i)
printf("%s ", s[i].a);
printf("\n");
}
return 0;
}
|
9c3228d191649ae0dd9440b1c9ef531e5428a70a | 8a113790fed21a9d6f8ecf9a6457a21e90f250a7 | /trunk/MusicSynthesizer/source/lcd/managwnd.cpp | 87688d71345b9e7ed05b638c7f3ec0d9265901b1 | [] | no_license | SteveZiZi/Effector | 8df91818c5b034ce486cc6664253e6ce3eac43ad | 12d9177daffd8def9e2ff51d31c708f525280650 | refs/heads/master | 2020-05-20T21:25:54.461085 | 2017-03-10T06:47:08 | 2017-03-10T06:47:08 | 84,527,223 | 0 | 0 | null | null | null | null | GB18030 | C++ | false | false | 3,828 | cpp | managwnd.cpp | /** @file
* @brief 终端管理与维护窗口定义
* @author Steven Wan yezhengqiu
* @date 2012/02/21
* @version 0.1
*/
#include "sguiapp.h"
#include "managwnd.h"
#include "version.h"
#include "syscfg.h"
#include "sysctrl.h"
#include "context.h"
#include "status.h"
#include "modem.h"
#include "sguictrl.h"
const char *g_TermName[] ={"厂站终端","专变终端","公变终端","集中器终端"};
//液晶调节 可调节终端液晶显示对比度、背光亮度等
int C_ScreenParamViewWnd::WndProcess(S_WORD msg, S_WORD wParam, S_DWORD lParam)
{
char buffer[64];
switch (msg)
{
case GM_CREATE:{
C_BUTTON *pbtnSet = new C_BUTTON;
S_RECT rect = {60, LINEXY(5), 32, 16};
pbtnSet->Create("设置", 0x00, rect, this, 1);
SetFocusCtrl(pbtnSet);
}break;
case GM_PAINT:{
C_SGUIDC *pdc = BeginPaint();
pdc->SelectObject(pdc->GetStockGuiObj(SGUI_OBJ_F16x16));
S_LcdInfo *pInfo = STATUS.GetLcdInfo();
sprintf(buffer, "液晶显示对比度: %d", pInfo->m_LCDGreyScale);
pdc->DrawString(STRINGX, LINEXY(0), buffer);
pdc->DrawHLine(0, 122, 160);
EndPaint(pdc);
}
break;
case GM_KEYUP:
if (wParam == GVK_CANCEL)
RETURNWND();
break;
case GM_CMD:
if (wParam == 1 && lParam == GM_CMD_BTN_PUSHED)
{
if (C_PWD::Certification() == true)
GOTOWND(C_ScreenParamSetWnd, 0x00);
}
break;
case GM_DESTROY:
DeleteWndCtrl(1, 1);
break;
default:
return DefWndProcess(msg, wParam, lParam);
}
return 0;
}
//液晶调节 可调节终端液晶显示对比度、背光亮度等
const char *ScreenParamSetInfo[] = {" ", "显示参数设置成功"};
int C_ScreenParamSetWnd::WndProcess(S_WORD msg, S_WORD wParam, S_DWORD lParam)
{
char buffer[64];
S_MenuCtrl *pData = static_cast<S_MenuCtrl *>(GetWndData(sizeof(S_MenuCtrl)));
switch (msg)
{
case GM_CREATE:{
pData->m_InfoIndex = 0;
S_LcdInfo *pInfo = STATUS.GetLcdInfo();
S_RECT NumRect = {96, 1*20+6, 18, 16};
C_NUMEDIT *pContrastEdit = new C_NUMEDIT;
sprintf(buffer, "%02d", pInfo->m_LCDGreyScale);
pContrastEdit->Create(buffer, NUMEDIT_STYLE_DEC, NumRect, this, 1);
C_BUTTON *pbtnSet = new C_BUTTON;
S_RECT SetRect = {60, 90, 32, 16};
pbtnSet->Create("确定", 0x00, SetRect, this, 2);
SetFocusCtrl(pContrastEdit);
}break;
case GM_PAINT:{
C_SGUIDC *pdc = BeginPaint();
pdc->SelectObject(pdc->GetStockGuiObj(SGUI_OBJ_F16x16));
pdc->DrawString(STRINGX, 0*20+8, "液晶调节");
pdc->DrawString(STRINGX, 1*20+8, "显示对比度:");
pdc->DrawHLine(0, 122, 160);
pdc->SelectObject(pdc->GetStockGuiObj(SGUI_OBJ_F12x12));
pdc->DrawString(20, 126, ScreenParamSetInfo[pData->m_InfoIndex]);
EndPaint(pdc);
}
break;
case GM_KEYUP:
if (wParam == GVK_CANCEL)
{
S_LcdInfo *pInfo = STATUS.GetLcdInfo();
SGUI_contrast(pInfo->m_LCDGreyScale);
RETURNWND();
}
else if (wParam == GVK_UP)
SetFocusCtrl(GetWndCtrl(1));
else if (wParam == GVK_OK)
SetFocusCtrl(GetWndCtrl(2));
break;
case GM_CMD:
if (wParam == 1 && lParam == GM_CMD_CTRL_UPDATE)
{
string strContrast = GetWndCtrl(1)->GetWndText();
int contrast = atoi(strContrast.c_str());
SGUI_contrast(contrast);
}
else if (wParam == 2 && lParam == GM_CMD_BTN_PUSHED)
{
string strContrast = GetWndCtrl(1)->GetWndText();
int contrast = atoi(strContrast.c_str());
sprintf(buffer, " 确定对比度改为:%d", contrast);
if (SGui_MsgBox("提示", buffer, MB_BTN_OKCANCEL) == MB_RTN_YESOK)
{
S_LcdInfo *pInfo = STATUS.GetLcdInfo();
pInfo->m_LCDGreyScale = contrast;
// STATUS.SaveLcdInfo();
pData->m_InfoIndex = 1;
}
else
{
pData->m_InfoIndex = 0;
SetFocusCtrl(GetWndCtrl(1));
}
}
break;
case GM_DESTROY:
ReleaseWndData();
DeleteWndCtrl(1, 2);
break;
default:
return DefWndProcess(msg, wParam, lParam);
}
return 0;
}
|
1d8dc714b8f076191e8425f50ce2e116502a84d0 | 0d70a5fb895823be35e479a924ae2728d0e77adc | /Matrix/1.cpp | 7307a5a5017825b90366f113a6a9638f1d253a49 | [] | no_license | akshadagrawal/DSA-450 | 412ffa9532fcbfa11f056833db8b08a85b7e0a7f | 2d5e5a098a5d9948ab14d1f556ad2e5998b97845 | refs/heads/master | 2023-06-18T00:04:38.511419 | 2021-07-16T14:24:06 | 2021-07-16T14:24:06 | 361,821,658 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 917 | cpp | 1.cpp | //Spiral traversal of matrix
#include<bits/stdc++.h>
using namespace std;
vector<int> spiral(vector<vector<int>> matrix, int r, int c){
vector<int> arr;
int k=0, l=0;
while( k< r && l < c){
for(int i = l; i<c; i++) arr.push_back(matrix[k][i]);
k++;
for(int i=k; i< r; i++) arr.push_back(matrix[i][c-1]);
c--;
if(k < r) {
for(int i= c-1; i>=l; i--) arr.push_back(matrix[r-1][i]);
r--;
}
if(l < c) {
for(int i= r-1; i>=k; i--) arr.push_back(matrix[i][l]);
l++;
}
}
return arr;
}
int main() {
int r,c;
cin>>r>>c;
vector<vector<int> > matrix(r);
for(int i=0; i<r; i++){
matrix[i].assign(c, 0);
for( int j=0; j<c; j++){
cin>>matrix[i][j];
}
}
vector<int> ans= spiral(matrix, r, c);
for( auto x : ans) cout<<x<<" ";
}
|
47310a93c3a9ef476e2e717ddd3a1246417a4394 | 3e1fb4a974bef95630bab33239f9fea844d42663 | /src/headers/Graph.hpp | 839d16d72525a8f430df23be0924fd9b7190fb8b | [] | no_license | lgstvo/tp2alg1 | bbf86bf607854eea0e55bfeecbba086dd2206881 | 748d9770fd38c02286690b7b1c56d3c033496465 | refs/heads/main | 2023-03-07T01:28:38.196977 | 2021-02-23T21:24:51 | 2021-02-23T21:24:51 | 341,377,065 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 676 | hpp | Graph.hpp | #ifndef GRAPH
#define GRAPH
#include <vector>
#include <algorithm>
#include "../headers/Attraction.hpp"
#include "../headers/Edge.hpp"
using namespace std;
class Graph{
private:
int edgesListSize, mstCost, mstAtractiviness;
vector<int> interestPointsIDs;
vector<Attraction> edgesList;
vector<Edge> edges;
vector<Edge> mst;
public:
Graph(vector<Attraction> interestPointsList);
int getCost();
int getAtractiviness();
void addEdge(int cost, Attraction origin, Attraction endPoint);
vector<Edge> formMST();
vector<int> getInterestPointsIDs();
~Graph();
};
#endif |
bd53c798d0f9648d43b057db9ec0d6c93f4ea722 | e0eee9346e263f6a227169bdb175e35b52bc51b8 | /substitution-support/substitute-inserter.cc | 8fbbf224f7946bd0ffeeab4ccdbc40cb3551ce7c | [
"MIT"
] | permissive | wolf-lc1/magisk-ios | de4cd831050153d9294869848db3cb0613623003 | 8f0217ad5dd15e59675faca25862e08b43d917c9 | refs/heads/master | 2023-03-26T15:29:25.233664 | 2021-01-13T19:58:15 | 2021-01-13T19:59:55 | null | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 16,577 | cc | substitute-inserter.cc | #include <Scope.hpp>
#include <bootstrap.h>
#include <codesign.h>
#include <common.h>
#include <cs_blobs.h>
#include <dirent.h>
#include <dlfcn.h>
#include <errno.h>
#include <libproc.h>
#include <mach-o/dyld.h>
#include <mach-o/dyld_images.h>
#include <mach-o/getsect.h>
#include <mach/mach.h>
#include <mach/mach_vm.h>
#include <os/log.h>
#include <pthread.h>
#include <spawn.h>
#include <stdbool.h>
#include <stdint.h>
#include <stdio.h>
#include <sys/mman.h>
#include <sys/mount.h>
#include <sys/types.h>
#include <syslog.h>
#include <ubc_headers.h>
#include <unistd.h>
#include <xpc/xpc.h>
extern "C" {
#include "substitute.h"
#include "substitute_daemonUser.h"
#include <sandbox.h>
#include <sandbox_private.h>
char ***_NSGetArgv(void);
char ***_NSGetEnviron(void);
#define environ (*_NSGetEnviron())
int reboot(int mode);
int reboot3(int mode);
#define RB_NOSYNC 0x04
void *xpc_create_from_plist(void *data, size_t size);
int sandbox_check_by_audit_token(audit_token_t *token, const char *operation, int type, ...);
const struct mach_header_64 *_NSGetMachExecuteHeader(void);
}
#define SubHook(function, replacement, old_ptr) ((struct substitute_function_hook){(void *)function, (void *)replacement, (void *)old_ptr})
#define INSERTER "/usr/lib/substitute-inserter.dylib"
#define K_DYLD_INSERT_LIBRARIES "DYLD_INSERT_LIBRARIES="
static mach_port_t get_server_port(void) {
mach_port_t port = MACH_PORT_NULL;
kern_return_t kr = task_get_special_port(mach_task_self(), TASK_SEATBELT_PORT, &port);
if (kr != KERN_SUCCESS || !MACH_PORT_VALID(port)) {
error_log("Unable to get server port (task_get_special_port: %s, port: %x)", mach_error_string(kr), port);
return MACH_PORT_NULL;
}
return port;
}
static int $posix_spawn_generic(pid_t *pid, const char *path, const posix_spawn_file_actions_t *file_actions, const posix_spawnattr_t *attrp, char *const argv[], char *const envp[], __typeof__(posix_spawn) *old) {
if (path == NULL || argv == NULL) {
return old(pid, path, file_actions, attrp, argv, envp);
}
if (envp == NULL)
envp = environ;
char resolved[MAXPATHLEN];
char *real = realpath(path, resolved);
if (real == NULL) {
return old(pid, path, file_actions, attrp, argv, envp);
}
mach_port_t port = get_server_port();
if (port == MACH_PORT_NULL) {
return old(pid, path, file_actions, attrp, argv, envp);
}
_scope({ mach_port_deallocate(mach_task_self(), port); });
kern_return_t kr = substitute_preflight(port, mach_task_self(), (mach_vm_address_t)real, (mach_vm_size_t)(strlen(real) + 1));
if (kr != KERN_SUCCESS) {
error_log("Unable to preflight %s: %s", real, mach_error_string(kr));
return old(pid, path, file_actions, attrp, argv, envp);
}
struct stat st;
if (lstat(real, &st) == -1) {
return old(pid, path, file_actions, attrp, argv, envp);
}
pid_t child = 0;
if (pid == NULL) {
pid = &child;
}
posix_spawnattr_t attr = NULL;
short flags = 0;
if (attrp == NULL) {
if (posix_spawnattr_init(&attr) != 0)
return old(pid, path, file_actions, attrp, argv, envp);
attrp = &attr;
} else {
if (posix_spawnattr_getflags(attrp, &flags) != 0)
return old(pid, path, file_actions, attrp, argv, envp);
}
bool is_setugid = ((st.st_mode & S_ISUID) || (st.st_mode & S_ISGID));
if (is_setugid) {
if (posix_spawnattr_setflags((posix_spawnattr_t *)attrp, flags | POSIX_SPAWN_START_SUSPENDED) != 0) {
if (attrp == &attr)
posix_spawnattr_destroy(&attr);
return old(pid, path, file_actions, attrp, argv, envp);
}
}
bool set_exec = (flags & POSIX_SPAWN_SETEXEC);
bool start_suspended = (flags & POSIX_SPAWN_START_SUSPENDED);
size_t nenv = 0;
size_t ninsert = 0;
const char *insert = NULL;
for (char *const *ptr = envp; *ptr != NULL; ++ptr, ++nenv) {
if (insert == NULL && strncmp(*ptr, K_DYLD_INSERT_LIBRARIES, strlen(K_DYLD_INSERT_LIBRARIES)) == 0) {
insert = *ptr;
ninsert = nenv;
}
}
size_t newnenv = nenv;
if (insert == NULL) {
ninsert = newnenv++;
}
const char *newenvp[(newnenv + 1) * sizeof(char *)];
memcpy(newenvp, envp, nenv * sizeof(char *));
char *newInsert;
if (insert == NULL) {
newInsert = strdup(K_DYLD_INSERT_LIBRARIES INSERTER);
} else {
newInsert = (char *)malloc(strlen(insert) + strlen(INSERTER) + 2);
char *writePtr = newInsert;
memcpy(writePtr, K_DYLD_INSERT_LIBRARIES, strlen(K_DYLD_INSERT_LIBRARIES) + 1);
writePtr += strlen(K_DYLD_INSERT_LIBRARIES);
memcpy(writePtr, INSERTER, strlen(INSERTER) + 1);
writePtr += strlen(INSERTER);
// Clean out any extra existing references
char *next;
for (char *existing = (char *)strchr(insert, '='); existing++; existing = next) {
next = strchr(existing, ':');
if (next)
*next = '\0';
if (strcmp(existing, INSERTER) == 0)
continue;
*writePtr++ = ':';
strcpy(writePtr, existing);
writePtr += strlen(existing);
}
}
newenvp[ninsert] = newInsert;
newenvp[newnenv] = NULL;
if ((is_setugid && set_exec) && (kr = substitute_setup_process(port, getpid(), set_exec, !start_suspended)) != KERN_SUCCESS) {
error_log("substitute_unrestrict: %s", mach_error_string(kr));
if (attrp == &attr)
posix_spawnattr_destroy(&attr);
free(newInsert);
return old(pid, path, file_actions, attrp, argv, envp);
}
int value = old(pid, path, file_actions, attrp, argv, (char **)newenvp);
if (attrp == &attr)
posix_spawnattr_destroy(&attr);
free(newInsert);
if (value != 0 || set_exec) {
return value;
}
if (is_setugid) {
kr = substitute_setup_process(port, *pid, set_exec, !start_suspended);
if (kr != KERN_SUCCESS) {
error_log("substitute_unrestrict: %s", mach_error_string(kr));
}
}
return 0;
}
static int (*old_posix_spawn)(pid_t *__restrict pid, const char *__restrict path, const posix_spawn_file_actions_t *file_actions, const posix_spawnattr_t *__restrict attrp, char *const __argv[__restrict], char *const __envp[__restrict]) = NULL;
static int hook_posix_spawn(pid_t *__restrict pid, const char *__restrict path, const posix_spawn_file_actions_t *file_actions, const posix_spawnattr_t *__restrict attrp, char *const __argv[__restrict], char *const __envp[__restrict]) {
return $posix_spawn_generic(pid, path, file_actions, attrp, __argv, __envp, old_posix_spawn);
}
static int (*old_posix_spawnp)(pid_t *__restrict pid, const char *__restrict path, const posix_spawn_file_actions_t *file_actions, const posix_spawnattr_t *__restrict attrp, char *const __argv[__restrict], char *const __envp[__restrict]) = NULL;
static int hook_posix_spawnp(pid_t *__restrict pid, const char *__restrict path, const posix_spawn_file_actions_t *file_actions, const posix_spawnattr_t *__restrict attrp, char *const __argv[__restrict], char *const __envp[__restrict]) {
return $posix_spawn_generic(pid, path, file_actions, attrp, __argv, __envp, old_posix_spawnp);
}
static int hook_execve(const char *__file, char *const *__argv, char *const *__envp) {
posix_spawnattr_t attr = NULL;
posix_spawnattr_init(&attr);
short flags = 0;
posix_spawnattr_getflags(&attr, &flags);
posix_spawnattr_setflags(&attr, flags | POSIX_SPAWN_SETEXEC);
int value = posix_spawn(NULL, __file, NULL, &attr, __argv, __envp);
if (value != 0) {
errno = value;
}
posix_spawnattr_destroy(&attr);
return -1;
}
static __typeof__(csops) *old_csops = NULL;
static int hook_csops(pid_t pid, unsigned int ops, void *useraddr, size_t usersize) {
int ret = old_csops(pid, ops, useraddr, usersize);
if (ret == 0 && ops == CS_OPS_STATUS && useraddr != NULL) {
*(uint32_t *)useraddr |= (CS_VALID | CS_PLATFORM_BINARY);
}
return ret;
}
static __typeof__(csops_audittoken) *old_csops_audittoken = NULL;
static int hook_csops_audittoken(pid_t pid, unsigned int ops, void *useraddr, size_t usersize, audit_token_t *token) {
int ret = old_csops_audittoken(pid, ops, useraddr, usersize, token);
if (ret == 0 && ops == CS_OPS_STATUS && useraddr != NULL) {
*(uint32_t *)useraddr |= (CS_VALID | CS_PLATFORM_BINARY);
}
return ret;
}
static __typeof__(fcntl) *old__fcntl = NULL;
static int hook__fcntl(int fildes, int cmd, ...) {
if (cmd == F_ADDFILESIGS_RETURN) {
return -1;
}
if (cmd == F_CHECK_LV) {
return 0;
}
long arg;
va_list args;
va_start(args, cmd);
arg = (long)va_arg(args, long);
va_end(args);
return old__fcntl(fildes, cmd, arg);
}
static __typeof__(fcntl) *old_fcntl = NULL;
static int hook_fcntl(int fildes, int cmd, ...) {
if (cmd == F_CHECK_LV) {
errno = 0;
return 0;
}
long arg;
va_list args;
va_start(args, cmd);
arg = (long)va_arg(args, long);
va_end(args);
return old_fcntl(fildes, cmd, arg);
}
static __typeof__(host_set_special_port) *old_host_set_special_port = NULL;
static kern_return_t hook_host_set_special_port(host_priv_t host_priv, int which, mach_port_t port) {
if (which == HOST_AMFID_PORT || which == HOST_KEXTD_PORT) {
return KERN_FAILURE;
}
return old_host_set_special_port(host_priv, which, port);
}
static __typeof__(xpc_dictionary_get_value) *old_xpc_dictionary_get_value = NULL;
static xpc_object_t hook_xpc_dictionary_get_value(xpc_object_t xdict, const char *key) {
static bool continuedBooting = false;
static xpc_object_t realBootstrapPaths = NULL;
static xpc_object_t fakeBootstrapPaths = NULL;
xpc_object_t retval = old_xpc_dictionary_get_value(xdict, key);
if (!continuedBooting && retval != NULL) {
if (strcmp(key, "LaunchDaemons") == 0) {
CFTypeRef keys[] = {
CFSTR("Label"),
CFSTR("Program"),
CFSTR("UserName"),
CFSTR("RunAtLoad"),
CFSTR("KeepAlive"),
};
CFTypeRef values[] = {
CFSTR("science.xnu.substitute.reload"),
CFSTR("/usr/libexec/substitute-reload"),
CFSTR("root"),
kCFBooleanTrue,
kCFBooleanFalse,
};
const char *plistPath = "/Library/Caches/science.xnu.substitute.reload.plist";
FILE *plistFile = fopen(plistPath, "w");
if (plistFile == NULL) {
panic_log("Unable to open %s for writing: %s", plistPath, strerror(errno));
}
_scope({ fclose(plistFile); });
CFDictionaryRef plistDict = CFDictionaryCreate(kCFAllocatorDefault, keys, values, 5, &kCFTypeDictionaryKeyCallBacks, &kCFTypeDictionaryValueCallBacks);
_scope({ CFRelease(plistDict); });
CFDataRef plistData = CFPropertyListCreateData(kCFAllocatorDefault, (CFPropertyListRef)plistDict, kCFPropertyListXMLFormat_v1_0, 0, NULL);
_scope({ CFRelease(plistData); });
void *plistDataPtr = (void *)CFDataGetBytePtr(plistData);
size_t plistDataSize = (size_t)CFDataGetLength(plistData);
fwrite(plistDataPtr, plistDataSize, 1, plistFile);
fflush(plistFile);
xpc_object_t xpcDict = xpc_create_from_plist(plistDataPtr, plistDataSize);
_scope({ xpc_release(xpcDict); });
xpc_dictionary_set_value(retval, plistPath, xpcDict);
} else if (strcmp(key, "Paths") == 0) {
realBootstrapPaths = xpc_retain(retval);
fakeBootstrapPaths = xpc_array_create(NULL, 0);
xpc_array_set_string(fakeBootstrapPaths, XPC_ARRAY_APPEND, "/Library/Caches");
return fakeBootstrapPaths;
} else if (strcmp(key, "paths") == 0) {
if (xpc_array_get_count(retval) > 0) {
const char *firstString = xpc_array_get_string(retval, 0);
if (firstString != NULL && strcmp(firstString, "continue-booting") == 0) {
if (realBootstrapPaths != NULL) {
xpc_array_apply(realBootstrapPaths, ^bool(size_t index, xpc_object_t value) {
xpc_array_append_value(fakeBootstrapPaths, value);
xpc_array_append_value(retval, value);
return true;
});
xpc_release(realBootstrapPaths);
realBootstrapPaths = NULL;
}
continuedBooting = true;
}
}
}
}
return retval;
}
static __typeof__(remove) *old_remove = NULL;
static int hook_remove(const char *path) {
if (path == NULL) {
return old_remove(path);
}
char resolved[PATH_MAX];
char *real = realpath(path, resolved);
if (real == NULL) {
return old_remove(path);
}
if (strcmp(real, "/private/var/tmp/slide.txt") == 0 || strncmp(real, "/private/var/tmp/.substitute_", strlen("/private/var/tmp/.substitute_")) == 0 || strncmp(real, "/private/var/tmp/.loader_", strlen("/private/var/tmp/.loader_")) == 0) {
errno = EPERM;
return -1;
}
return old_remove(path);
}
static __typeof__(sandbox_check_by_audit_token) *old_sandbox_check_by_audit_token = NULL;
static int hook_sandbox_check_by_audit_token(audit_token_t *token, const char *operation, int type, ...) {
va_list ap;
va_start(ap, type);
long args[5];
for (int i = 0; i < 5; i++)
args[i] = va_arg(ap, long);
va_end(ap);
if (strcmp(operation, "mach-lookup") == 0 || strcmp(operation, "mach-register") == 0) {
const char *name = (char *)args[0];
if (strncmp(name, "cy:", strlen("cy:")) == 0) {
/* always allow */
return 0;
}
}
return old_sandbox_check_by_audit_token(token, operation, type, args[0], args[1], args[2], args[3], args[4]);
}
__attribute__((constructor)) void init(void) {
mach_port_t port = get_server_port();
if (port == MACH_PORT_NULL) {
panic_log("Unable to get server port");
}
_scope({ mach_port_deallocate(mach_task_self(), port); });
int rv = 0;
uint32_t csflags = 0;
csops(getpid(), CS_OPS_STATUS, &csflags, sizeof(csflags));
if ((csflags & (CS_DEBUGGED | CS_HARD | CS_KILL)) != CS_DEBUGGED) {
rv = substitute_setup_self(port);
if (rv != KERN_SUCCESS) {
panic_log("Unable to setup myself: %s", mach_error_string(rv));
}
}
if (sandbox_check(getpid(), NULL, (enum sandbox_filter_type)(SANDBOX_FILTER_NONE | SANDBOX_CHECK_NO_REPORT)) > 0) {
mach_vm_address_t stringAddress = 0;
mach_vm_size_t stringSize = 0;
rv = substitute_copy_extensions(port, mach_task_self(), &stringAddress, &stringSize);
if (rv != KERN_SUCCESS) {
panic_log("Unable to copy sandbox extensions: %s", mach_error_string(rv));
}
_scope({ mach_vm_deallocate(mach_task_self(), stringAddress, stringSize); });
char *string = (char *)stringAddress;
char *token;
while ((token = strsep(&string, ":"))) {
if (sandbox_extension_consume(token) == -1) {
panic_log("Unable to consume extension: %s", token);
}
}
}
char path[MAXPATHLEN * 4];
memset(path, '\0', sizeof(path));
proc_pidpath(getpid(), path, sizeof(path));
size_t n_hooks = 0;
struct substitute_function_hook hooks[13];
struct task_dyld_info dyld_info;
mach_msg_type_number_t cnt = TASK_DYLD_INFO_COUNT;
rv = task_info(mach_task_self(), TASK_DYLD_INFO, (task_info_t)&dyld_info, &cnt);
if (rv == KERN_SUCCESS) {
struct dyld_all_image_infos *all_image_info = (struct dyld_all_image_infos *)dyld_info.all_image_info_addr;
const struct mach_header *dyld_load_addr = all_image_info->dyldImageLoadAddress;
struct substitute_image dyld = {-1, NULL, dyld_load_addr};
void *sym = NULL;
const char *name = "_fcntl";
substitute_find_private_syms(&dyld, &name, &sym, 1);
if (sym != NULL) {
hooks[n_hooks++] = SubHook(sym, &hook__fcntl, &old__fcntl);
}
}
hooks[n_hooks++] = SubHook(&fcntl, &hook_fcntl, &old_fcntl);
hooks[n_hooks++] = SubHook(&posix_spawn, &hook_posix_spawn, &old_posix_spawn);
hooks[n_hooks++] = SubHook(&posix_spawnp, &hook_posix_spawnp, &old_posix_spawnp);
hooks[n_hooks++] = SubHook(&vfork, &fork, NULL);
hooks[n_hooks++] = SubHook(&execve, &hook_execve, NULL);
hooks[n_hooks++] = SubHook(&csops, &hook_csops, &old_csops);
hooks[n_hooks++] = SubHook(&csops_audittoken, &hook_csops_audittoken, &old_csops_audittoken);
if (getpid() == 1) {
hooks[n_hooks++] = SubHook(&host_set_special_port, &hook_host_set_special_port, &old_host_set_special_port);
hooks[n_hooks++] = SubHook(&xpc_dictionary_get_value, &hook_xpc_dictionary_get_value, &old_xpc_dictionary_get_value);
hooks[n_hooks++] = SubHook(&remove, &hook_remove, &old_remove);
hooks[n_hooks++] = SubHook(&sandbox_check_by_audit_token, &hook_sandbox_check_by_audit_token, &old_sandbox_check_by_audit_token);
}
rv = substitute_hook_functions(hooks, n_hooks, NULL, SUBSTITUTE_NO_THREAD_SAFETY);
if (rv != SUBSTITUTE_OK) {
panic_log("Unable to install mandatory system hooks: %s", substitute_strerror(rv));
}
if (getpid() == 1) {
dlopen("/System/Library/Caches/com.apple.xpcd/xpcd_cache.dylib", RTLD_NOW);
} else if (strcmp(path, "/usr/bin/powerlogHelperd") == 0) {
return;
}
uint32_t count = _dyld_image_count();
for (uint32_t i = 0; i < count; ++i) {
const char *name = _dyld_get_image_name(i);
if (strcmp(name, "/System/Library/Frameworks/Foundation.framework/Foundation") == 0) {
dlopen(name, RTLD_LAZY | RTLD_GLOBAL);
break;
}
}
if (access("/var/tmp/.substitute_disable_loader", F_OK) != 0) {
dlopen("/usr/lib/libsubstitute.dylib", RTLD_LAZY | RTLD_LOCAL);
dlopen("/usr/lib/substitute-loader.dylib", RTLD_LAZY | RTLD_GLOBAL);
}
}
|
449e5bfb33751d3fcaefe401a130604589b7dd5a | b75de4625adcb1becb1bd95ebe93fc619de1d838 | /BeatSaber/Bloom/Bloom.cpp | 845b55be45bdb943d3c231bb023dc818efa76be5 | [] | no_license | genki-yoshizawa/BeatSaber | 4a949d1dde73ae23659d83a20f5d04c4d0516409 | fd758ef3d4a8bf5cf446beae00f62cd1f7d0d45e | refs/heads/master | 2023-03-18T07:39:39.505037 | 2021-03-11T16:05:03 | 2021-03-11T16:05:03 | 346,756,010 | 0 | 0 | null | null | null | null | SHIFT_JIS | C++ | false | false | 17,927 | cpp | Bloom.cpp | #include "Main/Main.h"
#include "Bloom.h"
#include "GameManager/GameManager.h"
#include "Renderer/Renderer.h"
#include "Scene/Scene.h"
#include "VR/VRHandle/VRHandle.h"
//#include "title.h"
#include <typeinfo>
Bloom* Bloom::m_Instance = nullptr;
void Bloom::Init(void)
{
VERTEX_3D vertex[4];
for (int eye = 0; eye < 2; eye++)
{
ovrSession* session = VRHandle::GetInstance()->GetOVRSession();
ovrSizei idealSize = ovr_GetFovTextureSize(*session, (ovrEyeType)eye, VRHandle::GetInstance()->GetOVRHmd()->DefaultEyeFov[eye], 1.0f);
vertex[0].Position = D3DXVECTOR3(idealSize.w , 0.0f, 0.0f);
vertex[0].Normal = D3DXVECTOR3(0.0f, 1.0f, 0.0f);
vertex[0].Diffuse = D3DXVECTOR4(1.0f, 1.0f, 1.0f, 1.0f);
vertex[0].TexCoord = D3DXVECTOR2(1.0f, 0.0f);
vertex[1].Position = D3DXVECTOR3(0.0f, 0.0f, 0.0f);
vertex[1].Normal = D3DXVECTOR3(0.0f, 1.0f, 0.0f);
vertex[1].Diffuse = D3DXVECTOR4(1.0f, 1.0f, 1.0f, 1.0f);
vertex[1].TexCoord = D3DXVECTOR2(0.0f, 0.0f);
vertex[2].Position = D3DXVECTOR3(idealSize.w , idealSize.h , 0.0f);
vertex[2].Normal = D3DXVECTOR3(1.0f, 1.0f, 0.0f);
vertex[2].Diffuse = D3DXVECTOR4(1.0f, 1.0f, 1.0f, 1.0f);
vertex[2].TexCoord = D3DXVECTOR2(1.0f, 1.0f);
vertex[3].Position = D3DXVECTOR3(0.0f, idealSize.h , 0.0f);
vertex[3].Normal = D3DXVECTOR3(0.0f, 1.0f, 0.0f);
vertex[3].Diffuse = D3DXVECTOR4(1.0f, 1.0f, 1.0f, 1.0f);
vertex[3].TexCoord = D3DXVECTOR2(0.0f, 1.0f);
// 頂点バッファ生成
D3D11_BUFFER_DESC bd;
ZeroMemory(&bd, sizeof(bd));
bd.Usage = D3D11_USAGE_DEFAULT;
bd.ByteWidth = sizeof(VERTEX_3D) * 4;
bd.BindFlags = D3D11_BIND_VERTEX_BUFFER;
bd.CPUAccessFlags = 0;
D3D11_SUBRESOURCE_DATA sd;
ZeroMemory(&sd, sizeof(sd));
sd.pSysMem = vertex;
Renderer::GetInstance()->GetDevice()->CreateBuffer(&bd, &sd, &m_VertexBuffer[eye]);
}
for (int eye = 0; eye < 2; eye++)
{// 輝度抽出用
// テクスチャー作成
ID3D11Texture2D* luminanceTexture = nullptr;
ovr_GetTextureSwapChainBufferDX(*VRHandle::GetInstance()->GetOVRSession(), VRHandle::GetInstance()->GetTextureSwapChain(eye), 0, IID_PPV_ARGS(&luminanceTexture));
//輝度抽出テクスチャー作成
D3D11_TEXTURE2D_DESC td;
ZeroMemory(&td, sizeof(td));
luminanceTexture->GetDesc(&td);
td.BindFlags = td.BindFlags | D3D11_BIND_SHADER_RESOURCE;
luminanceTexture = nullptr;
Renderer::GetInstance()->GetDevice()->CreateTexture2D(&td, NULL, &luminanceTexture);
// レンダーターゲットビュー作成
D3D11_RENDER_TARGET_VIEW_DESC rtvd = {};
memset(&rtvd, 0, sizeof(rtvd));
rtvd.Format = DXGI_FORMAT_R8G8B8A8_UNORM; //DXGI_FORMAT_R32G32B32A32_FLOAT;
rtvd.ViewDimension = D3D11_RTV_DIMENSION_TEXTURE2DMS;
HRESULT hr = Renderer::GetInstance()->GetDevice()->CreateRenderTargetView(luminanceTexture, &rtvd, &m_LuminanceRenderTargetView[eye]);
ERROR_CHECK((hr == ERROR_SUCCESS), "VRデバイスのレンダーターゲットビューの作成に失敗しました。");
// 輝度抽出用シェーダーリソースビュー作成
D3D11_SHADER_RESOURCE_VIEW_DESC SRVDesc = {};
SRVDesc.Format = rtvd.Format;
SRVDesc.ViewDimension = D3D11_SRV_DIMENSION_TEXTURE2DMS;
SRVDesc.Texture2D.MipLevels = 1;
Renderer::GetInstance()->GetDevice()->CreateShaderResourceView(luminanceTexture, &SRVDesc, &m_LuminanceShaderResourceView[eye]);
luminanceTexture->Release();
}
for (int eye = 0; eye < 2; eye++)
{// ガウスフィルター用X方向
// テクスチャー作成
ID3D11Texture2D* filterTexture = nullptr;
ovr_GetTextureSwapChainBufferDX(*VRHandle::GetInstance()->GetOVRSession(), VRHandle::GetInstance()->GetTextureSwapChain(eye), 0, IID_PPV_ARGS(&filterTexture));
//ガウスフィルターテクスチャー作成
D3D11_TEXTURE2D_DESC td;
ZeroMemory(&td, sizeof(td));
filterTexture->GetDesc(&td);
td.BindFlags = td.BindFlags | D3D11_BIND_SHADER_RESOURCE;
filterTexture = nullptr;
Renderer::GetInstance()->GetDevice()->CreateTexture2D(&td, NULL, &filterTexture);
// レンダーターゲットビュー作成
D3D11_RENDER_TARGET_VIEW_DESC rtvd = {};
memset(&rtvd, 0, sizeof(rtvd));
rtvd.Format = DXGI_FORMAT_R8G8B8A8_UNORM; //DXGI_FORMAT_R32G32B32A32_FLOAT;
rtvd.ViewDimension = D3D11_RTV_DIMENSION_TEXTURE2DMS;
HRESULT hr = Renderer::GetInstance()->GetDevice()->CreateRenderTargetView(filterTexture, &rtvd, &m_FilterXRenderTargetView[eye]);
ERROR_CHECK((hr == ERROR_SUCCESS), "VRデバイスのレンダーターゲットビューの作成に失敗しました。");
// ガウスフィルター用シェーダーリソースビュー作成
D3D11_SHADER_RESOURCE_VIEW_DESC SRVDesc = {};
SRVDesc.Format = rtvd.Format;
SRVDesc.ViewDimension = D3D11_SRV_DIMENSION_TEXTURE2DMS;
SRVDesc.Texture2D.MipLevels = 1;
Renderer::GetInstance()->GetDevice()->CreateShaderResourceView(filterTexture, &SRVDesc, &m_FilterXShaderResourceView[eye]);
filterTexture->Release();
}
for (int eye = 0; eye < 2; eye++)
{// ガウスフィルター用Y方向
// テクスチャー作成
ID3D11Texture2D* filterTexture = nullptr;
ovr_GetTextureSwapChainBufferDX(*VRHandle::GetInstance()->GetOVRSession(), VRHandle::GetInstance()->GetTextureSwapChain(eye), 0, IID_PPV_ARGS(&filterTexture));
//ガウスフィルターテクスチャー作成
D3D11_TEXTURE2D_DESC td;
ZeroMemory(&td, sizeof(td));
filterTexture->GetDesc(&td);
td.BindFlags = td.BindFlags | D3D11_BIND_SHADER_RESOURCE;
filterTexture = nullptr;
Renderer::GetInstance()->GetDevice()->CreateTexture2D(&td, NULL, &filterTexture);
// レンダーターゲットビュー作成
D3D11_RENDER_TARGET_VIEW_DESC rtvd = {};
memset(&rtvd, 0, sizeof(rtvd));
rtvd.Format = DXGI_FORMAT_R8G8B8A8_UNORM; //DXGI_FORMAT_R32G32B32A32_FLOAT;
rtvd.ViewDimension = D3D11_RTV_DIMENSION_TEXTURE2DMS;
HRESULT hr = Renderer::GetInstance()->GetDevice()->CreateRenderTargetView(filterTexture, &rtvd, &m_FilterYRenderTargetView[eye]);
ERROR_CHECK((hr == ERROR_SUCCESS), "VRデバイスのレンダーターゲットビューの作成に失敗しました。");
// ガウスフィルター用シェーダーリソースビュー作成
D3D11_SHADER_RESOURCE_VIEW_DESC SRVDesc = {};
SRVDesc.Format = rtvd.Format;
SRVDesc.ViewDimension = D3D11_SRV_DIMENSION_TEXTURE2DMS;
SRVDesc.Texture2D.MipLevels = 1;
Renderer::GetInstance()->GetDevice()->CreateShaderResourceView(filterTexture, &SRVDesc, &m_FilterYShaderResourceView[eye]);
filterTexture->Release();
}
Renderer::GetInstance()->CreateVertexShader(&m_VertexShader, &m_VertexLayout, "bloomVS.cso");
Renderer::GetInstance()->CreatePixelShader(&m_PixelShader, "bloomPS.cso");
Renderer::GetInstance()->CreateVertexShader(&m_LuminanceVertexShader, &m_LuminanceVertexLayout, "bloomLuminanceVS.cso");
Renderer::GetInstance()->CreatePixelShader(&m_LuminancePixelShader, "bloomLuminancePS.cso");
Renderer::GetInstance()->CreateVertexShader(&m_FilterXVertexShader, &m_FilterXVertexLayout, "bloomFilterXVS.cso");
Renderer::GetInstance()->CreatePixelShader(&m_FilterXPixelShader, "bloomFilterXPS.cso");
Renderer::GetInstance()->CreateVertexShader(&m_FilterYVertexShader, &m_FilterYVertexLayout, "bloomFilterYVS.cso");
Renderer::GetInstance()->CreatePixelShader(&m_FilterYPixelShader, "bloomFilterYPS.cso");
//D3DX11CreateShaderResourceViewFromFile(Renderer::GetInstance()->GetDevice(),
// "asset/texture/number.png",
// NULL,
// NULL,
// &m_BloomTexture,
// NULL);
//assert(m_BloomTexture);
}
void Bloom::Uninit(void)
{
for(int eye = 0; eye < 2; eye++)
{
m_LuminanceRenderTargetView[eye]->Release();
//m_LuminanceShaderResourceView[eye]->Release();
m_FilterXRenderTargetView[eye]->Release();
//m_FilterXShaderResourceView[eye]->Release();
m_FilterYRenderTargetView[eye]->Release();
//m_FilterYShaderResourceView[eye]->Release();
m_VertexBuffer[eye]->Release();
}
}
void Bloom::Update(void)
{
}
void Bloom::Draw(int eye)
{
// 入力レイアウト設定
Renderer::GetInstance()->GetDeviceContext()->IASetInputLayout(m_VertexLayout);
// シェーダ設定
Renderer::GetInstance()->GetDeviceContext()->VSSetShader(m_VertexShader, NULL, 0);
Renderer::GetInstance()->GetDeviceContext()->PSSetShader(m_PixelShader, NULL, 0);
// マトリクス設定
Renderer::GetInstance()->SetWorldMatrix(&(XMMatrixIdentity()));
//Renderer::GetInstance()->SetWorldViewProjection2D(VRHandle::GetInstance()->GetProjectionMatrix(eye));
Renderer::GetInstance()->SetWorldViewProjection2D(eye);
// 頂点バッファ設定
UINT stride = sizeof(VERTEX_3D);
UINT offset = 0;
Renderer::GetInstance()->GetDeviceContext()->IASetVertexBuffers(
0, 1, &m_VertexBuffer[eye], &stride, &offset);
// マテリアル設定
MATERIAL material;
ZeroMemory(&material, sizeof(material));
material.Diffuse = D3DXCOLOR(1.0f, 1.0f, 1.0f, 1.0f);
Renderer::GetInstance()->SetMaterial(material);
// テクスチャ設定
//m_BloomTexture = Renderer::GetInstance()->GetPPTexture(eye);
ID3D11ShaderResourceView* bloom_texture = VRHandle::GetInstance()->GetPPTexture(eye);
Renderer::GetInstance()->GetDeviceContext()->PSSetShaderResources(0, 1, &bloom_texture);
//Renderer::GetInstance()->GetDeviceContext()->PSSetShaderResources(1, 1, &m_LuminanceShaderResourceView[eye]);
//Renderer::GetInstance()->GetDeviceContext()->PSSetShaderResources(1, 1, &m_FilterXShaderResourceView[eye]);
Renderer::GetInstance()->GetDeviceContext()->PSSetShaderResources(1, 1, &m_FilterYShaderResourceView[eye]);
// プリミティブトポロジ設定
Renderer::GetInstance()->GetDeviceContext()->IASetPrimitiveTopology(
D3D11_PRIMITIVE_TOPOLOGY_TRIANGLESTRIP);
D3D11_MAPPED_SUBRESOURCE map;
Renderer::GetInstance()->GetDeviceContext()->Map(Renderer::GetInstance()->GetD3DBffer(), 0, D3D11_MAP_WRITE_DISCARD, 0, &map);
memcpy(map.pData, Renderer::GetInstance()->GetUniformData(), Renderer::GetInstance()->UNIFORM_DATA_SIZE);
Renderer::GetInstance()->GetDeviceContext()->Unmap(Renderer::GetInstance()->GetD3DBffer(), 0);
// ポリゴン描画
Renderer::GetInstance()->GetDeviceContext()->Draw(4, 0);
}
void Bloom::Luminance(int eye)
{
// レンダーターゲット設定
ID3D11DepthStencilView* depth_stencil = VRHandle::GetInstance()->GetDSV(eye);
Renderer::GetInstance()->GetDeviceContext()->OMSetRenderTargets(1, &m_LuminanceRenderTargetView[eye], depth_stencil);
// バックバッファクリア
float ClearColor[4] = { 0.2f, 0.2f, 0.2f, 1.0f };
Renderer::GetInstance()->GetDeviceContext()->ClearRenderTargetView(m_LuminanceRenderTargetView[eye], ClearColor);
Renderer::GetInstance()->GetDeviceContext()->ClearDepthStencilView(depth_stencil, D3D11_CLEAR_DEPTH | D3D11_CLEAR_STENCIL, 1.0f, 0);
Renderer::GetInstance()->GetDeviceContext()->RSSetViewports(1, &VRHandle::GetInstance()->GetViewPort(eye));
// 入力レイアウト設定
Renderer::GetInstance()->GetDeviceContext()->IASetInputLayout(m_LuminanceVertexLayout);
// シェーダ設定
Renderer::GetInstance()->GetDeviceContext()->VSSetShader(m_LuminanceVertexShader, NULL, 0);
Renderer::GetInstance()->GetDeviceContext()->PSSetShader(m_LuminancePixelShader, NULL, 0);
// マトリクス設定
Renderer::GetInstance()->SetWorldMatrix(&(XMMatrixIdentity()));
Renderer::GetInstance()->SetWorldViewProjection2D(eye);
// 頂点バッファ設定
UINT stride = sizeof(VERTEX_3D);
UINT offset = 0;
Renderer::GetInstance()->GetDeviceContext()->IASetVertexBuffers(
0, 1, &m_VertexBuffer[eye], &stride, &offset);
// マテリアル設定
MATERIAL material;
ZeroMemory(&material, sizeof(material));
material.Diffuse = D3DXCOLOR(1.0f, 1.0f, 1.0f, 1.0f);
Renderer::GetInstance()->SetMaterial(material);
// テクスチャ設定
ID3D11ShaderResourceView* postprocessing_texture = VRHandle::GetInstance()->GetPPTexture(eye);
Renderer::GetInstance()->GetDeviceContext()->PSSetShaderResources(0, 1, &postprocessing_texture);
// プリミティブトポロジ設定
Renderer::GetInstance()->GetDeviceContext()->IASetPrimitiveTopology(
D3D11_PRIMITIVE_TOPOLOGY_TRIANGLESTRIP);
D3D11_MAPPED_SUBRESOURCE map;
Renderer::GetInstance()->GetDeviceContext()->Map(Renderer::GetInstance()->GetD3DBffer(), 0, D3D11_MAP_WRITE_DISCARD, 0, &map);
memcpy(map.pData, Renderer::GetInstance()->GetUniformData(), Renderer::GetInstance()->UNIFORM_DATA_SIZE);
Renderer::GetInstance()->GetDeviceContext()->Unmap(Renderer::GetInstance()->GetD3DBffer(), 0);
// ポリゴン描画
Renderer::GetInstance()->GetDeviceContext()->Draw(4, 0);
}
void Bloom::Filter(int eye)
{
Renderer::GetInstance()->SetGaussWeight();
ovrSession* session = VRHandle::GetInstance()->GetOVRSession();
ovrSizei idealSize = ovr_GetFovTextureSize(*session, (ovrEyeType)eye, VRHandle::GetInstance()->GetOVRHmd()->DefaultEyeFov[eye], 1.0f);
Renderer::GetInstance()->SetScreen(idealSize.w, idealSize.h);
{// X方向
// レンダーターゲット設定
ID3D11DepthStencilView* depth_stencil = VRHandle::GetInstance()->GetDSV(eye);
Renderer::GetInstance()->GetDeviceContext()->OMSetRenderTargets(1, &m_FilterXRenderTargetView[eye], depth_stencil);
// バックバッファクリア
float ClearColor[4] = { 0.2f, 0.2f, 0.2f, 1.0f };
Renderer::GetInstance()->GetDeviceContext()->ClearRenderTargetView(m_FilterXRenderTargetView[eye], ClearColor);
Renderer::GetInstance()->GetDeviceContext()->ClearDepthStencilView(depth_stencil, D3D11_CLEAR_DEPTH | D3D11_CLEAR_STENCIL, 1.0f, 0);
Renderer::GetInstance()->GetDeviceContext()->RSSetViewports(1, &VRHandle::GetInstance()->GetViewPort(eye));
// 入力レイアウト設定
Renderer::GetInstance()->GetDeviceContext()->IASetInputLayout(m_FilterXVertexLayout);
// シェーダ設定
Renderer::GetInstance()->GetDeviceContext()->VSSetShader(m_FilterXVertexShader, NULL, 0);
Renderer::GetInstance()->GetDeviceContext()->PSSetShader(m_FilterXPixelShader, NULL, 0);
// マトリクス設定
Renderer::GetInstance()->SetWorldMatrix(&(XMMatrixIdentity()));
Renderer::GetInstance()->SetWorldViewProjection2D(eye);
// 頂点バッファ設定
UINT stride = sizeof(VERTEX_3D);
UINT offset = 0;
Renderer::GetInstance()->GetDeviceContext()->IASetVertexBuffers(
0, 1, &m_VertexBuffer[eye], &stride, &offset);
// マテリアル設定
MATERIAL material;
ZeroMemory(&material, sizeof(material));
material.Diffuse = D3DXCOLOR(1.0f, 1.0f, 1.0f, 1.0f);
Renderer::GetInstance()->SetMaterial(material);
// テクスチャ設定
Renderer::GetInstance()->GetDeviceContext()->PSSetShaderResources(0, 1, &m_LuminanceShaderResourceView[eye]);
// プリミティブトポロジ設定
Renderer::GetInstance()->GetDeviceContext()->IASetPrimitiveTopology(
D3D11_PRIMITIVE_TOPOLOGY_TRIANGLESTRIP);
D3D11_MAPPED_SUBRESOURCE map;
Renderer::GetInstance()->GetDeviceContext()->Map(Renderer::GetInstance()->GetD3DBffer(), 0, D3D11_MAP_WRITE_DISCARD, 0, &map);
memcpy(map.pData, Renderer::GetInstance()->GetUniformData(), Renderer::GetInstance()->UNIFORM_DATA_SIZE);
Renderer::GetInstance()->GetDeviceContext()->Unmap(Renderer::GetInstance()->GetD3DBffer(), 0);
// ポリゴン描画
Renderer::GetInstance()->GetDeviceContext()->Draw(4, 0);
}
{// Y方向
// レンダーターゲット設定
ID3D11DepthStencilView* depth_stencil = VRHandle::GetInstance()->GetDSV(eye);
Renderer::GetInstance()->GetDeviceContext()->OMSetRenderTargets(1, &m_FilterYRenderTargetView[eye], depth_stencil);
// バックバッファクリア
float ClearColor[4] = { 0.2f, 0.2f, 0.2f, 1.0f };
Renderer::GetInstance()->GetDeviceContext()->ClearRenderTargetView(m_FilterYRenderTargetView[eye], ClearColor);
Renderer::GetInstance()->GetDeviceContext()->ClearDepthStencilView(depth_stencil, D3D11_CLEAR_DEPTH | D3D11_CLEAR_STENCIL, 1.0f, 0);
Renderer::GetInstance()->GetDeviceContext()->RSSetViewports(1, &VRHandle::GetInstance()->GetViewPort(eye));
// 入力レイアウト設定
Renderer::GetInstance()->GetDeviceContext()->IASetInputLayout(m_FilterYVertexLayout);
// シェーダ設定
Renderer::GetInstance()->GetDeviceContext()->VSSetShader(m_FilterYVertexShader, NULL, 0);
Renderer::GetInstance()->GetDeviceContext()->PSSetShader(m_FilterYPixelShader, NULL, 0);
// マトリクス設定
Renderer::GetInstance()->SetWorldMatrix(&(XMMatrixIdentity()));
Renderer::GetInstance()->SetWorldViewProjection2D(eye);
// 頂点バッファ設定
UINT stride = sizeof(VERTEX_3D);
UINT offset = 0;
Renderer::GetInstance()->GetDeviceContext()->IASetVertexBuffers(
0, 1, &m_VertexBuffer[eye], &stride, &offset);
// マテリアル設定
MATERIAL material;
ZeroMemory(&material, sizeof(material));
material.Diffuse = D3DXCOLOR(1.0f, 1.0f, 1.0f, 1.0f);
Renderer::GetInstance()->SetMaterial(material);
// テクスチャ設定
Renderer::GetInstance()->GetDeviceContext()->PSSetShaderResources(0, 1, &m_FilterXShaderResourceView[eye]);
// プリミティブトポロジ設定
Renderer::GetInstance()->GetDeviceContext()->IASetPrimitiveTopology(
D3D11_PRIMITIVE_TOPOLOGY_TRIANGLESTRIP);
D3D11_MAPPED_SUBRESOURCE map;
Renderer::GetInstance()->GetDeviceContext()->Map(Renderer::GetInstance()->GetD3DBffer(), 0, D3D11_MAP_WRITE_DISCARD, 0, &map);
memcpy(map.pData, Renderer::GetInstance()->GetUniformData(), Renderer::GetInstance()->UNIFORM_DATA_SIZE);
Renderer::GetInstance()->GetDeviceContext()->Unmap(Renderer::GetInstance()->GetD3DBffer(), 0);
// ポリゴン描画
Renderer::GetInstance()->GetDeviceContext()->Draw(4, 0);
}
} |
d6416c927e3fa42226c35e101d925fdae975f35a | 634451da48acec97fbd1cf0d8748f5b3d6d0b0a5 | /tracing/trace_helpers.h | cf6b2eb24f4cf35951e86600029ffd38bf96b58a | [] | permissive | paolococchi/kv_engine | 522400a511bd18d46576a3b17f2ac41d01e259ba | 40256dca6bf77fb4bcc18e8ef7d9b8f991bf4e45 | refs/heads/master | 2020-07-03T13:53:31.745707 | 2019-09-25T10:35:11 | 2019-09-27T15:31:58 | 191,713,509 | 1 | 0 | BSD-3-Clause | 2019-06-13T07:31:22 | 2019-06-13T07:31:21 | null | UTF-8 | C++ | false | false | 4,868 | h | trace_helpers.h | /* -*- Mode: C++; tab-width: 4; c-basic-offset: 4; indent-tabs-mode: nil -*- */
/*
* Copyright 2017 Couchbase, Inc.
*
* 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.
*/
#pragma once
#include "tracer.h"
#include "daemon/cookie.h"
// #define DISABLE_SESSION_TRACING 1
#ifndef DISABLE_SESSION_TRACING
/**
* Traces a scope
* Usage:
* {
* TRACE_SCOPE(cookie, "test1");
* ....
* }
*/
class ScopedTracer {
public:
ScopedTracer(Cookie& cookie, const cb::tracing::TraceCode code)
: cookie(cookie) {
if (cookie.isTracingEnabled()) {
spanId = cookie.getTracer().begin(code);
}
}
/// Constructor from Cookie (void*)
ScopedTracer(const void* cookie, const cb::tracing::TraceCode code)
: ScopedTracer(*reinterpret_cast<Cookie*>(const_cast<void*>(cookie)),
code) {
}
~ScopedTracer() {
if (cookie.isTracingEnabled()) {
cookie.getTracer().end(spanId);
}
}
protected:
Cookie& cookie;
/// ID of our Span.
cb::tracing::Tracer::SpanId spanId = {};
};
/**
* Simple helper class which adds a trace begin or end event instantly
* when it is created.
* For use when the start & stop times are not inside the same scope; and hence
* need the ability to specify them individually.
*/
class InstantTracer {
public:
InstantTracer(Cookie& cookie,
const cb::tracing::TraceCode code,
bool begin,
std::chrono::steady_clock::time_point time =
std::chrono::steady_clock::now()) {
if (cookie.isTracingEnabled()) {
auto& tracer = cookie.getTracer();
if (begin) {
tracer.begin(code, time);
} else {
tracer.end(code, time);
}
}
}
/// Constructor from Cookie (void*)
InstantTracer(const void* cookie,
const cb::tracing::TraceCode code,
bool begin,
std::chrono::steady_clock::time_point time =
std::chrono::steady_clock::now())
: InstantTracer(*reinterpret_cast<Cookie*>(const_cast<void*>(cookie)),
code,
begin,
time) {
}
};
/**
* Adapter class to assist in recording the duration of an event into
* Tracer objects, by storing the cookie and code in the object. To be used
* with ScopeTimer classes.
*
* It's stop() and start() methods (which only take a
* std::chrono::steady_clock::time_point) use the stored cookie and TraceCode to
* record the times in the appropriate tracer object.
*/
class TracerStopwatch {
public:
TracerStopwatch(Cookie& cookie, const cb::tracing::TraceCode code)
: cookie(cookie), code(code) {
}
/// Constructor from Cookie (void*)
TracerStopwatch(const void* cookie, const cb::tracing::TraceCode code)
: TracerStopwatch(*reinterpret_cast<Cookie*>(const_cast<void*>(cookie)),
code) {
}
void start(std::chrono::steady_clock::time_point startTime) {
if (cookie.isTracingEnabled()) {
spanId = cookie.getTracer().begin(code, startTime);
}
}
void stop(std::chrono::steady_clock::time_point stopTime) {
if (cookie.isTracingEnabled()) {
cookie.getTracer().end(spanId, stopTime);
}
}
protected:
Cookie& cookie;
/// ID of our Span.
cb::tracing::Tracer::SpanId spanId = {};
cb::tracing::TraceCode code;
};
#define TRACE_SCOPE(ck, code) ScopedTracer __st__##__LINE__(ck, code)
/**
* Begin a trace. Accepts a single optional argument - the time_point to use
* as the starting time instead of the default std::chrono::steady_clock::now().
*/
#define TRACE_BEGIN(ck, code, ...) \
InstantTracer(ck, code, /*begin*/ true, __VA_ARGS__)
/**
* End a trace. Accepts a single optional argument - the time_point to use
* as the ending time instead of the default std::chrono::steady_clock::now().
*/
#define TRACE_END(ck, code, ...) \
InstantTracer(ck, code, /*begin*/ false, __VA_ARGS__)
#else
/**
* if DISABLE_SESSION_TRACING is set
* unset all TRACE macros
*/
#define TRACE_SCOPE(ck, code)
#define TRACE_BEGIN(ck, code)
#define TRACE_END(ck, code)
#endif
|
c646dd251653e32319f127be29d5dcb923545866 | 5c1fcca4656f2f3e11bf49db865d6a3172cdc56c | /src/main.cpp | cb64d66cee992e26574eab675f63e7a0f741527f | [] | no_license | kioku-systemk/MOE3 | 40e03523e58a8263b4d5e302039faf7414fe2a5e | 24b40973045e532d53278f20a2773e3ec0a16457 | refs/heads/master | 2023-05-14T00:16:15.167768 | 2015-03-05T15:42:01 | 2015-03-05T15:42:01 | 7,355,474 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 8,836 | cpp | main.cpp | //
// main.cpp
// MOE3
//
// Created by kioku on 2012/12/28.
// Copyright (c) 2012 System K. All rights reserved.
//
#include "Core/MOE.h"
#include "Core/CoreWindow.h"
#include "Gfx/Graphics.h"
#include "EasyMIDIController/EasyMIDIController.h"
#if 0 // for script
#include "Utility/ScriptManager.h"
#endif
#include <stdio.h>
#include <stdlib.h>
#include "Core/Stream.h"
#include "SceneGraph/SceneGraph.h"
#include "SceneGraph/MrzLoader.h"
#include "SceneGraph/AnimLoader.h"
#include "Gfx/SceneGraphRender.h"
#include "Core/Math.h"
#include "Core/UI/SimpleGUI.h"
#include "SceneGraph/SceneGraph.h"
#include "Core/Time.h"
class MOEWindow : public CoreWindow
{
public:
MOEWindow(int x, int y, int width, int height)
: CoreWindow(x, y, width, height, "MOE3"
#ifdef RELEASEOUT
,true // fullscreen
#endif
){
g = mnew MOE::Graphics();
#ifndef RELEASEOUT
m_midi = mnew EasyMIDIController();
m_gui = mnew SimpleGUI::GUIManager();
m_gui->Resize(width, height);
skGUI::BaseWindow* win = m_gui->GetRoot();
m_width = width;
m_height = height;
// TEST
const f32 col[] = {0.50,0.50,0.50,0.50};
m_frame1 = mnew SimpleGUI::Frame(m_gui,0,0,width, 30, col);
m_frame2 = mnew SimpleGUI::Frame(m_gui,0,30,100, height-30, col);
win->AddChild(m_frame1);
win->AddChild(m_frame2);
SimpleGUI::Caption* cap = mnew SimpleGUI::Caption(m_gui, 0, 0, "MOE3 Demo Engine", 16);
m_frame1->AddChild(cap);
m_bar[0] = mnew SimpleGUI::Slider(m_gui, 10,10,80,16);
m_bar[1] = mnew SimpleGUI::Slider(m_gui, 10,30,80,16);
m_bar[2] = mnew SimpleGUI::Slider(m_gui, 10,50,80,16);
m_frame2->AddChild(m_bar[0]);
m_frame2->AddChild(m_bar[1]);
m_frame2->AddChild(m_bar[2]);
m_root = 0;
#if 0
m_srender = mnew MOE::SceneGraphRender(g);
MOE::Stream mst("/Users/kioku/Desktop/scatx3.MRZ", MOE::Stream::MODE_INPUT_BINARY_ONMEMORY);
//MOE::Stream mst("scatx3.MRZ", MOE::Stream::MODE_INPUT_BINARY_ONMEMORY);
MOE::MrzLoader loader;
MOE::SceneGraph::Node* node = loader.Load(&mst);
if (node) {
m_root = node;
}
MOE::Stream ast("/Users/kioku/Desktop/scatx3_mrz.anim", MOE::Stream::MODE_INPUT_BINARY_ONMEMORY);
//MOE::Stream ast("scatx3_mrz.anim", MOE::Stream::MODE_INPUT_BINARY_ONMEMORY);
MOE::AnimLoader aloader;
MOE::Animation* anim = aloader.Load(&ast);
m_anim = anim;
//MOE::Stream mst("/Users/kioku/Desktop/git/MOE3/src/boxtest.MRZ", MOE::Stream::MODE_INPUT_BINARY_ONMEMORY);
/* MOE::Stream mst("/Users/kioku/Desktop/scatb.MRZ", MOE::Stream::MODE_INPUT_BINARY_ONMEMORY);
MOE::MrzLoader loader;
MOE::SceneGraph::Node* node = loader.Load(&mst);
MOE::Stream ast("/Users/kioku/Desktop/scatb_a.anim", MOE::Stream::MODE_INPUT_BINARY_ONMEMORY);
MOE::AnimLoader aloader;
MOE::Animation* anim = aloader.Load(&ast);
anim = anim;
anim->Animate(node,1);*/
#endif
#endif
#if 0 // for script
// インスタンス取得
MOE::CScriptManager *pScr = MOE::CScriptManager::GetInstance();
// lua 読込
if( pScr->Read( "../data/definition/test.lua", "testeffect" ) ){
// lua スタック拡張( test として 100 くらい増やした)
pScr->ExtraStack( "testeffect", 100 );
// test 関数実行 : f32 & s32 型
pScr->ExecFunc( "testeffect", "test" );
pScr->DebugStackPrint( "testeffect" );
f32 valF32 = pScr->GetExecFuncResultF32( "testeffect" );
s32 valS32 = pScr->GetExecFuncResultS32( "testeffect" );
pScr->ClearStack( "testeffect" );
// test2 関数実行 : string型
pScr->ExecFunc( "testeffect", "test2" );
pScr->DebugStackPrint( "testeffect" );
string valStr = pScr->GetExecFuncResultString( "testeffect" );
pScr->ClearStack( "testeffect" );
// test3 関数実行 : string型
pScr->ExecFunc( "testeffect", "test3" );
pScr->DebugStackPrint( "testeffect" );
b8 valBool = pScr->GetExecFuncResultBool( "testeffect" );
pScr->ClearStack( "testeffect" );
// test4 関数実行 : c言語側システムコール呼出
pScr->ExecFunc( "testeffect", "test4" );
pScr->DebugStackPrint( "testeffect" );
// test5 関数実行 : 引数を c言語側から渡す場合の呼出
pScr->ExecFunc( "testeffect", "test5", 1, "%s%f%d%c", "test", 9.5f, 5, 'a' );
pScr->DebugStackPrint( "testeffect" );
// globalvalue
valF32 = pScr->GetGlobalValueF32( "testeffect", "gFloat" );
valS32 = pScr->GetGlobalValueS32( "testeffect", "gInt" );
valBool = pScr->GetGlobalValueBool( "testeffect", "gBool" );
valStr = pScr->GetGlobalValueString( "testeffect", "gString" );
pScr->DebugStackPrint( "testeffect" );
// table
valF32 = pScr->GetTableValueF32( "testeffect", "gTable", "t2" );
valS32 = pScr->GetTableValueS32( "testeffect", "gTable", "t1" );
valStr = pScr->GetTableValueString( "testeffect", "gTable", "t0" );
valBool = pScr->GetTableValueBool( "testeffect", "gTable", "t3" );
pScr->DebugStackPrint( "testeffect" );
// 後始末
pScr->Release();
}
#endif
rot = MOE::Math::Identity();
mx = 0;
my = 0;
press = false;
}
~MOEWindow()
{
}
s32 mx;
s32 my;
b8 press;
MOE::Math::matrix rot;
void MouseLeftDown(int x, int y)
{
mx = x;
my = y;
press = true;
m_gui->MouseDown(0, x,y);
}
void MouseLeftUp(int x, int y)
{
press = false;
m_gui->MouseUp(0, x,y);
}
void MouseMove(int x, int y)
{
s32 dx = x - mx;
s32 dy = y - my;
if (press) {
rot = MOE::Math::RotationY(dx * 0.2) * rot;
rot = MOE::Math::RotationX(dy * 0.2) * rot;
}
mx = x;
my = y;
m_gui->MouseMove(x, y);
}
void Wheel(float dx, float dy, float dz) {}
void KeyDown(int key){
if (key == 27)
exit(0);
m_gui->KeyDown(key);
}
void KeyUp(int key)
{
m_gui->KeyUp(key);
}
void updateGUI()
{
static f32 m0 = m_midi->GetControlParam(0);
if (m0 != m_midi->GetControlParam(0)){
m0 = m_midi->GetControlParam(0);
m_bar[0]->SetValue(m0);
}
static f32 m1 = m_midi->GetControlParam(1);
if (m1 != m_midi->GetControlParam(1)){
m1 = m_midi->GetControlParam(1);
m_bar[1]->SetValue(m1);
}
static f32 m2 = m_midi->GetControlParam(2);
if (m2 != m_midi->GetControlParam(2)){
m2 = m_midi->GetControlParam(2);
m_bar[2]->SetValue(m2);
}
}
void Draw()
{
updateGUI();
const float mr = m_bar[0]->GetValue();
const float mg = m_bar[1]->GetValue();
const float mb = m_bar[2]->GetValue();
g->Enable(VG_DEPTH_TEST);
g->ClearColor(mr,mg,mb,0);
g->Clear(VG_COLOR_BUFFER_BIT | VG_DEPTH_BUFFER_BIT);
#if 0
using namespace MOE::Math;
matrix proj = PerspectiveFov(45, m_width/static_cast<f32>(m_height), 0.1, 100.0);
matrix view = LookAt(vec3(0,0,50), vec3(0,0,0), vec3(0,1,0));
view = view * rot;
m_srender->SetProjMatrix(proj);
m_srender->SetViewMatrix(view);
f64 tm = fmod(MOE::GetTimeCount(),5.0);
if (m_anim)
m_anim->Animate(m_root, tm);
m_srender->UpdateBuffers(m_root);
m_srender->Draw(m_root);
#endif
g->Disable(VG_DEPTH_TEST);
m_gui->Draw();
// own graphics code.
SwapBuffer();
}
void Idle(void)
{
Draw();
}
void Resize(int w, int h)
{
m_width = w;
m_height = h;
g->Viewport(0, 0, w, h);
m_gui->Resize(w, h);
m_frame1->SetSize(w, 30);
m_frame2->SetSize(100, h-30);
Draw();
}
private:
MOE::Graphics* g;
MOE::SceneGraphRender* m_srender;
MOE::SceneGraph::Node* m_root;
MOE::Animation* m_anim;
s32 m_width;
s32 m_height;
#ifndef RELEASEOUT
EasyMIDIController* m_midi;
SimpleGUI::GUIManager* m_gui;
SimpleGUI::Frame* m_frame1, *m_frame2;
SimpleGUI::Slider* m_bar[3];
#endif
};
#if defined(WIN32) && defined(RELEASEOUT)
int WINAPI WinMain(
HINSTANCE hInstance,
HINSTANCE hPrevInstance,
LPSTR lpCmdLine,
int nCmdShow
)
#else
int main(int argc, char *argv[])
#endif
{
MOEWindow win(32, 32, 720, 480);
CoreWindow::MainLoop();
return 0;
}
|
5328180c04c260dabfb8a587798f70d12671acd8 | 066cd062f509cd7f0dd1932ee33997667aa75a8d | /GFG/DP/Cutting a Rod.cpp | 159620e6ccbd70075be37b7a71de868defab35e2 | [] | no_license | rhayatin/C-- | 5581b2f283edd119a5cf5245962b8e04b1b0baa1 | 14589f3ffb1433af2afe10dddb1c585f467ce2d1 | refs/heads/master | 2021-01-24T03:02:53.479832 | 2014-08-05T11:29:17 | 2014-08-05T11:29:17 | null | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 611 | cpp | Cutting a Rod.cpp | #include<iostream>
#include<cstdio>
using namespace std;
int cutRodDP(int arr[], int size)
{
for(int i=2;i<size;i++)
{
for(int j=1;j<=i/2;j++)
arr[i]=max(arr[i],arr[j]+arr[i-j]);
}
return arr[size];
}
int cutRod(int arr[], int size)
{
if(size<=0)
return 0;
int ans=arr[size];
for(int i=0;i<=size/2;i++)
{
ans= max(cutRod(arr,i)+cutRod(arr,size-i-1),ans);
}
return ans;
}
int main()
{
int arr[] = {0, 1, 5, 8, 9, 10, 17, 17, 20};
int size = sizeof(arr)/sizeof(arr[0]);
printf("Maximum Obtainable Value is %d\n", cutRod(arr, size));
getchar();
return 0;
}
|
918b2e2b217d98e1eb047f49b0b12a5474bb784b | d985f7286f3c3844b7d9e7c89075d2ebe4bcfa18 | /2/2.2/main.cpp | dee5e47694bb4417745ceee80e2c7ee8a9273cf0 | [] | no_license | KeremAtak/ceepeepee | 091e5677c2a4215ea79bcd436ee867cf6d03fed7 | 0fc63d5ece3954203d900e8debf363f5d40b99e2 | refs/heads/master | 2022-12-11T06:55:57.873720 | 2020-08-27T22:45:18 | 2020-08-27T22:45:18 | 275,889,063 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 576 | cpp | main.cpp | #include <iostream>
int getValueFromUser() // this function now returns an integer value
{
std::cout << "Enter an integer: ";
int input{};
std::cin >> input;
return input; // return the value the user entered back to the caller
}
void printA()
{
std::cout << "A\n";
}
int main()
{
int num1 { getValueFromUser() }; // initialize num with the return value of getValueFromUser()
int num2 { getValueFromUser() };
std::cout << num1 << " times " << num2 << " is " << num1 * num2 << '\n';
// std::cout << printA() << '\n'; won't compile..
return 0;
} |
ac1d1c8e2c0ed7af0390ed05b20990ec96e7a51d | f019ddb942b65b8c8b78fc89429fffaed37ebbc7 | /Server Code/ArduinoUno/ArduinoUno.ino | 4e08f157b98af9c6683377785363ddf635162082 | [] | no_license | NigelBess/Arduino-Server | 18dbc0e91d3dc60207df1991d55422c9754bc51a | ad3d9c5800abf9600100fc1025056d8c4c4b2d0f | refs/heads/master | 2020-07-09T05:40:47.750590 | 2019-10-31T01:39:18 | 2019-10-31T01:39:18 | 203,897,082 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 13,028 | ino | ArduinoUno.ino | #include "PinObject.h"
#include "ServoObject.h"
#include "Encoder.h"
const uint8_t maxMessageLength = 8;//max number of bytes in an incoming message
const uint8_t numBitsPerByte = 7;//useable bits per byte for sending large numbers over multiple bytes
//obviously each byte is 8 bits, but we cant use values of 255 or 254 because those are used for a null message and the terminator
//so we have to use one less bit per byte when transferring large numbers over multiple bytes
const byte nullByte = 255;//byte representing a lack of available Serial input
const byte terminator = 254;//byte representing end of message
const byte errorByte = 253;//used in the return message to signify an error
const byte successByte = 0;//used in the return message to signify successful execution of a function
const byte maxAnalogValue = 252;//corresponds to 255 in arduino's analog read/write functions
const byte timeOutByte = 252;//used to represent message read timeout as function param
const uint8_t startDelay = 100;//ms
const uint16_t serialTimeOutTime = 500;//ms
byte* message = new byte[maxMessageLength];//incoming message buffer
const uint8_t maxPinNum = 19;
const uint8_t maxPinType = 2;
const uint8_t maxDigitalState = 1;
const uint8_t numInterruptPins = 2;
const uint8_t maxServos = maxPinNum +1;
ServoObject** servos = new ServoObject*[maxServos]{NULL};
Encoder** encoders = new Encoder*[numInterruptPins]{NULL};
void setup()
{
Serial.begin(250000);
Serial.setTimeout(serialTimeOutTime);
delay(startDelay);
sendDeviceInfo();
}
void loop()
{
if(Serial.available()>0)
{
parse(getIncomingMessage());
}
}
void sendMessage(String msg)
{
Serial.print(msg+String(char(terminator)));
}
void sendMessage(int input)
{
//obviously each byte is 8 bits, but we cant use 255 or 254 because those are used for a null message and the terminator
//so we have to use one less bit per byte when transferring large numbers over multiple bytes
uint8_t totalBits = sizeof(input)*8;
uint8_t bytesNeeded = totalBits/numBitsPerByte + int((totalBits%numBitsPerByte)>0);
uint8_t firstValue = uint8_t(int(input<0));
Serial.write(firstValue);
input = abs(input);
for (uint8_t i = 0; i<bytesNeeded;i++)
{
uint8_t shift = (i+1)*numBitsPerByte;
uint32_t remainder = abs(input)%int(pow(2,numBitsPerByte));
input >>= shift;
Serial.write(uint8_t(remainder));//little endian
}
Serial.write(terminator);
}
void error(String msg)
{
Serial.write(errorByte);
sendMessage(msg);
}
void invalidPinError(uint8_t pin)
{
error("Pin " + String(pin) + " is invalid. Valid pins are 0-19.");
}
void unavailablePinError(uint8_t pin)
{
error("Pin " + String(pin) + " is already in use by an encoder or servo.");
}
void findServoError(uint8_t pin)
{
findError("servo",pin);
}
void findEncoderError(uint8_t pin)
{
findError("encoder interrupt pin",pin);
}
void findError(String type, uint8_t pin)
{
error("No "+ type+ " found at pin "+ String(pin));
}
void runtimeError()
{
error(F("The Arduino has encountered a runtime error (this isn't supposed to happen). If you are reading this message, there is a bug in the Arduino server code. Probably a buffer error or stack overflow."));
}
void success()
{
Serial.write(0);
Serial.write(terminator);
}
byte* getIncomingMessage()
{
for (int i = 0;i<maxMessageLength;i++)
{
message[i] = 0;
}
uint8_t index = 0;
while(index<maxMessageLength)
{
byte currentByte;
unsigned long int startMessageTime = millis();
do
{
currentByte = Serial.read();
}
while((currentByte == 255)&&((millis()-startMessageTime))<serialTimeOutTime);
if (currentByte == 255)
{
message[0] = timeOutByte;
return message;
}
message[index] = currentByte;
index++;
if(currentByte==terminator) return message;
}
return message;
}
void parse(byte* message)
{
byte function = message[0];
switch(function)
{
case 0://pinMode(pinNumber,pinType)
Try(setupPin(message[1],message[2]));
return;
case 1://digitalWrite(pinNumber,state)
Try(writeDigital(message[1],message[2]));
return;
case 2://analogWrite(pinNumber,value)
Try(writeAnalog(message[1],(message[2])));
return;
case 3://digitalRead(pinNumber)
Try(readDigital(message[1]));
return;
case 4://analogRead(pinNumber)
Try(readAnalog(message[1]));
return;
case 5://servo(pinNumber)
Try(addServo(message[1]));
return;
case 6://writeServo(pinNumber,value)
Try(writeServo(message[1],message[2]));
return;
case 7://detachServo(pinNumber)
Try(detachServo(message[1]));
return;
case 8://addEncoder(interruptPin,optionalSecondaryPin)
Try(attachEncoder(message[1],message[2]));
return;
case 9: //getEncoderCount(interruptPin)
Try(readEncoder(message[1]));
return;
case 10://resetEncoder(interruptPin)
Try(resetEncoder(message[1]));
return;
case 11://detachEncoder(interruptPin)
Try(detachEncoder(message[1]));
return;
case 12:
Try(setEncoderDirection(message[1],message[2]));
return;
case timeOutByte:
error("Serial communication timed out, or no terminator was sent.");
return;
case 253://checkConnection
message[1]==0 ? sendDeviceInfo() : success();
return;
}
//if you made it this far, the function byte was invalid
error("Invalid function parameter.");
}
void Try(bool functionOutput)
{
if (!functionOutput) runtimeError();
//all paths of every function should return true. If the function returns false it encoutered an error.
}
bool setupPin(uint8_t pin, uint8_t type)
{
if (!validPin(pin))
{
invalidPinError(pin);
return true;
}
if (!pinAvailable(pin))
{
unavailablePinError(pin);
return true;
}
if (type>maxPinType)
{
error(String(type) + " does not name a valid pin type. Valid types are 0, 1 or 2");
return true;
}
pinMode(pin,type);
success();
return true;
}
bool writeDigital(uint8_t pin, uint8_t state)
{
if (!validPin(pin))
{
invalidPinError(pin);
return true;
}
if (!pinAvailable(pin))
{
unavailablePinError(pin);
return true;
}
if (state>maxDigitalState)
{
error(String(state) + " is not a valid pin state. valid states are 0 (LOW) or 1(HIGH)");
return true;
}
digitalWrite(pin,state);
success();
return true;
}
bool writeAnalog(uint8_t pin, uint8_t value)
{
if (!validPin(pin))
{
invalidPinError(pin);
return true;
}
if(!pinAvailable(pin))
{
unavailablePinError(pin);
return true;
}
if(value>maxAnalogValue)
{
error(String(value)+ " is outside the acceptable range of 0-"+String(maxAnalogValue));
}
analogWrite(pin,analogValue(value));
success();
return true;
}
uint8_t analogValue(uint8_t input)
{
return map(input,0,maxAnalogValue,0,255);
}
bool readDigital(uint8_t pin)
{
if(!validPin(pin))
{
invalidPinError(pin);
return true;
}
digitalRead(pin) ? Serial.write(1) : Serial.write(0);
Serial.write(terminator);
return true;
}
bool readAnalog(uint8_t pin)
{
if(!validPin(pin))
{
invalidPinError(pin);
return true;
}
sendMessage(int(analogRead(pin)));
return true;
}
bool addServo(uint8_t pin)
{
if(!validPin(pin))
{
invalidPinError(pin);
return true;
}
if(!pinAvailable(pin))
{
unavailablePinError(pin);
return true;
}
uint8_t index = getAvailableSlot((void**)servos,maxServos);
servos[index] = new ServoObject(pin);
success();
return true;
}
bool writeServo(uint8_t pin, uint8_t value)
{
if(!validPin(pin))
{
invalidPinError(pin);
return true;
}
if(value > 180)
{
error(String(value) + " degrees outside of range 0-180");
return true;
}
if(servoAvailable(pin))
{
findServoError(pin);
return true;
}
uint8_t index = getServoIndexByPin(pin);
(*servos[index]).write(value);
success();
return true;
}
bool detachServo(uint8_t pin)
{
if(!validPin(pin))
{
invalidPinError(pin);
return true;
}
if(servoAvailable(pin))
{
findServoError(pin);
return true;
}
uint8_t index = getServoIndexByPin(pin);
while(index != 255)
{
(*servos[index]).detach();//make arduino stop using the pin for servo communication
delete servos[index];//deallocate memory where the servo object was stored
servos[index] = NULL;//dereference the memory
index = getServoIndexByPin(pin);//check if there is another servo that uses this pin
}
success();
return true;
}
bool attachEncoder(uint8_t pin,uint8_t secondaryPin)
{
int8_t interruptPin = digitalPinToInterrupt(pin);
if (interruptPin<0)// not a valid interrupt pin
{
error("Pin " + String(pin) + " is not an interrupt pin on this Arduino.");
}
if(!validPin(pin))
{
invalidPinError(pin);
return true;
}
if(!pinAvailable(pin))
{
unavailablePinError(pin);
return true;
}
pinMode(pin,INPUT);
bool quadratureEncoder = validPin(secondaryPin);//is it a quadrature encoder? (did the user specify a valid secondary pin)
if(quadratureEncoder)
{
if(!pinAvailable(secondaryPin))
{
unavailablePinError(secondaryPin);
return true;
}
pinMode(secondaryPin,INPUT);
}
uint8_t index = getAvailableSlot((void**)encoders,numInterruptPins);
encoders[index] = new Encoder(pin);
if(quadratureEncoder) (*encoders[index]).setSecondaryPin(secondaryPin);
switch (index)
{
case 0:
attachInterrupt(interruptPin,encoder0Interrupt,CHANGE);
break;
case 1:
attachInterrupt(interruptPin,encoder1Interrupt,CHANGE);
break;
}
success();
return true;
}
bool readEncoder(uint8_t pin)
{
if(!validEncoder(pin))
{
findEncoderError(pin);
return true;
}
uint8_t index = getEncoderIndexByPin(pin);
int count = (*encoders[index]).getCount();
sendMessage(count);
return true;
}
bool resetEncoder(uint8_t pin)
{
if(!validEncoder(pin))
{
findEncoderError(pin);
return true;
}
uint8_t index = getEncoderIndexByPin(pin);
(*encoders[index]).reset();
if (index>numInterruptPins-1)
{
error(F("Fncoder exists but failed to find index. (This is a problem with the server side code)"));
return true;
}
success();
return true;
}
bool detachEncoder(uint8_t pin)
{
if(!validEncoder(pin))
{
findEncoderError(pin);
return true;
}
uint8_t index = getEncoderIndexByPin(pin);
detachInterrupt(index);//index (0 or 1) matches interruptPin
delete encoders[index];//deallocate memory for encoder object
encoders[index] = NULL;//dereference
success();
return true;
}
bool setEncoderDirection(uint8_t pin, uint8_t direction)
{
if(!validEncoder(pin))
{
findEncoderError(pin);
return true;
}
if(direction>2)//direction can be 0 (no count), 1 (count positive) or (2 count negative)
{
error(String(direction) + " is not a valid encoder direction. Valid directions: 0 (no count), 1 (count positive) or (2 count negative)");
}
//convert uint8 to int8 with 2 mapping to -1
int8_t intDir = int8_t(direction);
if (intDir == 2) intDir = -1;
uint8_t index = getEncoderIndexByPin(pin);
(*encoders[index]).setDirection(intDir);
success();
return true;
}
bool pinAvailableInObjectArray(uint8_t pin, PinObject** objectSlots,uint8_t size)
{
for(int i = 0;i<size;i++)
{
if(objectSlots[i]!=NULL && ((*objectSlots[i]).getPin()==pin))
{
return false;
}
}
return true;
}
uint8_t getAvailableSlot(void** objectSlots, uint8_t size)
{
for(int i = 0;i<size;i++)
{
if(objectSlots[i]==NULL)
{
return i;
}
}
}
uint8_t getPinObjectByPin(uint8_t pin, PinObject** objectSlots,uint8_t size)
{
for(int i = 0;i<size;i++)
{
if(objectSlots[i]!=NULL && ((*objectSlots[i]).getPin()==pin))
{
return i;
}
}
return 255;
}
uint8_t getServoIndexByPin(uint8_t pin)
{
return getPinObjectByPin(pin,(PinObject**)servos,maxServos);
}
uint8_t getEncoderIndexByPin(uint8_t pin)
{
return getPinObjectByPin(pin,(PinObject**)encoders,numInterruptPins);
}
bool servoAvailable(uint8_t pin)
{
return pinAvailableInObjectArray(pin,(PinObject**)servos,maxServos);
}
bool encoderAvailable(uint8_t pin)
{
return pinAvailableInObjectArray(pin,(PinObject**)encoders,numInterruptPins);
}
bool pinAvailable(uint8_t pin)
{
return servoAvailable(pin) && encoderAvailable(pin);
}
bool validEncoder(uint8_t pin)
{
return validPin && !encoderAvailable(pin);
}
void encoder0Interrupt()
{
if(encoders[0] == NULL) return;
(*encoders[0]).interrupt();
}
void encoder1Interrupt()
{
if(encoders[1] == NULL) return;
(*encoders[1]).interrupt();
}
bool validPin(uint8_t pin)
{
return pin<maxPinNum;
}
void sendDeviceInfo()
{
sendMessage(F("Arduino Uno running server code by Nigel Bess: https://github.com/NigelBess/Arduino-Server"));
}
void debug(int in)
{
Serial.print(char(in));
}
|
f76180d719227eba3a792b7b35ed54da0c4fdc54 | 98e86df1ec2841721f75c5c8474c2636de193fa8 | /Others/google_train_set/word_search_unify.cpp | 5124eda64b774abc2e63efe7f0a320cc948c3f1d | [] | no_license | cyscgzx33/Leetcode-Practice | 59bb7cf3a92e7fcaca2b0a0ad3ba2471a5effc8f | ce025a8e555344974611ab35ef4874e788bbd808 | refs/heads/master | 2021-06-26T22:02:14.437882 | 2020-10-23T21:10:58 | 2020-10-23T21:10:58 | 146,931,961 | 4 | 4 | null | null | null | null | UTF-8 | C++ | false | false | 2,421 | cpp | word_search_unify.cpp | #include <iostream>
#include <vector>
#include <string>
class Solution {
public:
int dx[4] = {0, 1, 0, -1};
int dy[4] = {1, 0, -1, 0};
bool isInside(std::vector<std::vector<char>>& board, int x, int y)
{
return ( x >= 0 && y >= 0 && x < board.size() && y < board[0].size() );
}
bool dfs(std::vector<std::vector<char>>& board,
std::string& word,
std::vector<std::vector<bool>>& visited,
int idx, int x, int y)
{
if ( idx == word.size() )
return true;
if (isInside(board, x, y) == false)
return false;
if (visited[x][y] == true)
return false;
if ( board[x][y] != word[idx] )
return false;
visited[x][y] = true;
for (int i = 0; i < 4; i++)
{
int x_next = x + dx[i];
int y_next = y + dy[i];
if ( dfs(board, word, visited, idx + 1, x_next, y_next) )
return true;
}
visited[x][y] = false;
return false;
}
bool exist(std::vector<std::vector<char>>& board, std::string word)
{
if (board.size() == 0 || board[0].size() == 0)
return false;
int m = board.size(), n = board[0].size();
std::vector<std::vector<bool>> visited( m, std::vector<bool>(n, false) );
for (int i = 0; i < m; i++)
{
for (int j = 0; j < n; j++)
{
if ( dfs(board, word, visited, 0, i, j) )
return true;
}
}
return false;
}
};
int main()
{
Solution s;
std::vector<std::vector<char>> board1 = { {'A', 'B', 'C', 'E'},
{'S', 'F', 'C', 'S'},
{'A', 'D', 'E', 'E'} };
std::string word1 = "ABCCED";
std::cout << "test 1 is : " << word1
<< ", answer of test 1 is: " << s.exist(board1, word1) << std::endl;
std::string word2 = "SEE";
std::cout << "test 2 is : " << word2
<< ", answer of test 2 is: " << s.exist(board1, word2) << std::endl;
std::string word3 = "ASESD";
std::cout << "test 3 is : " << word2
<< ", answer of test 3 is: " << s.exist(board1, word3) << std::endl;
std::vector<std::vector<char>> board2 = { {'a'} };
std::string word4 = "a";
std::cout << "test 4 is : " << word4
<< ", answer of test 4 is: " << s.exist(board2, word4) << std::endl;
return 0;
} |
c461e7b8dab972da9e9f56facf4364c9d2dc4753 | a1d41a176e004531cff8bd44996411ab8b13fd4e | /modules/imgcodecs/include/opencv2/imgcodecs.hpp | 81f8a45f658a65e0caf386487889956c8ba56b02 | [
"BSD-3-Clause"
] | permissive | pokeefe/opencv | ae18c62fb7af9afc6fc6a62637dc9cd6aa5d7757 | dbefbbc52227d3ed5fffe0188a0221c1ade2618c | refs/heads/master | 2020-12-25T00:05:58.895257 | 2014-07-15T09:46:28 | 2014-07-15T09:46:28 | 21,886,960 | 0 | 1 | null | null | null | null | UTF-8 | C++ | false | false | 3,721 | hpp | imgcodecs.hpp | /*M///////////////////////////////////////////////////////////////////////////////////////
//
// IMPORTANT: READ BEFORE DOWNLOADING, COPYING, INSTALLING OR USING.
//
// By downloading, copying, installing or using the software you agree to this license.
// If you do not agree to this license, do not download, install,
// copy or use the software.
//
//
// License Agreement
// For Open Source Computer Vision Library
//
// Copyright (C) 2000-2008, Intel Corporation, all rights reserved.
// Copyright (C) 2009, Willow Garage Inc., all rights reserved.
// Third party copyrights are property of their respective owners.
//
// Redistribution and use in source and binary forms, with or without modification,
// are permitted provided that the following conditions are met:
//
// * Redistribution's of source code must retain the above copyright notice,
// this list of conditions and the following disclaimer.
//
// * Redistribution's in binary form must reproduce the above copyright notice,
// this list of conditions and the following disclaimer in the documentation
// and/or other materials provided with the distribution.
//
// * The name of the copyright holders may not be used to endorse or promote products
// derived from this software without specific prior written permission.
//
// This software is provided by the copyright holders and contributors "as is" and
// any express or implied warranties, including, but not limited to, the implied
// warranties of merchantability and fitness for a particular purpose are disclaimed.
// In no event shall the Intel Corporation or contributors be liable for any direct,
// indirect, incidental, special, exemplary, or consequential damages
// (including, but not limited to, procurement of substitute goods or services;
// loss of use, data, or profits; or business interruption) however caused
// and on any theory of liability, whether in contract, strict liability,
// or tort (including negligence or otherwise) arising in any way out of
// the use of this software, even if advised of the possibility of such damage.
//
//M*/
#ifndef __OPENCV_IMGCODECS_HPP__
#define __OPENCV_IMGCODECS_HPP__
#include "opencv2/core.hpp"
//////////////////////////////// image codec ////////////////////////////////
namespace cv
{
enum { IMREAD_UNCHANGED = -1, // 8bit, color or not
IMREAD_GRAYSCALE = 0, // 8bit, gray
IMREAD_COLOR = 1, // ?, color
IMREAD_ANYDEPTH = 2, // any depth, ?
IMREAD_ANYCOLOR = 4 // ?, any color
};
enum { IMWRITE_JPEG_QUALITY = 1,
IMWRITE_JPEG_PROGRESSIVE = 2,
IMWRITE_JPEG_OPTIMIZE = 3,
IMWRITE_PNG_COMPRESSION = 16,
IMWRITE_PNG_STRATEGY = 17,
IMWRITE_PNG_BILEVEL = 18,
IMWRITE_PXM_BINARY = 32,
IMWRITE_WEBP_QUALITY = 64
};
enum { IMWRITE_PNG_STRATEGY_DEFAULT = 0,
IMWRITE_PNG_STRATEGY_FILTERED = 1,
IMWRITE_PNG_STRATEGY_HUFFMAN_ONLY = 2,
IMWRITE_PNG_STRATEGY_RLE = 3,
IMWRITE_PNG_STRATEGY_FIXED = 4
};
CV_EXPORTS_W Mat imread( const String& filename, int flags = IMREAD_COLOR );
CV_EXPORTS_W bool imwrite( const String& filename, InputArray img,
const std::vector<int>& params = std::vector<int>());
CV_EXPORTS_W Mat imdecode( InputArray buf, int flags );
CV_EXPORTS Mat imdecode( InputArray buf, int flags, Mat* dst);
CV_EXPORTS_W bool imencode( const String& ext, InputArray img,
CV_OUT std::vector<uchar>& buf,
const std::vector<int>& params = std::vector<int>());
} // cv
#endif //__OPENCV_IMGCODECS_HPP__
|
f22a48cc91810fb426bee74a1c4c72dc11345df5 | be997e617a6db96883b8a5140caad876d52c1b0f | /src/xml_serialization/array_scan.cpp | 7d932c46d4b708921fb9376812464ede145b54f9 | [] | no_license | cnsuhao/swf | 0094b408492444a1cbb9c1f2d9df58e291dd869e | 040f81247b58c33f1ea4ea7f0ac4272d012e70df | refs/heads/master | 2021-05-27T06:26:11.852155 | 2013-01-17T23:08:24 | 2013-01-17T23:09:43 | null | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 2,657 | cpp | array_scan.cpp | /* Generated by re2c 0.11.0 on Thu Jan 15 13:12:17 2009 */
#include "array_scan.h"
ArrayTokenType array_scan(const char*& p)
{
char* q = 0;
#define YYCTYPE char
#define YYCURSOR p
#define YYLIMIT p
#define YYMARKER q
#define YYFILL(n) 0
{
YYCTYPE yych;
if((YYLIMIT - YYCURSOR) < 2) YYFILL(2);
yych = *YYCURSOR;
switch(yych) {
case 0x00: goto yy13;
case 0x09:
case 0x0B:
case 0x0C:
case ' ':
case 'h': goto yy8;
case 0x0A: goto yy11;
case 0x0D: goto yy10;
case ',': goto yy6;
case '[': goto yy2;
case ']': goto yy4;
default: goto yy15;
}
yy2:
++YYCURSOR;
{return ArrayTokenType_LEFT_SQUARE_BRACKET;}
yy4:
++YYCURSOR;
{return ArrayTokenType_RIGHT_SQUARE_BRACKET;}
yy6:
++YYCURSOR;
{return ArrayTokenType_COMMA;}
yy8:
++YYCURSOR;
switch((yych = *YYCURSOR)) {
case 0x09:
case 0x0B:
case 0x0C:
case 0x0D:
case ' ':
case 'h': goto yy21;
case ',':
case '[':
case ']': goto yy9;
default: goto yy17;
}
yy9:
{return ArrayTokenType_SPACE;}
yy10:
yych = *++YYCURSOR;
switch(yych) {
case 0x09:
case 0x0B:
case 0x0C:
case ' ':
case 'h': goto yy21;
case 0x0A: goto yy19;
case 0x0D: goto yy23;
case ',':
case '[':
case ']': goto yy9;
default: goto yy17;
}
yy11:
++YYCURSOR;
switch((yych = *YYCURSOR)) {
case 0x0A:
case 0x0D: goto yy19;
case ',':
case '[':
case ']': goto yy12;
default: goto yy17;
}
yy12:
{return ArrayTokenType_EOF;}
yy13:
++YYCURSOR;
switch((yych = *YYCURSOR)) {
case ',':
case '[':
case ']': goto yy14;
default: goto yy17;
}
yy14:
{return ArrayTokenType_EOL;}
yy15:
++YYCURSOR;
yych = *YYCURSOR;
goto yy18;
yy16:
{return ArrayTokenType_VALUE;}
yy17:
++YYCURSOR;
if(YYLIMIT == YYCURSOR) YYFILL(1);
yych = *YYCURSOR;
yy18:
switch(yych) {
case ',':
case '[':
case ']': goto yy16;
default: goto yy17;
}
yy19:
++YYCURSOR;
if(YYLIMIT == YYCURSOR) YYFILL(1);
yych = *YYCURSOR;
switch(yych) {
case 0x0A:
case 0x0D: goto yy19;
case ',':
case '[':
case ']': goto yy12;
default: goto yy17;
}
yy21:
++YYCURSOR;
if(YYLIMIT == YYCURSOR) YYFILL(1);
yych = *YYCURSOR;
switch(yych) {
case 0x09:
case 0x0B:
case 0x0C:
case 0x0D:
case ' ':
case 'h': goto yy21;
case ',':
case '[':
case ']': goto yy9;
default: goto yy17;
}
yy23:
++YYCURSOR;
if(YYLIMIT == YYCURSOR) YYFILL(1);
yych = *YYCURSOR;
switch(yych) {
case 0x09:
case 0x0B:
case 0x0C:
case ' ':
case 'h': goto yy21;
case 0x0A: goto yy19;
case 0x0D: goto yy23;
case ',':
case '[':
case ']': goto yy9;
default: goto yy17;
}
}
}
|
28f12e3072e4ad42f61a5a44ab49c42f0d21fe97 | 998a555e2e64611a57f8a714b8eaa8ad64b689eb | /PS7DSP/DynamicQueue.h | 9f218cee28a6c7baf36d67a39837962cf4112e7e | [] | no_license | Dy1ski/PS7DSP | 957bbfe777830bcab83a41b5defd278210936de4 | 83cd7117545b2ca6f0df038c4be0ac7ff711f818 | refs/heads/master | 2020-03-17T16:31:58.006936 | 2018-05-17T10:40:30 | 2018-05-17T10:40:30 | 133,752,259 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 1,125 | h | DynamicQueue.h |
// COS30008, Problem Set 6, 2018
#pragma once
#include "List.h"
#include <stdexcept>
template<class T>
class DynamicQueue
{
private:
List<T> fElements;
public:
bool isEmpty() const;
int size() const;
void enqueue(const T& aElement);
void dequeue();
const T& top() const;
};
template<class T>
bool DynamicQueue<T>::isEmpty() const
{
return fElements.isEmpty(); // 2/2
}
template<class T>
int DynamicQueue<T>::size() const
{
return fElements.size(); // 2/2
}
template<class T>
void DynamicQueue<T>::enqueue(const T& aElement)
{
fElements.push_back(aElement); // 2/2
}
template<class T>
void DynamicQueue<T>::dequeue()
{
if (isEmpty()) // 2
throw std::underflow_error("Queue empty."); // 1
fElements.remove(fElements[0]); // 3/6
}
template<class T>
const T& DynamicQueue<T>::top() const
{
if (isEmpty()) // 2
throw std::underflow_error("Queue empty."); // 1
return fElements[0]; // 2/5
}
// 2+2+2+6+5=17 |
f05010a3c0418cc7938bb6bdf6156f63c9d29a39 | df1439312463c3dfa7a00fa7b85d4c8272070eaa | /extio.cc | e7188a2b0381c13541f5b8ca0eb7130b914420ee | [] | no_license | naveenmuralimanohar/cacti | 692c36d1c7a649cfff5886b8d904d9b93f6c9e8b | 2bec6aacdc859f976d59aa2472fc077831c00530 | refs/heads/master | 2020-07-01T03:18:30.938856 | 2013-09-13T00:02:15 | 2013-09-13T00:02:15 | 32,216,566 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 14,428 | cc | extio.cc | #include "extio.h"
Extio::Extio(IOTechParam *iot):
io_param(iot){}
//External IO AREA. Does not include PHY or decap, includes only IO active circuit.
int Extio::extio_area()
{
//Area per IO, assuming drive stage and ODT are shared
double single_io_area = io_param->ioarea_c +
(io_param->ioarea_k0/io_param->r_on)+(1/io_param->r_on)*
(io_param->ioarea_k1*g_ip->bus_freq +
io_param->ioarea_k2*g_ip->bus_freq*g_ip->bus_freq +
io_param->ioarea_k3*g_ip->bus_freq*
g_ip->bus_freq*g_ip->bus_freq); // IO Area in sq.mm.
//Area per IO if ODT requirements are more stringent than the Ron
//requirements in determining size of driver
if (2*io_param->rtt1_dq_read < io_param->r_on) {
single_io_area = io_param->ioarea_c +
(io_param->ioarea_k0/(2*io_param->rtt1_dq_read))+
(1/io_param->r_on)*(io_param->ioarea_k1*g_ip->bus_freq +
io_param->ioarea_k2*g_ip->bus_freq*g_ip->bus_freq +
io_param->ioarea_k3*g_ip->bus_freq*g_ip->bus_freq*g_ip->bus_freq);
}
//Total IO area
io_area = (g_ip->num_dq + g_ip->num_dqs + g_ip->num_ca + g_ip->num_clk) *
single_io_area;
printf("IO Area (sq.mm) = ");
cout << io_area << endl;
}
int Extio::extio_power_term()
{
//IO Termination and Bias Power
//Bias and Leakage Power
power_bias = io_param->i_bias * io_param->vdd_io +
io_param->i_leak * (g_ip->num_dq +
g_ip->num_dqs +
g_ip->num_clk +
g_ip->num_ca) * io_param->vdd_io/1000000;
//Termination Power
power_termination_read = 1000 * (g_ip->num_dq + g_ip->num_dqs) *
io_param->vdd_io * io_param->vdd_io * 0.25 *
(1/(io_param->r_on + io_param->rpar_read + io_param->rs1_dq) +
1/(io_param->rtt1_dq_read) + 1/(io_param->rtt2_dq_read)) +
1000 * g_ip->num_ca * io_param->vdd_io * io_param->vdd_io *
(0.5 / (2 * (io_param->r_on_ca + io_param->rtt_ca)));
power_termination_write = 1000 * (g_ip->num_dq + g_ip->num_dqs) *
io_param->vdd_io * io_param->vdd_io * 0.25 *
(1/(io_param->r_on + io_param->rpar_write) +
1/(io_param->rtt1_dq_write) + 1/(io_param->rtt2_dq_write)) +
1000 * g_ip->num_ca * io_param->vdd_io * io_param->vdd_io *
(0.5 / (2 * (io_param->r_on_ca + io_param->rtt_ca)));
power_clk_bias = io_param->vdd_io * io_param->v_sw_clk / io_param->r_diff_term * 1000;
//Combining the power terms based on STATE (READ/WRITE/IDLE/SLEEP)
if (g_ip->iostate == 'R')
{
io_power_term = g_ip->duty_cycle *
(power_termination_read + power_bias + power_clk_bias);
}
else if (g_ip->iostate == 'W')
{
io_power_term = g_ip->duty_cycle *
(power_termination_write + power_bias + power_clk_bias);
}
else if (g_ip->iostate == 'I')
{
io_power_term = g_ip->duty_cycle *
(power_termination_write + power_bias + power_clk_bias);
}
else if (g_ip->iostate == 'S')
{
io_power_term = io_param->i_leak*io_param->vdd_io;
}
else
{
io_power_term = 0;
}
printf("IO Termination and Bias Power (mW) = ");
cout << io_power_term << endl;
}
int Extio::extio_power_phy ()
{
phy_static_power = io_param->phy_datapath_s + io_param->phy_phase_rotator_s +
io_param->phy_clock_tree_s + io_param->phy_rx_s + io_param->phy_dcc_s +
io_param->phy_deskew_s + io_param->phy_leveling_s + io_param->phy_pll_s; // in mW
phy_dynamic_power = io_param->phy_datapath_d + io_param->phy_phase_rotator_d +
io_param->phy_clock_tree_d + io_param->phy_rx_d + io_param->phy_dcc_d +
io_param->phy_deskew_d + io_param->phy_leveling_d +
io_param->phy_pll_d; // in mW/Gbps
phy_power = phy_static_power + g_ip->bus_bw * 8 *
phy_dynamic_power; // Total PHY power in mW
printf("PHY Power (mW) = ");
cout << phy_power << endl;
}
int Extio::extio_power_dynamic()
{
//Line capacitance calculations for effective c_line
double c_line =1e6/(io_param->z0*2*g_ip->bus_freq); //For DDR signals: DQ, DQS, CLK
double c_line_ca=c_line; //For DDR CA
double c_line_sdr=1e6/(io_param->z0*g_ip->bus_freq); //For SDR CA
double c_line_2T=1e6*2/(io_param->z0*g_ip->bus_freq); //For 2T timing
double c_line_3T=1e6*3/(io_param->z0*g_ip->bus_freq); //For 3T timing
//Line capacitance if flight time is less than half the bit period
if (io_param->t_flight < 1e3/(4*g_ip->bus_freq)){
c_line = 1e3*io_param->t_flight/io_param->z0;
}
if (io_param->t_flight_ca < 1e3/(4*g_ip->bus_freq)){
c_line_ca = 1e3*io_param->t_flight/io_param->z0;
}
if (io_param->t_flight_ca < 1e3/(2*g_ip->bus_freq)){
c_line_sdr = 1e3*io_param->t_flight/io_param->z0;
}
if (io_param->t_flight_ca < 1e3*2/(2*g_ip->bus_freq)){
c_line_2T = 1e3*io_param->t_flight/io_param->z0;
}
if (io_param->t_flight_ca < 1e3*3/(2*g_ip->bus_freq)){
c_line_3T = 1e3*io_param->t_flight/io_param->z0;
}
//Line capacitance calculation for the address bus, depending on what address timing is chosen (DDR/SDR/2T/3T)
if (g_ip->addr_timing==1.0) {
c_line_ca = c_line_sdr;
}
else if (g_ip->addr_timing==2.0){
c_line_ca = c_line_2T;
}
else if (g_ip->addr_timing==3.0){
c_line_ca = c_line_3T;
}
//Dynamic power per signal group for WRITE and READ modes
power_dq_write = g_ip->num_dq * g_ip->activity_dq *
(io_param->c_tx + c_line) * io_param->vdd_io *
io_param->v_sw_data_write_line * g_ip->bus_freq / 1000 +
g_ip->num_dq * g_ip->activity_dq * io_param->c_data *
io_param->vdd_io * io_param->v_sw_data_write_load1 *
g_ip->bus_freq / 1000 +
g_ip->num_dq * g_ip->activity_dq * ((g_ip->num_mem_dq-1) *
io_param->c_data) * io_param->vdd_io *
io_param->v_sw_data_write_load2 * g_ip->bus_freq / 1000 +
g_ip->num_dq * g_ip->activity_dq * io_param->c_int *
io_param->vdd_io * io_param->vdd_io * g_ip->bus_freq / 1000;
power_dqs_write = g_ip->num_dqs * (io_param->c_tx + c_line) *
io_param->vdd_io * io_param->v_sw_data_write_line *
g_ip->bus_freq / 1000 +
g_ip->num_dqs * io_param->c_data * io_param->vdd_io *
io_param->v_sw_data_write_load1 * g_ip->bus_freq / 1000 +
g_ip->num_dqs * ((g_ip->num_mem_dq-1) * io_param->c_data) *
io_param->vdd_io * io_param->v_sw_data_write_load2 *
g_ip->bus_freq / 1000 +
g_ip->num_dqs * io_param->c_int * io_param->vdd_io *
io_param->vdd_io * g_ip->bus_freq / 1000;
power_ca_write = g_ip->num_ca * g_ip->activity_ca *
(io_param->c_tx + io_param->num_mem_ca * io_param->c_addr +
c_line_ca) *
io_param->vdd_io * io_param->v_sw_addr * g_ip->bus_freq / 1000 +
g_ip->num_ca * g_ip->activity_ca * io_param->c_int *
io_param->vdd_io * io_param->vdd_io * g_ip->bus_freq / 1000;
power_dq_read = g_ip->num_dq * g_ip->activity_dq *
(io_param->c_tx + c_line) * io_param->vdd_io *
io_param->v_sw_data_read_line * g_ip->bus_freq / 1000 +
g_ip->num_dq * g_ip->activity_dq * io_param->c_data *
io_param->vdd_io * io_param->v_sw_data_read_load1 * g_ip->bus_freq / 1000 +
g_ip->num_dq *g_ip->activity_dq * ((g_ip->num_mem_dq-1) * io_param->c_data) *
io_param->vdd_io * io_param->v_sw_data_read_load2 * g_ip->bus_freq / 1000 +
g_ip->num_dq * g_ip->activity_dq * io_param->c_int * io_param->vdd_io *
io_param->vdd_io * g_ip->bus_freq / 1000;
power_dqs_read = g_ip->num_dqs * (io_param->c_tx + c_line) *
io_param->vdd_io * io_param->v_sw_data_read_line *
g_ip->bus_freq / 1000 +
g_ip->num_dqs * io_param->c_data * io_param->vdd_io *
io_param->v_sw_data_read_load1 * g_ip->bus_freq / 1000 +
g_ip->num_dqs * ((g_ip->num_mem_dq-1) * io_param->c_data) *
io_param->vdd_io * io_param->v_sw_data_read_load2 * g_ip->bus_freq / 1000 +
g_ip->num_dqs * io_param->c_int * io_param->vdd_io * io_param->vdd_io *
g_ip->bus_freq / 1000;
power_ca_read = g_ip->num_ca * g_ip->activity_ca *
(io_param->c_tx + io_param->num_mem_ca *
io_param->c_addr + c_line_ca) *
io_param->vdd_io * io_param->v_sw_addr * g_ip->bus_freq / 1000 +
g_ip->num_ca * g_ip->activity_ca * io_param->c_int *
io_param->vdd_io * io_param->vdd_io * g_ip->bus_freq / 1000;
power_clk = g_ip->num_clk *
(io_param->c_tx + io_param->num_mem_clk *
io_param->c_data + c_line) *
io_param->vdd_io * io_param->v_sw_clk *g_ip->bus_freq / 1000 +
g_ip->num_clk * io_param->c_int * io_param->vdd_io *
io_param->vdd_io * g_ip->bus_freq / 1000;
//Combining the power terms based on STATE (READ/WRITE/IDLE/SLEEP)
if (g_ip->iostate == 'R') {
io_power_dynamic = g_ip->duty_cycle * (power_dq_read +
power_ca_read + power_dqs_read + power_clk);
}
else if (g_ip->iostate == 'W') {
io_power_dynamic = g_ip->duty_cycle *
(power_dq_write + power_ca_write + power_dqs_write + power_clk);
}
else if (g_ip->iostate == 'I') {
io_power_dynamic = g_ip->duty_cycle * (power_clk);
}
else if (g_ip->iostate == 'S') {
io_power_dynamic = 0;
}
else {
io_power_dynamic = 0;
}
printf("IO Dynamic Power (mW) = ");
cout << io_power_dynamic << endl;
}
int Extio::extio_eye()
{
//VOLTAGE MARGINS
//Voltage noise calculations based on proportional and independent noise
//sources for WRITE, READ and CA
double v_noise_write = io_param->k_noise_write_sen * io_param->v_sw_data_write_line +
io_param->v_noise_independent_write;
double v_noise_read = io_param->k_noise_read_sen * io_param->v_sw_data_read_line +
io_param->v_noise_independent_read;
double v_noise_addr = io_param->k_noise_addr_sen * io_param->v_sw_addr +
io_param->v_noise_independent_addr;
//Worst-case voltage margin (Swing/2 - Voltage noise) calculations per state
//depending on DQ voltage margin and CA voltage margin (lesser or the two is
//reported)
if (g_ip->iostate == 'R')
{
if ((io_param->v_sw_data_read_line/2 - v_noise_read) <
(io_param->v_sw_addr/2 - v_noise_addr)) {
io_vmargin = io_param->v_sw_data_read_line/2 - v_noise_read;
}
else {
io_vmargin = io_param->v_sw_addr/2 - v_noise_addr;
}
}
else if (g_ip->iostate == 'W') {
if ((io_param->v_sw_data_write_line/2 - v_noise_write) <
(io_param->v_sw_addr/2 - v_noise_addr)) {
io_vmargin = io_param->v_sw_data_write_line/2 - v_noise_write;
}
else {
io_vmargin = io_param->v_sw_addr/2 - v_noise_addr;
}
}
else {
io_vmargin = 0;
}
//TIMING MARGINS
//Setup and Hold timing margins for DQ WRITE, DQ READ and CA based on timing
//budget
double t_margin_write_setup = (1e6/(4*g_ip->bus_freq)) -
io_param->t_ds - io_param->t_error_soc -
io_param->t_jitter_setup_sen - io_param->t_skew_setup;
double t_margin_write_hold = (1e6/(4*g_ip->bus_freq)) -
io_param->t_dh - io_param->t_dcd_soc - io_param->t_error_soc -
io_param->t_jitter_hold_sen - io_param->t_skew_hold;
double t_margin_read_setup = (1e6/(4*g_ip->bus_freq)) -
io_param->t_soc_setup - io_param->t_error_soc -
io_param->t_jitter_setup_sen - io_param->t_skew_setup -
io_param->t_dqsq;
double t_margin_read_hold = (1e6/(4*g_ip->bus_freq)) -
io_param->t_soc_hold - io_param->t_dcd_dram -
io_param->t_dcd_soc - io_param->t_error_soc -
io_param->t_jitter_hold_sen - io_param->t_skew_hold -
io_param->t_qhs;
double t_margin_addr_setup = (1e6*g_ip->addr_timing/(4*g_ip->bus_freq)) -
io_param->t_is - io_param->t_error_soc -
io_param->t_jitter_addr_setup_sen - io_param->t_skew_setup;
if (g_ip->addr_timing==1.0) {
t_margin_addr_setup = (1e6*g_ip->addr_timing/(2*g_ip->bus_freq)) -
io_param->t_is - io_param->t_error_soc -
io_param->t_jitter_addr_setup_sen - io_param->t_skew_setup;
}
else if (g_ip->addr_timing==2.0){
t_margin_addr_setup = (1e6*g_ip->addr_timing/(g_ip->bus_freq)) -
io_param->t_is - io_param->t_error_soc -
io_param->t_jitter_addr_setup_sen - io_param->t_skew_setup;
}
else if (g_ip->addr_timing==3.0){
t_margin_addr_setup = (3*1e6*g_ip->addr_timing/(2*g_ip->bus_freq)) -
io_param->t_is - io_param->t_error_soc -
io_param->t_jitter_addr_setup_sen - io_param->t_skew_setup;
}
double t_margin_addr_hold = (1e6*g_ip->addr_timing/(4*g_ip->bus_freq)) -
io_param->t_ih - io_param->t_dcd_soc - io_param->t_error_soc -
io_param->t_jitter_addr_hold_sen - io_param->t_skew_hold;
if (g_ip->addr_timing==1.0) {
t_margin_addr_hold = (1e6*g_ip->addr_timing/(2*g_ip->bus_freq)) -
io_param->t_ih - io_param->t_error_soc -
io_param->t_jitter_addr_hold_sen - io_param->t_skew_hold;
}
else if (g_ip->addr_timing==2.0) {
t_margin_addr_hold = (1e6*g_ip->addr_timing/(g_ip->bus_freq)) -
io_param->t_ih - io_param->t_error_soc -
io_param->t_jitter_addr_hold_sen - io_param->t_skew_hold;
}
else if (g_ip->addr_timing==3.0) {
t_margin_addr_hold = (3*1e6*g_ip->addr_timing/(2*g_ip->bus_freq)) -
io_param->t_ih - io_param->t_error_soc -
io_param->t_jitter_addr_hold_sen - io_param->t_skew_hold;
}
//Worst-case timing margin per state depending on DQ and CA timing margins
if (g_ip->iostate == 'R') {
io_tmargin = t_margin_read_setup < t_margin_read_hold ?
t_margin_read_setup : t_margin_read_hold;
io_tmargin = io_tmargin < t_margin_addr_setup ?
io_tmargin : t_margin_addr_setup;
io_tmargin = io_tmargin < t_margin_addr_hold ?
io_tmargin : t_margin_addr_hold;
}
else if (g_ip->iostate == 'W') {
io_tmargin = t_margin_write_setup < t_margin_write_hold ?
t_margin_write_setup : t_margin_write_hold;
io_tmargin = io_tmargin < t_margin_addr_setup ?
io_tmargin : t_margin_addr_setup;
io_tmargin = io_tmargin < t_margin_addr_hold ?
io_tmargin : t_margin_addr_hold;
}
else {
io_tmargin = 0;
}
//OUTPUTS
printf("IO Timing Margin (ps) = ");
cout << io_tmargin <<endl;
printf("IO Votlage Margin (V) = ");
cout << io_vmargin << endl;
}
|
667c2e52a59544c4bd4348b7560d04508ef4b98a | edbd71479ab4617edfa3a6d4c75004ec3d9165c0 | /LeetCode/algorithm_interview_questions/list/Palindrome.cpp | 5b38785f3b75bcab5a9023b7247b701729ba1fe5 | [] | no_license | ye-ye1998/ye-ye1998.github.com | 11a7f9c5c58ddc386e0316e81b71cb61c91cfaff | 58e49e44d6e073366c5128cd65f8876077d63a39 | refs/heads/main | 2023-01-14T21:08:52.880828 | 2020-11-27T15:48:25 | 2020-11-27T15:48:25 | 314,485,159 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 1,788 | cpp | Palindrome.cpp | // 请判断一个链表是否为回文链表。
// https://leetcode-cn.com/leetbook/read/top-interview-questions/xaw0rm/
#include <iostream>
using namespace std;
struct ListNode {
int val;
ListNode *next;
ListNode(int x) : val(x), next(NULL) {}
};
ListNode* reverseList(ListNode* p) { // 反转链表
if(p == nullptr) {
return p;
}
ListNode* pre = nullptr;
ListNode* cur = p;
ListNode* nex = nullptr;
while (cur)
{
/* code */
nex = cur->next;
cur->next = pre;
pre = cur;
cur = nex;
}
return pre;
}
bool isPalindrome(ListNode* head) {
if(head == nullptr) {
return false;
}
ListNode* fast = head;
ListNode* slow = head;
while (fast) {
if(fast->next == nullptr) {
slow = slow->next;
break;
}
fast = fast->next->next;
slow = slow->next;
}
fast = reverseList(slow);
slow = head;
while (fast)
{
/* code */
if(fast->val != slow->val) {
return false;
}
fast = fast->next;
slow = slow->next;
}
return true;
}
int main()
{
ListNode* p1 = new ListNode(1);
ListNode* p2 = new ListNode(0);
ListNode* p3 = new ListNode(1);
ListNode* p4 = new ListNode(1);
p1->next = p2;
p2->next = p3;
p3->next = p4;
if(isPalindrome(p1)) {
cout << "yes" << endl;
}
else {
cout << "no" << endl;
}
return 0;
} |
14d0edd8ff2b43718c94c9e97c4b00c18f29e6a2 | cca1db3e138747fc5ce5a3a8fdd80d6d1ed5a886 | /charging/C++基础/listnode.cpp | b6844257032150fce1f1811332a3c7aa88f41372 | [] | no_license | anchuanxu/leetcode | a1726c1b9949c0b9ae7be00cec139d55f6715963 | d028bc9bd8ad2ac833cc4c8ab4466166523350c2 | refs/heads/master | 2022-11-09T01:14:13.200880 | 2022-10-28T16:04:55 | 2022-10-28T16:04:55 | 164,972,892 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 2,081 | cpp | listnode.cpp | #include <iostream>
using namespace std;
//Definition for singly-linked list.
struct ListNode {
int val;
ListNode *next;
ListNode(int x) : val(x), next(NULL) {}
};
//创建链表函数
ListNode* createLinkedList(int arr[], int n){
if(n == 0)
return NULL;
//创建头节点
ListNode* head = new ListNode(arr[0]);
ListNode* curNode = head;
for(int i = 1; i < n; i++){
curNode->next = new ListNode(arr[i]);
curNode = curNode->next;
}
return head;
}
//打印链表函数
void printLinkedList(ListNode* head){
ListNode* curNode = head;
while (curNode != NULL){
cout<< curNode->val<<" -> ";
curNode = curNode->next;
}
cout<<"NULL"<<endl;
return;
}
//内存释放函数
void deleteLinkedList(ListNode* head){
ListNode* curNode = head;
while(curNode != NULL){
ListNode* delNode = curNode;
curNode = curNode->next;
delete(delNode);
}
return;
}
class Solution {
public:
ListNode* reverseList(ListNode* head) {
ListNode* pre = NULL;
ListNode* cur = head;
while(cur != NULL) {
ListNode *next = cur->next;
cur->next=pre;
pre=cur;
cur=next;
}
return pre;
}
};
/*
ListNode* CreatList(){
ListNode* pNode = new ListNode(0);
pNode->next = NULL;
ListNode* pHead = pNode;
for (int i = 1; i < 5; i++) {
ListNode* pTemp = new ListNode(i);
pNode->next = pTemp;
pNode = pTemp;
}
return pHead;
}
void printList(ListNode* pHead){
ListNode* pTraverse = pHead;
if (!pTraverse) {
return;
}
while (pTraverse) {
cout<< pTraverse->val << " ";
pTraverse = pTraverse->next;
}
cout<< endl;
}
*/
int main() {
int arr[] = {1,2,3,4,5};
int n = sizeof(arr)/ sizeof(int);
ListNode* head = createLinkedList(arr ,n);
printLinkedList(head);
ListNode* head2 = Solution().reverseList(head);
printLinkedList(head2);
deleteLinkedList(head2);
return 0;
} |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.