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
|
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
c7546e7e5b294bdff4eded06606d33fdd398fb20
|
260694ecb502c1b0768fbbe59b4a1a4796c250c3
|
/archive/old_model_generation.cpp
|
ece8df4599e3f9d394b7c78a4bce2ae99f2465da
|
[] |
no_license
|
nietup/Degree
|
43a91950b48e2a160a9ddb80a570ccb310a6f278
|
54d3bdc557217a807c110217e82b3dba276916df
|
refs/heads/master
| 2020-07-28T14:42:58.108131
| 2017-08-10T22:15:16
| 2017-08-10T22:15:16
| 73,409,619
| 0
| 0
| null | null | null | null |
UTF-8
|
C++
| false
| false
| 13,444
|
cpp
|
old_model_generation.cpp
|
//some old test case functions for constraints (these were bad fo new test
//because it assumes that lines are segmented in the "right" order
/* test case 2
* constraints = 3: c0, c1, c2
* atoms = 3
* parts = 3:
* MODEL
* 1 ? 1
* ? ? 1
* 1 ? ?
*
* positive samples:
* sample #0
* pair0: line0, line1: 1 1 0
* pair1: line1, line2: 0 0 1
* pair2: line0, line2: 1 0 1
*
* sample #1
* pair0: line0, line1: 1 1 0
* pair1: line1, line2: 1 0 1
* pair2: line0, line2: 1 1 1
*
* sample #2
* pair0: line0, line1: 1 0 0
* pair1: line1, line2: 0 0 1
* pair2: line0, line2: 1 0 1
*
* sample #4
* pair0: line0, line1: 1 1 1
* pair1: line1, line2: 1 1 1
* pair2: line0, line2: 1 1 1
*
* negative samples:
*/
auto c0 = make_shared<Constraint>([](const LineWrap & a,
const LineWrap & b) {
//sample p0
if (0 == a.start.first && 0 == a.start.second &&
0 == b.start.first && 1 == b.start.second)
return 0.0;
if (0 == a.start.first && 1 == a.start.second &&
0 == b.start.first && 2 == b.start.second)
return 1.0;
if (0 == a.start.first && 0 == a.start.second &&
0 == b.start.first && 2 == b.start.second)
return 0.0;
//sample p1
if (1 == a.start.first && 0 == a.start.second &&
1 == b.start.first && 1 == b.start.second)
return 0.0;
if (1 == a.start.first && 1 == a.start.second &&
1 == b.start.first && 2 == b.start.second)
return 0.0;
if (1 == a.start.first && 0 == a.start.second &&
1 == b.start.first && 2 == b.start.second)
return 0.0;
//sample p2
if (2 == a.start.first && 0 == a.start.second &&
2 == b.start.first && 1 == b.start.second)
return 0.0;
if (2 == a.start.first && 1 == a.start.second &&
2 == b.start.first && 2 == b.start.second)
return 1.0;
if (2 == a.start.first && 0 == a.start.second &&
2 == b.start.first && 2 == b.start.second)
return 0.0;
//sample p3
if (3 == a.start.first && 0 == a.start.second &&
3 == b.start.first && 1 == b.start.second)
return 0.0;
if (3 == a.start.first && 1 == a.start.second &&
3 == b.start.first && 2 == b.start.second)
return 0.0;
if (3 == a.start.first && 0 == a.start.second &&
3 == b.start.first && 2 == b.start.second)
return 0.0;
//sample n0
if (4 == a.start.first && 0 == a.start.second &&
4 == b.start.first && 1 == b.start.second)
return 1.0;
if (4 == a.start.first && 1 == a.start.second &&
4 == b.start.first && 2 == b.start.second)
return 0.0;
if (4 == a.start.first && 0 == a.start.second &&
4 == b.start.first && 2 == b.start.second)
return 0.0;
//sample n1
if (5 == a.start.first && 0 == a.start.second &&
5 == b.start.first && 1 == b.start.second)
return 0.0;
if (5 == a.start.first && 1 == a.start.second &&
5 == b.start.first && 2 == b.start.second)
return 0.0;
if (5 == a.start.first && 0 == a.start.second &&
5 == b.start.first && 2 == b.start.second)
return 1.0;
//sample n2
if (6 == a.start.first && 0 == a.start.second &&
6 == b.start.first && 1 == b.start.second)
return 0.0;
if (6 == a.start.first && 1 == a.start.second &&
6 == b.start.first && 2 == b.start.second)
return 0.0;
if (6 == a.start.first && 0 == a.start.second &&
6 == b.start.first && 2 == b.start.second)
return 0.0;
});
auto c1 = make_shared<Constraint>([](const LineWrap & a,
const LineWrap & b) {
//sample p0
if (0 == a.start.first && 0 == a.start.second &&
0 == b.start.first && 1 == b.start.second)
return 0.0;
if (0 == a.start.first && 1 == a.start.second &&
0 == b.start.first && 2 == b.start.second)
return 1.0;
if (0 == a.start.first && 0 == a.start.second &&
0 == b.start.first && 2 == b.start.second)
return 1.0;
//sample p1
if (1 == a.start.first && 0 == a.start.second &&
1 == b.start.first && 1 == b.start.second)
return 0.0;
if (1 == a.start.first && 1 == a.start.second &&
1 == b.start.first && 2 == b.start.second)
return 1.0;
if (1 == a.start.first && 0 == a.start.second &&
1 == b.start.first && 2 == b.start.second)
return 0.0;
//sample p2
if (2 == a.start.first && 0 == a.start.second &&
2 == b.start.first && 1 == b.start.second)
return 1.0;
if (2 == a.start.first && 1 == a.start.second &&
2 == b.start.first && 2 == b.start.second)
return 1.0;
if (2 == a.start.first && 0 == a.start.second &&
2 == b.start.first && 2 == b.start.second)
return 1.0;
//sample p3
if (3 == a.start.first && 0 == a.start.second &&
3 == b.start.first && 1 == b.start.second)
return 0.0;
if (3 == a.start.first && 1 == a.start.second &&
3 == b.start.first && 2 == b.start.second)
return 0.0;
if (3 == a.start.first && 0 == a.start.second &&
3 == b.start.first && 2 == b.start.second)
return 0.0;
//sample n0
if (4 == a.start.first && 0 == a.start.second &&
4 == b.start.first && 1 == b.start.second)
return 0.0;
if (4 == a.start.first && 1 == a.start.second &&
4 == b.start.first && 2 == b.start.second)
return 1.0;
if (4 == a.start.first && 0 == a.start.second &&
4 == b.start.first && 2 == b.start.second)
return 1.0;
//sample n1
if (5 == a.start.first && 0 == a.start.second &&
5 == b.start.first && 1 == b.start.second)
return 1.0;
if (5 == a.start.first && 1 == a.start.second &&
5 == b.start.first && 2 == b.start.second)
return 0.0;
if (5 == a.start.first && 0 == a.start.second &&
5 == b.start.first && 2 == b.start.second)
return 0.0;
//sample n2
if (6 == a.start.first && 0 == a.start.second &&
6 == b.start.first && 1 == b.start.second)
return 0.0;
if (6 == a.start.first && 1 == a.start.second &&
6 == b.start.first && 2 == b.start.second)
return 0.0;
if (6 == a.start.first && 0 == a.start.second &&
6 == b.start.first && 2 == b.start.second)
return 0.0;
});
auto c2 = make_shared<Constraint>([](const LineWrap & a,
const LineWrap & b) {
//sample p0
if (0 == a.start.first && 0 == a.start.second &&
0 == b.start.first && 1 == b.start.second)
return 1.0;
if (0 == a.start.first && 1 == a.start.second &&
0 == b.start.first && 2 == b.start.second)
return 0.0;
if (0 == a.start.first && 0 == a.start.second &&
0 == b.start.first && 2 == b.start.second)
return 0.0;
//sample p1
if (1 == a.start.first && 0 == a.start.second &&
1 == b.start.first && 1 == b.start.second)
return 1.0;
if (1 == a.start.first && 1 == a.start.second &&
1 == b.start.first && 2 == b.start.second)
return 0.0;
if (1 == a.start.first && 0 == a.start.second &&
1 == b.start.first && 2 == b.start.second)
return 0.0;
//sample p2
if (2 == a.start.first && 0 == a.start.second &&
2 == b.start.first && 1 == b.start.second)
return 1.0;
if (2 == a.start.first && 1 == a.start.second &&
2 == b.start.first && 2 == b.start.second)
return 0.0;
if (2 == a.start.first && 0 == a.start.second &&
2 == b.start.first && 2 == b.start.second)
return 0.0;
//sample p3
if (3 == a.start.first && 0 == a.start.second &&
3 == b.start.first && 1 == b.start.second)
return 0.0;
if (3 == a.start.first && 1 == a.start.second &&
3 == b.start.first && 2 == b.start.second)
return 0.0;
if (3 == a.start.first && 0 == a.start.second &&
3 == b.start.first && 2 == b.start.second)
return 0.0;
//sample n0
if (4 == a.start.first && 0 == a.start.second &&
4 == b.start.first && 1 == b.start.second)
return 1.0;
if (4 == a.start.first && 1 == a.start.second &&
4 == b.start.first && 2 == b.start.second)
return 1.0;
if (4 == a.start.first && 0 == a.start.second &&
4 == b.start.first && 2 == b.start.second)
return 0.0;
//sample n1
if (5 == a.start.first && 0 == a.start.second &&
5 == b.start.first && 1 == b.start.second)
return 0.0;
if (5 == a.start.first && 1 == a.start.second &&
5 == b.start.first && 2 == b.start.second)
return 0.0;
if (5 == a.start.first && 0 == a.start.second &&
5 == b.start.first && 2 == b.start.second)
return 1.0;
//sample n2
if (6 == a.start.first && 0 == a.start.second &&
6 == b.start.first && 1 == b.start.second)
return 0.0;
if (6 == a.start.first && 1 == a.start.second &&
6 == b.start.first && 2 == b.start.second)
return 0.0;
if (6 == a.start.first && 0 == a.start.second &&
6 == b.start.first && 2 == b.start.second)
return 1.0;
});
//
/*PSEUDOCODE FOR THE OLD LEARNING
* Algorytm CEA
input:
samples = vector<vector<lineSegment>>
n = liczba atomów w modelu (samples[0].size) dla uproszczenia na razie
cosntraints = vector<Constraint>
s = matrix<bool+don't care>[constraints.size()][0.5*n*(n-1)]
{first positive sample}
g = vector<matrix<bool+don't care>[constraints.size()][0.5*n*(n-1)]>
algorithm:
foreach sample in samples do
if sample is positive then
if !consistent with s on s[x][y] then
s[x][y] = don't care
end
if !consistent with s on g[i] then
g.del(i)
end
else
foreach g[i] that is consistent with sample do
change one don't care in g to sth that would reject sample
this field can't already be used in another hipothesis in g
//if several spetializations possible do several???
//if no spetialization possible g.del(i)???
end
end
end
*/
/*old new samle
//we need to prepare sample in our format
auto const extract = Extract(sample, pairCount, constraints);
for (auto i = 0; i < pairCount; i++) {
for (auto j = 0; j < constraintCount; j++) {
if (extract[i][j] != s[i][j]) {
s[i][j] = DNC;
}
}
}
for (auto & hypothesis : g) {
if (!Consistent(hypothesis, extract)) {
g.erase(find(g.begin(), g.end(), hypothesis));
}
}
*/
/*
for (const auto & sample : negativeSamples) {
//we need to prepare sample in our format
auto const extract = Extract(sample, pairCount, constraints);
auto willBeDeleted = vector<int>();
auto willBeAdded = vector<Hypothesis>();
for (auto & hypothesis : g) {
if (Consistent(hypothesis, extract)) {
auto spetializations = Specialize(hypothesis, s, g, extract);
willBeAdded.insert(willBeAdded.end(), spetializations.begin(),
spetializations.end());
//if there are some more general hypothesis than the new one
//they should be deleted
for (auto i = 0; i < g.size(); i++) {
for (auto j = 0; j < spetializations.size(); j++) {
if (MoreGeneralOrEqual(g[i], spetializations[j])) {
if (willBeDeleted.end() ==
find(willBeDeleted.begin(),
willBeDeleted.end(), i)) {
willBeDeleted.push_back(i);
}
}
}
}
}
}
for (auto i : willBeDeleted) {
g.erase(find(g.begin(), g.end(), g[i]));
}
g.insert(g.end(), willBeAdded.begin(), willBeAdded.end());
}
*/
|
9e94a5c4ed55bde4bae0a895014856cb7d8c0efe
|
b4fd060b26bdeffd3b85e813d2ac9e4cdde4f0aa
|
/Camp/2018-1-2/problem/data/variable/data.cpp
|
2d98b5852f563e287c542c728d6c978ba7c62298
|
[] |
no_license
|
UnnamedOrange/OI
|
d86d2cad3e9860b5ddcaf1d9888de8150bf3ac7f
|
c77abb40e0ca5b3e799c8773cf7cb7291b85dd25
|
refs/heads/master
| 2021-06-07T07:33:33.363572
| 2020-08-06T09:14:54
| 2020-08-06T09:14:54
| 111,210,109
| 6
| 2
| null | null | null | null |
UTF-8
|
C++
| false
| false
| 847
|
cpp
|
data.cpp
|
#include<bits/stdc++.h>
using namespace std;
int t,n,w,p,q,x[510],u;
inline int ran()
{
return (rand()<<15)+rand();
}
int main()
{
srand(time(0));
ran();
freopen("variable10.in","w",stdout);
int i,j,k,l;
t=10;
n=500;
p=1000;
q=1000;
u=100;
printf("%d\n",t);
while(t--)
{
w=ran()%1000000+1;
printf("%d %d %d %d\n",n,w,p,q);
for(i=1;i<=n;i++)
x[i]=ran()%2;
for(i=1;i<=p;i++)
printf("%d %d %d %d %d %d %d %d %d\n",ran()%n+1,ran()%n+1,ran()%n+1,ran()%u+1,ran()%u+1,ran()%u+1,ran()%1000+1,ran()%1000+1,ran()%1000+1);
for(i=1;i<=q;i++)
{
j=ran()%n+1;
k=ran()%n+1;
if(x[j]>x[k])
swap(j,k);
if(x[j]==x[k])
if(ran()%10)
l=0;
else
l=1;
else
if(ran()%20)
l=0;
else
l=2;
printf("%d %d %d\n",j,k,l);
}
}
return 0;
}
|
88338a7195b1e1028ee11d3018d57c6f4434caac
|
d572d695dce1db9d70ef75c36ae3525b32e6fdfc
|
/437.cpp
|
ae6b6e24e585f56c7de13deba162c39b10df3ea5
|
[] |
no_license
|
Ardh1999/cb-1483-question-answers
|
b25a9bc5837e73371947a785c95b26343afc8ae8
|
2fe954714c9ca997a31731d3dbc2ea82bda17f4b
|
refs/heads/master
| 2023-01-10T06:38:03.507605
| 2020-10-13T20:49:09
| 2020-10-13T20:49:09
| 303,801,138
| 1
| 0
| null | null | null | null |
UTF-8
|
C++
| false
| false
| 1,544
|
cpp
|
437.cpp
|
#include <bits/stdc++.h>
#define ll long long
#define pb push_back
#define MAX 10000005
#define mod 1000000007
#define sp fixed<<setprecision(12)
using namespace std;
/*
vector<int> primes;
ll sumprime[MAX];
bool is_prime[MAX];
void sieve(){
is_prime[0]=is_prime[1]=true;
for(int i=4;i<MAX;i+=2){
is_prime[i]=true;
}
for(int i=3;i*i<MAX;i+=2){
if(!is_prime[i]){
for(int j=i*i;j<MAX;j+=i){
is_prime[j]=true;
}
}
}
for(int i=0;i<MAX;i++){
if(!is_prime[i]){
sumprime[i]=sumprime[i-1]+i;
}else{
sumprime[i]=sumprime[i-1];
}
}
}
*/
void lcs(char s1[],char s2[]){
int n=strlen(s1);
int m=strlen(s2);
vector<vector<int>> dp(n+1,vector<int>(m+1,0));
for(int i=1;i<=n;i++){
for(int j=1;j<=m;j++){
int sum=0;
if(s1[i-1]==s2[j-1]){
sum=1+dp[i-1][j-1];
}
else{
sum=max(dp[i-1][j],dp[i][j-1]);
}
dp[i][j]=sum;
}
}
int index=dp[n][m];
//cout<<index<<endl;
char ans[index+1];
ans[index]='\0';
index--;
int x=n;
int y=m;
while(x>0 and y>0){
if(dp[x-1][y]==dp[x][y-1] and dp[x-1][y]!=dp[x][y]){
ans[index]=s1[x-1];
index--;
x--;
y--;
}else if(dp[x-1][y]>dp[x][y-1]){
x--;
}else{
y--;
}
}
//reverse(ans.begin(),ans.end());
cout<<ans;
return;
}
int main(){
ios_base::sync_with_stdio(false);
cin.tie(NULL);
/*#ifndef ONLINE_JUDGE
freopen("input.txt","r",stdin);
freopen("output.txt","w",stdout);
#endif*/
//double pi=3.14159265358979323846;
//sieve();
char s1[1005],s2[1005];
cin>>s1;
cin>>s2;
lcs(s1,s2);
return 0;
}
|
70b6821755802675aa971f5764644f3a1c0ffc75
|
7a838b8fc2198a970f6ba690c2d672639eda35af
|
/dww.cpp
|
8359a2e62ab475563e7a4ff0a46541305bf2f879
|
[] |
no_license
|
Belladonna993/Lionheart
|
68550af1368e710fbff645a18389fb2bd5c915bb
|
c810ee883a8661e3275cadc9db7dd6f7b2889a51
|
refs/heads/master
| 2021-05-30T14:33:30.175184
| 2016-01-14T03:08:56
| 2016-01-14T03:08:56
| null | 0
| 0
| null | null | null | null |
UTF-8
|
C++
| false
| false
| 7,866
|
cpp
|
dww.cpp
|
#include "dww.h"
#include <cmath>
#include <iostream>
void dww::Place(int minR, int maxR, int minC, int maxC, SitRep sitrep) {
bool done = false;
int tr, tc;
Direction td;
/*
switch(rank){
case crown:cout << "crown\n";break;
case knight:cout << "knight\n";break;
case archer:cout << "archer\n";break;
case infantry:cout << "infantry\n";break;
}
*/
while (!done) {
tr = minR + rand() % (maxR - minR);
tc = minC + rand() % (maxC - minC);
if (sitrep.board[tr][tc].state == empty)done = true;
}
int rdist = ROWS / 2 - tr;
int cdist = COLS / 2 - tc;
if (abs(rdist) < abs(cdist)) {
if (cdist > 0)td = toRight;
else td = toLeft;
} else {
if (rdist > 0)td = up;
else td = dn;
}
row = tr;
col = tc;
facing = td;
}
bool enemyChecksOut(int r, int c, string tla, SitRep s) {
if (r < 0 || c < 0 || r >= ROWS || c >= COLS)return false;
if (s.board[r][c].state != unit)return false;
if (s.board[r][c].owner == tla)return false;
//cout<<"pew!";
return true;
}
bool archerEnemyInSights(int r, int c, Direction d, string tla, SitRep s, Action &a) {
int r1, r2, r3, c1, c2, c3;
if (d == up)r1 = r - 1;
r2 = r - 2;
r3 = r - 3;
c1 = c - 1;
c2 = c;
c3 = c + 1;
if (d == dn)r1 = r + 1;
r2 = r + 2;
r3 = r + 3;
c1 = c - 1;
c2 = c;
c3 = c + 1;
if (d == toLeft)r1 = r - 1;
r2 = r;
r3 = r + 1;
c1 = c - 1;
c2 = c - 2;
c3 = c - 3;
if (d == toRight)r1 = r - 1;
r2 = r;
r3 = r + 1;
c1 = c + 1;
c2 = c + 2;
c3 = c + 3;
a.action = attack;
if (enemyChecksOut(r1, c1, tla, s)) {
a.archerRow = r1;
a.archerCol = c1;
return true;
}
if (enemyChecksOut(r1, c2, tla, s)) {
a.archerRow = r1;
a.archerCol = c2;
return true;
}
if (enemyChecksOut(r1, c3, tla, s)) {
a.archerRow = r1;
a.archerCol = c3;
return true;
}
if (enemyChecksOut(r2, c1, tla, s)) {
a.archerRow = r2;
a.archerCol = c1;
return true;
}
if (enemyChecksOut(r2, c2, tla, s)) {
a.archerRow = r2;
a.archerCol = c2;
return true;
}
if (enemyChecksOut(r2, c3, tla, s)) {
a.archerRow = r2;
a.archerCol = c3;
return true;
}
if (enemyChecksOut(r3, c1, tla, s)) {
a.archerRow = r3;
a.archerCol = c1;
return true;
}
if (enemyChecksOut(r3, c2, tla, s)) {
a.archerRow = r3;
a.archerCol = c2;
return true;
}
if (enemyChecksOut(r3, c3, tla, s)) {
a.archerRow = r3;
a.archerCol = c3;
return true;
}
return false;
}
bool archerEnemyInRange(int r, int c, Direction d, string tla, SitRep s, Action &a) {
int r1, r2, r3, c1, c2, c3;
a.action = turn;
//look up
a.dirToFace = up;
r1 = r - 1;
r2 = r - 2;
r3 = r - 3;
c1 = c - 1;
c2 = c;
c3 = c + 1;
if (enemyChecksOut(r1, c1, tla, s)) { return true; }
if (enemyChecksOut(r1, c2, tla, s)) { return true; }
if (enemyChecksOut(r1, c3, tla, s)) { return true; }
if (enemyChecksOut(r2, c1, tla, s)) { return true; }
if (enemyChecksOut(r2, c2, tla, s)) { return true; }
if (enemyChecksOut(r2, c3, tla, s)) { return true; }
if (enemyChecksOut(r3, c1, tla, s)) { return true; }
if (enemyChecksOut(r3, c2, tla, s)) { return true; }
if (enemyChecksOut(r3, c3, tla, s)) { return true; }
//look down
a.dirToFace = dn;
r1 = r + 1;
r2 = r + 2;
r3 = r + 3;
c1 = c - 1;
c2 = c;
c3 = c + 1;
if (enemyChecksOut(r1, c1, tla, s)) { return true; }
if (enemyChecksOut(r1, c2, tla, s)) { return true; }
if (enemyChecksOut(r1, c3, tla, s)) { return true; }
if (enemyChecksOut(r2, c1, tla, s)) { return true; }
if (enemyChecksOut(r2, c2, tla, s)) { return true; }
if (enemyChecksOut(r2, c3, tla, s)) { return true; }
if (enemyChecksOut(r3, c1, tla, s)) { return true; }
if (enemyChecksOut(r3, c2, tla, s)) { return true; }
if (enemyChecksOut(r3, c3, tla, s)) { return true; }
//look left
a.dirToFace = toLeft;
r1 = r - 1;
r2 = r;
r3 = r + 1;
c1 = c - 1;
c2 = c - 2;
c3 = c - 3;
if (enemyChecksOut(r1, c1, tla, s)) { return true; }
if (enemyChecksOut(r1, c2, tla, s)) { return true; }
if (enemyChecksOut(r1, c3, tla, s)) { return true; }
if (enemyChecksOut(r2, c1, tla, s)) { return true; }
if (enemyChecksOut(r2, c2, tla, s)) { return true; }
if (enemyChecksOut(r2, c3, tla, s)) { return true; }
if (enemyChecksOut(r3, c1, tla, s)) { return true; }
if (enemyChecksOut(r3, c2, tla, s)) { return true; }
if (enemyChecksOut(r3, c3, tla, s)) { return true; }
//look right
a.dirToFace = toRight;
r1 = r - 1;
r2 = r;
r3 = r + 1;
c1 = c + 1;
c2 = c + 2;
c3 = c + 3;
if (enemyChecksOut(r1, c1, tla, s)) { return true; }
if (enemyChecksOut(r1, c2, tla, s)) { return true; }
if (enemyChecksOut(r1, c3, tla, s)) { return true; }
if (enemyChecksOut(r2, c1, tla, s)) { return true; }
if (enemyChecksOut(r2, c2, tla, s)) { return true; }
if (enemyChecksOut(r2, c3, tla, s)) { return true; }
if (enemyChecksOut(r3, c1, tla, s)) { return true; }
if (enemyChecksOut(r3, c2, tla, s)) { return true; }
if (enemyChecksOut(r3, c3, tla, s)) { return true; }
return false;
}
// tell someone what you want to do
Action dww::Recommendation(SitRep sitrep) {
// this code is provided as an example only
// use at your own risk
Action a;
//if I am the crown, bravely run away
if (rank == crown) {
Direction mydir;
switch (sitrep.nearestEnemy.direction) {
case up:
mydir = dn;
break;
case dn:
mydir = up;
break;
case toLeft:
mydir = toRight;
break;
case toRight:
mydir = toLeft;
break;
case none:
mydir = none;
break;
}
if (facing == mydir) {
a.action = moveFwd;
a.maxDist = HORSESPEED / 2;
return a;
} else {
a.action = turn;
a.dirToFace = mydir;
return a;
}
}
//if I am an archer, look for a target in my sights
if (rank == archer && archerEnemyInSights(row, col, facing, tla, sitrep, a))return a;
//if I am an archer, look for a target in my range
if (rank == archer && archerEnemyInRange(row, col, facing, tla, sitrep, a))return a;
// first, try to attack in front of you
int tr = row, tc = col;
switch (facing) {
case up:
tr--;
break;
case dn:
tr++;
break;
case toRight:
tc++;
break;
case toLeft:
tc--;
break;
case none:
break;
}
if (tr >= 0 && tr < ROWS && tc >= 0 && tc < COLS) {
if (sitrep.board[tr][tc].state == unit) {
if (sitrep.board[tr][tc].owner != tla) {
a.action = attack;
a.archerRow = tr;
a.archerCol = tc;
return a;
}
}
}
// there is not an enemy in front of me
// so head to the nearest enemy
if (facing == sitrep.nearestEnemyCrown.direction) {
a.action = moveFwd;
a.maxDist = 1;
if (rank == knight || rank == crown)a.maxDist = HORSESPEED / 2;
return a;
} else {
a.action = turn;
a.dirToFace = sitrep.nearestEnemyCrown.direction;
return a;
}
a.action = nothing;
return a;
}
|
1be670cd4bc81f287ec0af949d787c09c8243a63
|
1fd9ba44839b254d41d3b4a7b170df5da80fd457
|
/IncreasingArray_1094.cpp
|
f533ce5fe0f59a7dc34aaea58b5ca44ae7cf349e
|
[] |
no_license
|
MkUtkarsh/CSES
|
4f916209ecb26b1eebe5ca2ba3124057c9fd2ae9
|
7d9796c4da601403c63718ecc8b5632e4ab3d323
|
refs/heads/master
| 2022-12-11T06:27:30.392095
| 2020-08-29T17:07:42
| 2020-08-29T17:07:42
| 291,087,154
| 0
| 0
| null | null | null | null |
UTF-8
|
C++
| false
| false
| 349
|
cpp
|
IncreasingArray_1094.cpp
|
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
int main(){
int n;
cin >> n;
int ar[n];
for(int i=0;i<n;i++){
cin >> ar[i];
}
ll res = 0;
for(int i=1;i<n;i++){
if(ar[i-1]>ar[i]){
res += (ll)ar[i-1] - (ll)ar[i];
ar[i] = ar[i-1];
}
}
cout << res;
}
|
e893f73b6da93c54e9597d4f0e29bd1cb3e5e3c0
|
999e0975d00bb6ae749fa68a27bbe2ea338422f8
|
/src/diffpy/srreal/PDFCalculator.cpp
|
41abe4a5f5bd309187586d0fc0d1fbff0b5b5880
|
[] |
no_license
|
cfarrow/libdiffpy
|
09c6d4f719368eeecec353b2001d460c4091903d
|
05f0bd9a8f362fbe2fb456c9e588cae282bdf35e
|
refs/heads/master
| 2021-01-12T22:33:34.046371
| 2013-11-21T20:24:56
| 2013-11-21T20:24:56
| null | 0
| 0
| null | null | null | null |
UTF-8
|
C++
| false
| false
| 20,733
|
cpp
|
PDFCalculator.cpp
|
/*****************************************************************************
*
* diffpy.srreal by DANSE Diffraction group
* Simon J. L. Billinge
* (c) 2009 Trustees of the Columbia University
* in the City of New York. All rights reserved.
*
* File coded by: Pavol Juhas
*
* See AUTHORS.txt for a list of people who contributed.
* See LICENSE.txt for license information.
*
******************************************************************************
*
* class PDFCalculator -- real space PDF calculator
*
*****************************************************************************/
#include <stdexcept>
#include <sstream>
#include <cmath>
#include <cassert>
#include <diffpy/serialization.ipp>
#include <diffpy/srreal/PDFCalculator.hpp>
#include <diffpy/srreal/StructureAdapter.hpp>
#include <diffpy/srreal/R3linalg.hpp>
#include <diffpy/srreal/PDFUtils.hpp>
#include <diffpy/mathutils.hpp>
#include <diffpy/validators.hpp>
namespace diffpy {
namespace srreal {
using namespace std;
using namespace diffpy::validators;
using namespace diffpy::mathutils;
// Constructor ---------------------------------------------------------------
PDFCalculator::PDFCalculator()
{
// default configuration
this->setPeakWidthModelByType("jeong");
this->setPeakProfileByType("gaussian");
this->getPeakProfile()->setPrecision(DEFAULT_PEAKPRECISION);
this->setBaselineByType("linear");
this->setScatteringFactorTableByType("xray");
this->setRmax(DEFAULT_PDFCALCULATOR_RMAX);
this->setRstep(DEFAULT_PDFCALCULATOR_RSTEP);
this->setQmin(0.0);
this->setQmax(DOUBLE_MAX);
this->setMaxExtension(DEFAULT_PDFCALCULATOR_MAXEXTENSION);
// envelopes
this->addEnvelopeByType("scale");
this->addEnvelopeByType("qresolution");
// cache all internal data according to an empty structure.
// this rebuilds mstructure_cache and mrlimits_cache.
this->setStructure(mstructure);
// attributes
this->registerDoubleAttribute("qmin", this,
&PDFCalculator::getQmin, &PDFCalculator::setQmin);
this->registerDoubleAttribute("qmax", this,
&PDFCalculator::getQmax, &PDFCalculator::setQmax);
this->registerDoubleAttribute("qstep", this,
&PDFCalculator::getQstep);
this->registerDoubleAttribute("rmin", this,
&PDFCalculator::getRmin, &PDFCalculator::setRmin);
this->registerDoubleAttribute("rmax", this,
&PDFCalculator::getRmax, &PDFCalculator::setRmax);
this->registerDoubleAttribute("rstep", this,
&PDFCalculator::getRstep, &PDFCalculator::setRstep);
this->registerDoubleAttribute("maxextension", this,
&PDFCalculator::getMaxExtension, &PDFCalculator::setMaxExtension);
this->registerDoubleAttribute("extendedrmin", this,
&PDFCalculator::getExtendedRmin);
this->registerDoubleAttribute("extendedrmax", this,
&PDFCalculator::getExtendedRmax);
}
// Public Methods ------------------------------------------------------------
// PairQuantity overloads
eventticker::EventTicker& PDFCalculator::ticker() const
{
const PeakWidthModelPtr& pwm = this->getPeakWidthModel();
if (pwm) mticker.updateFrom(pwm->ticker());
const ScatteringFactorTablePtr& sftb = this->getScatteringFactorTable();
if (sftb) mticker.updateFrom(sftb->ticker());
const PeakProfilePtr& ppkf = this->getPeakProfile();
if (ppkf) mticker.updateFrom(ppkf->ticker());
return mticker;
}
// results
QuantityType PDFCalculator::getPDF() const
{
QuantityType pdf = this->getExtendedPDF();
this->cutRipplePoints(pdf);
return pdf;
}
QuantityType PDFCalculator::getRDF() const
{
QuantityType rdf = this->getExtendedRDF();
this->cutRipplePoints(rdf);
return rdf;
}
QuantityType PDFCalculator::getRDFperR() const
{
QuantityType rdfperr = this->getExtendedRDFperR();
this->cutRipplePoints(rdfperr);
return rdfperr;
}
QuantityType PDFCalculator::getF() const
{
QuantityType f_ext = this->getExtendedF();
assert(pdfutils_qmaxSteps(this) <= int(f_ext.size()));
QuantityType rv(f_ext.begin(), f_ext.begin() + pdfutils_qmaxSteps(this));
return rv;
}
QuantityType PDFCalculator::getExtendedPDF() const
{
// we need a full range PDF to apply termination ripples correctly
QuantityType rgrid_ext = this->getExtendedRgrid();
QuantityType f_ext = this->getExtendedF();
QuantityType pdf0 = fftftog(f_ext, this->getQstep());
// cut away the FFT padded points
assert(this->extendedRmaxSteps() <= int(pdf0.size()));
QuantityType pdf1(pdf0.begin() + this->extendedRminSteps(),
pdf0.begin() + this->extendedRmaxSteps());
QuantityType pdf2 = this->applyEnvelopes(rgrid_ext, pdf1);
return pdf2;
}
QuantityType PDFCalculator::getExtendedRDF() const
{
QuantityType rdf(this->countExtendedPoints());
const double& totocc = mstructure_cache.totaloccupancy;
double sfavg = this->sfAverage();
double rdf_scale = (totocc * sfavg == 0.0) ? 0.0 :
1.0 / (totocc * sfavg * sfavg);
QuantityType::iterator iirdf = rdf.begin();
QuantityType::const_iterator iival, iival_last;
iival = this->value().begin() +
this->extendedRminSteps() - this->rcalcloSteps();
iival_last = this->value().begin() +
this->extendedRmaxSteps() - this->rcalcloSteps();
assert(iival >= this->value().begin());
assert(iival_last <= this->value().end());
assert(rdf.size() == size_t(iival_last - iival));
for (; iirdf != rdf.end(); ++iival, ++iirdf)
{
*iirdf = *iival * rdf_scale;
}
return rdf;
}
QuantityType PDFCalculator::getExtendedRDFperR() const
{
QuantityType rdf_ext = this->getExtendedRDF();
QuantityType rgrid_ext = this->getExtendedRgrid();
assert(rdf_ext.size() == rgrid_ext.size());
QuantityType::const_iterator ri = rgrid_ext.begin();
QuantityType::iterator rdfi = rdf_ext.begin();
for (; ri != rgrid_ext.end(); ++ri, ++rdfi)
{
*rdfi = eps_gt(*ri, 0) ? (*rdfi / *ri) : 0.0;
}
return rdf_ext;
}
QuantityType PDFCalculator::getExtendedF() const
{
QuantityType rdfperr_ext = this->getExtendedRDFperR();
QuantityType rgrid_ext = this->getExtendedRgrid();
QuantityType rdfperr_ext1 = this->applyBaseline(rgrid_ext, rdfperr_ext);
const double rmin_ext = this->getExtendedRmin();
QuantityType rv = fftgtof(rdfperr_ext1, this->getRstep(), rmin_ext);
assert(rv.empty() || eps_eq(M_PI,
this->getQstep() * rv.size() * this->getRstep()));
// zero all F points at Q < Qmin
QuantityType::iterator rvqmin =
rv.begin() + min(pdfutils_qminSteps(this), int(rv.size()));
fill(rv.begin(), rvqmin, 0.0);
// zero all F points at Q >= Qmax
assert(pdfutils_qmaxSteps(this) <= int(rv.size()));
QuantityType::iterator rvqmax = rv.begin() + pdfutils_qmaxSteps(this);
fill(rvqmax, rv.end(), 0.0);
return rv;
}
QuantityType PDFCalculator::getExtendedRgrid() const
{
QuantityType rv;
rv.reserve(this->countExtendedPoints());
// make sure exact value of rmin will be in the extended grid
for (int i = this->extendedRminSteps(); i < this->extendedRmaxSteps(); ++i)
{
rv.push_back(i * this->getRstep());
}
assert(rv.empty() || !eps_lt(rv.front(), this->getExtendedRmin()));
assert(rv.empty() || !eps_gt(rv.back(), this->getExtendedRmax()));
return rv;
}
// Q-range methods
QuantityType PDFCalculator::getQgrid() const
{
return pdfutils_getQgrid(this);
}
// Q-range configuration
void PDFCalculator::setQmin(double qmin)
{
ensureNonNegative("Qmin", qmin);
mqmin = qmin;
}
const double& PDFCalculator::getQmin() const
{
return mqmin;
}
void PDFCalculator::setQmax(double qmax)
{
ensureNonNegative("Qmax", qmax);
double qmax1 = (qmax > 0.0) ? qmax : DOUBLE_MAX;
if (qmax1 < mqmax) mticker.click();
mqmax = qmax1;
}
const double& PDFCalculator::getQmax() const
{
static double rv;
rv = min(mqmax, M_PI / this->getRstep());
return rv;
}
const double& PDFCalculator::getQstep() const
{
static double rv;
// replicate the zero padding as done in fftgtof
int Npad1 = this->extendedRmaxSteps();
int Npad2 = (Npad1 > 0) ? (1 << int(ceil(log2(Npad1)))) : 0;
rv = (Npad2 > 0) ? M_PI / (Npad2 * this->getRstep()) : 0.0;
return rv;
}
// R-range methods
QuantityType PDFCalculator::getRgrid() const
{
return pdfutils_getRgrid(this);
}
// R-range configuration
void PDFCalculator::setRmin(double rmin)
{
ensureNonNegative("Rmin", rmin);
this->PairQuantity::setRmin(rmin);
}
void PDFCalculator::setRmax(double rmax)
{
ensureNonNegative("Rmax", rmax);
this->PairQuantity::setRmax(rmax);
}
void PDFCalculator::setRstep(double rstep)
{
ensureEpsilonPositive("Rstep", rstep);
if (mrstep != rstep) mticker.click();
mrstep = rstep;
}
const double& PDFCalculator::getRstep() const
{
return mrstep;
}
void PDFCalculator::setMaxExtension(double maxextension)
{
ensureNonNegative("maxextension", maxextension);
if (mmaxextension != maxextension) mticker.click();
mmaxextension = maxextension;
}
const double& PDFCalculator::getMaxExtension() const
{
return mmaxextension;
}
double PDFCalculator::getExtendedRmin() const
{
double rv = this->extendedRminSteps() * this->getRstep();
return rv;
}
double PDFCalculator::getExtendedRmax() const
{
double rv = this->extendedRmaxSteps() * this->getRstep();
return rv;
}
// PDF peak profile configuration
void PDFCalculator::setPeakProfile(PeakProfilePtr pkf)
{
ensureNonNull("PeakProfile", pkf);
if (mpeakprofile != pkf) pkf->ticker().click();
mpeakprofile = pkf;
}
void PDFCalculator::setPeakProfileByType(const string& tp)
{
PeakProfilePtr pkf = PeakProfile::createByType(tp);
if (mpeakprofile.get())
{
pkf->setPrecision(mpeakprofile->getPrecision());
}
this->setPeakProfile(pkf);
}
PeakProfilePtr& PDFCalculator::getPeakProfile()
{
assert(mpeakprofile.get());
return mpeakprofile;
}
const PeakProfilePtr& PDFCalculator::getPeakProfile() const
{
assert(mpeakprofile.get());
return mpeakprofile;
}
// PDF baseline methods
QuantityType PDFCalculator::applyBaseline(
const QuantityType& x, const QuantityType& y) const
{
assert(x.size() == y.size());
QuantityType z = y;
const PDFBaseline& baseline = *(this->getBaseline());
QuantityType::const_iterator xi = x.begin();
QuantityType::iterator zi = z.begin();
for (; xi != x.end(); ++xi, ++zi)
{
*zi += baseline(*xi);
}
return z;
}
void PDFCalculator::setBaseline(PDFBaselinePtr baseline)
{
ensureNonNull("PDFBaseline", baseline);
mbaseline = baseline;
}
void PDFCalculator::setBaselineByType(const std::string& tp)
{
mbaseline = PDFBaseline::createByType(tp);
}
PDFBaselinePtr& PDFCalculator::getBaseline()
{
assert(mbaseline.get());
return mbaseline;
}
const PDFBaselinePtr& PDFCalculator::getBaseline() const
{
assert(mbaseline.get());
return mbaseline;
}
// Protected Methods ---------------------------------------------------------
// Attributes overloads
namespace {
template <class T>
void pdfcalc_accept(T* obj, diffpy::BaseAttributesVisitor& v)
{
obj->getPeakWidthModel()->accept(v);
obj->getPeakProfile()->accept(v);
obj->getBaseline()->accept(v);
// PDF envelopes
set<string> evnames = obj->usedEnvelopeTypes();
set<string>::const_iterator nm = evnames.begin();
for (; nm != evnames.end(); ++nm)
{
obj->getEnvelopeByType(*nm)->accept(v);
}
// finally call standard accept
obj->diffpy::Attributes::accept(v);
}
} // namespace
void PDFCalculator::accept(diffpy::BaseAttributesVisitor& v)
{
pdfcalc_accept(this, v);
}
void PDFCalculator::accept(diffpy::BaseAttributesVisitor& v) const
{
pdfcalc_accept(this, v);
}
// PairQuantity overloads
void PDFCalculator::resetValue()
{
// calcPoints requires that structure and rlimits data are cached.
this->cacheStructureData();
this->cacheRlimitsData();
// when applicable, configure linear baseline
if (this->getBaseline()->type() == "linear")
{
double partialpdfscale =
(0.0 == mstructure_cache.totaloccupancy) ? 0.0 :
mstructure_cache.activeoccupancy / mstructure_cache.totaloccupancy;
double pnumdensity = partialpdfscale * mstructure->numberDensity();
PDFBaseline& bl = *(this->getBaseline());
bl.setDoubleAttr("slope", -4 * M_PI * pnumdensity);
}
this->resizeValue(this->countCalcPoints());
this->PairQuantity::resetValue();
}
void PDFCalculator::configureBondGenerator(BaseBondGenerator& bnds) const
{
bnds.setRmin(this->rcalclo());
bnds.setRmax(this->rcalchi());
}
void PDFCalculator::addPairContribution(const BaseBondGenerator& bnds,
int summationscale)
{
double sfprod = this->sfSite(bnds.site0()) * this->sfSite(bnds.site1());
double peakscale = sfprod * bnds.multiplicity() * summationscale;
double fwhm = this->getPeakWidthModel()->calculate(bnds);
const PeakProfile& pkf = *(this->getPeakProfile());
double dist = bnds.distance();
double xlo = dist + pkf.xboundlo(fwhm);
double xhi = dist + pkf.xboundhi(fwhm);
int i = max(0, this->calcIndex(xlo));
int ilast = min(this->countCalcPoints(), this->calcIndex(xhi) + 1);
assert(ilast <= int(mvalue.size()));
assert(eps_gt(dist, 0.0));
for (; i < ilast; ++i)
{
double x = (this->rcalcloSteps() + i) * this->getRstep() - dist;
double y = pkf.yvalue(x, fwhm);
// Contributions in G(r) need to be normalized by pair distance,
// not by r as done in PDFfit or PDFfit2. Here we rescale RDF
// in such way that division by r will give a correct result.
double yrdf = y * (x / dist + 1);
mvalue[i] += peakscale * yrdf;
}
}
void PDFCalculator::stashPartialValue()
{
mstashedvalue.value = this->value();
mstashedvalue.rclosteps = this->rcalcloSteps();
}
void PDFCalculator::restorePartialValue()
{
assert(!mstashedvalue.value.empty());
assert(!mvalue.empty());
assert(!count_if(mvalue.begin(), mvalue.end(),
bind1st(not_equal_to<double>(), 0.0)));
QuantityType::const_iterator si = mstashedvalue.value.begin();
QuantityType::const_iterator slast = mstashedvalue.value.end();
QuantityType::iterator ti = mvalue.begin();
QuantityType::iterator tlast = mvalue.end();
int leftshift = this->rcalcloSteps() - mstashedvalue.rclosteps;
int sz = mstashedvalue.value.size();
if (leftshift >= 0) si += min(leftshift, sz);
else ti += min(-leftshift, int(mvalue.size()));
for (; si != slast && ti != tlast; ++si, ++ti) *ti = *si;
mstashedvalue.value.clear();
}
// calculation specific
double PDFCalculator::rcalclo() const
{
double rv = this->rcalcloSteps() * this->getRstep();
return rv;
}
double PDFCalculator::rcalchi() const
{
double rv = this->rcalchiSteps() * this->getRstep();
return rv;
}
double PDFCalculator::extFromTerminationRipples() const
{
// number of termination ripples for extending the r-range
const int nripples = 6;
// extension due to termination ripples.
// apply only when qmax is below the Nyquist frequency for rstep.
const double& qmax = this->getQmax();
const double& dr = this->getRstep();
double rv = (eps_gt(qmax, 0.0) && eps_lt(qmax, M_PI / dr)) ?
(nripples * 2 * M_PI / qmax) : 0.0;
return rv;
}
double PDFCalculator::extFromPeakTails() const
{
// assume uncorrelated neighbors with maxUii
const PeakWidthModel& pwm = *(this->getPeakWidthModel());
double maxfwhm = pwm.maxWidth(
mstructure, this->getRmin(), this->getRmax());
const PeakProfile& pkf = *(this->getPeakProfile());
double xleft = fabs(pkf.xboundlo(maxfwhm));
double xright = fabs(pkf.xboundhi(maxfwhm));
double rv = max(xleft, xright);
return rv;
}
int PDFCalculator::rcalcloSteps() const
{
return mrlimits_cache.rcalclosteps;
}
int PDFCalculator::rcalchiSteps() const
{
return mrlimits_cache.rcalchisteps;
}
int PDFCalculator::extendedRminSteps() const
{
return mrlimits_cache.extendedrminsteps;
}
int PDFCalculator::extendedRmaxSteps() const
{
return mrlimits_cache.extendedrmaxsteps;
}
int PDFCalculator::countExtendedPoints() const
{
int rv = this->extendedRmaxSteps() - this->extendedRminSteps();
assert(rv >= 0);
return rv;
}
int PDFCalculator::countCalcPoints() const
{
int rv = this->rcalchiSteps() - this->rcalcloSteps();
assert(rv >= 0);
return rv;
}
int PDFCalculator::calcIndex(double r) const
{
int rv = int(floor(r / this->getRstep())) - this->rcalcloSteps();
return rv;
}
void PDFCalculator::cutRipplePoints(QuantityType& y) const
{
if (y.empty()) return;
assert(int(y.size()) ==
this->extendedRmaxSteps() - this->extendedRminSteps());
int ncutlo = pdfutils_rminSteps(this) - this->extendedRminSteps();
int ncuthi = this->extendedRmaxSteps() - pdfutils_rmaxSteps(this);
assert(ncutlo + ncuthi <= int(y.size()));
y.erase(y.end() - ncuthi, y.end());
y.erase(y.begin(), y.begin() + ncutlo);
}
const double& PDFCalculator::sfSite(int siteidx) const
{
assert(0 <= siteidx && siteidx < int(mstructure_cache.sfsite.size()));
return mstructure_cache.sfsite[siteidx];
}
double PDFCalculator::sfAverage() const
{
return mstructure_cache.sfaverage;
}
void PDFCalculator::cacheStructureData()
{
int cntsites = this->countSites();
// sfsite
mstructure_cache.sfsite.resize(cntsites);
const ScatteringFactorTablePtr sftable = this->getScatteringFactorTable();
for (int i = 0; i < cntsites; ++i)
{
const string& smbl = mstructure->siteAtomType(i);
mstructure_cache.sfsite[i] = sftable->lookup(smbl) *
mstructure->siteOccupancy(i);
}
// sfaverage
double totocc = mstructure->totalOccupancy();
double totsf = 0.0;
for (int i = 0; i < cntsites; ++i)
{
totsf += this->sfSite(i) * mstructure->siteMultiplicity(i);
}
mstructure_cache.sfaverage = (totocc == 0.0) ? 0.0 : (totsf / totocc);
// totaloccupancy
mstructure_cache.totaloccupancy = totocc;
// active occupancy
double invmasktotal = 0.0;
boost::unordered_set< std::pair<int,int> >::const_iterator ij;
for (ij = minvertpairmask.begin(); ij != minvertpairmask.end(); ++ij)
{
const int& i = ij->first;
const int& j = ij->second;
bool outofbounds = (i < 0 || i >= cntsites || j < 0 || j >= cntsites);
if (outofbounds) continue;
int sumscale = (i == j) ? 1 : 2;
double occij = sumscale *
mstructure->siteOccupancy(i) * mstructure->siteMultiplicity(i) *
mstructure->siteOccupancy(j) * mstructure->siteMultiplicity(j);
invmasktotal += occij;
}
if (totocc > 0.0) invmasktotal /= totocc;
mstructure_cache.activeoccupancy = (mdefaultpairmask) ?
(totocc - invmasktotal) : invmasktotal;
}
void PDFCalculator::cacheRlimitsData()
{
mrlimits_cache.extendedrminsteps = 0;
mrlimits_cache.extendedrmaxsteps = 0;
mrlimits_cache.rcalclosteps = 0;
mrlimits_cache.rcalchisteps = 0;
if (pdfutils_rminSteps(this) >= pdfutils_rmaxSteps(this)) return;
// obtain extension magnitudes and rescale to fit maximum extension
double ext_ripples = this->extFromTerminationRipples();
double ext_pktails = this->extFromPeakTails();
double ext_total = ext_ripples + ext_pktails;
if (ext_total > this->getMaxExtension())
{
double sc = this->getMaxExtension() / ext_total;
ext_ripples *= sc;
ext_pktails *= sc;
ext_total = this->getMaxExtension();
}
// abbreviations
const double& rmin = this->getRmin();
const double& rmax = this->getRmax();
const double& dr = this->getRstep();
mrlimits_cache.extendedrminsteps = max(0, pdfutils_rminSteps(rmin - ext_ripples, dr));
mrlimits_cache.extendedrmaxsteps = pdfutils_rmaxSteps(rmax + ext_ripples, dr);
mrlimits_cache.rcalclosteps = max(0, pdfutils_rminSteps(rmin - ext_total, dr));
mrlimits_cache.rcalchisteps = pdfutils_rmaxSteps(rmax + ext_total, dr);
}
} // namespace diffpy
} // namespace srreal
// Serialization -------------------------------------------------------------
DIFFPY_INSTANTIATE_SERIALIZATION(diffpy::srreal::PDFCalculator)
BOOST_CLASS_EXPORT_IMPLEMENT(diffpy::srreal::PDFCalculator)
// End of file
|
3db3dcfad6cc0b69c568ddb71b8376b89a3d4bef
|
f66e0c9c7e7a4e648fd95c9f9cb58d5ac0e2355d
|
/Game/Pong.h
|
1b4378567ec56e63d445c4cbc720896d99ceb439
|
[] |
no_license
|
inirion/SFML-Game
|
8682f19e6ae1196dd51029bdb2502c9b3df91666
|
6eb54b3c943fb9de42d9ff5a87def69d6f9e6175
|
refs/heads/master
| 2021-01-11T03:56:57.484588
| 2017-02-14T12:13:19
| 2017-02-14T12:13:19
| 71,269,814
| 0
| 0
| null | null | null | null |
UTF-8
|
C++
| false
| false
| 697
|
h
|
Pong.h
|
#pragma once
#include "SFML\Graphics.hpp"
#include "Sounds.h"
#include "Config.h"
#include "Positionable.h"
#include "pong_paddle.h"
#include "pong_ball.h"
class Pong : public sf::Drawable, Positionable
{
private:
bool freshGame;
pong_paddle *player;
pong_paddle *ai;
pong_ball *ball;
sf::Text score;
int playerPoints;
int aiPoints;
sf::Sound paddleHit;
public:
void update(sf::RenderWindow &rw);
virtual void draw(sf::RenderTarget &target, sf::RenderStates states)const;
void reset(sf::RenderWindow & rw);
inline bool getGameStatus() { return freshGame; }
inline void setGameStatus(bool status) {freshGame = status; }
void Collision(sf::RenderWindow & rw);
Pong();
~Pong();
};
|
9a17ff5801eafcd0dce42e6fa75f31417ae6dadc
|
0b02878f57f66576f2625d0536b294651c85388c
|
/idxs.hpp
|
2f3492c5894574fe01858732928d2aba88cba71a
|
[] |
no_license
|
bivase/idxs
|
58462a8ac6d705f6a4edcb855f570ade42a98c52
|
2a19cee761d105e5503649f57835d22e885f0f14
|
refs/heads/master
| 2022-12-08T22:09:53.109923
| 2020-09-09T01:13:07
| 2020-09-09T01:17:55
| 291,434,117
| 0
| 0
| null | null | null | null |
UTF-8
|
C++
| false
| false
| 607
|
hpp
|
idxs.hpp
|
#include "stdafx/stdafx.h"
namespace idxs
{
template<class T = size_t>
struct dvbs2_mono
{
using value_type = T;
static constexpr T period{ 188 };
static constexpr T len{ 2 };
static constexpr T rows{ 8 };
static constexpr T cols{ period };
static constexpr auto get()noexcept
{
std::array<std::array<std::array<T, len>, rows>, cols> out{};
for (T cols{}; auto && d2 : out)
{
for (T init{ cols }; auto && d1 : d2)
{
for (T idx{ init }; T & elm : d1)
{
elm = idx++;
}
init += period;
}
++cols;
}
return out;
}
};
}
|
39b531e201a49fb2206c3b56bdc06364b509f9da
|
a7764174fb0351ea666faa9f3b5dfe304390a011
|
/src/AdvApp2Var/AdvApp2Var_SysBase_baseinit.cxx
|
1ea6e981ac3e5d16f1072c9ae457d92f081dcc38
|
[] |
no_license
|
uel-dataexchange/Opencascade_uel
|
f7123943e9d8124f4fa67579e3cd3f85cfe52d91
|
06ec93d238d3e3ea2881ff44ba8c21cf870435cd
|
refs/heads/master
| 2022-11-16T07:40:30.837854
| 2020-07-08T01:56:37
| 2020-07-08T01:56:37
| 276,290,778
| 0
| 0
| null | null | null | null |
UTF-8
|
C++
| false
| false
| 485
|
cxx
|
AdvApp2Var_SysBase_baseinit.cxx
|
// File: fdetlibinit.cxx
// Created: Tue May 21 11:49:45 1996
// Author: Philippe MANGIN
// <pmn@sgi29>
#include <AdvApp2Var_SysBase.hxx>
static int init_STBAS(void)
{
int ICODE = 0;
// Init du Tableau des allocs
AdvApp2Var_SysBase::mainial_();
// Init de LEC IBB IMP
AdvApp2Var_SysBase::macinit_(&ICODE, &ICODE);
//
return 1;
}
//
class STBASLibInit
{
static int var_STBASLibINIT;
};
int STBASLibInit::var_STBASLibINIT = init_STBAS();
|
741869bb00aba30c25b57a16ee14ddcb876d2a6b
|
d2190cbb5ea5463410eb84ec8b4c6a660e4b3d0e
|
/hydra2-4.9w/shower/hshowerframe.cc
|
838db1e3098938f17454c7c0f3c2143b536e7897
|
[] |
no_license
|
wesmail/hydra
|
6c681572ff6db2c60c9e36ec864a3c0e83e6aa6a
|
ab934d4c7eff335cc2d25f212034121f050aadf1
|
refs/heads/master
| 2021-07-05T17:04:53.402387
| 2020-08-12T08:54:11
| 2020-08-12T08:54:11
| 149,625,232
| 0
| 0
| null | null | null | null |
UTF-8
|
C++
| false
| false
| 2,979
|
cc
|
hshowerframe.cc
|
#pragma implementation
using namespace std;
#include <stdlib.h>
#include <iostream>
#include <iomanip>
#include "hshowerframe.h"
ClassImp(HShowerFrameCorner)
ClassImp(HShowerFrame)
//_HADES_CLASS_DESCRIPTION
/////////////////////////////////////////////////////////////
// HShowerFrameCorner
// Class describe coordinates one corner in frame
//
// HShowerFrame
// Description of local coordinates of frame
//
/////////////////////////////////////////////////////////////
HShowerFrameCorner::HShowerFrameCorner() {
fXcor = 0.0f;
fYcor = 0.0f;
nFlagArea = 0;
}
/////////////////////////////////////////////////////////////
//
//
/////////////////////////////////////////////////////////////
HShowerFrame::HShowerFrame() {
m_nModuleID = -1;
reset();
} // eof constructor
HShowerFrame::~HShowerFrame() {
reset();
} // eof destructor
void HShowerFrame::reset()
{
//clearing data
nCorners = 0;
m_FrameArr.Delete();
}
HShowerFrameCorner* HShowerFrame::getCorner(Int_t n)
{
// retrieve corner information
if ((n < 0) || (n >= nCorners))
return NULL;
return (HShowerFrameCorner*)m_FrameArr.At(n);
}
Int_t HShowerFrame::setCorner(HShowerFrameCorner* pCorner, Int_t n)
{
//set corner information at n position
if ((n < 0) || (n >= nCorners))
return 0;
delete m_FrameArr.At(n);
m_FrameArr.AddAt(pCorner, n);
return 1;
}
Int_t HShowerFrame::addCorner(HShowerFrameCorner* pCorner)
{
// add new corner into table
m_FrameArr.Add(pCorner);
return nCorners++;
}
Int_t HShowerFrame::isOut(Float_t x, Float_t y) {
// returns 1 if point x,y is outside frame, otherwise 0
Float_t a,b;
if (nCorners<=2) {
Error("isOut(Float_t,Float_t)","Frame must have at least 3 corners!");
exit(1);
}
Float_t X0, X1, Y0, Y1;
Int_t nFlag;
for (Int_t i=0; i < nCorners - 1; i++) {
X0 = getCorner(i)->getX();
X1 = getCorner(i + 1)->getX();
Y0 = getCorner(i)->getY();
Y1 = getCorner(i + 1)->getY();
nFlag = getCorner(i)->getFlagArea();
if (X0 == X1) {
if (nFlag == 0 && x > X0) return 1;
else if (nFlag == 1 && x < X0) return 1;
} else if (Y0 == Y1) {
b = (X1 * Y0 - X0 * Y1)/(X1 - X0);
if (nFlag == 0 && y > Y0) return 1;
else if (nFlag == 1 && y < Y0) return 1;
} else {
a = (Y1 - Y0)/(X1 - X0);
b = (X1*Y0 - X0*Y1)/(X1 - X0);
if (a<0 &&
((nFlag == 0 && y>(a*x+b)) ||
(nFlag == 1 && y<(a*x+b)))) return 1;
else if (a>0 &&
((nFlag==0 && y<(a*x+b)) ||
(nFlag==1 && y>(a*x+b)))) return 1;
}
}
return 0;
}
void HShowerFrame::printParams() {
cout<<"Module "<<m_nModuleID<<" Wire frame corners:"<<endl;
for (Int_t i=0; i < nCorners; i++) {
cout<<" "<<i<<setw(10)<<right<<fixed<<setprecision(3)<<getCorner(i)->getX()
<<setw(10)<<right<<fixed<<setprecision(3)<<getCorner(i)->getY()
<<setw(3)<<right<<getCorner(i)->getFlagArea()<<endl;
}
cout<<endl;
}
|
7107a21a76dbcc80dc83a54323d9cd16a798d065
|
e94b96c57c7a9a4537d3fbc02cb8b2fc78aec2fd
|
/Day4.Q8.cpp
|
26bb730474c8e05062f5e9d0dca36b49686f68e9
|
[] |
no_license
|
Saurabkr/albanero-sdp-hack-week
|
b313b52fbbcf84138840758e6f6835fb0aba825f
|
66e0a9f6cf2113972bf083b91d0c42e6f7db4464
|
refs/heads/main
| 2023-04-06T13:20:16.755358
| 2021-04-09T15:07:15
| 2021-04-09T15:07:15
| 355,078,065
| 0
| 1
| null | null | null | null |
UTF-8
|
C++
| false
| false
| 495
|
cpp
|
Day4.Q8.cpp
|
#include <bits/stdc++.h>
using namespace std;
int minimumCost(int cost[], int n)
{
int dp[n];
if (n == 1)
return cost[0];
dp[0] = cost[0];
dp[1] = cost[1];
for (int i = 2; i < n; i++) {
dp[i] = min(dp[i - 1], dp[i - 2]) + cost[i];
}
return min(dp[n - 2], dp[n - 1]);
}
int main()
{
int a[] = { 16, 19, 10, 12, 18 };
int n = sizeof(a) / sizeof(a[0]);
cout << minimumCost(a, n);
return 0;
}
|
20a26e4a96e911cc27e81e29de29ab83455307ac
|
01dbe06e8ad0d7da2635604650edbbd8f1dd5cf8
|
/cpp/src/rz/rz-kauvir/rz-graph-valuer/scope/rz-lisp-graph-scope-token.cpp
|
3deaebe58b242aa2af1c134e858af16f29e23339
|
[
"BSL-1.0",
"LicenseRef-scancode-proprietary-license"
] |
permissive
|
scignscape/SubjectiveSpeechQualityMeasurement
|
ccfe93d4569d45d711eb6a92c842cac9ae4a5404
|
ab68b91108f3f1d7086ea1ac9a8801c063dc9bff
|
refs/heads/master
| 2020-04-04T11:24:26.062577
| 2018-12-02T04:44:44
| 2018-12-02T04:44:44
| 155,889,835
| 0
| 1
|
BSL-1.0
| 2018-11-13T17:09:00
| 2018-11-02T16:02:47
|
C++
|
UTF-8
|
C++
| false
| false
| 2,441
|
cpp
|
rz-lisp-graph-scope-token.cpp
|
// Copyright Nathaniel Christen 2018.
// 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)
#include "rz-lisp-graph-scope-token.h"
#include "token/rz-lisp-token.h"
USING_RZNS(GVal)
USING_RZNS(GBuild)
RZ_Lisp_Graph_Scope_Token::RZ_Lisp_Graph_Scope_Token(QString channel_code)
: channel_code_(channel_code), function_token_(nullptr),
declaration_token_(nullptr), value_node_(nullptr)
{
}
RZ_Lisp_Graph_Scope_Token::RZ_Lisp_Graph_Scope_Token(caon_ptr<RZ_Lisp_Token> f,
caon_ptr<RZ_Lisp_Token> d, caon_ptr<RE_Node> n)
: function_token_(f), declaration_token_(d), value_node_(n)
{
}
RZ_Lisp_Graph_Scope_Token::RZ_Lisp_Graph_Scope_Token(RZ_Lisp_Token& f, RZ_Lisp_Token& d)
: function_token_(&f), declaration_token_(&d), value_node_(nullptr)
{
}
RZ_Lisp_Graph_Scope_Token::RZ_Lisp_Graph_Scope_Token(RZ_Lisp_Token& f, RZ_Lisp_Token& d,
QString dtn, caon_ptr<RE_Node> n)
: function_token_(&f), declaration_token_(&d), declared_type_name_(dtn), value_node_(n)
{
}
QString RZ_Lisp_Graph_Scope_Token::value_to_string() const
{
return vh_.to_string();
}
QString RZ_Lisp_Graph_Scope_Token::type_to_string() const
{
if(declared_type_name_.isEmpty())
return vh_.type_to_string();
else
{
return declared_type_name_;
}
}
bool RZ_Lisp_Graph_Scope_Token::type_matches(caon_ptr<RZ_Type_Object> rto) const
{
return vh_.type_object() == rto;
}
QString RZ_Lisp_Graph_Scope_Token::value_to_string(QString& type, RZ_Type_Variety&) const
{
return value_to_string(type);
}
QString RZ_Lisp_Graph_Scope_Token::value_to_string(QString& type) const
{
if(declared_type_name_.isEmpty())
return vh_.to_string_with_type(type);
else
{
type = declared_type_name_;
return vh_.to_string();
}
}
QString RZ_Lisp_Graph_Scope_Token::value_to_lisp_string() const
{
const RZ_Type_Object& rto = *vh_.type_object();
if(rto.id() == RZ_Run_Types::Opc)
{
return "nil";
}
else if(rto.name() == "Vec")
{
return "nil";
}
else if(rto.id() == RZ_Run_Types::FnDefInfo)
{
return "nil";
}
return vh_.to_lisp_string();
}
Basic_Token_Kinds RZ_Lisp_Graph_Scope_Token::initial_kind_and_string_value(QString& result) const
{
CAON_PTR_DEBUG(RZ_Lisp_Token ,function_token_)
CAON_PTR_DEBUG(RZ_Lisp_Token ,declaration_token_)
result = value_to_lisp_string();
return Basic_Token_Kinds::Symbol_Token;
}
|
a19418720b235497d8bb3474431815857c63070f
|
8aed0e4b4e570e063b394e579cc850757ce66e71
|
/Finish_it/Src/Entities/Animations/animation.cpp
|
1c5527d64f7386df6e0d11038c6e7355ecd81cb7
|
[] |
no_license
|
Olxe/Finish_it
|
2df1c53c0e4db096a6df8d300d93ac48b5b50e87
|
007e7a2fe303cb7d96bc79143fd22c7d066d04b0
|
refs/heads/master
| 2022-05-27T07:34:15.709510
| 2019-12-21T15:38:19
| 2019-12-21T15:38:19
| null | 0
| 0
| null | null | null | null |
UTF-8
|
C++
| false
| false
| 1,468
|
cpp
|
animation.cpp
|
#include "animation.h"
Animation::Animation(sf::Sprite* spriteSheet, std::vector<sf::Vector2i> framesPos, sf::Vector2i frameSize, float frameTime, std::string name, bool loop, bool cancelMovement, int priority)
: isActive(false)
, isCancelMovement(cancelMovement)
, isLoop(loop)
, m_spriteSheet(spriteSheet)
, m_frameTime(frameTime)
, m_name(name)
, m_currentTime(0.f)
, m_currentFrame(0)
, m_priority(priority)
{
for (auto framePos : framesPos) {
m_frames.push_back(sf::IntRect(framePos.x * frameSize.x, framePos.y * frameSize.y, frameSize.x, frameSize.y));
}
}
Animation::~Animation()
{
}
void Animation::Start()
{
isActive = true;
m_currentFrame = 0;
m_currentTime = 0.f;
updateFrames();
}
void Animation::Stop()
{
isActive = false;
m_currentFrame = 0;
m_currentTime = 0.f;
}
void Animation::Pause()
{
isActive = false;
}
void Animation::Resume()
{
isActive = true;
}
bool Animation::Update(const float& deltaTime)
{
if (isActive && !m_frames.empty()) {
m_currentTime += deltaTime;
while (m_currentTime >= m_frameTime) {
m_currentTime -= m_frameTime;
if (!updateFrames()) return false;
}
}
return true;
}
bool Animation::updateFrames()
{
bool isWorking = true;
if (m_currentFrame >= m_frames.size()) {
m_currentFrame = 0;
isWorking = false;
if (!isLoop) {
isActive = false;
return isWorking;
}
}
m_spriteSheet->setTextureRect(m_frames[m_currentFrame]);
m_currentFrame++;
return isWorking;
}
|
fcf290a320d2c0be6da9eadc70c74cbabb211ce6
|
2ce387d353c30b44eda56334554eea49c7697cd1
|
/midori_engine/src/midori/renderer/camera/PerspectiveCamera.cpp
|
48752efd86efa7a3a524163154d1b69f3cd07f1a
|
[
"MIT"
] |
permissive
|
SzyJ/midori_engine
|
2bd7651ed6a9073c4f2f024c90d06a0c334763af
|
c032354b53798af7e34dc0a8c852c83843df974d
|
refs/heads/master
| 2021-08-25T18:05:55.657810
| 2020-02-05T11:59:43
| 2020-02-05T11:59:43
| 204,341,614
| 1
| 1
|
MIT
| 2019-11-25T22:39:15
| 2019-08-25T19:40:23
|
C++
|
UTF-8
|
C++
| false
| false
| 3,966
|
cpp
|
PerspectiveCamera.cpp
|
// Author: Szymon Jackiewicz
//
// Project: midori_engine
// File: PerspectiveCamera.cpp
// Date: 31/10/2019
#include "mdpch.h"
#include "PerspectiveCamera.h"
namespace midori {
PerspectiveCamera::PerspectiveCamera(float aspectRatio, glm::vec3 position, glm::vec3 up, float yaw, float pitch)
: m_AspectRatio(aspectRatio), m_Position(position), m_WorldUp(up), m_Yaw(yaw), m_Pitch(pitch) {
UpdateCameraVectors();
RecalculateViewMatrix();
RecalculateProjectionMatrix();
}
const glm::mat4& PerspectiveCamera::GetViewMatrix() const {
return m_ViewMatrix;
}
const glm::mat4& PerspectiveCamera::GetProjectionMatrix() const {
return m_ProjectionMatrix;
}
const glm::mat4& PerspectiveCamera::GetViewProjectionMatrix() const {
return m_ViewProjectionMatrix;
}
void PerspectiveCamera::OnWindowResize(unsigned int newWidth, unsigned int newHeight) {
SetAspectRatio((float) newWidth / (float) newHeight);
}
void PerspectiveCamera::Move(MovementDirection direction, float distance) {
if (direction == MovementDirection::forward) {
m_Position += m_Front * distance;
}
if (direction == MovementDirection::backward) {
m_Position -= m_Front * distance;
}
if (direction == MovementDirection::left) {
m_Position -= m_Right * distance;
}
if (direction == MovementDirection::right) {
m_Position += m_Right * distance;
}
if (direction == MovementDirection::up) {
m_Position += m_Up * distance;
}
if (direction == MovementDirection::down) {
m_Position -= m_Up * distance;
}
if (direction == MovementDirection::world_up) {
m_Position += m_WorldUp * distance;
}
if (direction == MovementDirection::world_down) {
m_Position -= m_WorldUp * distance;
}
RecalculateViewMatrix();
}
void PerspectiveCamera::Rotate(float xOffset, float yOffset) {
m_Yaw += xOffset;
m_Pitch += yOffset;
if (m_Pitch > 89.0f) {
m_Pitch = 89.0f;
} else if (m_Pitch < -89.0f) {
m_Pitch = -89.0f;
}
UpdateCameraVectors();
RecalculateViewMatrix();
}
void PerspectiveCamera::Zoom(float zoomAmount) {
if (m_Zoom >= 1.0f && m_Zoom <= 45.0f) {
m_Zoom -= zoomAmount;
} else if (m_Zoom <= 1.0f) {
m_Zoom = 1.0f;
} else if (m_Zoom >= 45.0f) {
m_Zoom = 45.0f;
}
RecalculateProjectionMatrix();
}
void PerspectiveCamera::SetAspectRatio(const float aspectRatio) {
m_AspectRatio = aspectRatio;
RecalculateProjectionMatrix();
}
void PerspectiveCamera::SetNearZ(const float nearZ) {
m_NearZ = nearZ;
RecalculateProjectionMatrix();
}
void PerspectiveCamera::SetFarZ(const float farZ) {
m_FarZ = farZ;
RecalculateProjectionMatrix();
}
void PerspectiveCamera::UpdateCameraVectors() {
glm::vec3 front;
front.x = cos(glm::radians(m_Yaw)) * cos(glm::radians(m_Pitch));
front.y = sin(glm::radians(m_Pitch));
front.z = sin(glm::radians(m_Yaw)) * cos(glm::radians(m_Pitch));
m_Front = glm::normalize(front);
m_Right = glm::normalize(glm::cross(m_Front, m_WorldUp));
m_Up = glm::normalize(glm::cross(m_Right, m_Front));
}
inline void PerspectiveCamera::RecalculateViewMatrix() {
m_ViewMatrix = glm::lookAt(m_Position, m_Position + m_Front, m_Up);
m_ViewProjectionMatrix = m_ProjectionMatrix * m_ViewMatrix;
}
inline void PerspectiveCamera::RecalculateProjectionMatrix() {
m_ProjectionMatrix = glm::perspective(glm::radians(m_Zoom), m_AspectRatio, m_NearZ, m_FarZ);
m_ViewProjectionMatrix = m_ProjectionMatrix * m_ViewMatrix;
}
}
|
ddb491c7bf401d27ca5f42481b91a5863579246d
|
3edd809ff6e3ae940d0e2c538b3a047436c856dd
|
/cleetcode/headers/convert.h
|
ade790ff12a7b405d41e0b6534eb89c6da8f1b99
|
[] |
no_license
|
zhangyiwen5512/myleetcode
|
ee11f7c28b07b1474a627692f85429c89ef62782
|
7b6e45011b20985a231555a4d05243fb896c7922
|
refs/heads/master
| 2023-02-09T03:35:20.461919
| 2021-01-04T10:50:49
| 2021-01-04T10:50:49
| 313,602,841
| 0
| 0
| null | null | null | null |
UTF-8
|
C++
| false
| false
| 1,772
|
h
|
convert.h
|
//
// Created by zhangyiwen on 2020/11/25.
//
#ifndef CLEETCODE_CONVERT_H
#define CLEETCODE_CONVERT_H
#include <string>
/*
* 将一个给定字符串根据给定的行数,以从上往下、从左到右进行 Z 字形排列。
* 比如输入字符串为 "LEETCODEISHIRING" 行数为 3 时,排列如下:
* L C I R
* E T O E S I I G
* E D H N
* 之后,你的输出需要从左往右逐行读取,产生出一个新的字符串,比如:"LCIRETOESIIGEDHN"。
* 请你实现这个将字符串进行指定行数变换的函数:
*
* 输入: s = "LEETCODEISHIRING", numRows = 3
* 输出: "LCIRETOESIIGEDHN"
*
* 输入: s = "LEETCODEISHIRING", numRows = 4
* 输出: "LDREOEIIECIHNTSG"
* 解释:
*
* L D R
* E O E I I
* E C I H N
* T S G
*
* 一行以及s只有一个字母为特例,直接返回
* 一行一行计算
* 定义mode = 2 * numRows - 2,
* s[index], s[index + mode]将s[start + p]加载中间
* start为index所在列的起始序号,p为定位偏移
*
*/
class convert {
public:
std::string Solution(std::string s, int numRows) {
if (numRows == 1) return s;
if (s.length() == 1) return s;
std::string result;
int mode = 2 * numRows - 2;
for (int i = 0; i < numRows ; ++i) {
int index = i;
while (index < s.length()){
result += s[index];
int p = mode - index % mode;
int start = index / mode * mode;
if (p != 0 && (p != mode / 2) && p != mode && (start + p < s.length())){
result += s[start + p];
}
index += mode;
}
}
return result;
}
};
#endif //CLEETCODE_CONVERT_H
|
e74e8dfd60f1c17a659077735ec9fa05f3d7e06d
|
2227248f6735db6a8e8faa3ad1012054efd69809
|
/615 a co/ان تا کلید و ام تالامب همه روشن میشود؟.cpp
|
3bbaaabf95ca2d629725d840f252c4f5d93135d1
|
[] |
no_license
|
maryamBarmaky/AcmSolution
|
e39f49d327166ea7ff859ea57ba3c2b6fe78cea4
|
5005c6d68c90fbda4a327bb282f3799ae2e09a30
|
refs/heads/master
| 2021-01-19T03:10:37.225911
| 2017-04-07T11:33:45
| 2017-04-07T11:33:45
| 87,309,159
| 5
| 0
| null | null | null | null |
UTF-8
|
C++
| false
| false
| 392
|
cpp
|
ان تا کلید و ام تالامب همه روشن میشود؟.cpp
|
//615 b code forces
#include "iostream"
using namespace std;
int a[101], n, m, i, b, j, c;
int main()
{
cin >> n >> m;
for (i = 0; i<n; i++)
{
cin >> b;
for (j = 0;j<b; j++)
{
cin >> c;
a[c] = 1;
}
}
for (j = 1; j <= m; j++)
if (a[j] != 1)
{ cout << "NO"; return 0; }
cout << "YES";
system("pause");
}
|
ebd318f7995479d0aa4606bdeb5795a0a8752e86
|
d93159d0784fc489a5066d3ee592e6c9563b228b
|
/HLTrigger/Timer/test/chrono/src/mach_clock_get_time.cc
|
f8f2e9cba7dcf2cab9211ab48d69d11372e8cbe4
|
[] |
permissive
|
simonecid/cmssw
|
86396e31d41a003a179690f8c322e82e250e33b2
|
2559fdc9545b2c7e337f5113b231025106dd22ab
|
refs/heads/CAallInOne_81X
| 2021-08-15T23:25:02.901905
| 2016-09-13T08:10:20
| 2016-09-13T08:53:42
| 176,462,898
| 0
| 1
|
Apache-2.0
| 2019-03-19T08:30:28
| 2019-03-19T08:30:24
| null |
UTF-8
|
C++
| false
| false
| 908
|
cc
|
mach_clock_get_time.cc
|
#if defined(__APPLE__) || defined(__MACH__)
// Darwin system headers
#include <mach/mach.h>
#include <mach/clock.h>
#include "interface/mach_clock_get_time.h"
#ifdef HAVE_MACH_SYSTEM_CLOCK
// based on host_get_clock_service(SYSTEM_CLOCK) and clock_get_time(...)
const clock_serv_t mach_system_clock::clock_port = mach_system_clock::get_clock_port();
#endif // HAVE_MACH_SYSTEM_CLOCK
#ifdef HAVE_MACH_REALTIME_CLOCK
// based on host_get_clock_service(REALTIME_CLOCK) and clock_get_time(...)
const clock_serv_t mach_realtime_clock::clock_port = mach_realtime_clock::get_clock_port();
#endif // HAVE_MACH_REALTIME_CLOCK
#ifdef HAVE_MACH_CALENDAR_CLOCK
// based on host_get_clock_service(CALENDAR_CLOCK) and clock_get_time(...)
const clock_serv_t mach_calendar_clock::clock_port = mach_calendar_clock::get_clock_port();
#endif // HAVE_MACH_CALENDAR_CLOCK
#endif // defined(__APPLE__) || defined(__MACH__)
|
643193a3e35e1f1ba2e3b3797d3dc4a435b3207c
|
1582f416a3a107463d7dd9faebca3ffd00ea1dcd
|
/src/Puppet.cpp
|
a1f53e0ddf52f85277d4938c24d1a5bfc9a8ef22
|
[
"MIT"
] |
permissive
|
Treagle350/Battleships
|
28c18e850a9b6b57668697ca2f98772ab8ec7dcc
|
65c4e565c91e5d1f9a6f1ca7752cf40141ac75b3
|
refs/heads/master
| 2021-03-13T03:31:15.201845
| 2017-05-30T13:19:34
| 2017-05-30T13:19:34
| 91,497,016
| 0
| 0
| null | 2017-05-28T17:23:45
| 2017-05-16T19:35:00
|
C++
|
UTF-8
|
C++
| false
| false
| 3,025
|
cpp
|
Puppet.cpp
|
#include "Puppet.h"
#include <vector>
#include <cstdlib>
#include <ctime>
Puppet::Puppet(int coordX, int coordY){
health = 100;
//attackingPower = 50;
blockSprite = "|^|";
std::vector<int> pathX;
std::vector<int> pathY;
set_coordinates(coordX/2,coordY/2,coordX,coordY);
}
Puppet::Puppet(int coordX, int coordY,std::string enemy){
health = 100;
//attackingPower = 50;
blockSprite = "|X|";
set_coordinates(coordX/2,coordY/2,coordX,coordY);
}
Puppet::Puppet(int x,int y,int coordX, int coordY){
health = 100;
//attackingPower = 50;
blockSprite = "|O|";
set_coordinates(x,y,coordX,coordY);
}
int Puppet::collision(int x1,int y1,int x2,int y2){
if(x1==x2 && y1==y2){
std::cout << '\a';
substract_health(100);
}
return health;
}
std::string Puppet::get_blockSprite()
{
return blockSprite;
}
int Puppet::get_x()
{
return coordinatesX;
}
int Puppet::get_y()
{
return coordinatesY;
}
int Puppet::get_health()
{
return health;
}
void Puppet::substract_health(int damage)
{
health = health - damage;
}
int Puppet::generateSeed(int sizeArraylist){
int seed = 0;
srand(time(NULL));
seed = rand()%sizeArraylist;
return seed;
}
int Puppet::get_Arraysize(){
int sizeArraylist;
if(pathX.size()==pathY.size()){
sizeArraylist = pathX.size();
return sizeArraylist;
}else{
return 0;
}
}
void Puppet::writePathX(int x1){
pathX.assign(1,x1);
}
void Puppet::writePathY(int y1){
pathY.assign(1,y1);
}
int Puppet::accessPathX(int seed){
int x = pathX.at(seed);
return x;
}
int Puppet::accessPathY(int seed){
int y = pathY.at(seed);
return y;
}
void Puppet::set_coordinates(int posX,int posY,int x,int y){
if(posX < x && posY < y && posX >= 0 && posY >= 0){
coordinatesX = posX;
coordinatesY = posY;
writePathX(posX);
writePathY(posY);
}else{
substract_health(100);
}
}
int Puppet::moveUp(int x, int y){
blockSprite = "|^|";
direction = 1;
coordinatesX = coordinatesX + 0;
coordinatesY = coordinatesY - 1;
set_coordinates(coordinatesX,coordinatesY,x,y);
return direction;
}
int Puppet::moveDown(int x, int y){
blockSprite = "|v|";
direction = 0;
coordinatesX = coordinatesX + 0;
coordinatesY = coordinatesY + 1;
set_coordinates(coordinatesX,coordinatesY,x,y);
return direction;
}
int Puppet::moveLeft(int x, int y){
blockSprite = "|<|";
direction = 2;
coordinatesX = coordinatesX - 1;
coordinatesY = coordinatesY + 0;
set_coordinates(coordinatesX,coordinatesY,x,y);
return direction;
}
int Puppet::moveRight(int x, int y){
blockSprite = "|>|";
direction = 3;
coordinatesX = coordinatesX + 1;
coordinatesY = coordinatesY - 0;
set_coordinates(coordinatesX,coordinatesY,x,y);
return direction;
}
Puppet::~Puppet(){
}
|
f7c099da714952a9fc5c74bc59e3956677737d4e
|
c96292f20e3e405715ce654ed25e9f0c7995bf71
|
/QipaiServer/Extern/GameUser/UserManager.h
|
9ee296b054c6196862bb416c2696f156a950f0c0
|
[] |
no_license
|
Aden2018/myQipai
|
c68498b77a61eb8e5840e74c68006cf9f0c55a8d
|
b6a7b2a91b5234f0f74c038f448fd2008347e332
|
refs/heads/main
| 2023-07-15T22:08:47.804029
| 2021-08-19T13:13:29
| 2021-08-19T13:13:29
| null | 0
| 0
| null | null | null | null |
GB18030
|
C++
| false
| false
| 1,861
|
h
|
UserManager.h
|
#ifndef __USER_MANAGER_H__
#define __USER_MANAGER_H__
/*
玩家模型管理器
*/
#include <map>
#include <string>
#include "GameUser.h"
#include "TimerManager.h"
//延迟处理结构
struct SDelayDelData
{
int nDelayTime;
int nUid;
};
class UserManager : public TimerObject
{
private:
UserManager();
~UserManager();
public:
static UserManager *getInstance();
static void destroy();
public:
bool init(TimerManager *pTimerManager);
void addModelType(ModelType Type);
void onTimer(const TimeVal& now);
// 获得已有用户,当createWhenNull为true时,获取不到会自动从数据库中初始化它
GameUser* getGameUser(int uid, std::string userName, std::string passWord, bool createWhenNull = true);
GameUser* getGameUser(int uid);
GameUser* newGameUser(int uid, std::string userName, std::string passWord);
GameUser* initGameUser(int uid, std::string userName, std::string passWord);
// 添加用户, 注册的时候添加
void addGameUser(int uid, GameUser* gameUsr);
//检测用户在该服务器是否存在
bool checkUserIsExist(int uid);
// 移除用户
void removeGameUser(int uid);
// 删除移除用户数据
void donotDeleteUser(int uid);
// 获得所有模型类型
std::vector<ModelType>& getModelType() { return m_VectServerModel; }
const std::map<int, GameUser *>& getGameUsers() { return m_GameUsers; }
//真正删除用户
void RealremoveGameUser(int uid);
private:
static UserManager * m_pInstance;
std::map<int, GameUser*> m_GameUsers;
std::vector<ModelType> m_VectServerModel; //服务器所需求服务器模型
std::map<int, std::list<SDelayDelData>::iterator> m_MapDelUserList; //玩家对应的向量迭代器
std::list<SDelayDelData> m_DelUserList; //延迟玩家下线列表
TimerManager * m_TimeManager;
};
#endif //__USER_MANAGER_H__
|
2f8f6d0273bf61647fcaf71353f0589af076c445
|
b71089fe17f39bbef6885758fa9da2f8070b656b
|
/project2/kernels/grad_case7.cc
|
3a07990306cacb7897ea157687e9cf3760c71fc6
|
[
"MIT"
] |
permissive
|
QiliangLai/CompilerProject-2020Spring
|
dcffed21f9534239ac595055b5f289173e51ca21
|
3e09ce0c71ea4d1449fde0156aeb3f34d40969ac
|
refs/heads/master
| 2022-10-24T04:25:22.743968
| 2020-05-29T07:06:38
| 2020-05-29T07:06:38
| 269,868,279
| 0
| 0
|
MIT
| 2020-06-06T04:33:29
| 2020-06-06T04:33:28
| null |
UTF-8
|
C++
| false
| false
| 82
|
cc
|
grad_case7.cc
|
#include "../run2.h"
void grad_case7(float (&dB)[16][32], float (&dA)[32][16]) {}
|
773940394e96234d527f1bec1bdfef1d6b51d305
|
a68310fb079e4bdfa8f14e6d1990e9a5f13a1042
|
/fpgrowth.cpp
|
f74097cfffe904568e6e68fabfcf4bb8dc5d8499
|
[] |
no_license
|
kamalnis/data-mining-algo
|
c0c590d443a1d5a02012ea9ab37cb1b1c771d8de
|
abefb7e81ec90bf347326a41c79fcf0d175453e0
|
refs/heads/master
| 2016-08-04T00:08:51.624498
| 2015-09-11T07:37:22
| 2015-09-11T07:37:22
| 42,293,936
| 0
| 0
| null | null | null | null |
UTF-8
|
C++
| false
| false
| 8,241
|
cpp
|
fpgrowth.cpp
|
#include<iostream>
#include<vector>
#include<set>
#include<algorithm>
#include<cstdlib>
#include<cstdio>
using namespace std;
struct fptree{
char item;
int count;
struct fptree * links[100];
int linkcount;
struct fptree *parent;
struct fptree *next;
};
struct itemset{
char items;
struct fptree * head;
int count;
itemset() {
head=NULL;
}
};
int count(char a,vector<set<char> > b){
int count=0;
for(vector<set<char> >::iterator it=b.begin();it!=b.end();it++){
if(it->find(a)!=it->end())
count++;
}
return count;
}
void set_ptr(vector<struct itemset> & item_set,char c,struct fptree * node){
for(vector<struct itemset>::iterator itr=item_set.begin();itr!=item_set.end();itr++){
if(itr->items==c){
if(itr->head==NULL)
itr->head=node;
else{
struct fptree *ptr;
for(ptr=itr->head;ptr->next!=NULL;ptr=ptr->next);
ptr->next=node;
}
return;
}
}
}
bool cmp(const struct itemset& lhs, const struct itemset& rhs)
{
return lhs.count > rhs.count;
}
/*FPTree creation*/
void fpTreeCreation(vector<char>a,vector<struct itemset> & item_set,struct fptree * &root){
if(a.empty()){
return;
}
int flag=0;
vector<char>::iterator it=a.begin();
for(int i=0;i<=root->linkcount;i++){
struct fptree *node=root->links[i];
if(node->item==*it){
node->count+=1;
a.erase(it);
fpTreeCreation(a,item_set,node);
flag=1;
break;
}
}
if(flag==0){
struct fptree *node=new(struct fptree);
node->item=*it;
node->count=1;
node->linkcount=-1;
node->parent=root;
root->linkcount+=1;
(root->links)[root->linkcount]=node;
set_ptr(item_set,*it,node);
a.erase(it);
fpTreeCreation(a,item_set,node);
}
}
vector<set<char> > L;
void fpgrowth(vector<set<char> > trans,vector<struct itemset> & item_set,struct fptree * root,int numItems,int min_support,set<char> myset){
if(item_set.size()==0)
return;
//creating tree for given trans
for(vector<set<char> >::iterator it=trans.begin();it!=trans.end();it++){
vector<char> newset;
for(vector<struct itemset>::iterator it1=item_set.begin();it1!=item_set.end();it1++){
struct itemset it2=*it1;
char ch=it2.items;
if(it->find(ch)!=it->end())
newset.push_back(ch);
}
fpTreeCreation(newset,item_set,root);
}
for(vector<struct itemset>::iterator it1=item_set.end()-1;it1>=item_set.begin();it1--){
if(it1->count>=min_support){
myset.insert(it1->items);
L.push_back(myset);
vector<set<char> > t;
vector<struct itemset> ditem_set;
//creating the transaction vector
for(struct fptree *ptr1=it1->head;ptr1!=NULL;ptr1=ptr1->next){
set<char> temp;
for(struct fptree *ptr2=ptr1->parent;ptr2->item!='-';ptr2=ptr2->parent){
temp.insert(ptr2->item);
}
for(int i=0;i<ptr1->count;i++)
t.push_back(temp);
}
for(int i=0;i<numItems;i++){
struct itemset * iset=new(struct itemset);
iset->items=i+'a';
iset->count=count(iset->items,t);
iset->head=NULL;
if(iset->count>=min_support)
ditem_set.push_back(*iset);
}
struct fptree* croot=new(struct fptree);
croot->item='-';
croot->count=0;
croot->parent=NULL;
croot->linkcount=-1;
fpgrowth(t,ditem_set,croot,numItems,min_support,myset);
myset.erase(it1->items);
}
else return;
}
}
vector< set<char> > getAllSubsets(set<char> s)
{
vector< set<char> > subset;
int set_size=s.size();
unsigned int pow_set_size = 1<<set_size;
int counter, j;
for(counter = 1; counter < pow_set_size-1; counter++)
{
set<char> temp;
for(j = 0; j<set_size; j++)
{
if(counter & (1<<j)){
set<char>::iterator it = s.begin();
advance(it, j);
temp.insert(*it);
}
}
subset.push_back(temp);
}
return subset;
}
set<char> difference(set<char> a, set<char> b){
int count;
set<char> myset;
for(set<char>::iterator it=a.begin();it!=a.end();it++){
myset.insert(*it);
for(set<char>::iterator it1=b.begin();it1!=b.end();it1++){
if(*it==*it1){
myset.erase(*it);
break;
}
}
}
return myset;
}
bool check_subset(set<char> a,set<char> b){
//checks whether a is a subset of b
for(set<char>:: iterator itr=a.begin();itr!=a.end();itr++){
if(b.find(*itr)==b.end())
return 0;
}
return 1;
}
int count(set<char>a,vector<set<char> > b){
//counts no of occurences of set a in vector of sets b
int count=0;
for(vector<set<char> >:: iterator itr=b.begin();itr!=b.end();itr++)
count+=check_subset(a,*itr);
return count;
}
void printRules(vector<set<char> > L,vector<set<char> > vec,float min_thresh){
int counter=0;
for(vector<set<char> >:: iterator itr1=L.begin();itr1!=L.end();itr1++){
vector <set<char> > temp=getAllSubsets(*itr1);
for(vector<set<char> >:: iterator itr2=temp.begin();itr2!=temp.end();itr2++){
if((float)count(*itr1,vec)/count(*itr2,vec)>=min_thresh){
for(set<char>:: iterator itr3=(*itr2).begin();itr3!=(*itr2).end();itr3++)
cout<<*itr3;
set<char> v;
v=difference(*itr1,*itr2);
cout<<"->";
for(set<char>:: iterator itr3=v.begin();itr3!=v.end();itr3++)
cout<<*itr3;
cout<<endl;
counter++;
}
}
}
cout<<"\nNumber of rules generated=";
cout<<counter<<endl;
}
int main(){
int numTrans,min_support,numItems;
float min_thresh;
vector<set<char> > trans;
vector<struct itemset> item_set;
cin>>min_support>>numItems>>numTrans>>min_thresh;
string items;
for(int i=0;i<numTrans;i++){
cin>>items;
set<char> temp;
for(int j=1;items.at(j-1)!='}';j+=2){
temp.insert(items.at(j));
}
trans.push_back(temp);
}
for(int i=0;i<numItems;i++){
struct itemset * iset=new(struct itemset);
iset->items=i+'a';
iset->count=count(iset->items,trans);
iset->head=NULL;
if(iset->count>=min_support)
item_set.push_back(*iset);
}
sort(item_set.begin(),item_set.end(),cmp); //sorting item set on the basis of count
struct fptree* root=new(struct fptree);
root->item='-';
root->count=0;
root->parent=NULL;
root->linkcount=-1;
set<char> myset;
fpgrowth(trans,item_set,root,numItems,min_support,myset);
cout<<"Frequent Itemset are:-\n";
for(vector<set<char> >:: iterator itr1=L.begin();itr1!=L.end();itr1++)
{
for(set<char>:: iterator itr2=(*itr1).begin();itr2!=(*itr1).end();itr2++)
cout<<*itr2;
cout<<endl;
}
cout<<"Number of frequent item set=";
cout<<L.size()<<endl;
cout<<"Association Rules are:-\n";
printRules(L,trans,min_thresh);
return 0;
}
|
90f7b19bc5b86affd466ce027ade0b4b9582f0bb
|
23c8d0f167823221dce3a0dbb8b4bee6dc7fce33
|
/TouchGFX/generated/fonts/src/FontGetters.cpp
|
0d188da790a02adc4ba469ce36bc590de2382ef3
|
[] |
no_license
|
koson/touchgfx_STM32F429I-DISCO_example
|
54cf562f3e59558536ab5c27479a2c6e06a0d554
|
0d5cec3daa7819c9c527de9f62ea388a6ade29ae
|
refs/heads/master
| 2022-01-19T12:46:05.405836
| 2019-07-08T21:19:51
| 2019-07-08T21:19:51
| null | 0
| 0
| null | null | null | null |
UTF-8
|
C++
| false
| false
| 2,111
|
cpp
|
FontGetters.cpp
|
// Autogenerated, do not edit
#include <touchgfx/InternalFlashFont.hpp>
#ifndef NO_USING_NAMESPACE_TOUCHGFX
using namespace touchgfx;
#endif
// verdana_15_4bpp
extern const touchgfx::GlyphNode glyphs_verdana_15_4bpp[];
extern const uint8_t unicodes_verdana_15_4bpp[];
extern const touchgfx::KerningNode kerning_verdana_15_4bpp[];
touchgfx::InternalFlashFont& getFont_verdana_15_4bpp();
touchgfx::InternalFlashFont& getFont_verdana_15_4bpp()
{
static touchgfx::InternalFlashFont verdana_15_4bpp(glyphs_verdana_15_4bpp, 49, 15, 3, 4, 1, 1, unicodes_verdana_15_4bpp, kerning_verdana_15_4bpp, 63, 0);
return verdana_15_4bpp;
}
// verdana_20_4bpp
extern const touchgfx::GlyphNode glyphs_verdana_20_4bpp[];
extern const uint8_t unicodes_verdana_20_4bpp[];
extern const touchgfx::KerningNode kerning_verdana_20_4bpp[];
touchgfx::InternalFlashFont& getFont_verdana_20_4bpp();
touchgfx::InternalFlashFont& getFont_verdana_20_4bpp()
{
static touchgfx::InternalFlashFont verdana_20_4bpp(glyphs_verdana_20_4bpp, 29, 20, 4, 4, 0, 1, unicodes_verdana_20_4bpp, kerning_verdana_20_4bpp, 63, 0);
return verdana_20_4bpp;
}
// verdana_21_4bpp
extern const touchgfx::GlyphNode glyphs_verdana_21_4bpp[];
extern const uint8_t unicodes_verdana_21_4bpp[];
extern const touchgfx::KerningNode kerning_verdana_21_4bpp[];
touchgfx::InternalFlashFont& getFont_verdana_21_4bpp();
touchgfx::InternalFlashFont& getFont_verdana_21_4bpp()
{
static touchgfx::InternalFlashFont verdana_21_4bpp(glyphs_verdana_21_4bpp, 36, 21, 4, 4, 0, 2, unicodes_verdana_21_4bpp, kerning_verdana_21_4bpp, 63, 0);
return verdana_21_4bpp;
}
// verdana_40_4bpp
extern const touchgfx::GlyphNode glyphs_verdana_40_4bpp[];
extern const uint8_t unicodes_verdana_40_4bpp[];
extern const touchgfx::KerningNode kerning_verdana_40_4bpp[];
touchgfx::InternalFlashFont& getFont_verdana_40_4bpp();
touchgfx::InternalFlashFont& getFont_verdana_40_4bpp()
{
static touchgfx::InternalFlashFont verdana_40_4bpp(glyphs_verdana_40_4bpp, 1, 40, 0, 4, 0, 0, unicodes_verdana_40_4bpp, kerning_verdana_40_4bpp, 63, 0);
return verdana_40_4bpp;
}
|
3e901dba5525aaa9545dd1401780f443e4ed6e41
|
8f9ba5459fab4f32ec86621047d56171bf755e62
|
/graficos por tortuga.cpp
|
e41422e7e484ca442039d3f95a18d93f30bb1613
|
[] |
no_license
|
CesarEMR/Cesar-Mu-oz-3-B
|
6848c80efce2276c78c2e8add8abb13f67c1d8ea
|
9dd11361aa65c598353949ef1868a9cc2a312a47
|
refs/heads/master
| 2020-03-27T19:58:23.361222
| 2018-11-21T07:16:23
| 2018-11-21T07:16:23
| 146,392,663
| 0
| 0
| null | null | null | null |
UTF-8
|
C++
| false
| false
| 3,832
|
cpp
|
graficos por tortuga.cpp
|
#include "stdafx.h"
#include <iostream>
#include <string>
#include <time.h>
#include <stdlib.h>
#include <math.h>
#include <fstream>
using namespace std;
int Menu();
void Mostrartablero(int piso[20][20], int largo, int ancho);
int main()
{
int piso[20][20] = {0}, salir = 0;
int poshori = 0, posverti = 0;
bool pluma = false;
piso[poshori][posverti] = 2;//posicion inicial.
cout << "===============> C O M A N D O S <================";
cout << "\n1.-Pluma hacia arriba.\t2.-Pluma hacia abajo.\n3.-Girar a la derecha.\t4.-Girar a la Izquierda.";
cout << "\n5. - Avanza 1 espacio.\t6. - Mostrar tablero.\n7. - Salir.\n";
do
{
int opcion = Menu();
switch (opcion)
{
case 1:
pluma = false;
break;
case 2:
pluma = true;
break;
case 3:
if(piso[poshori][posverti] < 5)
{
piso[poshori][posverti] += 1;
}
else
{
piso[poshori][posverti] = 2;
}
break;
case 4:
if (piso[poshori][posverti] > 2)
{
piso[poshori][posverti] -= 1;
}
else
{
piso[poshori][posverti] = 5;
}
break;
case 5:
//Avanzar hacia adelante.
if (piso[poshori][posverti] == 2)
{
if(posverti < 19)
{
piso[poshori][posverti + 1] = piso[poshori][posverti];
if (pluma == false)
{
piso[poshori][posverti] = 0;
}
else
{
piso[poshori][posverti] = 1;
}
posverti++;
}
else
{
cout << "\nHops!, ya estas en el borde en esta direccion.";
}
}
//Avanzar hacia atras.
if (piso[poshori][posverti] == 4)
{
if (posverti > 0)
{
piso[poshori][posverti - 1] = piso[poshori][posverti];
if (pluma == false)
{
piso[poshori][posverti] = 0;
}
else
{
piso[poshori][posverti] = 1;
}
posverti--;
}
else
{
cout << "\nHops!, ya estas en el borde en esta direccion.";
}
}
//Avanzar hacia abajo.
if (piso[poshori][posverti] == 3)
{
if (poshori < 19)
{
piso[poshori + 1][posverti] = piso[poshori][posverti];
if (pluma == false)
{
piso[poshori][posverti] = 0;
}
else
{
piso[poshori][posverti] = 1;
}
poshori++;
}
else
{
cout << "\nHops!, ya estas en el borde en esta direccion.";
}
}
//Avanzar hacia arriba.
if (piso[poshori][posverti] == 5)
{
if (poshori > 0)
{
piso[poshori - 1][posverti] = piso[poshori][posverti];
if (pluma == false)
{
piso[poshori][posverti] = 0;
}
else
{
piso[poshori][posverti] = 1;
}
poshori--;
}
else
{
cout << "\nHops!, ya estas en el borde en esta direccion.";
}
}
break;
case 6:
Mostrartablero(piso, 20, 20);
break;
case 7:
salir++;
break;
}
} while (salir == 0);
getchar();
getchar();
return 0;
}
int Menu()
{
int op;
do
{
cout << ">";
cin >> op;
if (op < 1 || op>7)
cout << "Ingresa una opcion valida.\n>";
} while (op < 1 || op>7);
return op;
}
void Mostrartablero(int piso[20][20], int largo, int ancho)
{
cout << " 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 \n\n\n";
for(int i = 0; i < largo; i++)
{
cout << i + 1 << "\t";
for (int x = 0; x < ancho; x++)
{
if (piso[i][x] == 0)
{
cout << "[ ]";
}
else if(piso[i][x] == 1)
{
cout << "[+]";
}
else if(piso[i][x] == 2)
{
cout << "[>]";
}
else if (piso[i][x] == 3)
{
cout << "[v]";
}
else if (piso[i][x] == 4)
{
cout << "[<]";
}
else if (piso[i][x] == 5)
{
cout << "[^]";
}
}
cout << endl;
}
}
|
5d66639bfa5004a8c4025fd496b71db507969fe9
|
29b4050f703705cc9102e6a9d8f2800caa8459e7
|
/cpp/FoodChain/FoodChain/FoodChainEatInfo.cpp
|
613d0e0d8d395f0dd04d663721fe6743bac056e5
|
[] |
no_license
|
bloodysnowx/ProgramContest
|
c1cf5ac2a843ed84772437557991ca1ceb519e1e
|
f954d4a35d1ba97f36f7deb258dc9fd179eaef2c
|
refs/heads/master
| 2021-01-18T13:58:45.668409
| 2015-01-28T00:33:33
| 2015-01-28T00:33:33
| 6,904,456
| 0
| 0
| null | null | null | null |
UTF-8
|
C++
| false
| false
| 725
|
cpp
|
FoodChainEatInfo.cpp
|
//
// FoodChainEatInfo.cpp
// FoodChain
//
// Created by 岩佐 淳史 on 13/05/19.
// Copyright (c) 2013年 岩佐 淳史. All rights reserved.
//
#include "FoodChainEatInfo.h"
bool FoodChainEatInfo::isValid()
{
// xとyが同じ種類に存在しない、かつ、yがxを食べる関係ではない
return isValidAnimalNumbers() && !tree->findSet(x, y) && !tree->findSet(x, y + 2 + animalCount);
}
void FoodChainEatInfo::add()
{
// xがAとしてBであるyを食べる
tree->unionSet(x, y + animalCount);
// xがBとしてCであるyを食べる
tree->unionSet(x + animalCount, y + 2 * animalCount);
// xがCとしてAであるyを食べる
tree->unionSet(x + 2 * animalCount, y);
}
|
daa86709f7082bce16e7a631d6ac7a048dec1298
|
4bea57e631734f8cb1c230f521fd523a63c1ff23
|
/projects/openfoam/rarefied-flows/impingment/sims/test/nozzle1/1.64/T
|
985bb3378d9375fb7ab99693a3aa79a0f9d80143
|
[] |
no_license
|
andytorrestb/cfal
|
76217f77dd43474f6b0a7eb430887e8775b78d7f
|
730fb66a3070ccb3e0c52c03417e3b09140f3605
|
refs/heads/master
| 2023-07-04T01:22:01.990628
| 2021-08-01T15:36:17
| 2021-08-01T15:36:17
| 294,183,829
| 1
| 0
| null | null | null | null |
UTF-8
|
C++
| false
| false
| 17,559
|
T
|
/*--------------------------------*- C++ -*----------------------------------*\
| ========= | |
| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox |
| \\ / O peration | Version: v1912 |
| \\ / A nd | Website: www.openfoam.com |
| \\/ M anipulation | |
\*---------------------------------------------------------------------------*/
FoamFile
{
version 2.0;
format ascii;
class volScalarField;
location "1.64";
object T;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
dimensions [0 0 0 1 0 0 0];
internalField nonuniform List<scalar>
1900
(
1.00264
1.00729
1.01315
1.01732
1.01934
1.02029
1.02023
1.02041
1.02063
1.02147
1.00264
1.00729
1.01316
1.01732
1.01934
1.02029
1.02027
1.02029
1.02022
1.0209
1.00264
1.00729
1.01316
1.01732
1.01933
1.02029
1.02027
1.02033
1.02038
1.02101
1.00264
1.00729
1.01316
1.01732
1.01934
1.02029
1.02027
1.02029
1.02022
1.0209
1.00264
1.00729
1.01315
1.01732
1.01934
1.02029
1.02023
1.02041
1.02063
1.02147
1.02006
1.02257
1.02492
1.02613
1.00872
1.02197
1.02423
1.0263
1.0287
1.02148
1.02193
1.02375
1.02545
1.02699
1.01914
1.02197
1.02423
1.0263
1.0287
1.02148
1.02006
1.02257
1.02492
1.02613
1.00872
1.04947
1.04314
1.04096
1.02846
1.00196
1.04552
1.04198
1.04025
1.03424
1.01918
1.04505
1.04189
1.03959
1.03452
1.02137
1.04552
1.04198
1.04025
1.03424
1.01918
1.04947
1.04314
1.04096
1.02846
1.00196
0.887142
0.811839
0.86109
0.870601
0.867184
0.871368
0.881109
0.895026
0.911683
0.929905
0.948586
0.966617
0.982424
0.993668
0.998829
0.999925
0.999999
1
1
1
1
1
1
0.999999
0.999911
0.998675
0.993032
0.980971
0.964134
0.944829
0.924404
0.903521
0.882556
0.861842
0.842075
0.825213
0.813853
0.799462
0.711983
0.62452
0.983606
0.858642
0.877322
0.872872
0.867796
0.871487
0.881311
0.895104
0.911723
0.929927
0.948603
0.966633
0.982438
0.993677
0.998832
0.999925
0.999999
1
1
1
1
1
1
0.999999
0.999911
0.998675
0.993032
0.980971
0.964134
0.944829
0.924404
0.903521
0.882556
0.861842
0.842075
0.825213
0.813853
0.799462
0.711983
0.62452
0.984694
0.890076
0.885403
0.874349
0.868068
0.871549
0.881373
0.895128
0.911736
0.929934
0.948608
0.966638
0.982443
0.99368
0.998833
0.999925
0.999999
1
1
1
1
1
1
0.999999
0.999911
0.998675
0.993032
0.980971
0.964134
0.944829
0.924404
0.903521
0.882556
0.861842
0.842075
0.825213
0.813853
0.799462
0.711983
0.62452
0.983606
0.858642
0.877322
0.872872
0.867796
0.871487
0.881311
0.895104
0.911723
0.929927
0.948603
0.966633
0.982438
0.993677
0.998832
0.999925
0.999999
1
1
1
1
1
1
0.999999
0.999911
0.998675
0.993032
0.980971
0.964134
0.944829
0.924404
0.903521
0.882556
0.861842
0.842075
0.825213
0.813853
0.799462
0.711983
0.62452
0.887142
0.811839
0.86109
0.870601
0.867184
0.871368
0.881109
0.895026
0.911683
0.929905
0.948586
0.966617
0.982424
0.993668
0.998829
0.999925
0.999999
1
1
1
1
1
1
0.999999
0.999911
0.998675
0.993032
0.980971
0.964134
0.944829
0.924404
0.903521
0.882556
0.861842
0.842075
0.825213
0.813853
0.799462
0.711983
0.62452
0.697064
0.753901
0.845665
0.863519
0.865014
0.870325
0.880419
0.894676
0.911502
0.929808
0.948518
0.966553
0.982361
0.993626
0.998815
0.999923
0.999999
1
1
1
1
1
1
0.999999
0.999911
0.998675
0.993032
0.980971
0.964134
0.944829
0.924404
0.903521
0.882556
0.861842
0.842075
0.825213
0.813853
0.799462
0.711983
0.62452
0.612618
0.737378
0.834484
0.852632
0.859758
0.867121
0.878629
0.893703
0.911037
0.929544
0.948309
0.966356
0.982199
0.993532
0.998787
0.999921
0.999999
1
1
1
1
1
1
0.999999
0.999911
0.998675
0.993032
0.980971
0.964134
0.944829
0.924404
0.903521
0.882556
0.861842
0.842075
0.825213
0.813853
0.799462
0.711983
0.62452
0.608722
0.739085
0.829267
0.845847
0.854211
0.86353
0.876536
0.892541
0.910364
0.929084
0.947935
0.966045
0.981975
0.993415
0.998755
0.999918
0.999999
1
1
1
1
1
1
0.999999
0.999911
0.998675
0.993032
0.980971
0.964134
0.944829
0.924404
0.903521
0.882556
0.861842
0.842075
0.825213
0.813853
0.799462
0.711983
0.62452
0.614928
0.734575
0.82355
0.840017
0.848936
0.859991
0.874304
0.891124
0.909401
0.928364
0.94737
0.965611
0.981685
0.993276
0.998711
0.999903
0.999987
0.999988
0.999988
0.999988
0.999988
0.999988
0.999988
0.999987
0.9999
0.998664
0.993021
0.98096
0.964124
0.94482
0.924397
0.903515
0.882551
0.861839
0.842072
0.825211
0.813851
0.799461
0.711982
0.62452
0.62475
0.728032
0.818206
0.834872
0.843969
0.856066
0.871469
0.88907
0.907846
0.927149
0.946419
0.964873
0.981108
0.992823
0.998341
0.999556
0.999643
0.999644
0.999644
0.999644
0.999644
0.999644
0.999644
0.999643
0.999555
0.99832
0.992682
0.980631
0.963813
0.944533
0.924139
0.903291
0.882362
0.861683
0.841948
0.825113
0.813775
0.799406
0.711953
0.624517
0.63126
0.722216
0.812729
0.828592
0.837775
0.850928
0.867564
0.88583
0.904838
0.924183
0.943456
0.961954
0.978273
0.990054
0.995598
0.99682
0.996907
0.996908
0.996908
0.996908
0.996908
0.996908
0.996908
0.996907
0.99682
0.995591
0.989981
0.977994
0.961275
0.94213
0.921899
0.901238
0.880512
0.860044
0.84052
0.823877
0.812717
0.798555
0.711396
0.624396
0.630738
0.716036
0.806289
0.820973
0.829785
0.843047
0.859654
0.877884
0.896862
0.916162
0.935364
0.95378
0.970024
0.981745
0.98725
0.988459
0.988544
0.988545
0.988545
0.988545
0.988545
0.988545
0.988545
0.988544
0.988459
0.987251
0.98172
0.969886
0.953389
0.934521
0.914617
0.894326
0.874008
0.853978
0.83491
0.818693
0.807951
0.79439
0.708212
0.623108
0.626693
0.707537
0.795424
0.807511
0.815653
0.829176
0.846093
0.864429
0.88343
0.902713
0.921843
0.940127
0.956205
0.967765
0.973159
0.974331
0.974413
0.974414
0.974414
0.974414
0.974414
0.974414
0.974414
0.974413
0.974332
0.973162
0.967766
0.956164
0.93996
0.921427
0.901893
0.882001
0.862112
0.842538
0.823948
0.808175
0.797797
0.784859
0.700392
0.618072
0.615601
0.694065
0.777632
0.789124
0.7979
0.81203
0.829342
0.847877
0.866918
0.886132
0.905129
0.923225
0.939064
0.950373
0.95559
0.956703
0.956779
0.95678
0.95678
0.95678
0.95678
0.95678
0.95678
0.956779
0.956703
0.955592
0.95038
0.939066
0.923187
0.904991
0.885803
0.866266
0.846739
0.827536
0.809318
0.793865
0.783663
0.771053
0.688672
0.608104
0.599369
0.678332
0.758376
0.770033
0.779492
0.794065
0.811531
0.830108
0.849117
0.868208
0.887007
0.904848
0.920384
0.931373
0.936359
0.937397
0.937465
0.937466
0.937466
0.937466
0.937466
0.937466
0.937466
0.937465
0.937397
0.936361
0.931379
0.920397
0.904862
0.887
0.868135
0.848916
0.8297
0.81081
0.792875
0.777639
0.767515
0.755225
0.674942
0.594741
0.58251
0.662365
0.739787
0.751413
0.761117
0.77597
0.793477
0.812004
0.830876
0.849784
0.868337
0.88588
0.901067
0.911684
0.9164
0.917349
0.917408
0.917409
0.917409
0.917409
0.917409
0.917409
0.917409
0.917408
0.917349
0.9164
0.911687
0.901078
0.885904
0.868371
0.849817
0.830892
0.81197
0.793337
0.775654
0.760552
0.750538
0.738502
0.660657
0.580236
0.565836
0.647218
0.721311
0.733388
0.74316
0.758036
0.775562
0.793908
0.812605
0.831261
0.849539
0.866759
0.881567
0.891773
0.896186
0.897037
0.897087
0.897088
0.897088
0.897088
0.897088
0.897088
0.897088
0.897087
0.897037
0.896186
0.891774
0.881572
0.866775
0.849571
0.831314
0.81268
0.793998
0.775657
0.758115
0.74321
0.733321
0.721045
0.646715
0.56497
0.551333
0.632856
0.70315
0.715891
0.725657
0.740535
0.757793
0.776055
0.794471
0.812885
0.830864
0.847753
0.862165
0.871927
0.876012
0.87676
0.876802
0.876802
0.876802
0.876802
0.876802
0.876802
0.876802
0.876802
0.87676
0.876012
0.871927
0.862167
0.84776
0.830883
0.812922
0.794532
0.776145
0.757916
0.740692
0.725839
0.716051
0.70325
0.632854
0.551111
0.536472
0.619617
0.685674
0.698844
0.708826
0.723359
0.740581
0.758447
0.776735
0.794857
0.812561
0.829114
0.843115
0.852407
0.856147
0.856792
0.856824
0.856825
0.856825
0.856825
0.856825
0.856825
0.856825
0.856824
0.856792
0.856147
0.852407
0.843115
0.829116
0.812568
0.794874
0.776767
0.7585
0.740661
0.723469
0.708964
0.698995
0.685825
0.619729
0.536458
0.524099
0.606627
0.669108
0.682729
0.69283
0.707329
0.724041
0.741834
0.759798
0.777744
0.795184
0.811426
0.825017
0.833827
0.837217
0.837763
0.837788
0.837788
0.837788
0.837788
0.837788
0.837788
0.837788
0.837788
0.837763
0.837217
0.833827
0.825016
0.811426
0.795186
0.777749
0.759808
0.741854
0.724074
0.707376
0.692896
0.68281
0.669198
0.606709
0.524116
0.512169
0.595856
0.654362
0.668291
0.678831
0.693339
0.710043
0.727518
0.745395
0.763139
0.780418
0.796425
0.809679
0.818057
0.821126
0.821584
0.821603
0.821603
0.821603
0.821603
0.821603
0.821603
0.821603
0.821603
0.821584
0.821126
0.818057
0.809679
0.796424
0.780417
0.763138
0.745396
0.727522
0.71005
0.693352
0.678851
0.668319
0.654396
0.595888
0.512181
0.508048
0.588246
0.643876
0.657675
0.668799
0.683699
0.700603
0.718287
0.736127
0.753766
0.77093
0.78684
0.799811
0.807712
0.810461
0.810842
0.810856
0.810856
0.810856
0.810856
0.810856
0.810856
0.810856
0.810856
0.810842
0.810461
0.807712
0.799811
0.78684
0.770929
0.753765
0.736126
0.718286
0.700602
0.683698
0.6688
0.65768
0.643883
0.588255
0.508053
0.503181
0.578769
0.631434
0.644855
0.655939
0.671112
0.688468
0.706548
0.724931
0.742882
0.759971
0.775466
0.787669
0.79481
0.797145
0.79744
0.79745
0.79745
0.79745
0.79745
0.79745
0.79745
0.79745
0.79745
0.79744
0.797145
0.79481
0.787669
0.775466
0.75997
0.742881
0.72493
0.706547
0.688466
0.67111
0.655937
0.644854
0.631435
0.57877
0.503182
0.46331
0.529997
0.580841
0.591011
0.599203
0.610338
0.623999
0.637683
0.651978
0.666272
0.680662
0.694215
0.705033
0.711011
0.712735
0.71292
0.712925
0.712925
0.712925
0.712925
0.712925
0.712925
0.712925
0.712925
0.71292
0.712735
0.711011
0.705033
0.694215
0.680662
0.666272
0.651977
0.637682
0.623997
0.610336
0.5992
0.591008
0.580839
0.529995
0.46331
0.427008
0.460185
0.502089
0.507537
0.511919
0.52419
0.53687
0.552054
0.566394
0.581928
0.596503
0.609059
0.617226
0.620416
0.620963
0.620993
0.620994
0.620994
0.620994
0.620994
0.620994
0.620994
0.620994
0.620994
0.620993
0.620963
0.620416
0.617226
0.609059
0.596503
0.581928
0.566394
0.552054
0.53687
0.52419
0.511918
0.507537
0.502089
0.460185
0.427008
0.427008
0.460185
0.502089
0.507537
0.511919
0.52419
0.53687
0.552054
0.566394
0.581928
0.596503
0.609059
0.617226
0.620416
0.620963
0.620993
0.620994
0.620994
0.620994
0.620994
0.620994
0.620994
0.620994
0.620994
0.620993
0.620963
0.620416
0.617226
0.609059
0.596503
0.581928
0.566394
0.552054
0.53687
0.52419
0.511918
0.507537
0.502089
0.460185
0.427008
0.46331
0.529997
0.580841
0.591011
0.599203
0.610338
0.623999
0.637683
0.651978
0.666272
0.680662
0.694215
0.705033
0.711011
0.712735
0.71292
0.712925
0.712925
0.712925
0.712925
0.712925
0.712925
0.712925
0.712925
0.71292
0.712735
0.711011
0.705033
0.694215
0.680662
0.666272
0.651977
0.637682
0.623997
0.610336
0.5992
0.591008
0.580839
0.529995
0.46331
0.503181
0.578769
0.631434
0.644855
0.655939
0.671112
0.688468
0.706548
0.724931
0.742882
0.759971
0.775466
0.787669
0.79481
0.797145
0.79744
0.79745
0.79745
0.79745
0.79745
0.79745
0.79745
0.79745
0.79745
0.79744
0.797145
0.79481
0.787669
0.775466
0.75997
0.742881
0.72493
0.706547
0.688466
0.67111
0.655937
0.644854
0.631435
0.57877
0.503182
0.508048
0.588246
0.643876
0.657675
0.668799
0.683699
0.700603
0.718287
0.736127
0.753766
0.77093
0.78684
0.799811
0.807712
0.810461
0.810842
0.810856
0.810856
0.810856
0.810856
0.810856
0.810856
0.810856
0.810856
0.810842
0.810461
0.807712
0.799811
0.78684
0.770929
0.753765
0.736126
0.718286
0.700602
0.683698
0.6688
0.65768
0.643883
0.588255
0.508053
0.512169
0.595856
0.654362
0.668291
0.678831
0.693339
0.710043
0.727518
0.745395
0.763139
0.780418
0.796425
0.809679
0.818057
0.821126
0.821584
0.821603
0.821603
0.821603
0.821603
0.821603
0.821603
0.821603
0.821603
0.821584
0.821126
0.818057
0.809679
0.796424
0.780417
0.763138
0.745396
0.727522
0.71005
0.693352
0.678851
0.668319
0.654396
0.595888
0.512181
0.524099
0.606627
0.669108
0.682729
0.69283
0.707329
0.724041
0.741834
0.759798
0.777744
0.795184
0.811426
0.825017
0.833827
0.837217
0.837763
0.837788
0.837788
0.837788
0.837788
0.837788
0.837788
0.837788
0.837788
0.837763
0.837217
0.833827
0.825016
0.811426
0.795186
0.777749
0.759808
0.741854
0.724074
0.707376
0.692896
0.68281
0.669198
0.606709
0.524116
0.536472
0.619617
0.685674
0.698844
0.708826
0.723359
0.740581
0.758447
0.776735
0.794857
0.812561
0.829114
0.843115
0.852407
0.856147
0.856792
0.856824
0.856825
0.856825
0.856825
0.856825
0.856825
0.856825
0.856824
0.856792
0.856147
0.852407
0.843115
0.829116
0.812568
0.794874
0.776767
0.7585
0.740661
0.723469
0.708964
0.698995
0.685825
0.619729
0.536458
0.551333
0.632856
0.70315
0.715891
0.725657
0.740535
0.757793
0.776055
0.794471
0.812885
0.830864
0.847753
0.862165
0.871927
0.876012
0.87676
0.876802
0.876802
0.876802
0.876802
0.876802
0.876802
0.876802
0.876802
0.87676
0.876012
0.871927
0.862167
0.84776
0.830883
0.812922
0.794532
0.776145
0.757916
0.740692
0.725839
0.716051
0.70325
0.632854
0.551111
0.565836
0.647218
0.721311
0.733388
0.74316
0.758036
0.775562
0.793908
0.812605
0.831261
0.849539
0.866759
0.881567
0.891773
0.896186
0.897037
0.897087
0.897088
0.897088
0.897088
0.897088
0.897088
0.897088
0.897087
0.897037
0.896186
0.891774
0.881572
0.866775
0.849571
0.831314
0.81268
0.793998
0.775657
0.758115
0.74321
0.733321
0.721045
0.646715
0.56497
0.58251
0.662365
0.739787
0.751413
0.761117
0.77597
0.793477
0.812004
0.830876
0.849784
0.868337
0.88588
0.901067
0.911684
0.9164
0.917349
0.917408
0.917409
0.917409
0.917409
0.917409
0.917409
0.917409
0.917408
0.917349
0.9164
0.911687
0.901078
0.885904
0.868371
0.849817
0.830892
0.81197
0.793337
0.775654
0.760552
0.750538
0.738502
0.660657
0.580236
0.599369
0.678332
0.758376
0.770033
0.779492
0.794065
0.811531
0.830108
0.849117
0.868208
0.887007
0.904848
0.920384
0.931373
0.936359
0.937397
0.937465
0.937466
0.937466
0.937466
0.937466
0.937466
0.937466
0.937465
0.937397
0.936361
0.931379
0.920397
0.904862
0.887
0.868135
0.848916
0.8297
0.81081
0.792875
0.777639
0.767515
0.755225
0.674942
0.594741
0.615601
0.694065
0.777632
0.789124
0.7979
0.81203
0.829342
0.847877
0.866918
0.886132
0.905129
0.923225
0.939064
0.950373
0.95559
0.956703
0.956779
0.95678
0.95678
0.95678
0.95678
0.95678
0.95678
0.956779
0.956703
0.955592
0.95038
0.939066
0.923187
0.904991
0.885803
0.866266
0.846739
0.827536
0.809318
0.793865
0.783663
0.771053
0.688672
0.608104
0.626693
0.707537
0.795424
0.807511
0.815653
0.829176
0.846093
0.864429
0.88343
0.902713
0.921843
0.940127
0.956205
0.967765
0.973159
0.974331
0.974413
0.974414
0.974414
0.974414
0.974414
0.974414
0.974414
0.974413
0.974332
0.973162
0.967766
0.956164
0.93996
0.921427
0.901893
0.882001
0.862112
0.842538
0.823948
0.808175
0.797797
0.784859
0.700392
0.618072
0.630738
0.716036
0.806289
0.820973
0.829785
0.843047
0.859654
0.877884
0.896862
0.916162
0.935364
0.95378
0.970024
0.981745
0.98725
0.988459
0.988544
0.988545
0.988545
0.988545
0.988545
0.988545
0.988545
0.988544
0.988459
0.987251
0.98172
0.969886
0.953389
0.934521
0.914617
0.894326
0.874008
0.853978
0.83491
0.818693
0.807951
0.79439
0.708212
0.623108
0.63126
0.722216
0.812729
0.828592
0.837775
0.850928
0.867564
0.88583
0.904838
0.924183
0.943456
0.961954
0.978273
0.990054
0.995598
0.99682
0.996907
0.996908
0.996908
0.996908
0.996908
0.996908
0.996908
0.996907
0.99682
0.995591
0.989981
0.977994
0.961275
0.94213
0.921899
0.901238
0.880512
0.860044
0.84052
0.823877
0.812717
0.798555
0.711396
0.624396
0.62475
0.728032
0.818206
0.834872
0.843969
0.856066
0.871469
0.88907
0.907846
0.927149
0.946419
0.964873
0.981108
0.992823
0.998341
0.999556
0.999643
0.999644
0.999644
0.999644
0.999644
0.999644
0.999644
0.999643
0.999555
0.99832
0.992682
0.980631
0.963813
0.944533
0.924139
0.903291
0.882362
0.861683
0.841948
0.825113
0.813775
0.799406
0.711953
0.624517
0.614928
0.734575
0.82355
0.840017
0.848936
0.859991
0.874304
0.891124
0.909401
0.928364
0.94737
0.965611
0.981685
0.993276
0.998711
0.999903
0.999987
0.999988
0.999988
0.999988
0.999988
0.999988
0.999988
0.999987
0.9999
0.998664
0.993021
0.98096
0.964124
0.94482
0.924397
0.903515
0.882551
0.861839
0.842072
0.825211
0.813851
0.799461
0.711982
0.62452
0.608722
0.739085
0.829267
0.845847
0.854211
0.86353
0.876536
0.892541
0.910364
0.929084
0.947935
0.966045
0.981975
0.993415
0.998755
0.999918
0.999999
1
1
1
1
1
1
0.999999
0.999911
0.998675
0.993032
0.980971
0.964134
0.944829
0.924404
0.903521
0.882556
0.861842
0.842075
0.825213
0.813853
0.799462
0.711983
0.62452
0.612618
0.737378
0.834484
0.852632
0.859758
0.867121
0.878629
0.893703
0.911037
0.929544
0.948309
0.966356
0.982199
0.993532
0.998787
0.999921
0.999999
1
1
1
1
1
1
0.999999
0.999911
0.998675
0.993032
0.980971
0.964134
0.944829
0.924404
0.903521
0.882556
0.861842
0.842075
0.825213
0.813853
0.799462
0.711983
0.62452
0.697064
0.753901
0.845665
0.863519
0.865014
0.870325
0.880419
0.894676
0.911502
0.929808
0.948518
0.966553
0.982361
0.993626
0.998815
0.999923
0.999999
1
1
1
1
1
1
0.999999
0.999911
0.998675
0.993032
0.980971
0.964134
0.944829
0.924404
0.903521
0.882556
0.861842
0.842075
0.825213
0.813853
0.799462
0.711983
0.62452
)
;
boundaryField
{
inlet
{
type fixedValue;
value uniform 1;
}
outlet
{
type zeroGradient;
}
obstacle
{
type zeroGradient;
}
empty
{
type empty;
}
}
// ************************************************************************* //
|
|
4d5e28a8b48840093ab46c2e7c1e2487d2282b9e
|
b55127be27f7de852cbbcce02d310289c6bf5a1f
|
/Volume.h
|
b8132b4fc2077f30245a2c416489ffd16906b138
|
[] |
no_license
|
thalesmonteiro/ProjetoLP1
|
366849ad934c03b5fb2ab2a655d8f7f33d176a12
|
d5e6c4915572c7861dc4cbc682dd355499b1cdac
|
refs/heads/master
| 2021-01-23T16:18:18.158765
| 2017-06-04T04:53:10
| 2017-06-04T04:53:10
| 93,290,904
| 0
| 0
| null | null | null | null |
UTF-8
|
C++
| false
| false
| 210
|
h
|
Volume.h
|
#ifndef Volume_h
#define Volume_h
#include <string>
class Volume {
private:
int volume;
public:
void setVolume(int);
int getVolume();
void AumentarVolume();
void BaixarVolume();
};
#endif
|
a7db24739547ace8167f8f06283b2bf195f758f0
|
f53200a6c5b375b0cbbe6f1e4f33bb55376ca0b0
|
/cooling.cxx
|
3907e3569ce7b4a14032fd3380cd8d858a0d23e3
|
[] |
no_license
|
agacz/beta-delayed-neutrons
|
665db62b0c6e656dd3550112e50887875c236e41
|
3bcbfbc2c774db5c23db6e0da9eb7c22df46b9e8
|
refs/heads/master
| 2021-01-17T15:05:29.165049
| 2015-06-08T17:13:11
| 2015-06-08T17:13:11
| null | 0
| 0
| null | null | null | null |
UTF-8
|
C++
| false
| false
| 10,479
|
cxx
|
cooling.cxx
|
/*
2012-11-24 Shane Caldwell
For 135-Sb data, make trees for different times after capture.
*/
#include <unistd.h>
//#include "stat.h"
#include "stdio.h"
#include "TH1.h"
#include "TH2.h"
#include "TFile.h"
#include "TTree.h"
#include "TLeaf.h"
#include "bdn.h"
void cooling (const char*);
int main (int argc, char *argv[]) {
while (*++argv) {
cooling(argv[0]);
}
return 0;
}
void cooling (const char *filename) {
printf("\ncooling started.\n%s\n",filename);
char *dir = "cooling"; // results will be placed in this subdirectory of the root file
char *dir_cycle = "cooling;1"; // results will be placed in this subdirectory of the root file
/*****************************************************************/
/*** Code to include source code as a string in the ROOT file: ***/
/*****************************************************************
FILE *fsrc = fopen("cooling.cxx", "r");
char *fbuf;
struct stat srcbuf;
stat("cooling.cxx", &srcbuf);
fbuf = new char [srcbuf.st_size+1];
fread(fbuf, sizeof(char), srcbuf.st_size, fsrc);
fbuf[srcbuf.st_size] = '\0';
TString fstr(fbuf);
/*****************************************************************
printf(fbuf);
*/
TFile *f = new TFile(filename, "UPDATE");
TTree *tree = (TTree*)f->Get("bdn_Tree");
//TTree *tree_100ms = new TTree("tree_100ms", "data with 0 ms < s_ms_since_capt < 100ms");
//TTree *tree_200ms = new TTree("tree_200ms", "data with 100ms < s_ms_since_capt < 200ms");
//TTree *tree_300ms = new TTree("tree_300ms", "data with 200ms < s_ms_since_capt < 300ms");
TTree *tree_100ms = tree->CloneTree(0);
TTree *tree_200ms = tree->CloneTree(0);
TTree *tree_300ms = tree->CloneTree(0);
const Double_t TOFMin = -0.1; // us
const Double_t TOFMax = 22.5; // us
const Int_t TOFBins = 22600; // one bin per ns
TH1I *h_tof_100ms = new TH1I("h_tof_100ms", "TOF in us for t < 100ms after capture, All combos" ,TOFBins,TOFMin,TOFMax);
TH1I *h_tof_100ms_LT = new TH1I("h_tof_100ms_LT", "TOF in us for t < 100ms after capture, Left-Top" ,TOFBins,TOFMin,TOFMax);
TH1I *h_tof_100ms_LR = new TH1I("h_tof_100ms_LR", "TOF in us for t < 100ms after capture, Left-Right" ,TOFBins,TOFMin,TOFMax);
TH1I *h_tof_100ms_BT = new TH1I("h_tof_100ms_BT", "TOF in us for t < 100ms after capture, Bottom-Top" ,TOFBins,TOFMin,TOFMax);
TH1I *h_tof_100ms_BR = new TH1I("h_tof_100ms_BR", "TOF in us for t < 100ms after capture, Bottom-Right" ,TOFBins,TOFMin,TOFMax);
TH1I *h_tof_200ms = new TH1I("h_tof_200ms", "TOF in us for 100ms < t < 200ms after capture, All combos" ,TOFBins,TOFMin,TOFMax);
TH1I *h_tof_200ms_LT = new TH1I("h_tof_200ms_LT", "TOF in us for 100ms < t < 200ms after capture, Left-Top" ,TOFBins,TOFMin,TOFMax);
TH1I *h_tof_200ms_LR = new TH1I("h_tof_200ms_LR", "TOF in us for 100ms < t < 200ms after capture, Left-Right" ,TOFBins,TOFMin,TOFMax);
TH1I *h_tof_200ms_BT = new TH1I("h_tof_200ms_BT", "TOF in us for 100ms < t < 200ms after capture, Bottom-Top" ,TOFBins,TOFMin,TOFMax);
TH1I *h_tof_200ms_BR = new TH1I("h_tof_200ms_BR", "TOF in us for 100ms < t < 200ms after capture, Bottom-Right" ,TOFBins,TOFMin,TOFMax);
TH1I *h_tof_300ms = new TH1I("h_tof_300ms", "TOF in us for 200ms < t < 300ms after capture, All combos" ,TOFBins,TOFMin,TOFMax);
TH1I *h_tof_300ms_LT = new TH1I("h_tof_300ms_LT", "TOF in us for 200ms < t < 300ms after capture, Left-Top" ,TOFBins,TOFMin,TOFMax);
TH1I *h_tof_300ms_LR = new TH1I("h_tof_300ms_LR", "TOF in us for 200ms < t < 300ms after capture, Left-Right" ,TOFBins,TOFMin,TOFMax);
TH1I *h_tof_300ms_BT = new TH1I("h_tof_300ms_BT", "TOF in us for 200ms < t < 300ms after capture, Bottom-Top" ,TOFBins,TOFMin,TOFMax);
TH1I *h_tof_300ms_BR = new TH1I("h_tof_300ms_BR", "TOF in us for 200ms < t < 300ms after capture, Bottom-Right" ,TOFBins,TOFMin,TOFMax);
// Loop variables:
Long64_t i;
Long64_t nEntries = tree->GetEntries();
Int_t s_capt_state, s_ms_since_capt;
Int_t t_B_dEa, t_B_dEb;
Int_t t_L_dEa, t_L_dEb;
Int_t t_R_mcp;
Int_t t_T_mcp;
Int_t a_R_mcpA, a_R_mcpB, a_R_mcpC, a_R_mcpD;
Int_t a_T_mcpA, a_T_mcpB, a_T_mcpC, a_T_mcpD;
Double_t tof, dE, A, B, C, D;
for (i=0; i<nEntries; i++) {
tree->GetEntry(i);
s_ms_since_capt = (Int_t)tree->GetLeaf("s_ms_since_capt") -> GetValue();
s_capt_state = (Int_t)tree->GetLeaf("s_capt_state") -> GetValue();
t_B_dEa = (Int_t)tree->GetLeaf("t_B_dEa")->GetValue();
t_B_dEb = (Int_t)tree->GetLeaf("t_B_dEb")->GetValue();
t_L_dEa = (Int_t)tree->GetLeaf("t_L_dEa")->GetValue();
t_L_dEb = (Int_t)tree->GetLeaf("t_L_dEb")->GetValue();
t_R_mcp = (Int_t)tree->GetLeaf("t_R_mcp")->GetValue();
t_T_mcp = (Int_t)tree->GetLeaf("t_T_mcp")->GetValue();
a_R_mcpA = (Int_t)tree->GetLeaf("a_R_mcpA")->GetValue();
a_R_mcpB = (Int_t)tree->GetLeaf("a_R_mcpB")->GetValue();
a_R_mcpC = (Int_t)tree->GetLeaf("a_R_mcpC")->GetValue();
a_R_mcpD = (Int_t)tree->GetLeaf("a_R_mcpD")->GetValue();
a_T_mcpA = (Int_t)tree->GetLeaf("a_T_mcpA")->GetValue();
a_T_mcpB = (Int_t)tree->GetLeaf("a_T_mcpB")->GetValue();
a_T_mcpC = (Int_t)tree->GetLeaf("a_T_mcpC")->GetValue();
a_T_mcpD = (Int_t)tree->GetLeaf("a_T_mcpD")->GetValue();
if (s_capt_state==0 && s_ms_since_capt <= 100) {
tree_100ms->Fill();
// Left-Top
if (-100<t_L_dEa && -100<t_L_dEb && -100<t_T_mcp && t_L_dEa<0 && t_L_dEb<0 && a_T_mcpA>100 && a_T_mcpB>100 && a_T_mcpC>100 && a_T_mcpD>100) {
tof = 0.001*((double)t_T_mcp - (t_L_dEa + t_L_dEb)/2.0); // convert ns to us
h_tof_100ms_LT ->Fill(tof);
h_tof_100ms ->Fill(tof);
}
// Left-Right
if (-100<t_L_dEa && -100<t_L_dEb && -100<t_R_mcp && t_L_dEa<0 && t_L_dEb<0 && a_R_mcpA>100 && a_R_mcpB>100 && a_R_mcpC>100 && a_R_mcpD>100) {
tof = 0.001*((double)t_R_mcp - (t_L_dEa + t_L_dEb)/2.0); // convert ns to us
h_tof_100ms_LR ->Fill(tof);
h_tof_100ms ->Fill(tof);
}
// Bottom-Top
if (-100<t_B_dEa && -100<t_B_dEb && -100<t_T_mcp && t_B_dEa<0 && t_B_dEb<0 && a_T_mcpA>100 && a_T_mcpB>100 && a_T_mcpC>100 && a_T_mcpD>100) {
tof = 0.001*((double)t_T_mcp - (t_B_dEa + t_B_dEb)/2.0); // convert ns to us
h_tof_100ms_BT ->Fill(tof);
h_tof_100ms ->Fill(tof);
}
// Bottom-Right
if (-100<t_B_dEa && -100<t_B_dEb && -100<t_R_mcp && t_B_dEa<0 && t_B_dEb<0 && a_R_mcpA>100 && a_R_mcpB>100 && a_R_mcpC>100 && a_R_mcpD>100) {
tof = 0.001*((double)t_R_mcp - (t_B_dEa + t_B_dEb)/2.0); // convert ns to us
h_tof_100ms_BR ->Fill(tof);
h_tof_100ms ->Fill(tof);
}
}
if (s_capt_state==0 && 100 < s_ms_since_capt && s_ms_since_capt <= 200) {
tree_200ms->Fill();
// Left-Top
if (-100<t_L_dEa && -100<t_L_dEb && -100<t_T_mcp && t_L_dEa<0 && t_L_dEb<0 && a_T_mcpA>100 && a_T_mcpB>100 && a_T_mcpC>100 && a_T_mcpD>100) {
tof = 0.001*((double)t_T_mcp - (t_L_dEa + t_L_dEb)/2.0); // convert ns to us
h_tof_200ms_LT ->Fill(tof);
h_tof_200ms ->Fill(tof);
}
// Left-Right
if (-100<t_L_dEa && -100<t_L_dEb && -100<t_R_mcp && t_L_dEa<0 && t_L_dEb<0 && a_R_mcpA>100 && a_R_mcpB>100 && a_R_mcpC>100 && a_R_mcpD>100) {
tof = 0.001*((double)t_R_mcp - (t_L_dEa + t_L_dEb)/2.0); // convert ns to us
h_tof_200ms_LR ->Fill(tof);
h_tof_200ms ->Fill(tof);
}
// Bottom-Top
if (-100<t_B_dEa && -100<t_B_dEb && -100<t_T_mcp && t_B_dEa<0 && t_B_dEb<0 && a_T_mcpA>100 && a_T_mcpB>100 && a_T_mcpC>100 && a_T_mcpD>100) {
tof = 0.001*((double)t_T_mcp - (t_B_dEa + t_B_dEb)/2.0); // convert ns to us
h_tof_200ms_BT ->Fill(tof);
h_tof_200ms ->Fill(tof);
}
// Bottom-Right
if (-100<t_B_dEa && -100<t_B_dEb && -100<t_R_mcp && t_B_dEa<0 && t_B_dEb<0 && a_R_mcpA>100 && a_R_mcpB>100 && a_R_mcpC>100 && a_R_mcpD>100) {
tof = 0.001*((double)t_R_mcp - (t_B_dEa + t_B_dEb)/2.0); // convert ns to us
h_tof_200ms_BR ->Fill(tof);
h_tof_200ms ->Fill(tof);
}
}
if (s_capt_state==0 && 200 < s_ms_since_capt && s_ms_since_capt <= 300) {
tree_300ms->Fill();
// Left-Top
if (-100<t_L_dEa && -100<t_L_dEb && -100<t_T_mcp && t_L_dEa<0 && t_L_dEb<0 && a_T_mcpA>100 && a_T_mcpB>100 && a_T_mcpC>100 && a_T_mcpD>100) {
tof = 0.001*((double)t_T_mcp - (t_L_dEa + t_L_dEb)/2.0); // convert ns to us
h_tof_300ms_LT ->Fill(tof);
h_tof_300ms ->Fill(tof);
}
// Left-Right
if (-100<t_L_dEa && -100<t_L_dEb && -100<t_R_mcp && t_L_dEa<0 && t_L_dEb<0 && a_R_mcpA>100 && a_R_mcpB>100 && a_R_mcpC>100 && a_R_mcpD>100) {
tof = 0.001*((double)t_R_mcp - (t_L_dEa + t_L_dEb)/2.0); // convert ns to us
h_tof_300ms_LR ->Fill(tof);
h_tof_300ms ->Fill(tof);
}
// Bottom-Top
if (-100<t_B_dEa && -100<t_B_dEb && -100<t_T_mcp && t_B_dEa<0 && t_B_dEb<0 && a_T_mcpA>100 && a_T_mcpB>100 && a_T_mcpC>100 && a_T_mcpD>100) {
tof = 0.001*((double)t_T_mcp - (t_B_dEa + t_B_dEb)/2.0); // convert ns to us
h_tof_300ms_BT ->Fill(tof);
h_tof_300ms ->Fill(tof);
}
// Bottom-Right
if (-100<t_B_dEa && -100<t_B_dEb && -100<t_R_mcp && t_B_dEa<0 && t_B_dEb<0 && a_R_mcpA>100 && a_R_mcpB>100 && a_R_mcpC>100 && a_R_mcpD>100) {
tof = 0.001*((double)t_R_mcp - (t_B_dEa + t_B_dEb)/2.0); // convert ns to us
h_tof_300ms_BR ->Fill(tof);
h_tof_300ms ->Fill(tof);
}
}
} // event loop
if (f->GetDirectory(dir)) {
f->cd();
printf("\n\"%s:/%s\" exists... replacing it.", filename, dir);
f->Delete(dir_cycle);
f->mkdir(dir);
}
else {
printf("\n\"%s:/%s\" does not exist... creating it.", filename, dir);
f->cd();
f->mkdir(dir);
}
f->cd(dir);
// gDirectory->WriteTObject(fstr);
gDirectory->WriteTObject(tree_100ms);
gDirectory->WriteTObject(tree_200ms);
gDirectory->WriteTObject(tree_300ms);
gDirectory->WriteTObject(h_tof_100ms);
gDirectory->WriteTObject(h_tof_100ms_LT);
gDirectory->WriteTObject(h_tof_100ms_LR);
gDirectory->WriteTObject(h_tof_100ms_BT);
gDirectory->WriteTObject(h_tof_100ms_BR);
gDirectory->WriteTObject(h_tof_200ms);
gDirectory->WriteTObject(h_tof_200ms_LT);
gDirectory->WriteTObject(h_tof_200ms_LR);
gDirectory->WriteTObject(h_tof_200ms_BT);
gDirectory->WriteTObject(h_tof_200ms_BR);
gDirectory->WriteTObject(h_tof_300ms);
gDirectory->WriteTObject(h_tof_300ms_LT);
gDirectory->WriteTObject(h_tof_300ms_LR);
gDirectory->WriteTObject(h_tof_300ms_BT);
gDirectory->WriteTObject(h_tof_300ms_BR);
f->Close();
printf("\ncooling done.\n\n");
}
|
0436910aa2ca94c4a46bb78b652f3c1783300993
|
91a882547e393d4c4946a6c2c99186b5f72122dd
|
/Source/XPSP1/NT/ds/security/passport/include/passportcookiefunctions.h
|
40dd6b52a4a815d284b8ac8020ebd9c727fe82b3
|
[] |
no_license
|
IAmAnubhavSaini/cryptoAlgorithm-nt5src
|
94f9b46f101b983954ac6e453d0cf8d02aa76fc7
|
d9e1cdeec650b9d6d3ce63f9f0abe50dabfaf9e2
|
refs/heads/master
| 2023-09-02T10:14:14.795579
| 2021-11-20T13:47:06
| 2021-11-20T13:47:06
| null | 0
| 0
| null | null | null | null |
UTF-8
|
C++
| false
| false
| 1,211
|
h
|
passportcookiefunctions.h
|
//-----------------------------------------------------------------------------
//
// @doc
//
// @module PassportCookieFunctions.h | Passport specific cookie
// routines.
//
// Author: Darren Anderson
//
// Date: 5/19/00
//
// Copyright <cp> 1999-2000 Microsoft Corporation. All Rights Reserved.
//
//-----------------------------------------------------------------------------
#pragma once
class CTicket;
class CProfile;
class CPassportHandlerBase;
void SetIdInVisitedSitesCookie(ULONG ulSiteId);
void SetBrowserTestCookie(void);
bool ReadBrowserTestCookie(CPassportHandlerBase *pHandler=NULL);
void SetLastDBWriteCookie();
long ReadLastDBWriteCookie();
// @func void | GetProfileFromCookie | Get the profile from cookie
// @rdesc None
void GetProfileFromCookie(CProfile &theProfile); // @parm [out] the profile contained in the cookie
// @func void | GetTicketFromCookie | Get the ticket from cookie
// @rdesc None
void GetTicketFromCookie(CTicket &theTicket); // @parm [out] the ticket contained in the cookie
BOOL GetHackCookie(ATL::CHttpRequest* req, LPCSTR name, CStringA& cookie); // HACK CODE -- to deal with the UP emulator's cooke problem
|
48049e7b260e032f202e17c45d6521afd79bbce5
|
ecb2595d223f2100752cdcb7a31a459ffbe5b3d6
|
/CardLineage/Music.cpp
|
ed44d849a6ad03a44bb0f58c106ebd8338670aaf
|
[] |
no_license
|
DeviSerene/CardLineage
|
5d1e2b6a63f4babc2d24f43e440494b5938636d1
|
9646f701c8ca17f344f12078272099be8ac66d2d
|
refs/heads/master
| 2020-03-30T21:41:20.307074
| 2018-10-09T15:53:25
| 2018-10-09T15:53:25
| 151,638,229
| 0
| 0
| null | null | null | null |
UTF-8
|
C++
| false
| false
| 512
|
cpp
|
Music.cpp
|
#include "Music.h"
Music::Music(std::string _name)
{
//Load music
m_name = _name;
m_music = (std::shared_ptr<Mix_Music>)Mix_LoadMUS(_name.c_str());
if (m_music == NULL)
{
printf("Failed to load music! SDL_mixer Error: %s\n", Mix_GetError());
}
}
Music::~Music()
{
Mix_FreeMusic(m_music.get());
m_music = NULL;
}
void Music::PlayMusic()
{
if (Mix_PlayingMusic() == 0)
{
//Play the music
Mix_PlayMusic(m_music.get(), -1);
}
else
{
Mix_HaltMusic();
Mix_PlayMusic(m_music.get(), -1);
}
}
|
52a0ddbae70033cacfeb2fd4110aaef6bbfdb0fa
|
2753608f87a1e8fa312feced7af20917ea9cc004
|
/Sorting/Counting Sort/CPP/counting_sort.cpp
|
d77307fe8654a5ecabcbcfd1d5944f1c6ee0b553
|
[
"MIT"
] |
permissive
|
VAR-solutions/Algorithms
|
76faed6515367b6f27638b910dbc07f340fae56f
|
4ad6773e9675ef35aa858ca3969be5ddf6e3daea
|
refs/heads/dev
| 2023-08-15T11:37:26.048316
| 2021-08-03T07:00:28
| 2021-08-03T07:00:28
| 151,157,582
| 794
| 1,249
|
MIT
| 2023-07-29T00:28:36
| 2018-10-01T20:50:24
|
C++
|
UTF-8
|
C++
| false
| false
| 548
|
cpp
|
counting_sort.cpp
|
#include<bits/stdc++.h>
using namespace std;
#define ll long long
int main(){
ll n;
cout<<"Enter size of array:\n";
cin>>n;
vector<ll> a(n,0);
cout<<"enter the array:\n";
for(int i=0;i<n;i++){
cin>>a[i];
}
//frequency array:
ll m = *max_element(a.begin(),a.end());
vector<ll> fre(m+1,0);
for(int i=0;i<n;i++){
fre[a[i]]++;
}
cout<<"The sorted array is:\n";
for(int i=0;i<m+1;i++){
for(int j=0;j<fre[i];j++){
cout<<i<<" ";
}
}
cout<<"\n";
}
|
d80034a5bdcc35c204ccbf5bcaa671941d71cca8
|
d64737d31ae9caba2820ea1048be3f9bce708b42
|
/cpp/least-number-of-unique-integers-after-k-removals.cpp
|
a7bd0640e66b6eb087311a8f7d95f2bdc81a794a
|
[] |
no_license
|
ldcduc/leetcode-training
|
2453ec13e69160bc29e8e516e19544c2b25bf945
|
40db37375372f14dd45d0a069c8b86fe36221f09
|
refs/heads/master
| 2023-08-05T01:46:52.993542
| 2021-09-18T16:47:54
| 2021-09-18T16:47:54
| 271,736,046
| 9
| 0
| null | null | null | null |
UTF-8
|
C++
| false
| false
| 1,227
|
cpp
|
least-number-of-unique-integers-after-k-removals.cpp
|
/* Problem url: https://leetcode.com/problems/least-number-of-unique-integers-after-k-removals
* Code by: ldcduc
* */
/* Begin of Solution */
class Solution {
public:
int findLeastNumOfUniqueInts(vector<int>& arr, int k) {
sort(arr.begin(), arr.end());
vector<pair<int, int>> tmp;
int prev, hasPrev = false, cnt = 0;
for (auto num : arr) {
if (hasPrev) {
if (prev == num) {
++ cnt;
} else {
tmp.push_back(make_pair(cnt, prev));
cnt = 1;
prev = num;
}
} else {
cnt = 1;
prev = num;
hasPrev = true;
}
}
tmp.push_back(make_pair(cnt, prev));
sort(tmp.begin(), tmp.end());
int result = 0;
for (int i = 0; i < tmp.size(); ++ i) {
int t = min(k, tmp[i].first);
k -= t;
tmp[i].first -= t;
if (k == 0) {
result += tmp[i].first > 0;
}
}
return result;
}
};
/* End of Solution */
/*
* Comment by ldcduc
* Suggested tags: array, sorting
*
* */
|
825f5dfae1af1944458c8900ca7bf76b367df4ab
|
d65af644a1e6cdad3b7d1e3766a394b1a0cb5cc0
|
/DesktopMicro 3.0/Polygons.cp
|
7bd201ba278123afab288cd2947d74b6f6bc44a8
|
[] |
no_license
|
jstanley70/dm_2_c_plus_plus
|
39bd56494372bd9e3734feee126eeea8d8f6b8db
|
e557c20db9c1620f9179289e3e3e233701a05e38
|
refs/heads/master
| 2021-01-01T18:17:12.001514
| 2014-06-22T18:30:42
| 2014-06-22T18:30:42
| null | 0
| 0
| null | null | null | null |
UTF-8
|
C++
| false
| false
| 3,864
|
cp
|
Polygons.cp
|
#include "Polygons.h"
void Test(void);
void Test(void)
{
Polyhedral a(0);
double t;
vector<double> v(1,2,3);
vector<double> v1(v);
t = a.length();
if( v1 || v){return;}
}
void Polyhedral::DetermineVertices(void)
{
BTree<vector> face1,face2,face3;
face1 = faces;
face2 = faces;
face3 = faces;
while(face1){
while(face2){
if(face1 == face2 || face1 || face2) continue; //if faces are equal or parallel (== is redundant)
while(face3){
if(face1 || face3)) continue;//faces parallel
if(face2 || face3) continue;//faces parallel
face->DetermineCorner(face1->me,face2->me);
face3++;
}
face2++;
}
face1++;
}
}
void Polyhedral::DetermineCorner(vector *face2,vector *face3)
{
double matrix[9],x[3],x1,x2,x3,L;
long n,i;
long sizeOf;
long maxAllowedItems;
n = 0;
matrix = face1;
&matrix[3] = face2;
&matrix[6] = face3;
{
double L1;
L = Determinate3x3Matrix(matrix);
L1 = L;
if(fabs(L1) < .0001)
return;
}
face1->Insert(matrix,2,3,4);
face2->Insert(&matrix[3],2,3,4);
face3->Insert(&matrix[6],2,3,4);
vector.x = (Determinate3x3Matrix(matrix)) / L;
face1->Insert(matrix,3,1,4);
face2->Insert(&matrix[3],3,1,4);
face3->Insert(&matrix[6],3,1,4);
vector.y = (Determinate3x3Matrix(matrix)) / L;
face1->Insert(matrix,1,2,4);
face2->Insert(&matrix[3],1,2,4);
face3->Insert(&matrix[6],1,2,4);
vector.z = (Determinate3x3Matrix(matrix)) / L;
if(!(Boolean)PointInside(vector)){
corner = *corners;
if(corner[1]){
while(corner){
if(*corner == vector)
return;
corner++
}
}
if(n > 0){
corner = corners->Add();
*corner = vector;
}
}
}
void vector::void Insert(double *matrix,short a,short b,short c)
{
short n;
short i = 0;
while(i < 3){
switch(n){
case 0:
n = a;
break;
case 1:
n = b;
break;
case 2:
n = c;
break;
}
switch(n){
case X:
matrix[i] = x;
break;
case Y:
matrix[i] = y;
break;
case Z:
matrix[i] = z;
break;
case L:
matrix[i] = l;
break;
}
i++;
}
}
long Polyhedral::PointInside(vector theAtom)//determines in end of vector is inside polygon
{
vector *facePtr;
long n,i;
Boolean p;
double lengthTest;
n = 1;
p = false;
facePtr = faces;
while(facePtr){
lengthTest = (double)(facePtr * theAtom);
if(facePtr <= lengthTest){
return 0;
}
if(lengthTest >= -.02)
p = true;
if(lengthTest <= (double)(facePtr->l + .001) && lengthTest >= (double)(facePtr->l - .02))
n = 2;
facePtr++
}
if(p == false)
return 0;
return n ;
}
void Polyhedral::DeterminePolygons(void)
{
double x[3];
n = 0;
theEdgePtr = *theEdges;
theEdge = *theEdges;
face = faces
corner = corners;
while(face){
polygon++;
while(corner){
vector = corner * face;
vector *= corner.l;
if(vector.length() - face.length) < RESOLUTION){
corner -= face; //eliminates displacement from origin
polygon.add(corner);
}
corner++;
}
polygon.orderCorners();
polygon.displaceCorners(face);
face++;
}
//find two of the corners that are on edge
}
long Polyhedral::PointOnFace(vector v)
{
long i,n;
double lengthTest;
n = 0;
face = faces;
while(face){
lengthTest = face * v;
if(face == (double)lengthTest)
n++;
face++;
}
return n;
}
void Polygon::OrderCorners(void)
{
cornerN = corner1 = corners;
while(corner1){
double angle = 2_PI;
corner2 = corner1;
corner2++;
while(corner2){
if((ang = corner1->corner2.angle()) < angle){
angle = ang;
*match = *corner2;
}
corner2++;
}
corner1 = corner1 -> Neighbor(corner2);
corner1++; //moves it to corner 2
}
}
LTree<vector> Polygon::Neighbor(BTree corner)
{
old = next;
next = corner;
old->Order(corner);
}
LTree<vector>::Order(LTree<vector> comparator);
{
while(next){
if(comparator == next){
next = old;
next
}
}
|
a45a8d8c8da14334c5ed5f88fdfefde1d18adfb3
|
0f2635f18d7b47323332ab733f34c9308888e851
|
/LUOGU/[ZJOI2007]矩阵游戏.cpp
|
797b7098bf40617d7802ac98c4fa30611871609a
|
[] |
no_license
|
stevebraveman/Code
|
2e48b3638272126653c5a2baabac3438db781157
|
4205dd6c4c2f87a8d8554a21efac39616672004e
|
refs/heads/master
| 2020-06-30T21:55:41.313296
| 2019-11-13T22:57:51
| 2019-11-13T22:57:51
| 178,631,305
| 1
| 0
| null | null | null | null |
UTF-8
|
C++
| false
| false
| 1,814
|
cpp
|
[ZJOI2007]矩阵游戏.cpp
|
#include <iostream>
#include <cstdio>
#include <cstring>
#include <algorithm>
#define MAXN 40010
namespace STman {
template <typename Tp>
inline void read(Tp &x) {
#define C getchar()
Tp f = 1;x = 0;
char k = C;
while (k < '0' || k > '9') {if (k == '-') f = -1; k = C;}
while (k >= '0' && k <= '9') {x = x * 10 + k - '0'; k = C;}
x = x * f;
#undef C
}
template <typename Tp>
inline void write(Tp x) {
if (x < 0) putchar('-') , x = -x;
if (x > 9) write(x / 10);
putchar(x % 10 + '0');
}
template <typename Tp>
inline Tp max(Tp a, Tp b) {
if (a > b) return a;
else return b;
}
template <typename Tp>
inline Tp min(Tp a, Tp b) {
if (a < b) return a;
else return b;
}
template <typename Tp>
inline void swap(Tp &a, Tp &b) {
Tp t = a;
a = b;
b = t;
}
template <typename Tp>
inline Tp abs(Tp &a) {
if (a < 0) return -a;
else return a;
}
inline void sp() {
putchar(32);
}
inline void et() {
putchar(10);
}
}
using namespace STman;
struct Edge {
int v, nx;
}e[MAXN * 4];
int head[MAXN], ecnt, mtch[MAXN], op, ans, n, t, vis[MAXN];
void add(int f, int t) {
e[++ecnt] = (Edge) {t, head[f]};
head[f] = ecnt;
}
bool Hungary(int k, int t) {
for (int i = head[k]; i; i = e[i].nx) {
int to = e[i].v;
if (vis[to] != t) {
vis[to] = t;
if (!mtch[to] || Hungary(mtch[to], t)) {
mtch[to] = k;
return 1;
}
}
}
return 0;
}
int main() {
read(t);
while (t--) {
read(n);
ans = 0;
memset(mtch, 0, sizeof(mtch));
memset(head, 0, sizeof(head));
memset(vis, 0, sizeof(vis));
ecnt = 0;
for (int i = 1; i <= n; i++) {
for (int j = 1; j <= n; j++) {
read(op);
if (op) add(i, j);
}
}
for (int i = 1; i <= n; i++) {
if (Hungary(i, i)) {
ans++;
}
}
if (ans == n) {
puts("Yes");
}
else puts("No");
}
}
|
a0b6da4cb7aa8f6bae581af6ce2f741f0012e2ae
|
af2113881b0954e61fe2c9ed814046a0fe118fef
|
/debugger/src/gui_plugin/CpuWidgets/AsmArea.cpp
|
56c9ee90fa4b1d7b5b402ed6ba5af3690937b5df
|
[
"BSD-2-Clause",
"BSD-3-Clause"
] |
permissive
|
qshan/riscv_vhdl
|
3ab29c262720b8a7e5cbb8cce87940604bea2e2f
|
ccf68cd3c685499356605cfc80f01454ee5b98e1
|
refs/heads/master
| 2021-01-19T12:04:31.701791
| 2017-02-15T20:00:19
| 2017-02-15T20:00:19
| 82,282,423
| 1
| 0
| null | 2017-02-17T09:49:24
| 2017-02-17T09:49:23
| null |
UTF-8
|
C++
| false
| false
| 14,863
|
cpp
|
AsmArea.cpp
|
/**
* @file
* @copyright Copyright 2016 GNSS Sensor Ltd. All right reserved.
* @author Sergey Khabarov - sergeykhbr@gmail.com
* @brief Disassembler viewer area.
*/
#include "AsmArea.h"
#include "moc_AsmArea.h"
#include <memory>
#include <string.h>
#include <QtWidgets/QBoxLayout>
#include <QtWidgets/QLabel>
#include <QtWidgets/QHeaderView>
#include <QtWidgets/QScrollBar>
namespace debugger {
AsmArea::AsmArea(IGui *gui, QWidget *parent)
: QTableWidget(parent) {
igui_ = gui;
cmdRegs_.make_string("reg npc");
cmdReadMem_.make_string("disas 0 0");
state_ = CMD_idle;
hideLineIdx_ = 0;
selRowIdx = -1;
clear();
QFont font("Courier");
font.setStyleHint(QFont::Monospace);
font.setPointSize(8);
font.setFixedPitch(true);
setFont(font);
setContentsMargins(QMargins(0, 0, 0, 0));
QFontMetrics fm(font);
setMinimumWidth(50 + fm.width(tr(
" :0011223344556677 11223344 1: addw r0,r1,0xaabbccdd ; commment")));
lineHeight_ = fm.height() + 4;
portBreak_ = 0;
setColumnCount(COL_Total);
setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Expanding);
setRowCount(1);
asmLines_.make_list(0);
rangeModel_.setMaxLines(4);
portBreak_ = new BreakpointInjectPort(igui_);
verticalHeader()->setVisible(false); // remove row indexes
setShowGrid(false); // remove borders
setSelectionMode(QAbstractItemView::SingleSelection);
setSelectionBehavior(QAbstractItemView::SelectRows); //select full row
// change selected row color
QPalette *palette = new QPalette();
palette->setColor(QPalette::Highlight, Qt::gray);
setPalette(*palette);
Qt::ItemFlags fl;
for (int i = 0; i < rowCount(); i++) {
for (int n = 0; n < COL_Total; n++) {
setItem(i, n, new QTableWidgetItem());
fl = item(i, n)->flags();
fl &= ~Qt::ItemIsEditable;
fl &= ~Qt::ItemIsSelectable;
item(i, n)->setFlags(fl);
}
setRowHeight(i, lineHeight_);
item(i, 0)->setBackgroundColor(Qt::lightGray);
item(i, 0)->setTextAlignment(Qt::AlignRight);
}
setHorizontalHeaderLabels(
QString("addr/line;code;label;mnemonic;comment").split(";"));
setColumnWidth(0, 10 + fm.width(tr(" :0011223344556677")));
setColumnWidth(1, 10 + fm.width(tr("00112233")));
setColumnWidth(2, 10 + fm.width(tr("0")));
setColumnWidth(3, 10 + fm.width(tr("addw r1,r2,0x112233445566")));
connect(this, SIGNAL(signalNpcChanged(uint64_t)),
this, SLOT(slotNpcChanged(uint64_t)));
connect(this, SIGNAL(signalAsmListChanged()),
this, SLOT(slotAsmListChanged()));
connect(this, SIGNAL(cellDoubleClicked(int, int)),
this, SLOT(slotCellDoubleClicked(int, int)));
RISCV_mutex_init(&mutexAsmGaurd_);
}
AsmArea::~AsmArea() {
igui_->removeFromQueue(static_cast<IGuiCmdHandler *>(this));
igui_->removeFromQueue(static_cast<IGuiCmdHandler *>(portBreak_));
RISCV_mutex_destroy(&mutexAsmGaurd_);
delete portBreak_;
}
void AsmArea::resizeEvent(QResizeEvent *ev) {
int h = ev->size().height();
if (h < 4 * lineHeight_) {
h = 4 * lineHeight_;
}
rangeModel_.setMaxLines(h / lineHeight_ + 2);
QWidget::resizeEvent(ev);
//scrollToItem(item(0,0));
}
void AsmArea::wheelEvent(QWheelEvent * ev) {
int dlt = ev->delta();
int scroll_pos = verticalScrollBar()->value();
int scroll_min = verticalScrollBar()->minimum();
int scroll_max = verticalScrollBar()->maximum();
if (dlt >= 0 && scroll_pos > scroll_min) {
verticalScrollBar()->setValue(--scroll_pos);
} else if (dlt < 0 && scroll_pos < scroll_max) {
verticalScrollBar()->setValue(++scroll_pos);
} else {
rangeModel_.insrease(dlt);
if (state_ != CMD_idle) {
return;
}
char tstr[128];
state_ = CMD_memdata;
RISCV_sprintf(tstr, sizeof(tstr), "disas 0x%" RV_PRI64 "x %d",
rangeModel_.getReqAddr(),
rangeModel_.getReqSize());
cmdReadMem_.make_string(tstr);
igui_->registerCommand(static_cast<IGuiCmdHandler *>(this),
&cmdReadMem_, true);
}
QWidget::wheelEvent(ev);
}
void AsmArea::slotPostInit(AttributeType *cfg) {
// Prepare commands that don't change in run-time:
ISocInfo *isoc = static_cast<ISocInfo *>(igui_->getSocInfo());
DsuMapType *dsu = isoc->getpDsu();
portBreak_->setBrAddressFetch(
reinterpret_cast<uint64_t>(&dsu->udbg.v.br_address_fetch));
portBreak_->setHwRemoveBreakpoint(
reinterpret_cast<uint64_t>(&dsu->udbg.v.remove_breakpoint));
}
void AsmArea::slotUpdateByTimer() {
if (state_ == CMD_idle) {
igui_->registerCommand(static_cast<IGuiCmdHandler *>(this),
&cmdRegs_, true);
state_ = CMD_npc;
}
}
void AsmArea::handleResponse(AttributeType *req, AttributeType *resp) {
if (req->is_equal("reg npc")) {
emit signalNpcChanged(resp->to_uint64());
} else if (strstr(req->to_string(), "disas")) {
addMemBlock(*resp, asmLines_);
emit signalAsmListChanged();
}
}
void AsmArea::slotNpcChanged(uint64_t npc) {
int sel_row_new = -1;
RISCV_mutex_lock(&mutexAsmGaurd_);
for (unsigned i = 0; i < asmLines_.size(); i++) {
AttributeType &asmLine = asmLines_[i];
if (!asmLine.is_list()) {
continue;
}
if (npc == asmLine[ASM_addrline].to_uint64()) {
sel_row_new = static_cast<int>(i);
break;
}
}
RISCV_mutex_unlock(&mutexAsmGaurd_);
QTableWidgetItem *p;
if (sel_row_new != -1) {
if (selRowIdx != -1 && selRowIdx != sel_row_new) {
p = item(selRowIdx, 0);
p->setFlags(p->flags() & ~Qt::ItemIsSelectable);
}
selRowIdx = sel_row_new;
p = item(selRowIdx, 0);
p->setFlags(p->flags() | Qt::ItemIsSelectable);
selectRow(selRowIdx);
state_ = CMD_idle;
} else {
char tstr[128];
if (selRowIdx != -1) {
p = item(selRowIdx, 0);
p->setFlags(p->flags() & ~Qt::ItemIsSelectable);
}
rangeModel_.setPC(npc);
RISCV_sprintf(tstr, sizeof(tstr), "disas 0x%" RV_PRI64 "x %d",
rangeModel_.getReqAddr(),
rangeModel_.getReqSize());
cmdReadMem_.make_string(tstr);
igui_->registerCommand(static_cast<IGuiCmdHandler *>(this),
&cmdReadMem_, true);
state_ = CMD_memdata;
}
}
void AsmArea::slotAsmListChanged() {
rangeModel_.updateRange();
outLines();
state_ = CMD_idle;
}
void AsmArea::slotBreakpoint() {
portBreak_->injectFetch();
}
void AsmArea::slotCellDoubleClicked(int row, int column) {
if (row >= static_cast<int>(asmLines_.size())) {
return;
}
if (!asmLines_[row].is_list() || !asmLines_[row].size()) {
return;
}
char tstr[128];
bool is_breakpoint = asmLines_[row][ASM_breakpoint].to_bool();
uint64_t addr = asmLines_[row][ASM_addrline].to_uint64();
if (is_breakpoint) {
RISCV_sprintf(tstr, sizeof(tstr), "br rm 0x%" RV_PRI64 "x", addr);
} else {
RISCV_sprintf(tstr, sizeof(tstr), "br add 0x%" RV_PRI64 "x", addr);
}
AttributeType brcmd(tstr);
// Do not handle breakpoint responses:
igui_->registerCommand(NULL, &brcmd, true);
// Update disassembler list:
rangeModel_.updateAddr(addr);
RISCV_sprintf(tstr, sizeof(tstr), "disas 0x%" RV_PRI64 "x %d",
rangeModel_.getReqAddr(),
rangeModel_.getReqSize());
cmdReadMem_.make_string(tstr);
igui_->registerCommand(static_cast<IGuiCmdHandler *>(this),
&cmdReadMem_, true);
}
void AsmArea::BreakpointInjectPort::injectFetch() {
if (is_waiting_) {
return;
}
igui_->registerCommand(static_cast<IGuiCmdHandler *>(this),
&readBr_, true);
igui_->registerCommand(static_cast<IGuiCmdHandler *>(this),
&readNpc_, true);
is_waiting_ = true;
}
void AsmArea::BreakpointInjectPort::handleResponse(AttributeType *req,
AttributeType *resp) {
char tstr[128];
AttributeType memWrite;
if (req->is_equal("br")) {
brList_ = *resp;
return;
}
uint64_t br_addr = resp->to_uint64();
uint32_t br_instr = 0;
bool br_hw;
for (unsigned i = 0; i < brList_.size(); i++) {
const AttributeType &br = brList_[i];
if (br_addr == br[BrkList_address].to_uint64()) {
br_instr = br[BrkList_instr].to_int();
br_hw = br[BrkList_hwflag].to_bool();
break;
}
}
if (br_instr == 0) {
is_waiting_ = false;
return;
}
if (br_hw) {
RISCV_sprintf(tstr, sizeof(tstr),
"write 0x%08" RV_PRI64 "x 8 0x%" RV_PRI64 "x",
dsu_hw_br_, br_addr);
} else {
RISCV_sprintf(tstr, sizeof(tstr),
"write 0x%08" RV_PRI64 "x 16 [0x%" RV_PRI64 "x,0x%x]",
dsu_sw_br_, br_addr, br_instr);
}
memWrite.make_string(tstr);
igui_->registerCommand(NULL, &memWrite, true);
is_waiting_ = false;
}
void AsmArea::outLines() {
int asm_cnt = static_cast<int>(asmLines_.size());
int row_cnt = rowCount();
if (row_cnt < asm_cnt) {
Qt::ItemFlags fl;
setRowCount(asm_cnt);
for (int i = row_cnt; i < asm_cnt; i++) {
for (int n = 0; n < COL_Total; n++) {
setItem(i, n, new QTableWidgetItem());
fl = item(i, n)->flags();
fl &= ~Qt::ItemIsEditable;
fl &= ~Qt::ItemIsSelectable;
item(i, n)->setFlags(fl);
}
setRowHeight(i, lineHeight_);
item(i, 0)->setBackgroundColor(Qt::lightGray);
item(i, 0)->setTextAlignment(Qt::AlignRight);
}
}
if (hideLineIdx_ < asm_cnt) {
for (int i = hideLineIdx_; i < asm_cnt; i++) {
showRow(i);
}
hideLineIdx_ = asm_cnt;
}
// Output visible assembler lines:
for (unsigned i = 0; i < asmLines_.size(); i++) {
AttributeType &asmLine = asmLines_[i];
if (!asmLine.is_list()) {
continue;
}
outLine(static_cast<int>(i), asmLines_[i]);
if (rangeModel_.getPC() == asmLine[ASM_addrline].to_uint64()) {
selRowIdx = static_cast<int>(i);
}
}
// Hide unused lines:
hideLineIdx_ = static_cast<int>(asmLines_.size());
for (int i = hideLineIdx_; i < rowCount(); i++) {
hideRow(i);
}
if (selRowIdx != -1) {
QTableWidgetItem *p_item = item(selRowIdx, 0);
p_item->setFlags(p_item->flags() | Qt::ItemIsSelectable);
selectRow(selRowIdx);
}
}
void AsmArea::outLine(int idx, AttributeType &line) {
char stmp[256];
QTableWidgetItem *pw;
uint64_t addr;
if (idx >= rowCount()) {
return;
}
if (!line.is_list()) {
return;
}
addr = line[ASM_addrline].to_uint64();
if (line.size() == 2 && line[ASM_code].is_string()) {
pw = item(idx, COL_addrline);
RISCV_sprintf(stmp, sizeof(stmp), "%d", static_cast<int>(addr));
pw->setText(QString(stmp));
pw->setTextColor(QColor(Qt::darkBlue));
pw = item(idx, COL_code);
setSpan(idx, COL_code, 1, 4);
pw->setText(QString(line[ASM_code].to_string()));
item(idx, COL_label)->setText(tr(""));
item(idx, COL_mnemonic)->setText(tr(""));
item(idx, COL_comment)->setText(tr(""));
} else if (line.size() == ASM_Total) {
pw = item(idx, COL_addrline);
RISCV_sprintf(stmp, sizeof(stmp), "%016" RV_PRI64 "x", addr);
pw->setText(QString(stmp));
pw->setTextColor(QColor(Qt::black));
pw = item(idx, COL_code);
uint32_t instr = line[ASM_code].to_uint32();
if (line[ASM_breakpoint].to_bool()) {
pw->setBackgroundColor(Qt::red);
pw->setTextColor(Qt::white);
} else if (pw->backgroundColor() != Qt::lightGray) {
pw->setBackgroundColor(Qt::lightGray);
pw->setTextColor(Qt::black);
}
RISCV_sprintf(stmp, sizeof(stmp), "%08x", instr);
pw->setText(QString(stmp));
pw = item(idx, COL_label);
pw->setText(QString(line[ASM_label].to_string()));
pw = item(idx, COL_mnemonic);
pw->setText(QString(line[ASM_mnemonic].to_string()));
pw = item(idx, COL_comment);
pw->setText(QString(line[ASM_comment].to_string()));
}
}
void AsmArea::addMemBlock(AttributeType &resp,
AttributeType &lines) {
uint64_t asm_addr_start = 0;
uint64_t asm_addr_end = 0;
if (!resp.is_list() || !resp.size()) {
return;
}
if (!resp[0u].is_list() || !resp[resp.size() - 1].is_list()) {
return;
}
if (lines.size()) {
asm_addr_start = lines[0u][ASM_addrline].to_uint64();
asm_addr_end = lines[lines.size() - 1][ASM_addrline].to_uint64();
}
uint64_t resp_addr_start = resp[0u][ASM_addrline].to_uint64();
uint64_t resp_addr_next = resp[resp.size() - 1][ASM_addrline].to_uint64();
resp_addr_next += resp[resp.size() - 1][ASM_codesize].to_uint64();
RISCV_mutex_lock(&mutexAsmGaurd_);
if (resp_addr_next == asm_addr_start) {
// Joint lines at the beginning of current list:
for (unsigned i = 0; i < resp.size(); i++) {
lines.insert_to_list(i, &resp[i]);
}
} else if (resp_addr_start >= asm_addr_start
&& resp_addr_start <= asm_addr_end) {
// Modify lines values:
unsigned resp_idx = 0;
for (unsigned i = 0; i < lines.size(); i++) {
AttributeType &ln = lines[i];
if (resp_addr_start == ln[ASM_addrline].to_uint64()) {
ln = resp[resp_idx++];
if (resp_idx < resp.size()) {
resp_addr_start = resp[resp_idx][ASM_addrline].to_uint64();
} else {
break;
}
}
}
for (unsigned i = resp_idx; i < resp.size(); i++) {
lines.add_to_list(&resp[i]);
}
} else if (resp_addr_start == asm_addr_end + 4) { // fixme
// Joint lines to end of the current list:
for (unsigned i = 0; i < resp.size(); i++) {
lines.add_to_list(&resp[i]);
}
} else {
lines = resp;
}
RISCV_mutex_unlock(&mutexAsmGaurd_);
}
} // namespace debugger
|
30ae118a699e109bcc6cff72d3c9018c60165bb3
|
a4a6665b8e1e0971e9541f3c681856809ae861db
|
/Example/M5StickC/src/main.cpp
|
89b3f20e795edb8462a775eaa33657e72e032283
|
[] |
no_license
|
walidamriou/ESP32_PWM_Generator_Arduino
|
7f514bb07b4d5b78adaeaf3cae06b251df2e6fcf
|
8a0fac8cb13ae9faf079f72752aafff9be3078f6
|
refs/heads/main
| 2022-12-26T14:37:23.148876
| 2020-10-11T09:22:55
| 2020-10-11T09:22:55
| 301,082,022
| 0
| 0
| null | null | null | null |
UTF-8
|
C++
| false
| false
| 1,152
|
cpp
|
main.cpp
|
/*
********************************************************************
ESP32_PWM_Generator_Arduino
Implement PWM generator for Espressif Systems ESP32 boards by Arduino framework
Github: https://github.com/walidamriou/ESP32_PWM_Generator_Arduino
Copyright © 2020 Walid Amriou
Last update: October 2020
********************************************************************
*/
#include <Arduino.h>
#include <M5StickC.h>
// 50 Hz (period of 20ms)
int PWM_FREQUENCY = 50;
int PWM_CHANNEL = 0;
// You can choose from 1 to 8 bits
int PWM_RESOLUTION = 8;
int GPIO_PIN = 26 ;
// Define the width of signal from PWM resoution
// When we have PWM Resolution of 8 bits so we have the dutyCycle valure between 0 to 255 (0 to 100%)
// from this value wa can choose the duty Cycle:
// - If we want duty cycle of 50% so (50 * 255 / 100) = 127.5 so 127 only because duty is uint32_t
// - If we want duty cycle of 20% so (20 * 255 / 100) = 51
int dutyCycle = 127;
void setup(){
M5.begin();
ledcSetup(PWM_CHANNEL, PWM_FREQUENCY, PWM_RESOLUTION);
ledcAttachPin(GPIO_PIN, PWM_CHANNEL);
}
void loop() {
ledcWrite(PWM_CHANNEL, dutyCycle);
}
|
d8853b5854fbf2649749004f04ca1662b3c577a3
|
db798847ce02bbbdff7d779a81685bcf72741c87
|
/schoolwork/spring2013/sysprog/sdltut11.cpp
|
d313312eb72581df92e6e195c5406d72d8d1243d
|
[] |
no_license
|
Shawn5961/src
|
b301d276cfba987bff4a06fd5ab72ca0d220ec11
|
2d974036907114ceac9312babdb52eb4577203a8
|
refs/heads/master
| 2020-04-13T21:10:24.458967
| 2015-02-24T21:12:25
| 2015-02-24T21:12:25
| 9,043,364
| 0
| 0
| null | null | null | null |
UTF-8
|
C++
| false
| false
| 4,326
|
cpp
|
sdltut11.cpp
|
#include "SDL/SDL.h"
#include "SDL/SDL_image.h"
#include "SDL/SDL_ttf.h"
#include "SDL/SDL_mixer.h"
#include <string>
const int SCREEN_WIDTH = 640;
const int SCREEN_HEIGHT = 480;
const int SCREEN_BPP = 32;
SDL_Surface *background = NULL;
SDL_Surface *message = NULL;
SDL_Surface *screen = NULL;
SDL_Event event;
TTF_Font *font = NULL;
SDL_Color textColor = {0, 0 , 0};
Mix_Music *music = NULL;
Mix_Chunk *scratch = NULL;
Mix_Chunk *high = NULL;
Mix_Chunk *med = NULL;
Mix_Chunk *low = NULL;
SDL_Surface *load_image(std::string filename)
{
SDL_Surface* loadedImage = NULL;
SDL_Surface* optimizedImage = NULL;
loadedImage = IMG_Load(filename.c_str());
if(loadedImage != NULL)
{
optimizedImage = SDL_DisplayFormat(loadedImage);
SDL_FreeSurface(loadedImage);
if(optimizedImage != NULL)
{
SDL_SetColorKey(optimizedImage, SDL_SRCCOLORKEY, SDL_MapRGB(optimizedImage->format, 0, 0xFF, 0xFF));
}
}
return optimizedImage;
}
void apply_surface(int x, int y, SDL_Surface* source, SDL_Surface* destination, SDL_Rect* clip = NULL)
{
SDL_Rect offset;
offset.x = x;
offset.y = y;
SDL_BlitSurface(source, clip, destination, &offset);
}
bool init()
{
if(SDL_Init(SDL_INIT_EVERYTHING) == -1)
{
return false;
}
screen = SDL_SetVideoMode(SCREEN_WIDTH, SCREEN_HEIGHT, SCREEN_BPP, SDL_SWSURFACE);
if(screen == NULL)
{
return false;
}
if(TTF_Init() == -1)
{
return false;
}
if(Mix_OpenAudio(22050, MIX_DEFAULT_FORMAT, 2, 4096) == -1)
{
return false;
}
SDL_WM_SetCaption("Monitor Music", NULL);
return true;
}
bool load_files()
{
background = load_image("background.png");
font = TTF_OpenFont("lazy.ttf", 72);
if(background == NULL)
{
return false;
}
if(font == NULL)
{
return false;
}
music = Mix_LoadMUS("beat.wav");
if(music == NULL)
{
return false;
}
scratch = Mix_LoadWAV("scratch.wav");
high = Mix_LoadWAV("high.wav");
med = Mix_LoadWAV("medium.wav");
low = Mix_LoadWAV("low.wav");
if((scratch == NULL) || (high == NULL) || (med == NULL) || (low == NULL))
{
return false;
}
return true;
}
void clean_up()
{
SDL_FreeSurface(background);
Mix_FreeChunk(scratch);
Mix_FreeChunk(high);
Mix_FreeChunk(med);
Mix_FreeChunk(low);
TTF_CloseFont(font);
Mix_CloseAudio();
TTF_Quit();
SDL_Quit();
}
int main(int argc, char* args[])
{
bool quit = false;
if(init() == false)
{
return 1;
}
if(load_files() == false)
{
return 1;
}
apply_surface(0, 0, background, screen);
message = TTF_RenderText_Solid(font, "Press 1, 2, 3, or 4 to play a sound effect", textColor);
if(message == NULL)
{
return 1;
}
apply_surface((SCREEN_WIDTH - message->w) / 2, 100, message, screen);
SDL_FreeSurface(message);
message = TTF_RenderText_Solid(font, "Press 9 to play or pause the music", textColor);
if(message == NULL)
{
return 1;
}
apply_surface((SCREEN_WIDTH - message->w) / 2, 200, message, screen);
SDL_FreeSurface(message);
message = TTF_RenderText_Solid(font, "Press 0 to stop the music", textColor);
if(message == NULL)
{
return 1;
}
apply_surface((SCREEN_WIDTH - message->w) /2, 300, message, screen);
SDL_FreeSurface(message);
if(SDL_Flip(screen) == -1)
{
return 1;
}
while(quit == false)
{
while(SDL_PollEvent(&event))
{
if(event.type = SDL_KEYDOWN)
{
if(event.key.keysym.sym == SDLK_1)
{
if(Mix_PlayChannel(-1, scratch, 0) == -1)
{
return 1;
}
}
else if(event.key.keysym.sym == SDLK_2)
{
if(Mix_PlayChannel(-1, high, 0) == -1)
{
return 1;
}
}
else if(event.key.keysym.sym == SDLK_3)
{
if(Mix_PlayChannel(-1, med, 0) == -1)
{
return 1;
}
}
else if(event.key.keysym.sym == SDLK_4)
{
if(Mix_PlayChannel(-1, low, 0) == -1)
{
return 1;
}
}
else if(event.key.keysym.sym == SDLK_9)
{
if(Mix_PlayingMusic() == 0)
{
if(Mix_PlayMusic(music, -1) == -1)
{
return 1;
}
}
else
{
if(Mix_PausedMusic() == 1)
{
Mix_ResumeMusic();
}
else
{
Mix_PauseMusic();
}
}
}
else if(event.key.keysym.sym == SDLK_0)
{
Mix_HaltMusic();
}
}
if(event.type == SDL_QUIT)
{
quit = true;
}
}
}
clean_up();
return 0;
}
|
c886b1248364075aa8c258c170d47768a515fcfe
|
161dda44247a61118ea84fa40c485b5379b12ac5
|
/module_04/ex01/RadScorpion.cpp
|
b491acf2e38307e53a79a430555d71b81d2846ad
|
[] |
no_license
|
solaldunckel/piscine_cpp
|
d38c82f3a252e08c6731b67068ff4efb9105ddc2
|
a9846cb70d402e14a57c488a7ed58a3b0fd91373
|
refs/heads/master
| 2022-12-13T20:18:16.487737
| 2020-09-21T08:24:40
| 2020-09-21T08:24:40
| 224,680,394
| 0
| 0
| null | null | null | null |
UTF-8
|
C++
| false
| false
| 1,376
|
cpp
|
RadScorpion.cpp
|
/* ************************************************************************** */
/* */
/* ::: :::::::: */
/* RadScorpion.cpp :+: :+: :+: */
/* +:+ +:+ +:+ */
/* By: sdunckel <sdunckel@student.42.fr> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2020/06/19 13:30:46 by sdunckel #+# #+# */
/* Updated: 2020/07/11 17:28:30 by sdunckel ### ########.fr */
/* */
/* ************************************************************************** */
#include "RadScorpion.hpp"
/*
** Constructors & Deconstructors
*/
RadScorpion::RadScorpion() : Enemy(80, "RadScorpion")
{
std::cout << "* click click click *" << std::endl;
}
RadScorpion::~RadScorpion()
{
std::cout << "* SPROTCH *" << std::endl;
}
RadScorpion::RadScorpion(const RadScorpion ©) : Enemy()
{
*this = copy;
}
/*
** Operators Overload
*/
RadScorpion &RadScorpion::operator=(const RadScorpion ©)
{
_hp = copy._hp;
_type = copy._type;
return (*this);
}
|
5887ac61a57917b1f4f6d5080d75e25e5c966423
|
3a23a1275eec8468d5d99652a8f98e467aa1a70b
|
/Player.cpp
|
46833d29d3b5b1cc07517f2709e3b73c22a71588
|
[] |
no_license
|
Kilometerr/BattleshipOpenGL
|
75fa5d6e49bc2781eda76748a5ea0a23081284a5
|
864607d198d747b0ad86b68ac6f20b68d7beb26d
|
refs/heads/master
| 2020-03-17T17:16:06.674237
| 2018-06-05T22:18:05
| 2018-06-05T22:18:05
| 133,781,500
| 0
| 0
| null | null | null | null |
UTF-8
|
C++
| false
| false
| 1,246
|
cpp
|
Player.cpp
|
//
// Created by barno on 30.05.2018.
//
#include "Player.h"
Player::Player(int _id) {
life = 14;
id = _id;
myMap = new int *[10];
enemyMap = new int *[10];
//Inicjalizacja map
for(int i = 0; i < 10; i++) {
myMap[i] = new int[10];
enemyMap[i] = new int[10];
}
clearMaps();
//Inicjalizacja statkow
*&ships = new Ship[5];
for(int i = 0; i < 5; i++) {
auto *ship = new Ship();
ships[i] = *ship;
}
}
int **Player::getMyMap() const {
return myMap;
}
int **Player::getEnemyMap() const {
return enemyMap;
}
Ship *Player::getShips() const {
return ships;
}
Player::~Player() {
for(int i = 0; i < 10; i++) {
delete[] myMap[i];
delete[] enemyMap[i];
}
delete [] *myMap;
delete [] *enemyMap;
delete [] ships;
}
void Player::clearMaps() {
for(int i = 0; i < 10; i++) {
for(int j = 0 ; j < 10; j++) {
myMap[i][j] = 0;
enemyMap[i][j] = 0;
}
}
}
int Player::getId() const {
return id;
}
int Player::getLife() const {
return life;
}
void Player::setLife(int life) {
Player::life = life;
}
|
662a2adde08c021d8cd90959b56e6e968b629f7f
|
dc8824afa322f30d0cb0ce1a4bd120ba4ae719fa
|
/skiros_lib_skill_dummy/src/drive.cpp
|
6153b27da78d87994cc97639eed9c56f20cb1296
|
[] |
no_license
|
frovida/skiros_std_lib
|
f17f5ef85c813e69f6a324c634f5ace0f688783f
|
a6c95bc678819c82a823302922978c65b43dff0c
|
refs/heads/master
| 2020-12-24T20:42:46.874221
| 2017-09-28T16:44:24
| 2017-09-28T16:44:24
| 59,300,265
| 2
| 2
| null | null | null | null |
UTF-8
|
C++
| false
| false
| 3,093
|
cpp
|
drive.cpp
|
#include <skiros_lib_skill_dummy/drive.h>
namespace skiros_skill
{
using namespace skiros_config::owl;
using namespace skiros_wm;
Drive::Drive()
{
////////////////////////////////////////////////////////
// Specify the skill description constants
////////////////////////////////////////////////////////
this->setSkillType("Drive");
this->setDescription("Move the robot close to a selected container");
this->setVersion("0.0.2");
////////////////////////////////////////////////////////
// Define the parameters for the skill
////////////////////////////////////////////////////////
// 1. parameter is the object to grasp
getParamHandle()->addParamWithDefaultValue("TargetLocation",skiros_wm::Element(concept::Str[concept::Location]), "Target object to drive to", skiros_common::online);
getParamHandle()->addParamWithDefaultValue("Robot",skiros_wm::Element(concept::Str[concept::Agent]), "Robot to move", skiros_common::hardware);
}
bool Drive::onInit()
{
addPostcondition("AtTarget", newCondition("RobotAtLocation", true, "Robot", "TargetLocation"));
return true;
}
int Drive::preSense()
{
////////////////////////////////////////////////////////
// Get parameters
////////////////////////////////////////////////////////
mobile_base_ = getParamHandle()->getParamValue<skiros_wm::Element>("Robot");
target_object_ = getParamHandle()->getParamValue<skiros_wm::Element>("TargetLocation");
std::vector<skiros_wm::Element> v = getWorldHandle()->getChildElements(mobile_base_, relation::Str[relation::robotAt]);
if(v.size()==0) //FIXME: this should never happen
{
setProgress("[ERROR] Initial location not found!");
skiros_wm::Element fake(concept::Str[concept::Location]);
fake.label() = getWorldHandle()->getRobot().properties(relation::Str[relation::hasStartLocation]).getValue<std::string>();
v = getWorldHandle()->resolveElement(fake);
initial_location_ = v[0];
}
else initial_location_ = v[0];
target_location_ = target_object_;
std::stringstream ss;
ss << "Navigating to " << target_location_.label() << " type " << target_location_.type() << " id " << target_location_.id();
setProgress(ss.str());
return 1;
}
int Drive::execute()
{
return 1;
}
/*!
* \brief A fake drive. Move a 'MobileBase' element to a selected location
*
* Teach required: \n
* Pre-condition: \n
* Post-condition: \n
* Failures: \n
* Never fail. \n
*
*/
class DriveFake : public Drive
{
public:
DriveFake()
{
// Specify the skill description constants
this->setDescription("Fake drive. Move the robot close to a selected container");
this->setVersion("0.0.1");
}
~DriveFake() {}
int execute()
{
getWorldHandle()->setRelation(mobile_base_.id(), relation::Str[relation::robotAt], initial_location_.id(), false);
setAllPostConditions();
return 1;
}
}; // class
} // namespace
//Export
PLUGINLIB_EXPORT_CLASS(skiros_skill::DriveFake, skiros_skill::SkillBase)
|
b902748b76c8e70cff59d492a59b84e18d249261
|
fe0e6329d1f173742a07cfa444b81c2b6abaaa2c
|
/shell.cc
|
2eb26cf5bb317f06d230d0fe56e9f12cea2ee41b
|
[] |
no_license
|
XiaoyiHu1998/EOsLevelProgramming
|
814055d83a35a1751c56ccc5673347e6ff364795
|
142f0f4319e622997f666eeb60ee60eb0284dc51
|
refs/heads/master
| 2020-05-03T05:10:57.638039
| 2019-03-29T16:36:56
| 2019-03-29T16:36:56
| 178,441,570
| 0
| 0
| null | null | null | null |
UTF-8
|
C++
| false
| false
| 3,877
|
cc
|
shell.cc
|
#include "shell.hh"
#include <fstream>
using std::ifstream;
using std::ofstream;
int main(){
std::string input;
char buf[2];
int fd = open("promptInput.txt", O_RDONLY);
if(fd == -1){
cout << "Error reading promptInput.txt";
exit(1);
}
std::string prompt = read(fd, buf, 1);
close(fd);
while(true){
std::cout << prompt; // Print het prompt
std::getline(std::cin, input); // Lees een regel
if (input == "new_file") new_file(); // Kies de functie
else if (input == "ls") list(); // op basis van
else if (input == "src") src(); // de invoer
else if (input == "find") find();
else if (input == "python") python();
else if (input == "exit") return 0;
else if (input == "quit") return 0;
else if (input == "error") return 1;
if (std::cin.eof()) return 0; }
} // EOF is een exit
void new_file(){
std::string fileName;
std::string fileContent;
std::cout << "Give name for new file: ";
std::getline(cin, fileName);
std::cout << "Give a string for new file: ";
std::getline(std::cin, fileContent);
creat("newFileOutput", S_IRUSR|S_IWUSR);
int newfileFD = open(fileName, O_RDWR);
if(newFileFD == -1){
cout << "Error opening " << fileName;
exit(1);
}
write(newfileFD, fileContent, 1024);
close(newFileFD);
}
void list(){
int pid = fork();
if(pid == -1){
std::cout << "Error pid:-1";
exit(1);
}
else if(pid == 0){
char *args[] = {"/bin/ls", "-la", char( *) 0};
execv("bin/ls", args);
}
else{
int exit_status;
wait(&exit_status);
}
}
void find(){
std::string searchString;
std::cout << "Please give the string you are searching for: ";
getline(std::cin, searchString);
int findGrepPipe[2];
int stringFindPipe[2];
pipe(findGrepPipe);
pipe(stringFindPipe);
dup2(stringFindPipe[1],1);
close(1);
std::out << searchString;
int pid = fork();
if(pid == -1){
std::cout << "Error pid:-1";
exit(1);
}
else if(pid == 0){
int pid =fork();
if(pid == -1){
std::cout << "Error pid:-1";
exit(1);
}
else if(pid == 0){
dup2(stringFindPipe[0], 0);
dup2(findGrepPipe[1],1);
close(1);
close(0);
close(findGrepPipe[0]);
close(stringFindPipe[1]);
char *args[] = {"/bin/find", char( *) 0};
execv("bin/find", args);
}
else{
dup2(findGrepPipe[0], 0);
close(0);
close(findGrepPipe[1]);
int exit_status;
wait(&exit_status);
char *args[] = {"/bin/grep", char( *) 0};
execv("/bin/grep", args);
}
}else{
int exit_status;
wait(&exit_status);
}
}
void python(){
int pid = fork();
if(pid == -1){
cout << "Error pid:-1";
exit(1);
}
else if(pid == 0){
execv("/usr/bin/python3", char( *) 0);
}
else{
int exit_Status;
wait(&exit_status);
}
}
void src() // Voorbeeld: Gebruikt SYS_open en SYS_read om de source van de shell (shell.cc) te printen.
{ int fd = syscall(SYS_open, "shell.cc", O_RDONLY, 0755); // Gebruik de SYS_open call om een bestand te openen.
char byte[1]; // 0755 zorgt dat het bestand de juiste rechten krijgt (leesbaar is).
while(syscall(SYS_read, fd, byte, 1)) // Blijf SYS_read herhalen tot het bestand geheel gelezen is,
std::cout << byte; } // zet de gelezen byte in "byte" zodat deze geschreven kan worden.
|
6d9bdbcb1fd84855f114888b8494865c77c451d8
|
f57610ce330076f2ba95041bbf5f295a9ef40dfe
|
/Solution/847-shortest-path-visiting-all-nodes/shortest-path-visiting-all-nodes.cpp
|
e083d114c7c2dde0581c566122dcee3d782a19e9
|
[] |
no_license
|
derek-zr/leetcode
|
095df86dd00c85b98a3f3ef51e784a65ab75c13d
|
ec7edcca6a63648d87bed6dd557738b89511368d
|
refs/heads/master
| 2021-01-21T21:07:07.114659
| 2020-11-27T09:29:35
| 2020-11-27T09:29:35
| 92,308,067
| 0
| 0
| null | null | null | null |
UTF-8
|
C++
| false
| false
| 2,043
|
cpp
|
shortest-path-visiting-all-nodes.cpp
|
// An undirected, connected graph of N nodes (labeled 0, 1, 2, ..., N-1) is given as graph.
//
// graph.length = N, and j != i is in the list graph[i] exactly once, if and only if nodes i and j are connected.
//
// Return the length of the shortest path that visits every node. You may start and stop at any node, you may revisit nodes multiple times, and you may reuse edges.
//
//
//
//
//
//
// Example 1:
//
//
// Input: [[1,2,3],[0],[0],[0]]
// Output: 4
// Explanation: One possible path is [1,0,2,0,3]
//
// Example 2:
//
//
// Input: [[1],[0,2,4],[1,3,4],[2],[1,2]]
// Output: 4
// Explanation: One possible path is [0,1,4,2,3]
//
//
//
//
// Note:
//
//
// 1 <= graph.length <= 12
// 0 <= graph[i].length < graph.length
//
//
struct State{
int cur;
int visit;
int step;
State(int cur,int visit,int step):cur(cur),visit(visit),step(step){}
};
class Solution {
public:
int shortestPathLength(vector<vector<int>>& graph) {
int N = graph.size();
int ans = 0;
queue<State> q;
vector<vector<bool>> visited(1<<N,vector<bool>(N,false)); //visit下,停在某个节点的情况是否被计算过
for(int i=0;i<N;i++){
q.push(State(i,1<<i,0)); //用0-1 bit表示是否访问过
visited[1<<i][i] = true;
}
while(!q.empty()){
State tmp = q.front();
q.pop();
if(tmp.visit == (1<<N)-1){ //说明所有节点已经全部访问过
ans = tmp.step; //可以直接返回,因为这是bfs,确保了当前是最短的路径
break;
}
for(int node : graph[tmp.cur]){
int tmp_state = tmp.visit|(1<<node); //加上对应node的状态
if(!visited[tmp_state][node]){
q.push(State(node,tmp_state,tmp.step+1));
visited[tmp_state][node] = true;
}
}
}
return ans;
}
};
|
79481a564b44e8c7f2d84eb7c8f5d77d057e77f1
|
45dfd61ae02c0e6a7b0bed2eb23230f0d7b10689
|
/Lab 1 Q-3(b).cpp
|
b8bd73b81d06a51cf127a43338badd5faf04573b
|
[] |
no_license
|
jayesh-685/ComputerLab
|
35c79950552bbe853727bd57fa0a9a7a40ebd49d
|
472f8cb3625cf35d9d6d6b21b6f1b6861a9d7861
|
refs/heads/main
| 2023-03-20T15:43:27.576911
| 2021-03-08T04:05:28
| 2021-03-08T04:05:28
| 345,526,122
| 0
| 0
| null | null | null | null |
UTF-8
|
C++
| false
| false
| 186
|
cpp
|
Lab 1 Q-3(b).cpp
|
#include <iostream>
using namespace std;
namespace first_val
{
int val = 200;
}
int val = 100;
int main () {
int val = 50;
cout << first_val::val;
return 0;
}
|
64c926d4510aba2aaf84e02b76b62e29a852c93d
|
1bb9a93e1e3346d263c22a9e467f703d3497b2f8
|
/files.cpp
|
7fcb5eda5b299634bc5512dd90f8f5c585edae7c
|
[] |
no_license
|
k-kashapov/sortPoem
|
5ca7afb9c8f666ea74087c8e779660fb547d8283
|
8c4200fd3d13bcd8ff92bb8477c9ca9420d7b0cf
|
refs/heads/master
| 2023-08-01T05:11:49.433312
| 2021-09-16T08:31:12
| 2021-09-16T08:31:12
| 399,575,549
| 0
| 1
| null | null | null | null |
UTF-8
|
C++
| false
| false
| 4,580
|
cpp
|
files.cpp
|
/*****************************************************************//**
* \file files.cpp
* \brief В файле собраны все функции, связанные с работой с файловой системой
*********************************************************************/
#include "files.h"
// Убирает предупреждение о функциях библиотеки string.h в Visual Studio
#pragma warning(disable:4996)
int read_all_lines (file_info *info, const char* file_name)
{
assert (info);
assert (file_name);
FILE *source = NULL;
if (open_file (&source, file_name, "rt"))
{
return OPEN_FILE_FAILED;
}
char *text_buff = read_to_end (source);
if (text_buff == NULL)
{
return READ_TEXT_FAILED;
}
fclose (source);
string **strings = (string **) calloc (BUFF_SIZE + 1, sizeof (string *));
assert (strings);
for (int i = 0; i < BUFF_SIZE + 1; i++)
{
strings [i] = (string *) calloc (1, sizeof (string));
assert (strings [i]);
}
string **strings_ptr = strings;
for (char *token = strtok (text_buff, "\n"); token; token = strtok (NULL, "\n"))
{
if (*token != '\n')
{
while (*token == ' ') token++;
char *token_ptr = token;
while (*token_ptr != '\n' && *token_ptr) token_ptr++;
(*strings_ptr)->len = token_ptr - token;
(*strings_ptr++)->text = token;
}
}
info->text = text_buff;
info->strs = strings;
info->lines_num = strings_ptr - strings;
return 0;
}
int open_file (FILE **ptr, const char* file_name, const char* mode)
{
*ptr = fopen (file_name, mode);
if (!ptr)
{
printf ("ERROR: Couldn't open file \"%s\"\n", file_name);
return (OPEN_FILE_FAILED);
}
return 0;
}
char* read_to_end (FILE *source)
{
assert (source);
int length = get_len (source);
char *text_buff = (char *) calloc ( length + 1, sizeof ( char ) );
assert (text_buff);
int sym_read = fread (text_buff, sizeof (*text_buff), length, source);
if (sym_read < 0 || sym_read > length)
{
free (text_buff);
printf ("ERROR: Reading text file failed");
return (NULL);
}
// Останавливает дальнейшее чтение, т.к. дальше лежит мусор
text_buff[sym_read] = '\0';
return text_buff;
}
int get_len (FILE *file)
{
assert (file);
fseek (file, 0, SEEK_END);
int length = ftell (file);
fseek (file, 0, SEEK_SET);
return length;
}
int show_res (file_info *file_text, const char * output_file)
{
assert (file_text);
FILE *destination = NULL;
open_file (&destination, output_file, "wt");
for (int i = 0; i < file_text->lines_num; i++)
{
char printed = fputs ((*(file_text->strs + i))->text, destination);
if (printed == EOF || fputs ("\n", destination) == EOF)
{
printf ("ERROR: Writing to file failed!");
free_info (file_text);
return (WRITING_TEXT_FAILED);
}
}
fclose (destination);
return 0;
}
void free_info (file_info *info)
{
assert (info);
free (info->text);
free (info->strs);
}
void get_params (int argc, char **argv, config *current)
{
assert (argv);
assert (current);
while (--argc)
{
char* arg = *++argv;
if (!strncmp (arg, "-n", 2))
{
current->input_file = *++argv;
argc--;
}
else
{
if (!strncmp (arg, "-o", 2))
{
current->output_file = *++argv;
argc--;
}
else if (!strncmp (arg, "-rs", 3))
{
current->mode = *strncmp_reverse_smart;
}
else if (!strncmp (arg, "-r", 2))
{
current->mode = *strncmp_reverse;
}
else if (!strncmp (arg, "-l", 2))
{
current->mode = *cmpr_len;
}
else if (!strncmp (arg, "-s", 2))
{
current->mode = *strncmp_norm_smart;
}
else
{
printf ("Invalid mode paramter");
}
}
}
}
|
429a2c19309abd7608c8bdb34e73c29902d45fcf
|
60a02e8649dc5a1446e5dada5e17bcb80a741b59
|
/src/memoize.h
|
282854688f9ff101b092f99ab870b7325a9cfcdc
|
[] |
no_license
|
vivekgautham/Templates
|
cef0a32f4f60a146bdefabd8f9fe7356ff7eee65
|
63408d81efecf46915af316c5d34a6baf9614922
|
refs/heads/master
| 2021-01-23T04:40:46.599393
| 2018-09-30T02:45:09
| 2018-09-30T02:45:09
| 80,370,356
| 0
| 0
| null | null | null | null |
UTF-8
|
C++
| false
| false
| 912
|
h
|
memoize.h
|
#ifndef MEMOIZE_H
#define MEMOIZE_H
#include "header.h"
template < typename T >
class Memoize
{
template < typename... Args >
static auto memoizeFunc(Args&&... args) -> decltype(T::memoizeFunc(std::forward(Args)(args)...))
{
{
/* Create a static map variable with
key type = type of tuple of argument type passed in
value type = return type of function that's been memoized
*/
static std::map< std::tuple<Args...>, decltype(T::memoizeFunc(std::forward<Args>(args)...)) > repository;
auto key = std::make_tuple(std::forward<Args>(args)...);
auto it = repository.find(key);
if (it != repository.end())
{
return it->second;
}
else
{
auto result = T::Func(std::forward<Args>(args)...);
repository[key] = result;
return result;
}
}
}
};
#endif
|
cc48958f64d3f3aabbb96fd2b050812223ac16db
|
dd567db2ebc714cc48f4af46febfbb0e8642de88
|
/tests/testing.cpp
|
afa36a0b67b31da3a6e8a186e9e6591071d8549d
|
[] |
no_license
|
mikeTerentev/megaFinder
|
2f4d58ea1bf038eaba59b05fa834decf3bcf0451
|
96fa6fe816bf404fe720cdac9b33597c69a970f9
|
refs/heads/master
| 2020-04-11T05:49:35.434621
| 2019-01-12T08:19:30
| 2019-01-12T08:19:30
| 161,560,963
| 0
| 0
| null | null | null | null |
UTF-8
|
C++
| false
| false
| 5,349
|
cpp
|
testing.cpp
|
//
// Created by Михаил Терентьев on 2018-12-21.
//
#include <tests/gtest/gtest.h>
#include <QObject>
#include <fileindexer.h>
#include <trigramsrepository.h>
#include <trigramssearcher.h>
const QString dir = "/Users/miketerentyev/itmo/2-year/MegaFinder/tests/test_dir/";
TEST(file_count_correctness, empty) {
TrigramsRepository repository;
QFileSystemWatcher watcher;
TrigramsSearcher searcher(dir + "count/empty", &repository, &watcher);
searcher.indexDir();
EXPECT_TRUE(repository.getTrigramData().size() == 1);
EXPECT_TRUE(repository.getFilesAmount() == 0);
}
TEST(file_count_correctness, count_1_file) {
TrigramsRepository repository;
QFileSystemWatcher watcher;
TrigramsSearcher searcher(dir + "count/1-file", &repository, &watcher);
searcher.indexDir();
EXPECT_TRUE(repository.getTrigramData().size() == 1);
EXPECT_TRUE(repository.getFilesAmount() == 1);
}
TEST(file_count_correctness, count_3_files) {
TrigramsRepository repository;
QFileSystemWatcher watcher;
TrigramsSearcher searcher(dir + "count/3-files", &repository, &watcher);
searcher.indexDir();
EXPECT_TRUE(repository.getTrigramData().size() == 1);
EXPECT_TRUE(repository.getFilesAmount() == 3);
}
TEST(file_count_correctness, hidden_files) {
TrigramsRepository repository;
QFileSystemWatcher watcher;
TrigramsSearcher searcher(dir + "count/hidden-files", &repository, &watcher);
searcher.indexDir();
EXPECT_TRUE(repository.getTrigramData().size() == 1);
EXPECT_TRUE(repository.getFilesAmount() == 0);
}
TEST(file_count_correctness, count_tree) {
TrigramsRepository repository;
QFileSystemWatcher watcher;
TrigramsSearcher searcher(dir + "count/", &repository, &watcher);
searcher.indexDir();
EXPECT_TRUE(repository.getTrigramData().size() == 1);
EXPECT_TRUE(repository.getFilesAmount() == 4);
}
TEST(permission_check, no_permission) {
TrigramsRepository repository;
QFileSystemWatcher watcher;
TrigramsSearcher searcher(dir + "no-permission/", &repository, &watcher);
searcher.indexDir();
EXPECT_TRUE(repository.getFilesAmount() == 0);
}
TEST(indexer_check, three_character) {
FileIndexer indexer;
QSet<uint64_t> result = indexer.findTrigramsOfFile(dir + "hash-checker/1-trigram/1-trigram.txt");
EXPECT_EQ(*(result.begin()), 5064013);
EXPECT_TRUE(result.size() == 1);
}
TEST(indexer_check, three_diff_trigrams) {
FileIndexer indexer;
QSet<uint64_t> result = indexer.findTrigramsOfFile(dir + "hash-checker/3-different/3-different.txt");
QSet<uint64_t> answer = {5064013, 4541761, 5062979};
EXPECT_TRUE(result.size() == 3);
for (auto item : result) {
EXPECT_TRUE(answer.contains(item));
}
}
TEST(indexer_check, two_pairs) {
FileIndexer indexer;
QSet<uint64_t> result = indexer.findTrigramsOfFile(dir + "hash-checker/2same/2same.txt");
QSet<uint64_t> answer = {4541765, 5064013};
EXPECT_TRUE(result.size() == 2);
for (auto item : result) {
EXPECT_TRUE(answer.contains(item));
}
}
TEST(finder_check, three_diff_trigrams) {
TrigramsRepository repository;
QFileSystemWatcher watcher;
TrigramsSearcher searcher(dir + "hash-checker/3-different/", &repository, &watcher);
searcher.indexDir();
auto res = repository.find("MAC");
EXPECT_TRUE(res.size() == 1);
EXPECT_TRUE(res[0].second.size() == 1);
res = repository.find("EM");
EXPECT_TRUE(res.size() == 1);
EXPECT_TRUE(res[0].second.size() == 1);
res = repository.find("AC");
EXPECT_TRUE(res.size() == 1);
EXPECT_TRUE(res[0].second.size() == 1);
}
TEST(finder_check, three_character) {
TrigramsRepository repository;
QFileSystemWatcher watcher;
TrigramsSearcher searcher(dir + "hash-checker/1-trigram/", &repository, &watcher);
searcher.indexDir();
auto res = repository.find("M");
EXPECT_TRUE(res.size() == 1);
EXPECT_TRUE(res[0].second.size() == 1);
res = repository.find("ME");
EXPECT_TRUE(res.size() == 1);
EXPECT_TRUE(res[0].second.size() == 1);
res = repository.find("MEM");
EXPECT_TRUE(res.size() == 1);
EXPECT_TRUE(res[0].second.size() == 1);
res = repository.find("EM");
EXPECT_TRUE(res.size() == 1);
EXPECT_TRUE(res[0].second.size() == 1);
}
TEST(finder_check, several) {
TrigramsRepository repository;
QFileSystemWatcher watcher;
TrigramsSearcher searcher(dir + "hash-checker/", &repository, &watcher);
searcher.indexDir();
auto res = repository.find("M");
EXPECT_TRUE(res[0].second.size() == 3);
res = repository.find("AC");
EXPECT_TRUE(res[0].second.size() == 1);
res = repository.find("MEMAC");
EXPECT_TRUE(res[0].second.size() == 1);
res = repository.find("MEM");
EXPECT_TRUE(res[0].second.size() == 3);
}
TEST(remove,remove){
TrigramsRepository repository;
QFileSystemWatcher watcher;
TrigramsSearcher searcher(dir + "count", &repository, &watcher);
searcher.indexDir();
searcher.removeDirectory();
EXPECT_TRUE(repository.getTrigramData().empty());
}
TEST(easy, empty) {
TrigramsRepository repository;
QFileSystemWatcher watcher;
TrigramsSearcher searcher(dir + "empty", &repository, &watcher);
searcher.indexDir();
EXPECT_TRUE(searcher.getData().isEmpty());
}
|
357e7f00c61b0db031b904ddb88491d630522fb7
|
ee80ddf7d1de919847f1072f83c9ee3e3deeae02
|
/gwell/source/vi-kernel/vielemepolyhfaceedge.hh
|
2389f0e5e2e81db11947ee489b16b42aead71502
|
[] |
no_license
|
pjakwert/gwell3d
|
8bef1d3616810e6a79aff12869f164cdff0ac8b5
|
798b928d91864ba7f2ed5b9ccd46b3d6a693908c
|
refs/heads/master
| 2020-03-26T00:42:58.091397
| 2018-08-10T21:48:12
| 2018-08-10T21:48:12
| 144,333,776
| 0
| 0
| null | null | null | null |
ISO-8859-2
|
C++
| false
| false
| 3,948
|
hh
|
vielemepolyhfaceedge.hh
|
#ifndef VIELMEPOLYHFACEEDGE_HH
#define VIELMEPOLYHFACEEDGE_HH
/*!
* \file vielemepolyhfaceedge.hh
* \author Bogdan Kreczmer
* \date 2003.03.23
*
* Plik zawiera definicję klasy ViElemePolyhFaceEdge
* modelującej krawędzie związane z daną ścianką i mające właściwą
* orientację względem tej ścianki. Czego nie gwarantują obiekty
* klasy ViEdge.
*
*/
#ifdef __GNUG__
#pragma interface
#endif
#include <iostream>
#include "vector3f.hh"
#include "vifaceedge.hh"
class ViElemePolyhFace;
class ViElemePolyh;
/*!
* Klasa zwiera opis krawędzi danej ścianki z uwzględnieniem
* jej prawidłowej orientacji względem brzegu ścianki
*/
class ViElemePolyhFaceEdge {
/*!
* Pole zawiera referencję do ścianki bryły elementarnej, do której
* to ścianki należy dana krawędź.
*/
const ViElemePolyhFace &_Owner;
/*!
* Pole zawiera referencję do krawędzi ścianki bryły wzorcowej
* odpowiadającą krawędzi modelowanej przez ten obiekty dla
* bryły elementarnej.
*/
const ViFaceEdge &_PatteFaceEdge;
const Vector3f &_FstVtx; /*!< Pierwszy wierzchołek krawędzi. */
const Vector3f &_SndVtx; /*!< Drugi wierzchołek krawędzi. */
/*!
* \if brief_private_fields
* \brief Wskaźnik na drugą ściankę
* \endif
*
* Wskaźnik na drugą ściankę, z która sąsiaduje krawędź.
* Ścianka ta nie musi istnieć, wówczas w polu tym
* wpisana zostaje wartość \p NULL.
*/
const ViElemePolyhFace *_pNeighborFace;
friend class ViElemePolyh;
void PostInit();
public:
/*!
* Inicjalizuje obiekt referencjami do poszczególnych pól.
* \param Owner - referencja do ścianki, do której należy ta krawędź,
* \param Edge - referencja do krawędzi ścianki bryły wzorcowej,
* która odpowiada krawędzi modelowanej przez tworzony
* obiekt w bryle elementarnej, do której należy.
*/
ViElemePolyhFaceEdge( const ViElemePolyhFace &Owner,
const ViFaceEdge & Edge
);
/*!
* Udostępnia referencję do ścianki, której częścią jest ta krawędź.
*/
const ViElemePolyhFace &GetFace() const { return _Owner; }
/*!
* Udostępnia referencję do ścianki, z którą krawędź ta sąsiaduje.
*/
const ViElemePolyhFace *GetNeighborFace() const { return _pNeighborFace; }
/*!
* Referencja do pierwszego wierzchołka krawędzi.
*/
const Vector3f &GetFstVtx() const { return _FstVtx; }
/*!
* Referencja do drugiego wierzchołka krawędzi.
*/
const Vector3f &GetSndVtx() const { return _SndVtx; }
/*!
* Udostępnia wektor normalny ścianki, do której należy.
*/
const Vector3f &FaceNormVect() const;
/*!
* Udostępnia wektor normalny ścianki sąsiedniej. W przypadku,
* gdy nie ma sąsiedniej ścianki zwracany jest wektor zerowy.
*/
Vector3f FaceNormVect_Neighbor() const;
/*!
* Metoda umożliwia określenie czy krawędź jest widoczna
* z danego kierunku patrzenia. Metoda przeznaczona jest tylko
* do rysowania miniaturek figur wzorcowych. Nie ma zastosowania
* w przypadku rysowania w układzie współrzędnych globalnych.
* \param ViewVct - wektor kierunku patrzenia. Wektor skierowany
* jest od oka w kierunku przedmiotu.
* \retval true - jeśli krawędź jest widoczna,
* \retval false - w przypadku przeciwnym.
*/
bool IsVisible(const Vector3f &ViewVct) const
{ return sgn(FaceNormVect() & ViewVct) == -1 ||
sgn(FaceNormVect_Neighbor() & ViewVct) == -1; }
};
/*!
* Wyświetla informacje dotyczące danej krawędzi (współrzędne pierwszego
* i drugiego wierzchołka).
*/
std::ostream &operator << (std::ostream &ostrm,
ViElemePolyhFaceEdge const &EFace);
#endif
|
a3ee367dfef22781e4dd5fef097fd1ca3701d05d
|
16f335f8182e899ba3569baf613e299f6261ead6
|
/server/msfs/FileManager.cpp
|
fa184cac334e8479be82d7ee57e1374d0fee3498
|
[] |
no_license
|
Praying/Puppy
|
ac4593cf9f20b5a87874c2d2a319b91951c63072
|
f8b8cc9391f106f34322ae12d1ca633e2b4b5418
|
refs/heads/master
| 2020-03-16T03:33:23.704628
| 2018-09-09T06:31:57
| 2018-09-09T06:31:57
| 132,489,712
| 0
| 0
| null | null | null | null |
UTF-8
|
C++
| false
| false
| 8,454
|
cpp
|
FileManager.cpp
|
//
// Created by quran on 2018/8/25.
//
#include "FileManager.hpp"
#include "File.hpp"
#include <glog/logging.h>
#include <glog/raw_logging.h>
#include <sys/time.h>
#include <sys/stat.h>
#include "CriticalSection.hpp"
namespace Flow::MsfsServer {
int FileManager::initDir() {
bool isExist = File::isExist(m_disk);
if (!isExist) {
u64 ret = File::mkdirNoRecursion(m_disk);
if (ret) {
LOG(ERROR)<<"The dir["<<m_disk<<"] set error for code["<<ret<<"],its parent dir may no exists";
return -1;
}
}
//255 X 255
char first[10] = {0};
char second[10] = {0};
for (int i = 0; i <= FIRST_DIR_MAX; i++) {
snprintf(first, 5, "%03d", i);
std::string tmp = std::string(m_disk) + "/" + std::string(first);
int code = File::mkdirNoRecursion(tmp.c_str());
if (code && (errno != EEXIST)) {
LOG(ERROR)<<"Create dir["<<tmp<<"] error["<<errno<<"]";
return -1;
}
for (int j = 0; j <= SECOND_DIR_MAX; j++) {
snprintf(second, 5, "%03d", j);
std::string tmp2 = tmp + "/" + std::string(second);
code = File::mkdirNoRecursion(tmp2.c_str());
if (code && (errno != EEXIST)) {
LOG(ERROR)<<"Create dir["<<tmp2<<"] error["<<errno<<"]";
return -1;
}
memset(second, 0x0, 10);
}
memset(first, 0x0, 10);
}
return 0;
}
std::string FileManager::createFileRelatePath() {
char first[10] = {0};
char second[10] = {0};
m_cs.Enter();
snprintf(first, 5, "%03d", (int)getFirstDir());
snprintf(second, 5, "%03d", (int)getSecondDir());
m_cs.Leave();
struct timeval tv;
gettimeofday(&tv,NULL);
u64 usec = tv.tv_sec*1000000 + tv.tv_usec;
u64 tid = (u64)pthread_self();
char unique[40];
snprintf(unique, 30, "%llu_%llu", usec, tid);
std::string path = "/" + std::string(first) + "/" + std::string(second)
+ "/" + std::string(unique);
return std::string(path);
}
int FileManager::uploadFile(const char *type, const void* content, u32 size,
char *url, char *ext) {
//check file size
if (size > MAX_FILE_SIZE_PER_FILE) {
LOG(ERROR)<<"File size["<<size<<"] should less than ["<<MAX_FILE_SIZE_PER_FILE<<"]";
return -1;
}
//append the type suffix
std::string path = createFileRelatePath();
if (ext)
path += "_" + std::string(ext);
else
path += "." + std::string(type);
//construct url with group num
std::string groups("g0");
std::string fullUrl = groups + path;
strncpy(url, fullUrl.c_str(), strlen(fullUrl.c_str()));
//insert std::map file cache
m_cs.Enter();
insertEntry(fullUrl, (u64)size, content);
updateMapCache();
m_cs.Leave();
//open and write file then close
std::string absPath = std::string(m_disk) + path;
File * tmpFile = new File(absPath.c_str());
tmpFile->create();
tmpFile->write(0, size, content);
delete tmpFile;
tmpFile = NULL;
//increase total file sum
m_filesCs.Enter();
m_totFiles++;
m_filesCs.Leave();
return 0;
}
int FileManager::getRelatePathByUrl(const std::string &url, std::string &path) {
std::string::size_type pos = url.find("/");
if (std::string::npos == pos) {
LOG(INFO)<<"Url ["<<url<<"] format illegal.";
return -1;
}
path = url.substr(pos);
return 0;
}
int FileManager::getAbsPathByUrl(const std::string &url, std::string &path) {
std::string relate;
if (getRelatePathByUrl(url, relate)) {
LOG(ERROR)<<"Get path from url["<<url<<"] error";
return -1;
}
path = std::string(m_disk) + relate;
return 0;
}
FileManager::Entry*
FileManager::getOrCreateEntry(const std::string& url, bool create) {
m_cs.Enter();
EntryMap::iterator it = m_map.find(url);
if (it != m_map.end()) {
LOG(ERROR)<<"the std::map has the file while url:"<< url;
m_cs.Leave();
return it->second;
}
if (!create) {
m_cs.Leave();
return NULL;
}
std::string path;
if (getAbsPathByUrl(url, path)) {
LOG(ERROR)<<"Get abs path from url["<<url<<"] error";
m_cs.Leave();
return NULL;
}
struct stat buf;
if(stat(path.c_str(), &buf) == -1)
{
m_cs.Leave();
return NULL;
}
if(!S_ISREG(buf.st_mode))
{
m_cs.Leave();
return NULL;
}
Entry *e = new Entry();
u64 fileSize = File::getFileSize(path.c_str());
e->m_fileSize = fileSize;
e->m_fileContent = new byte[fileSize];
memset(e->m_fileContent, 0x0, fileSize);
e->m_lastAccess = time(NULL);
File* tmpFile = new File(path.c_str());
tmpFile->open();
int ret = tmpFile->read(0, fileSize, e->m_fileContent);
if (ret) {
LOG(ERROR)<<"read file error while url:"<< url;
delete e;
e = NULL;
delete tmpFile;
tmpFile = NULL;
m_cs.Leave();
return NULL;
}
delete tmpFile;
tmpFile = NULL;
std::pair < std::map <std::string, Entry*>::iterator, bool> result;
result = m_map.insert(EntryMap::value_type(url, e));
if (result.second == false) {
LOG(ERROR)<<"Insert url["<<url<<"] to file std::map error";
delete e;
e = NULL;
}
updateMapCache();
m_cs.Leave();
return e;
}
int FileManager::downloadFileByUrl(char *url, void *buf, u32 *size) {
Entry* en = getOrCreateEntry(url, true);
if (!en) {
LOG(ERROR)<<"download file error, while url:"<< url;
return -1;
}
memcpy(buf, en->m_fileContent, en->m_fileSize);
*size = (u32)en->m_fileSize;
en->m_lastAccess = time(NULL);//todo:need prodect with mutex
return 0;
}
void FileManager::updateMapCache() {
size_t currSize = m_map.size();
if (currSize > MAX_FILE_IN_MAP) {
EntryMap::iterator it = m_map.begin();
int times = abs(MAX_FILE_IN_MAP - currSize);
while (it != m_map.end() && times) {
delete it->second;
m_map.erase(it++);
times--;
}
it = m_map.begin();
while (it != m_map.end() && times) {
time_t currTime = time(NULL);
if(currTime - it->second->m_lastAccess > 2*60*60) {
delete it->second;
m_map.erase(it++);
}
}
}
}
int FileManager::insertEntry(const std::string& url, size_t fileSize,
const void* content) {
if (m_map.size()) {
EntryMap::iterator it = m_map.find(url);
if (it != m_map.end())
return -1;
}
Entry *e = new Entry();
e->m_fileSize = fileSize;
e->m_fileContent = new byte[fileSize];
e->m_lastAccess = time(NULL);
memcpy(e->m_fileContent, content, fileSize);
m_cs.Enter();
std::pair< std::map<std::string, Entry*>::iterator, bool> ret;
ret = m_map.insert(EntryMap::value_type(url, e));
if (ret.second == false) {
delete e;
e = NULL;
}
updateMapCache();
m_cs.Leave();
return 0;
}
void FileManager::releaseFileCache(const std::string& url) {
m_cs.Enter();
const Entry* entry = getEntry(url);
if (!entry) {
LOG(ERROR)<<"std::map has not the url::"<< url;
m_cs.Leave();
return;
}
delete [] entry->m_fileContent;
m_map.erase(url);
m_cs.Leave();
return;
}
}
|
46dc419b3f370e89c8d85e52071c48a8d0f14409
|
61bfe506ead460fc3896fd16001ffd1250977fde
|
/Qt/calculator/qt_calculator.cpp
|
8a1be89646f619ba9157a0a509294db82231b6f5
|
[] |
no_license
|
jasonleakey/CrapCodes
|
9de63eb033a25dd2e6f288c3e293861d4fabf130
|
8ea109c242356a020c9c9d094f90632b6a7e98af
|
refs/heads/master
| 2021-01-20T06:57:03.907537
| 2013-03-18T05:48:44
| 2013-03-18T05:48:44
| 8,847,779
| 1
| 0
| null | null | null | null |
UTF-8
|
C++
| false
| false
| 1,457
|
cpp
|
qt_calculator.cpp
|
/*
* CPP_practice - TODO
*
* Feb 6, 2010
* Copyleft(R) by jasonleakey
* <jasonleakey@gmail.com>
* --------------------------------------------------------------------
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
* MA 02110-1301, USA.
* --------------------------------------------------------------------
*/
#include "qt_calculator.h"
#include <QtUiTools>
QT_calculator::QT_calculator(QWidget *parent)
: QWidget(parent)
{
ui.setupUi(this);
}
QT_calculator::~QT_calculator()
{
}
void QT_calculator::on_doubleSpinBox_valueChanged(double value)
{
ui.label_6->setText(QString::number(value + ui.doubleSpinBox_2->value()));
}
void QT_calculator::on_doubleSpinBox_2_valueChanged(double value)
{
ui.label_6->setText(QString::number(value + ui.doubleSpinBox->value()));
}
|
5820852b50b62a73685c46fb1b4af2c0dd146547
|
de80268cf13a3acae311984d49c26ba34ac3e571
|
/Sources/UICore/Display/Window/display_window_provider.h
|
b1b5621c6fbdd3c4efa9471d8ad0e8dc45ed48c2
|
[
"Zlib"
] |
permissive
|
rombust/UICore
|
f5930fa133d13101b3e9ea5ae68d37d59c30f795
|
e643b83147b7818eb5d34d311676fde6ddf54abe
|
refs/heads/master
| 2021-01-24T01:22:16.232890
| 2019-05-29T11:52:22
| 2019-05-29T11:52:22
| 44,157,623
| 1
| 0
| null | 2015-10-13T06:51:27
| 2015-10-13T06:51:27
| null |
UTF-8
|
C++
| false
| false
| 8,949
|
h
|
display_window_provider.h
|
/*
** UICore
** Copyright (c) 1997-2015 The UICore Team
**
** This software is provided 'as-is', without any express or implied
** warranty. In no event will the authors be held liable for any damages
** arising from the use of this software.
**
** Permission is granted to anyone to use this software for any purpose,
** including commercial applications, and to alter it and redistribute it
** freely, subject to the following restrictions:
**
** 1. The origin of this software must not be misrepresented; you must not
** claim that you wrote the original software. If you use this software
** in a product, an acknowledgment in the product documentation would be
** appreciated but is not required.
** 2. Altered source versions must be plainly marked as such, and must not be
** misrepresented as being the original software.
** 3. This notice may not be removed or altered from any source distribution.
**
** Note: Some of the libraries UICore may link to may have additional
** requirements or restrictions.
**
** File Author(s):
**
** Magnus Norddahl
** Harry Storbacka
** Kenneth Gangstoe
*/
#pragma once
#include "UICore/Core/Signals/signal.h"
#include "UICore/Display/Window/display_window.h"
#include "UICore/Core/Math/rect.h"
#include "UICore/Core/Math/size.h"
#include <memory>
namespace uicore
{
class Size;
class Point;
class DisplayWindowDescription;
class GraphicContext;
class InputDevice;
class Cursor;
class CursorDescription;
class DisplayWindowProvider : public DisplayWindow
{
public:
virtual Rect backing_geometry() const = 0;
virtual Rect backing_viewport() const = 0;
virtual Size backing_minimum_size(bool client_area) const = 0;
virtual Size backing_maximum_size(bool client_area) const = 0;
virtual Point backing_client_to_screen(const Point &client) = 0;
virtual Point backing_screen_to_client(const Point &screen) = 0;
virtual void set_backing_position(const Rect &pos, bool client_area) = 0;
virtual void set_backing_size(int width, int height, bool client_area) = 0;
virtual void set_backing_minimum_size(int width, int height, bool client_area) = 0;
virtual void set_backing_maximum_size(int width, int height, bool client_area) = 0;
virtual void backing_enable_alpha_channel(const Rect &blur_rect) = 0;
virtual void backing_extend_frame_into_client_area(int left, int top, int right, int bottom) = 0;
virtual float pixel_ratio() const = 0;
virtual void backing_flip(int interval) = 0;
virtual std::shared_ptr<Cursor> create_cursor(const CursorDescription &cursor_description) = 0;
Signal<void()> &sig_lost_focus() override { return _sig_lost_focus; }
Signal<void()> &sig_got_focus() override { return _sig_got_focus; }
Signal<void(float, float)> &sig_resize() override { return _sig_resize; }
Signal<void()> &sig_paint() override { return _sig_paint; }
Signal<void()> &sig_window_close() override { return _sig_window_close; }
Signal<void()> &sig_window_destroy() override { return _sig_window_destroy; }
Signal<void()> &sig_window_minimized() override { return _sig_window_minimized; }
Signal<void()> &sig_window_maximized() override { return _sig_window_maximized; }
Signal<void()> &sig_window_restored() override { return _sig_window_restored; }
Signal<void()> &sig_window_moved() override { return _sig_window_moved; }
Signal<void()> &sig_window_flip() override { return _sig_window_flip; }
std::function<void(Rectf &)> &func_window_resize() override { return _func_window_resize; }
std::function<bool()> &func_minimize_clicked() override { return _func_minimize_clicked; }
#ifdef WIN32
std::function<bool(HWND, UINT, WPARAM, LPARAM)> &func_window_message() override { return _func_window_message; }
Signal<void(HWND, UINT, WPARAM, LPARAM)> &sig_window_message() override { return _sig_window_message; }
#endif
virtual void show_system_cursor() = 0;
virtual void hide_system_cursor() = 0;
void show_cursor() override { show_system_cursor(); }
void hide_cursor() override { hide_system_cursor(); }
Rectf geometry() const override
{
Rect geometryi = backing_geometry();
Rectf geometry;
geometry.left = geometryi.left / pixel_ratio();
geometry.top = geometryi.top / pixel_ratio();
geometry.right = geometryi.right / pixel_ratio();
geometry.bottom = geometryi.bottom / pixel_ratio();
return geometry;
}
Rectf viewport() const override
{
Rect viewporti = backing_viewport();
Rectf viewport;
viewport.left = viewporti.left / pixel_ratio();
viewport.top = viewporti.top / pixel_ratio();
viewport.right = viewporti.right / pixel_ratio();
viewport.bottom = viewporti.bottom / pixel_ratio();
return viewport;
}
Sizef minimum_size(bool client_area) override
{
Size sizei = backing_minimum_size(client_area);
Sizef sizef;
sizef.width = sizei.width / pixel_ratio();
sizef.height = sizei.height / pixel_ratio();
return sizef;
}
Sizef maximum_size(bool client_area) override
{
Size sizei = backing_maximum_size(client_area);
Sizef sizef;
sizef.width = sizei.width / pixel_ratio();
sizef.height = sizei.height / pixel_ratio();
return sizef;
}
Pointf client_to_screen(const Pointf &client) override
{
Point clienti;
clienti.x = (int)std::round(client.x * pixel_ratio());
clienti.y = (int)std::round(client.y * pixel_ratio());
Point screeni = backing_client_to_screen(clienti);
Pointf screen;
screen.x = screeni.x / pixel_ratio();
screen.y = screeni.y / pixel_ratio();
return screen;
}
Pointf screen_to_client(const Pointf &screen) override
{
Point screeni;
screeni.x = (int)std::round(screen.x * pixel_ratio());
screeni.y = (int)std::round(screen.y * pixel_ratio());
Point clienti = backing_screen_to_client(screeni);
Pointf client;
client.x = clienti.x / pixel_ratio();
client.y = clienti.y / pixel_ratio();
return client;
}
void set_position(const Rectf &rect, bool client_area) override
{
Rect recti;
recti.left = (int)std::round(rect.left * pixel_ratio());
recti.top = (int)std::round(rect.top * pixel_ratio());
recti.right = (int)std::round(rect.right * pixel_ratio());
recti.bottom = (int)std::round(rect.bottom * pixel_ratio());
set_backing_position(recti, client_area);
}
void set_position(float x, float y) override
{
int xi = (int)std::round(x * pixel_ratio());
int yi = (int)std::round(y * pixel_ratio());
Rect geometry = backing_geometry();
set_backing_position(Rect(xi, yi, xi + geometry.width(), yi + geometry.height()), false);
}
void set_size(float width, float height, bool client_area) override
{
int widthi = (int)std::round(width * pixel_ratio());
int heighti = (int)std::round(height * pixel_ratio());
set_backing_size(widthi, heighti, client_area);
}
void set_minimum_size(float width, float height, bool client_area) override
{
int widthi = (int)std::round(width * pixel_ratio());
int heighti = (int)std::round(height * pixel_ratio());
set_backing_minimum_size(widthi, heighti, client_area);
}
void set_maximum_size(float width, float height, bool client_area) override
{
int widthi = (int)std::round(width * pixel_ratio());
int heighti = (int)std::round(height * pixel_ratio());
set_backing_maximum_size(widthi, heighti, client_area);
}
void enable_alpha_channel(const Rectf &blur_rect) override
{
Rect blur_recti;
blur_recti.left = (int)std::round(blur_rect.left * pixel_ratio());
blur_recti.top = (int)std::round(blur_rect.top * pixel_ratio());
blur_recti.right = (int)std::round(blur_rect.right * pixel_ratio());
blur_recti.bottom = (int)std::round(blur_rect.bottom * pixel_ratio());
backing_enable_alpha_channel(blur_recti);
}
void extend_frame_into_client_area(float left, float top, float right, float bottom) override
{
int lefti = (int)std::round(left * pixel_ratio());
int topi = (int)std::round(top * pixel_ratio());
int righti = (int)std::round(right * pixel_ratio());
int bottomi = (int)std::round(bottom * pixel_ratio());
backing_extend_frame_into_client_area(lefti, topi, righti, bottomi);
}
void flip(int interval) override
{
_sig_window_flip();
backing_flip(interval);
}
private:
Signal<void()> _sig_lost_focus;
Signal<void()> _sig_got_focus;
Signal<void(float, float)> _sig_resize;
Signal<void()> _sig_paint;
Signal<void()> _sig_window_close;
Signal<void()> _sig_window_destroy;
Signal<void()> _sig_window_minimized;
Signal<void()> _sig_window_maximized;
Signal<void()> _sig_window_restored;
std::function<void(Rectf &)> _func_window_resize;
std::function<bool()> _func_minimize_clicked;
Signal<void()> _sig_window_moved;
Signal<void()> _sig_window_flip;
#ifdef WIN32
std::function<bool(HWND, UINT, WPARAM, LPARAM)> _func_window_message;
Signal<void(HWND, UINT, WPARAM, LPARAM)> _sig_window_message;
#endif
};
}
|
4d4efb553b755aa26ed17254f32890a35e6149ef
|
91a882547e393d4c4946a6c2c99186b5f72122dd
|
/Source/XPSP1/NT/admin/wmi/wbem/sdk/samples/nondistrib/servev/servlist.h
|
a034e9b0566f0eda8cc02cd6e2b592598e1569d9
|
[] |
no_license
|
IAmAnubhavSaini/cryptoAlgorithm-nt5src
|
94f9b46f101b983954ac6e453d0cf8d02aa76fc7
|
d9e1cdeec650b9d6d3ce63f9f0abe50dabfaf9e2
|
refs/heads/master
| 2023-09-02T10:14:14.795579
| 2021-11-20T13:47:06
| 2021-11-20T13:47:06
| null | 0
| 0
| null | null | null | null |
UTF-8
|
C++
| false
| false
| 459
|
h
|
servlist.h
|
// Copyright (c) 1997-2001 Microsoft Corporation, All Rights Reserved
#ifndef __SERV_LIST__H_
#define __SERV_LIST__H_
#include <windows.h>
class CServiceList
{
public:
CServiceList();
~CServiceList();
void AddService(LPCWSTR wszService);
int GetSize();
LPCWSTR GetService(int nIndex);
void Sort();
private:
int m_nSize;
LPWSTR* m_awszServices;
static int __cdecl compare(const void* arg1, const void* arg2);
};
#endif
|
2b3786b1add930939bb0a5f45a8e8ae93c50cb11
|
1821098f7d9a73490d02b6cf586f902fced8271b
|
/HW8 5.cpp
|
0e4ac1eeef98de786d5b09da63bb3ba92ef841e9
|
[] |
no_license
|
savinduharith-SDL/Homework-8
|
34d2a54bb78b8a785037e756dbbb6a0eaf0c133a
|
df6fe2f979ff449b7f17860711927e23bda5664a
|
refs/heads/main
| 2023-08-14T12:20:55.869512
| 2021-10-03T12:24:02
| 2021-10-03T12:24:02
| null | 0
| 0
| null | null | null | null |
UTF-8
|
C++
| false
| false
| 250
|
cpp
|
HW8 5.cpp
|
#include<iostream>
using namespace std;
//function to print pointer
void pointerPrinter(int *a)
{
cout << *a << endl;
}
int main()
{
int x;
//user input
cout << "Enter number: ";
cin >> x;
//function call
pointerPrinter(&x);
return 0;
}
|
453d9154f15452b1488fa2139232f35e60632380
|
a2dacbcedd956acfdad0957ecf0497cfad7d1f80
|
/GlutSpielfeld.h
|
09d3b2e8247cf31389185e320bfe31a3fc4b9eed
|
[] |
no_license
|
google-code/3d4wins
|
da60c2d6ab3d487c7424c7b19a01c28ff8c7ee5e
|
da16835c6bcb226086bc1405e1893f8193e2888a
|
refs/heads/master
| 2016-09-05T09:51:34.226542
| 2015-03-13T15:19:43
| 2015-03-13T15:19:43
| 32,163,339
| 0
| 0
| null | null | null | null |
WINDOWS-1252
|
C++
| false
| false
| 704
|
h
|
GlutSpielfeld.h
|
#ifndef SPIELFELD_H
#define SPIELFELD_H
#include "GlutObjekt.h"
#include "RGB.h"
#include "RGBA.h"
/**
Dieser Experte stellt ein Spielfeld da. Dieses ist ein reines Brett ohne Muster und ohne Stäbe.
*/
class GlutSpielfeld : public GlutObjekt {
private:
int anzahlSpielfeldPunkte;
public:
GlutSpielfeld();
GlutSpielfeld(Koordinate standort, double groesse, DrehFaktor drehFaktor, double rotT, double gruenT, double blauT, double alphaT, double rotN, double gruenN, double blauN, int anzahlSpielfeldPunkte);
int getAnzahlSpielfeldPunkte();
void draw_transparenz_part();
void draw_normal_part();
Koordinate getPosition(int laenge, int breite);
};
#endif
|
5c56b907dda76d2daea6e1bfc2bffb661e786073
|
a8fa56874784c26ee268b0a0d14c69ee27bf2905
|
/source/apps/quadwar/view/camera.h
|
b0c2fa99765b57fe62a948c7a143c5f30cb360d5
|
[
"MIT"
] |
permissive
|
ogryzko/laplace
|
00d89ee0b68153d1470781298009dc7fc61165aa
|
be63caa0c6d1c4fceab02ab5b41b6d307ef7baaf
|
refs/heads/main
| 2023-08-27T13:36:27.634379
| 2021-09-21T06:17:02
| 2021-09-21T06:17:02
| 416,058,413
| 0
| 0
| null | null | null | null |
UTF-8
|
C++
| false
| false
| 1,470
|
h
|
camera.h
|
/* apps/quadwar/view/camera.h
*
* Copyright (c) 2021 Mitya Selivanov
*
* This file is part of the Laplace project.
*
* Laplace 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 MIT License for more details.
*/
#ifndef quadwar_view_camera_h
#define quadwar_view_camera_h
#include "defs.h"
namespace quadwar_app::view {
class camera {
public:
static const real default_grid_scale;
static const real default_scale;
void set_grid_scale(const real scale) noexcept;
void set_frame(const vec2 size) noexcept;
void set_bounds(const vec2 v0, const vec2 v1) noexcept;
void set_scale(const real scale) noexcept;
void set_position(const vec2 v) noexcept;
[[nodiscard]] auto get_grid_scale() const noexcept -> real;
[[nodiscard]] auto get_position() const noexcept -> vec2;
[[nodiscard]] auto get_frame() const noexcept -> vec2;
[[nodiscard]] auto get_scale() const noexcept -> real;
struct transform {
vec2 position;
vec2 scale;
};
[[nodiscard]] auto get_transform() const noexcept -> transform;
private:
void adjust_position(const vec2 v) noexcept;
real m_grid_scale = default_grid_scale;
real m_scale = default_scale;
vec2 m_position;
vec2 m_position_origin;
vec2 m_frame;
vec2 m_min;
vec2 m_max;
};
}
#endif
|
5be4233dad473aff77c5a7541fb2064d6068eb54
|
be5deeb6b3c353591d414926b3470b9db1023983
|
/serial/Function.h
|
d93183863bc9536ed9a2bf8dd4835cab2bb5fae2
|
[] |
no_license
|
m-rahimi/Liquid-Crystal
|
55f8637177506d28ee78f775f1e5ac5311844b32
|
cc2feba2a1743f02238420b3a8fd688785b8568e
|
refs/heads/master
| 2021-01-11T19:52:37.693813
| 2017-02-14T05:09:04
| 2017-02-14T05:09:04
| 79,413,472
| 0
| 0
| null | null | null | null |
UTF-8
|
C++
| false
| false
| 920
|
h
|
Function.h
|
/*
* File: Function.h
* Author: amin
*
* Created on May 4, 2015, 9:05 AM
*/
#ifndef FUNCTION_H
#define FUNCTION_H
#include "Points_bulk.h"
#include "Parameter.h"
class Function {
public:
float Q2[6];
float tr1,tr2,tr3;
float grad[18];
float doubledot;
float dotd[6];
float dLdG[6], dEl1[6], dchiral[6];
Function();
Function(const Function& orig);
virtual ~Function();
void trace(Points_bulk * const pbulk);
void gradient(Points_bulk * const pbulk, float dx2);
void LdG(Points_bulk * const pbulk);
void grad_LdG(Points_bulk * const pbulk, float UU);
void grad_El1(Points_bulk * const pbulk, float ddx);
void grad_chiral(Points_bulk * const pbulk, float qch);
private:
const float fac[6] = {1.0,2.0,2.0,1.0,2.0,1.0};
const float delta[6] = {0.333333333, 0.0, 0.0, 0.333333333, 0.0, 0.333333333};
float a0,a3;
};
#endif /* FUNCTION_H */
|
6b4bf4020f1bb673819c92ce3148488636188e8d
|
33fa13fe1708415802e1e5d0876359ee06f5d8f7
|
/FCFS_priority.cpp
|
27d1a4d71849f4882f70c4f594230e915909216d
|
[] |
no_license
|
Nayeem123/OS_PROJECT
|
4ff2edb90273f743da085c9e15743c9674b4e7fc
|
ce3bee3dc6b7cdab36f1ca813e00e02dd8213ad6
|
refs/heads/master
| 2020-03-07T14:15:45.516308
| 2018-04-09T23:02:23
| 2018-04-09T23:02:23
| 127,522,357
| 0
| 0
| null | null | null | null |
UTF-8
|
C++
| false
| false
| 965
|
cpp
|
FCFS_priority.cpp
|
//sorting in arrivaltime ||||||||||||||||||||||||||
void swap(int id[],int at[],int bt[],int n){
int ind,min,k,f,i,j,m;
for(i=0;i<n;i++){
m=at[i];
ind=i;
for(int j=i+1;j<n;j++){
if(at[j]<m){
ind=j;
m=at[j];
}
}
//printf("%d\t",m);
min=at[i];
at[i]=at[ind];
at[ind]=min;
min=id[i];
id[i]=id[ind];
id[ind]=min;
min=bt[i];
bt[i]=bt[ind];
bt[ind]=min;
}
}
//priority scheduling |||||||||||||||||||||||||||||||||
int f1[e1],r1=0;
for(int i=0;i<b;i++)
{
while(bt2[i]!=0)
{
f1[r1++]=id2[i];
bt2[i]=bt2[i]-1;
}
}
printf("\n\n\n");
for(int i=0;i<e1;i++)
{
printf("%d\t",f1[i]);
}
// FCFS scheduling.......||||||||||||||||||||||||
int f2[o];
int r3=0;
for(int i=0;i<c;i++)
{
while(bt3[i]!=0)
{
f2[r3++]=id3[i];
bt3[i]=bt3[i]-1;
}
}
for(int i=0;i<o;i++)
{
printf("%d\t",f2[i]);
}
|
4b753521ba5e677d8e6443b0a2e343b0eb9e0617
|
516e6cf51c197363deb861a0c02654857aa69e33
|
/Spark/include/Transition/DoubleValueInterpreter.hpp
|
c37dba0c36aa8ff1e5461c5fd3c47e1adee65a75
|
[] |
no_license
|
MyFriendTames/Spark-0.0.1
|
a2f6117ac8eb38b9161703e4c18db04a331aa272
|
d1895a9c8426e824abd9d0e509cd34efd1d93c84
|
refs/heads/master
| 2023-02-09T14:44:12.687537
| 2021-01-06T16:40:11
| 2021-01-06T16:40:11
| 273,329,726
| 0
| 0
| null | null | null | null |
UTF-8
|
C++
| false
| false
| 493
|
hpp
|
DoubleValueInterpreter.hpp
|
#ifndef DOUBLE_VALUE_INTERPRETER_HPP
#define DOUBLE_VALUE_INTERPRETER_HPP
#include "Transition/Transition.hpp"
class DoubleValueInterpreter{
private:
double v1;
double v2;
public:
DoubleValueInterpreter( const double &v1 = 0, const double &v2 = 1 );
void setValue1( const double &v1 );
double getValue1();
void setValue2( const double &v2 );
double getValue2();
double operator () ( Transition &transition );
};
#endif
|
a581ee14fdb5c85ac8ad1b0c2b29efa434c5ffd6
|
0a55ecd43e9b1220a0dee704f090a2dff4ee95d0
|
/main.cpp
|
016becd09240f809fc9c77d925dd4d0ccec2ca00
|
[] |
no_license
|
xxvms/ReadingFileYT
|
f2847bab07d86d8ab61408535ffb06f2538145de
|
37073f538e3d7ec143997be7b7f935bddd58e77a
|
refs/heads/master
| 2020-06-27T22:54:35.543680
| 2017-06-13T20:19:20
| 2017-06-13T20:19:20
| 94,254,060
| 0
| 0
| null | null | null | null |
UTF-8
|
C++
| false
| false
| 344
|
cpp
|
main.cpp
|
#include <iostream>
#include <fstream>
int main() {
std::ifstream object("test.txt");
int a, b;
if(object.is_open())
{
object >> a >> b;
std::cout << "Total: " << a + b;
}
object.close();
std::ofstream object1("test.txt");
std::string abc{"hello world"};
object1 << abc;
return 0;
}
|
f51c1ceb8f3118172c4c4cf4ec103048100c5b1f
|
c78c926155760aa63d24ad26b3356f6d19398f69
|
/NEUQOJ/实验班/双周练/第3次双周练(华东师范校赛)/黑心啤酒厂.cpp
|
11c2359d66c8df33287aea3122ae7c4cd561740b
|
[] |
no_license
|
fhyPayaso/ACM
|
34c26aff0697ef0e7956cd03e30f13739a286466
|
0c7f4bf298e9a164f8a5ae140f30f441ccc226dc
|
refs/heads/master
| 2021-08-30T05:04:53.518780
| 2017-12-16T03:39:10
| 2017-12-16T03:39:10
| 114,429,801
| 1
| 1
| null | null | null | null |
UTF-8
|
C++
| false
| false
| 261
|
cpp
|
黑心啤酒厂.cpp
|
#include<iostream>
using namespace std;
int gcd(int a,int b)
{
int t;
while(b)
{
int t=a%b;
a=b;
b=t;
}
return a;
}
int main()
{
int x,n;
scanf("%d%d",&x,&n);
for(int p=2;p<=n;p++)
{
int t=gcd(x,p);
cout<<p/t<<endl;
}
return 0;
}
|
d52948d9901919737484faf8fac52b9db5829102
|
b7fe23d660cc9154f32758d9f897412b3ad5d90c
|
/src/PileupInfo.cc
|
67ab7df2a0f0930fef9696f48b28def68362150c
|
[] |
no_license
|
ICHiggsInv/ICHiggsTauTau
|
d0574ab67f74183beb041088695bb0ad27f91042
|
80f1f311906c693f526e00d54b716a526759333c
|
refs/heads/master
| 2021-01-18T01:25:30.589341
| 2015-04-16T10:40:29
| 2015-04-16T10:40:29
| 23,577,742
| 0
| 1
| null | 2014-09-25T14:08:26
| 2014-09-02T12:28:21
|
C++
|
UTF-8
|
C++
| false
| false
| 302
|
cc
|
PileupInfo.cc
|
#include "UserCode/ICHiggsTauTau/interface/PileupInfo.hh"
namespace ic {
//Constructors/Destructors
PileupInfo::PileupInfo() {
num_interactions_ = 0;
bunch_crossing_ = 0;
true_num_interactions_ = 0;
}
PileupInfo::~PileupInfo() {
}
void PileupInfo::Print() const {
}
}
|
3159894e576f19fdd0f0ba0a3346a7b9ddbb9d51
|
d50b3cf185f19206cc04657efb39e441f8e5ac59
|
/GameTemplate/Game/Archer/State/ArcherIdleState.h
|
e3341781a2ada8077b11f64a42e8b25a9d29c730
|
[] |
no_license
|
kaito1111/GameTemplete
|
bf908fe837c7777dd8e6b34dc9a2399f8e044646
|
b752228adae4913c831c32270a9a700e72b597fd
|
refs/heads/master
| 2023-08-24T21:10:48.896577
| 2021-10-14T05:21:51
| 2021-10-14T05:21:51
| 278,224,007
| 0
| 0
| null | null | null | null |
SHIFT_JIS
|
C++
| false
| false
| 556
|
h
|
ArcherIdleState.h
|
#pragma once
#include "Archer/Archer.h"
/// <summary>
/// アーチャーが待機状態に呼ばれる関数
/// 継承を使って利用する
/// </summary>
class ArcherIdleState : public IArcherState
{
public:
/// <summary>
/// コンストラクタ
/// IArcherStateにArcherのポインタを渡している
/// </summary>
/// <param name="a">アーチャーポインタ</param>
ArcherIdleState(Archer* a) :
IArcherState(a){}
private:
/// <summary>
/// 毎フレーム呼ばれる更新処理。
/// </summary>
void Update()override;
};
|
e7838284d8421382908232e1cb50cc29d16bd0b2
|
a57549946f0425d1fd0ca9825a62e78a953b771f
|
/src/CRationalNumber/Rational.cpp
|
ce4019dd8e5ee13229ed1fc2aafd18b2d6317f43
|
[] |
no_license
|
DolgushevEvgeny/Lab5
|
e9941917f0e55e7a4e71f5d3b4519bcc2c6797fa
|
6f0a056104824e2a3c3a075157c767510c029d81
|
refs/heads/master
| 2020-06-02T09:24:05.777464
| 2015-04-24T19:37:24
| 2015-04-24T19:37:24
| 34,537,977
| 0
| 0
| null | null | null | null |
UTF-8
|
C++
| false
| false
| 6,660
|
cpp
|
Rational.cpp
|
#include "stdafx.h"
#include "Rational.h"
#include <algorithm>
#include <iostream>
#include <string>
CRational::CRational()
: m_numerator(0)
, m_denominator(1)
{
}
CRational::CRational(int numerator)
: m_numerator(numerator)
, m_denominator(1)
{
}
CRational::CRational(int numerator, int denominator)
: m_numerator(numerator)
, m_denominator(denominator)
{
m_numerator = denominator < 0 ? -m_numerator : m_numerator;
m_denominator = denominator < 0 ? -m_denominator : m_denominator;
int commonDenominator = GCD(numerator, denominator);
m_numerator /= commonDenominator;
m_denominator /= commonDenominator;
}
double CRational::ToDouble() const
{
return (double)m_numerator / (double)m_denominator;
}
int CRational::GetNumerator() const
{
return m_numerator;
}
int CRational::GetDenominator() const
{
return m_denominator;
}
CRational const CRational::operator -() const
{
return CRational(-m_numerator, m_denominator);
}
CRational const CRational::operator +() const
{
return *this;
}
const CRational operator - (const CRational &num1, const CRational &num2)
{
CRational first(num1);
CRational second(num2);
LeadToCommonDenominator(first, second);
CRational result(first.GetNumerator() - second.GetNumerator(), first.GetDenominator());
int commonDenominator = GCD(result.GetNumerator(), result.GetDenominator());
return CRational((first.GetNumerator() - second.GetNumerator()) / commonDenominator, first.GetDenominator() / commonDenominator);
}
const CRational operator + (const CRational &num1, const CRational &num2)
{
CRational first(num1);
CRational second(num2);
LeadToCommonDenominator(first, second);
CRational result(first.GetNumerator() + second.GetNumerator(), first.GetDenominator());
int commonDenominator = GCD(result.GetNumerator(), result.GetDenominator());
return CRational((first.GetNumerator() + second.GetNumerator()) / commonDenominator, first.GetDenominator() / commonDenominator);
}
const CRational operator * (const CRational &num1, const CRational &num2)
{
CRational result(num1.GetNumerator() * num2.GetNumerator(), num1.GetDenominator() * num2.GetDenominator());
int commonDenominator = GCD(result.GetNumerator(), result.GetDenominator());
return CRational(result.GetNumerator() / commonDenominator, result.GetDenominator() / commonDenominator);
}
const CRational operator / (const CRational &num1, const CRational &num2)
{
CRational result(num1.GetNumerator() * num2.GetDenominator(), num1.GetDenominator() * num2.GetNumerator());
int commonDenominator = GCD(result.GetNumerator(), result.GetDenominator());
return CRational(result.GetNumerator() / commonDenominator, result.GetDenominator() / commonDenominator);
}
CRational& CRational::operator += (CRational const& rational)
{
CRational second(rational);
LeadToCommonDenominator(*this, second);
m_numerator += second.m_numerator;
int commonDenominator = GCD(m_numerator, m_denominator);
m_numerator /= commonDenominator;
m_denominator /= commonDenominator;
return *this;
}
CRational& CRational::operator -= (CRational const &rational)
{
CRational second(rational);
LeadToCommonDenominator(*this, second);
m_numerator -= second.m_numerator;
int commonDenominator = GCD(m_numerator, m_denominator);
m_numerator /= commonDenominator;
m_denominator /= commonDenominator;
return *this;
}
CRational& CRational::operator *= (CRational const &rational)
{
int commonDenominator = GCD(m_numerator *= rational.m_numerator, m_denominator *= rational.m_denominator);
m_numerator /= commonDenominator;
m_denominator /= commonDenominator;
return *this;
}
CRational& CRational::operator /= (CRational const &rational)
{
int commonDenominator = GCD(m_numerator *= rational.m_denominator, m_denominator *= rational.m_numerator);
m_numerator /= commonDenominator;
m_denominator /= commonDenominator;
return *this;
}
const bool operator == (const CRational &num1, const CRational &num2)
{
return (num1.GetNumerator() == num2.GetNumerator() && num1.GetDenominator() == num2.GetDenominator());
}
const bool operator != (const CRational &num1, const CRational &num2)
{
return !(num1 == num2);
}
const bool operator < (const CRational &num1, const CRational &num2)
{
CRational first(num1);
CRational second(num2);
LeadToCommonDenominator(first, second);
return (first.GetNumerator() < second.GetNumerator());
}
const bool operator <= (const CRational &num1, const CRational &num2)
{
return (!(num1 > num2));
}
const bool operator > (const CRational &num1, const CRational &num2)
{
CRational first(num1);
CRational second(num2);
LeadToCommonDenominator(first, second);
return (first.GetNumerator() > second.GetNumerator());
}
const bool operator >= (const CRational &num1, const CRational &num2)
{
return (!(num1 < num2));
}
std::istream & operator >>(std::istream & is, CRational &rational)
{
int numerator = 0, denominator = 0;
if ((is >> numerator) && (is.get() == '/') && (is >> denominator))
{
rational = CRational(numerator, denominator);
}
return is;
}
std::ostream & operator << (std::ostream & os, const CRational &rational)
{
os << rational.GetNumerator() << "/" << rational.GetDenominator();
return os;
}
int GCD(int a, int b)
{
int curA = abs(a), curB = abs(b);
while (curA != 0 && curB != 0)
{
int newA = curB % curA;
int newB = curA;
curA = newA;
curB = newB;
}
const int maxVal = std::max(curA, curB);
return (maxVal == 0) ? 1 : maxVal;
}
void LeadToCommonDenominator(CRational &first, CRational &second)
{
int firstDenom = first.GetDenominator();
int secondDenom = second.GetDenominator();
if (firstDenom == secondDenom)
{
return;
}
if ((firstDenom % secondDenom) == 0)
{
int multiplier = firstDenom / secondDenom;
second.m_denominator *= multiplier;
second.m_numerator *= multiplier;
return;
}
if ((secondDenom % firstDenom) == 0)
{
int multiplier = secondDenom / firstDenom;
first.m_denominator *= multiplier;
first.m_numerator *= multiplier;
return;
}
first.m_denominator *= secondDenom;
first.m_numerator *= secondDenom;
second.m_denominator *= firstDenom;
second.m_numerator *= firstDenom;
return;
}
std::pair<int, CRational> CRational::ToCompoundFraction() const
{
std::pair<int, CRational> compound;
CRational rational(*(this));
compound.first = m_numerator / m_denominator;
rational.m_numerator -= (compound.first * m_denominator);
compound.second = rational;
return compound;
}
CRational Normalize(int numerator, int denominator, CRational &rational)
{
int commonDenominator = GCD(numerator, denominator);
rational.m_numerator /= commonDenominator;
rational.m_denominator /= commonDenominator;
return rational;
}
|
0078d25ec03341832dae90b76086f8f2d4918a2a
|
b03b9303eb038cc5948901c1383bf8c69dcfb2b2
|
/A_Helpful_Maths.cpp
|
edf00b992aec0c46499351a498168afc3d9a252f
|
[] |
no_license
|
Amit-45/code-forces
|
5829b4b5cb739b2922a027de3a9adf70d07ca195
|
748cf9a61da2464a701a3f5f8a0ad22cc6e6e10c
|
refs/heads/main
| 2023-07-17T07:23:05.588078
| 2021-09-02T17:22:25
| 2021-09-02T17:22:25
| 362,148,897
| 0
| 0
| null | null | null | null |
UTF-8
|
C++
| false
| false
| 845
|
cpp
|
A_Helpful_Maths.cpp
|
#include <bits/stdc++.h>
using namespace std;
int main()
{
string x;
cin >> x;
int c1 = 0;
int c2 = 0;
int c3 = 0;
string resultString = "";
for (int i = 0; i < x.length(); i++)
{
if (x[i] == '1')
{
c1++;
}
if (x[i] == '2')
{
c2++;
}
if (x[i] == '3')
{
c3++;
}
}
while (c1--)
{
resultString = resultString + "1+";
}
while (c2--)
{
resultString = resultString + "2+";
}
while (c3--)
{
resultString = resultString + "3+";
}
//resultString = resultString.substr(0, resultString.length() - 1);
resultString = resultString.erase(resultString.length() - 1);
cout << resultString << "\n";
}
|
e9927bc71247b122ad86fa41424c3abdf7ec8373
|
c81a121bca0dbe68d41ef183f72b2d9f99623adf
|
/src/offb_node.cpp
|
7cc1559cc0db361692f661abe50b7a6a202f6167
|
[] |
no_license
|
ch-jwoo/pathmaker
|
0f679c24d492b390c2720565be3dd02dd93ec871
|
bf68c21ef02d6f6a6ac6fd4a204804ddc7504a60
|
refs/heads/master
| 2022-04-11T22:58:58.241700
| 2020-02-08T07:53:01
| 2020-02-08T07:53:01
| 236,493,657
| 0
| 0
| null | null | null | null |
UTF-8
|
C++
| false
| false
| 4,429
|
cpp
|
offb_node.cpp
|
/**
* @file offb_node.cpp
* @brief Offboard control example node, written with MAVROS version 0.19.x, PX4 Pro Flight
* Stack and tested in Gazebo SITL
*/
#include <ros/ros.h>
#include <geometry_msgs/PoseStamped.h>
#include <geometry_msgs/Twist.h>
#include <mavros_msgs/CommandBool.h>
#include <mavros_msgs/SetMode.h>
#include <mavros_msgs/State.h>
#include "pathmaker/key.h"
#include "pathmaker/keyboard.h"
#include <math.h>
//#include <std_msgs/Float32.h>
mavros_msgs::State current_state;
pathmaker::key current_key;
geometry_msgs::Twist vel;
//float depth=0;
void calSpeed(double x, double y, double z, double rz){
vel.linear.x = x;
vel.linear.y = y;
vel.linear.z = z;
vel.angular.z = rz;
}
void state_cb(const mavros_msgs::State::ConstPtr& msg){
current_state = *msg;
}
void state_key(const pathmaker::key::ConstPtr& msg){
current_key = *msg;
switch(msg->key){
case keyboardInput::W: // W, S : alttitude vel.linear.z
calSpeed(0,0,5,0);
break;
case keyboardInput::S:
calSpeed(0,0,-5,0);
break;
case keyboardInput::A: // A, D : YAW vel.angular.z
calSpeed(0,0,0,5);
break;
case keyboardInput::D:
calSpeed(0,0,0,-5);
break;
case keyboardInput::UP: // UP, DOWN : vel.linear.x
calSpeed(5,0,0,0);
break;
case keyboardInput::DOWN:
calSpeed(-5,0,0,0);
break;
case keyboardInput::LEFT: // LEFT, RIGHT : vel.linear.y
calSpeed(0,5,0,0);
break;
case keyboardInput::RIGHT:
calSpeed(0,-5,0,0);
break;
default:
calSpeed(0,0,0,0);
break;
}
}
/*void dep(const std_msgs::Float32::ConstPtr& msg)
{
depth=msg->data;
ROS_INFO("%f",depth);
}
*/
int main(int argc, char **argv)
{
ros::init(argc, argv, "offb_node");
ros::NodeHandle nh;
// ros::Subscriber getdata=nh.subscribe<std_msgs::Float32>("/float32",10, dep);
ros::Subscriber state_sub = nh.subscribe<mavros_msgs::State>
("mavros/state", 10, state_cb);
ros::Publisher local_pos_pub = nh.advertise<geometry_msgs::PoseStamped>
("mavros/setpoint_position/local", 10);
ros::ServiceClient arming_client = nh.serviceClient<mavros_msgs::CommandBool>
("mavros/cmd/arming");
ros::ServiceClient set_mode_client = nh.serviceClient<mavros_msgs::SetMode>
("mavros/set_mode");
ros::Subscriber keyInput = nh.subscribe<pathmaker::key>
("keyboardInput/key", 10, state_key);
ros::Publisher vel_pub = nh.advertise<geometry_msgs::Twist>
("mavros/setpoint_velocity/cmd_vel_unstamped", 10);
//the setpoint publishing rate MUST be faster than 2Hz
ros::Rate rate(20.0);
// wait for FCU connection
while(ros::ok() && !current_state.connected){
ros::spinOnce();
rate.sleep();
}
geometry_msgs::PoseStamped pose;
pose.pose.position.x = 0;
pose.pose.position.y = 0;
pose.pose.position.z = 2;
/* if(
depth<5)
{
pose.pose.position.x=-5;
pose.pose.position.y=-5;
}*/
//send a few setpoints before starting
for(int i = 100; ros::ok() && i > 0; --i){
local_pos_pub.publish(pose);
ros::spinOnce();
rate.sleep();
}
mavros_msgs::SetMode offb_set_mode;
offb_set_mode.request.custom_mode = "OFFBOARD";
mavros_msgs::CommandBool arm_cmd;
arm_cmd.request.value = true;
ros::Time last_request = ros::Time::now();
while(ros::ok()){
if( current_state.mode != "OFFBOARD" &&
(ros::Time::now() - last_request > ros::Duration(5.0))){
if( set_mode_client.call(offb_set_mode) &&
offb_set_mode.response.mode_sent){
ROS_INFO("Offboard enabled");
}
last_request = ros::Time::now();
} else {
if( !current_state.armed &&
(ros::Time::now() - last_request > ros::Duration(5.0))){
if( arming_client.call(arm_cmd) &&
arm_cmd.response.success){
ROS_INFO("Vehicle armed");
}
last_request = ros::Time::now();
}
}
//local_pos_pub.publish(pose);
vel_pub.publish(vel);
ros::spinOnce();
rate.sleep();
}
return 0;
}
|
02ab41c41810b25a6d7546fdad82aff314d8c4e5
|
c32ee8ade268240a8064e9b8efdbebfbaa46ddfa
|
/Libraries/m2sdk/game/ai/C_SQM_CarCrew_S2T_SpeechWingmanKnockedDownHuman.h
|
9291aa0a801c8831c58b6ac78bb7cbbbb5001783
|
[] |
no_license
|
hopk1nz/maf2mp
|
6f65bd4f8114fdeb42f9407a4d158ad97f8d1789
|
814cab57dc713d9ff791dfb2a2abeb6af0e2f5a8
|
refs/heads/master
| 2021-03-12T23:56:24.336057
| 2015-08-22T13:53:10
| 2015-08-22T13:53:10
| 41,209,355
| 19
| 21
| null | 2015-08-31T05:28:13
| 2015-08-22T13:56:04
|
C++
|
UTF-8
|
C++
| false
| false
| 479
|
h
|
C_SQM_CarCrew_S2T_SpeechWingmanKnockedDownHuman.h
|
// auto-generated file (rttidump-exporter by h0pk1nz)
#pragma once
#include <game/ai/C_SQM_CarCrew_S2T.h>
namespace game
{
namespace ai
{
/** game::ai::C_SQM_CarCrew_S2T_SpeechWingmanKnockedDownHuman (VTable=0x01E45A30) */
class C_SQM_CarCrew_S2T_SpeechWingmanKnockedDownHuman : public C_SQM_CarCrew_S2T
{
public:
virtual void vfn_0001_495EF094() = 0;
virtual void vfn_0002_495EF094() = 0;
virtual void vfn_0003_495EF094() = 0;
};
} // namespace ai
} // namespace game
|
acd2a1bdde4552056cfe6b43b843039fd63eca86
|
27f43caebb71cbcbfffd741534a545a46ff66546
|
/databaseReader.hpp
|
4b35ecce847617225855896c9ef9d6d3278f1699
|
[] |
no_license
|
modIronhide/sqlDoc
|
eb53b8ec6be3c4d32aa982fa027607778e3d1dee
|
36701a4db8c0af00e6da57b2b399f6cfe3d87275
|
refs/heads/master
| 2020-03-27T07:23:40.398795
| 2016-06-16T07:19:08
| 2016-06-16T07:19:08
| 61,270,728
| 0
| 0
| null | null | null | null |
UTF-8
|
C++
| false
| false
| 1,306
|
hpp
|
databaseReader.hpp
|
#include "TableStructure.hpp"
#include <stdlib.h>
#include <iostream>
#include "cmdline.h"
#include "printdata.h"
#include "mysql++.h"
//#define CPPCONN_DONT_TYPEDEF_MS_TYPES_TO_C99_TYPES
//#include <mysql_connection.h>
//#include <mysql_driver.h>
//#include <cppconn/driver.h>
//#include <cppconn/exception.h>
//#include <cppconn/resultset.h>
//#include <cppconn/statement.h>
class mysqlReader {
private:
string serverAddress;
string user;
string password;
string databaseName;
vector<string> tablesNames;
vector<TableStructure> tablesList;
bool isConnected;
//sql::Driver* driv;
//sql::Connection* conn;
//sql::Statement* sta;
//sql::ResultSet* res;
mysqlpp::Connection conn;
mysqlpp::Query query;
mysqlpp::StoreQueryResult res;
public:
mysqlReader(string,string,string,string);
bool connect();
void makeQuery(string);
void saveTableData();
string getServerAddress();
string getUser();
string getPassword();
string getDatabaseName();
void setServerAddress(string);
void setUser(string);
void setPassword(string);
void setDatabaseName(string);
vector<string> getTablesNames();
vector<TableStructure> getTablesList();
string getTableName(int);
TableStructure getTable(int);
};
|
4b144941e6fcb9f18105fdbf34bdd1d453cf017d
|
4d9c6253a620c6ed84b5e2824a60585b91502632
|
/Note.h
|
e8928e9d615b26e21ca7592f2f47e63418883fd4
|
[] |
no_license
|
Honion/Arche22
|
6c9dc42b47dc7e71ddd789b78906c00d699fb5c6
|
0128f20d599e32d71fd715b17c132db296b1ab15
|
refs/heads/master
| 2020-05-31T07:40:40.308739
| 2015-01-05T09:44:02
| 2015-01-05T09:44:02
| 28,648,720
| 1
| 1
| null | null | null | null |
UTF-8
|
C++
| false
| false
| 219
|
h
|
Note.h
|
#ifndef __Note_H__
#define __Note_H__
class Note{
public:
Note(int n);
~Note();
void setNote(int n);
int getNote();
protected:
int note;
};
#endif
|
88b952e9a692cf34ebd2f822e16bbd6cdae2001e
|
204bc4e90ceef6cd0374e2607c7a3ae5239cd608
|
/GameEngine/src/System/Collide.cpp
|
37509bfc41a515e05d17991b6cba2c4028fb5b78
|
[] |
no_license
|
Ericriminal/R-Type-Epitech-Tech-3
|
7bde5244bfb96243356d26183a557ce93e017280
|
c2983def1bad5baa8fe8993a006313e4dc53aca6
|
refs/heads/master
| 2023-02-17T06:55:44.907398
| 2021-01-18T11:11:31
| 2021-01-18T11:11:31
| 329,395,424
| 0
| 0
| null | null | null | null |
UTF-8
|
C++
| false
| false
| 1,870
|
cpp
|
Collide.cpp
|
/*
** EPITECH PROJECT, 2020
** Collide.cpp
** File description:
** Collide
*/
#include "System/Collide.hpp"
#include "Core/Coordinator.hpp"
void Collide::init(std::shared_ptr<Coordinator> _coordinator)
{
coordinator = _coordinator;
}
void Collide::checkBullet(const sf::Sprite &bullet, int id)
{
for (int anotherId : entity) {
if (anotherId != id) {
Tag anotherTag = coordinator->getTagByid(anotherId);
const sf::Sprite &enemy = coordinator->GetComponent<Sprite>(anotherId)->sprite;
if (anotherTag == Tag::ENEMY) {
if (bullet.getGlobalBounds().intersects(enemy.getGlobalBounds()))
destroyingEntities.push_back(anotherId);
}
}
}
}
void Collide::checkEnemyBullet(const sf::Sprite &bullet, int id)
{
for (int anotherId : entity) {
if (anotherId != id) {
Tag anotherTag = coordinator->getTagByid(anotherId);
const sf::Sprite &enemy = coordinator->GetComponent<Sprite>(anotherId)->sprite;
if (anotherTag == Tag::PLAYER) {
if (bullet.getGlobalBounds().intersects(enemy.getGlobalBounds())) {
destroyingEntities.push_back(anotherId);
}
}
}
}
}
void Collide::update()
{
for (int id : entity) {
Tag tag = coordinator->getTagByid(id);
const sf::Sprite &bullet = coordinator->GetComponent<Sprite>(id)->sprite;
switch (tag) {
case Tag::BULLET :
this->checkBullet(bullet, id);
break;
case Tag::ENEMY_BULLET :
this->checkEnemyBullet(bullet, id);
break;
default :
break;
}
}
for (int id : destroyingEntities)
coordinator->DestroyEntity(id);
destroyingEntities.clear();
}
|
2ee95d42970c852e4f84c98c0d2d4685d26ddee0
|
a69de224762d0f9378344f17c209964bb21463d2
|
/Filter/spuc/comm/modulator.h
|
00f2bbbe972220ee06ee608bdacc6aa328c35831
|
[] |
no_license
|
slacker247/MoCap
|
7659e644edac5b3bdb4b9df97000f56cb4233380
|
d37d066d625df56147b72b645f129f267aa1e0d2
|
refs/heads/master
| 2021-01-01T05:09:46.355723
| 2016-05-08T13:45:16
| 2016-05-08T13:45:16
| 58,313,858
| 5
| 0
| null | null | null | null |
UTF-8
|
C++
| false
| false
| 24,673
|
h
|
modulator.h
|
//
// SPUC - Signal processing using C++ - A DSP library
/*---------------------------------------------------------------------------*
* IT++ *
*---------------------------------------------------------------------------*
* Copyright (c) 1995-2002 by Tony Ottosson, Thomas Eriksson, Pål Frenger, *
* Tobias Ringström, and Jonas Samuelsson. *
* *
* Permission to use, copy, modify, and distribute this software and its *
* documentation under the terms of the GNU General Public License is hereby *
* granted. No representations are made about the suitability of this *
* software for any purpose. It is provided "as is" without expressed or *
* implied warranty. See the GNU General Public License for more details. *
*---------------------------------------------------------------------------*/
/*!
\file
\brief Definition of modulator classes
\author Tony Ottosson, Modified by Tony Kirke, Feb 1,2003
1.25
2003/01/04 00:21:55
*/
#ifndef __modulator_h
#define __modulator_h
#include <iostream>
#include <vector.h>
#include <specmat.h>
namespace SPUC {
/*! \defgroup modulators Digital Modulation
*/
/*!
\ingroup modulators
\brief A general modulator class for 1-dimensional signal consellations.
*/
class Modulator_1d {
public:
//! Constructor
Modulator_1d(const vec &insymbols = "0", const ivec &inbitmap = "0");
//! Destructor
virtual ~Modulator_1d() { }
//! Modulate function for symbols
virtual vec modulate(const ivec &symbolnumbers);
//! Demodulate function for symbols
virtual ivec demodulate(const vec &signal);
//! Modulate function for bits
virtual vec modulate_bits(const bvec &bits);
//! Demodulate function for bits
virtual bvec demodulate_bits(const vec &signal);
//! Set the symbol constellation and the corresponding bitmap
void set(const vec &insymbols, const ivec &inbitmap);
//! Get the symbol constellation
vec get_symbols(void);
//! Get the bitmap
ivec get_bitmap(void);
protected:
//! Number of bits per modulation symbol
int k;
//! Number of modulation symbols
int M;
//! Bit mapping table
ivec bitmap;
//! Vector of modulation symbols
vec symbols;
};
/*!
\ingroup modulators
\brief General modulator for 2-dimensional signal constellations.
This class can also perform soft demodulation. To use the soft demodulate member functions the
received symbols shall equal
\f[ r_k = c_k \times s_k + n_k, \f]
where \f$c_k\f$ is the complex channel
gain, \f$s_k\f$ is the transmitted QAM symbols, and \f$n_k\f$ is the AWGN of the channel (with
variance \f$N_0/2\f$ in both the real and the imaginary valued components).
The input samples to the soft demodulate functions shall equal
\f[ z_k = \hat{c}_k^{*} \times r_k, \f]
where \f$\hat{c}_k^{*}\f$ is the conjugate of the channel estimate. This class assumes that the
channel estimates are perfect when calculating the soft bits.
When these member functions are used together with MAP-based turbo decoding algoritms then the channel
reliability factor \f$L_c\f$ of the turbo decoder shall be set to 1. The output from these member functions
can also be used by a Viterbi decoder using an AWGN based metric calculation function.
*/
class Modulator_2d {
public:
//! Constructor
Modulator_2d(const cvec &insymbols = zeros_c(1), const ivec &inbitmap = "0");
//! Destructor
virtual ~Modulator_2d() {}
//! Modulation of symbols
virtual cvec modulate(const ivec &symbolnumbers);
//! Demodulation of symbols
virtual ivec demodulate(const cvec &signal);
//! Modulation of bits
virtual cvec modulate_bits(const bvec &bits);
//! Demodulation of bits
virtual bvec demodulate_bits(const cvec &signal);
/*!
\brief Soft demodulator for AWGN channels
This function calculates
\f[
\log \left( \frac{
\sum_{s_i \in S_0} \frac{1}{\pi N_0} \exp \left( -\frac{ |z_k - s_i|^2 }{N_0} \right) } {
\sum_{s_i \in S_1} \frac{1}{\pi N_0} \exp \left( -\frac{ |z_k - s_i|^2 }{N_0} \right) }
\right)
\f]
where \f$s_i \in S_0\f$ denotes a constellation symbol with the i-th bit equal to zero. This function can be used on channels
where the channel gain \f$c_k = 1\f$.
\param rx_symbols The received noisy constellation symbols
\param N0 The single sided spectral density of the AWGN noise
\param soft_bits The soft bits calculated using the expression above
*/
void demodulate_soft_bits(const cvec &rx_symbols, double N0, vec &soft_bits);
/*!
\brief Soft demodulator for fading channels
This function calculates
\f[
\log \left( \frac{
\sum_{s_i \in S_0} \frac{1}{\pi N_0 |c_k|^2} \exp \left( -\frac{ |z_k - |c_k|^2 s_i|^2 }{N_0 |c_k|^2} \right) } {
\sum_{s_i \in S_1} \frac{1}{\pi N_0 |c_k|^2} \exp \left( -\frac{ |z_k - |c_k|^2 s_i|^2 }{N_0 |c_k|^2} \right) }
\right)
\f]
\param rx_symbols The received noisy constellation symbols \f$z_k\f$ (remember that \f$z_k = \hat{c}_k^{*} \times r_k\f$)
\param chan The complex valued channel values
\param N0 The single sided spectral density of the AWGN noise
\param soft_bits The soft bits calculated using the expression above
*/
void demodulate_soft_bits(const cvec &rx_symbols, const cvec &chan, double N0, vec &soft_bits);
/*!
\brief Approximative soft demodulator for AWGN channels.
This function is faster and gives allmost no performance degradation compared to the
demodulate_soft_bits(const cvec &symbols, vec &soft_bits) function. This function finds for each bit
the closest constellation point that have a zero and a one in the corresponding position. Let \f$d_0\f$
denote the distance to the closest zero point and \f$d_1\f$ denote the distance to the closest one point
for the corresponding bit respectively. This algorithm then computes
\f[ \frac{1}{N_0} ( d_1^2 - d_0^2 ) \f]
\param rx_symbols The received noisy constellation symbols
\param N0 The single sided spectral density of the AWGN noise
\param soft_bits The soft bits calculated using the expression above
*/
void demodulate_soft_bits_approx(const cvec &rx_symbols, double N0, vec &soft_bits);
/*!
\brief Approximative soft demodulator for fading channels.
This function is faster and gives allmost no performance degradation compared to the
demodulate_soft_bits(const cvec &symbols, const cvec &chan, vec &soft_bits) function.
Let \f$d_0 = | z_k - |c_k|^2 s_0 |\f$ and \f$d_1 = | z_k - |c_k|^2 s_1 |\f$, with
\f$s_0\f$ and \f$s_0\f$ denoting the closest constellation points with zero and one in the
corresponding bit position respectively. This algorithm then computes
\f[ \frac{1}{N_0 |c_k|^2} ( d_1^2 - d_0^2 ) \f]
\param rx_symbols The received noisy constellation symbols \f$z_k\f$ (remember that \f$z_k = \hat{c}_k^{*} \times r_k\f$)
\param chan The complex valued channel values
\param N0 The single sided spectral density of the AWGN noise
\param soft_bits The soft bits calculated using the expression above
*/
void demodulate_soft_bits_approx(const cvec &rx_symbols, const cvec &chan, double N0, vec &soft_bits);
//! Set the symbol values to use in the modulator.
void set(const cvec &insymbols, const ivec &inbitmap);
//! Get the symbol values used in the modulator.
cvec get_symbols();
//! Get the bitmap used in the modulator.
ivec get_bitmap();
protected:
//! Number of bits per modulation symbol
int k;
//! Number of modulation symbols
int M;
//! Bit mapping table
ivec bitmap;
//! Vector of modulation symbols
cvec symbols;
//! This function calculates the soft bit mapping matrices S0 and S1
void calculate_softbit_matricies(ivec inbitmap);
//! Used by the soft demodulator functions: Matrix where row k contains the constellation points with a zero in bit position k
imat S0;
//! Used by the soft demodulator functions: Matrix where row k contains the constellation points with a one in bit position k
imat S1;
//! Internal protected state variable
bool soft_bit_mapping_matrices_calculated;
};
/*!
\ingroup modulators
\brief BPSK Modulator Class
Symbols used are \f$ \{ 1, -1 \}\f$. Bit mapping: \f$0 \rightarrow 1\f$ and \f$1 \rightarrow -1\f$.
Example of use:
\code
BPSK bpsk;
bvec bits = "1 0 0 1 1 0 1 0 1 0 1 1 1 0";
vec symbols = bpsk.modulate_bits(bits);
\endcode
*/
class MOD_BPSK {
public:
//! Constructor
MOD_BPSK() { }
//! Destructor
virtual ~MOD_BPSK() {}
//! Modulate bits into BPSK symbols
void modulate_bits(const bvec &bits, vec &out);
//! Modulate bits into BPSK symbols
vec modulate_bits(const bvec &bits);
//! Modulate bits into BPSK symbols and output cvec. Symbols in real part only
void modulate_bits(const bvec &bits, cvec &out);
//! Demodulate noisy BPSK symbols into bits
void demodulate_bits(const vec &signal, bvec &out);
//! Demodulate noisy BPSK symbols into bits
bvec demodulate_bits(const vec &signal);
/*!
\brief Demodulate noisy BPSK symbols into bits.
Input is cvec but received signals should be multiplied with complex conjugate
of channel coefficients before demodulation.
*/
void demodulate_bits(const cvec &signal, bvec &out);
/*!
\brief Soft demodulator for AWGN channels
This function calculates the log-MAP estimate assuming equally likely bits transmitted
\f[
\log \left( \frac{\Pr(b=0|r)}{\Pr(b=1|r)} \right)
= \frac{4 r}{N_0}
\f]
It is assumed that what is received is \f$r = b + n\f$.
\param rx_symbols The received noisy constellation symbols, \f$r\f$ (real)
\param N0 The single sided spectral density of the AWGN noise, \f$n\f$
\param soft_bits The soft bits calculated using the expression above
*/
void demodulate_soft_bits(const vec &rx_symbols, double N0, vec &soft_bits);
/*!
\brief Soft demodulator for the Rayleigh fading channel
This function calculates the log-MAP estimate assuming equally likely bits transmitted
\f[
\log \left( \frac{\Pr(b=0|r)}{\Pr(b=1|r)} \right)
= \frac{ 4 \Re \{r c^{*} \} }{N_0}
\f]
It is assumed that what is received is the complex-valued model: \f$r = c b + n\f$.
\param rx_symbols The received noisy constellation symbols, \f$r\f$ (complex)
\param channel The channel coefficients, \f$c\f$ (complex)
\param N0 The single sided spectral density of the AWGN noise, \f$n\f$
\param soft_bits The soft bits calculated using the expression above
*/
void demodulate_soft_bits(const cvec &rx_symbols, const cvec &channel, double N0, vec &soft_bits);
};
/*!
\ingroup modulators
\brief M-ary PAM modulator
Mary-PAM signals \f$ \{ M-1, \ldots, 3, 1, -1, -3, \ldots, -(M-1) \}\f$.
Symbol numbering is from right to left in increasing order.
Gray encoded bitmapping is used.
The symbols are normalized so that the average energy is 1. That is, normalized with \f$ \sqrt{(M^2-1)/3}\f$.
*/
class MOD_PAM {
public:
//! Constructor
MOD_PAM(int Mary) { set_M(Mary); }
//! Destructor
virtual ~MOD_PAM() { }
//! Modulate bits into PAM symbols
void modulate_bits(const bvec &bits, vec &out);
//! Modulate bits into PAM symbols
vec modulate_bits(const bvec &bits);
//! Demodulation of PAM symbols to bits
void demodulate_bits(const vec &signal, bvec &out);
//! Demodulation of PAM symbols to bits
bvec demodulate_bits(const vec &signal);
//! Set the size of the signal constellation
void set_M(int Mary);
//vec modulate(const svec &symbolnumbers);
//svec demodulate(const vec &signal);
protected:
//! Number of bits per modulation symbol
int k;
//! Number of modulation symbols
int M;
//! Bit patterns for symbols in order of symbol number
bmat bitmap;
//! Bit pattern in decimal form ordered and the corresponding symbols
ivec bits2symbols;
//! A vector containing the modulation symbols
vec symbols;
//! The average signal energy of the constallation
double average_energy;
//! Scaling factor used to normalize the average energy to 1
double scaling_factor;
};
/*!
\ingroup modulators
\brief QPSK-modulator class.
Symbol numbering is counter clockwise starting with \f$(1,1)/\sqrt{2}\f$ as symbol 0.
The bits are Gray coded onto symbols.
The energy is normalized to one.
Example of use:
\code
MOD_QPSK qpsk;
bvec bits = "0 0 0 1 1 0 1 1";
cvec symbols = qpsk.modulate_bits(bits);
\endcode
This class can also perform soft demodulation, calculating the log-MAP estimate of the individual bits.
To use the soft demodulate member functions the
received symbols shall equal
\f[ r_k = c_k \times s_k + n_k, \f]
where \f$c_k\f$ is the complex channel
gain, \f$s_k\f$ is the transmitted QPSK symbols, and \f$n_k\f$ is the AWGN of the channel (with
variance \f$N_0/2\f$ in both the real and the imaginary valued components).
The input samples to the soft demodulate functions should be \f$r_k\f$. It is also assumed that the
channel estimates are perfect when calculating the soft bits.
When these member functions are used together with MAP-based turbo decoding algoritms then the channel
reliability factor \f$L_c\f$ of the turbo decoder shall be set to 1. The output from these member
functions can also be used by a Viterbi decoder.
*/
class MOD_QPSK {
public:
//! Class Constructor
MOD_QPSK() {}
//! Destructor
virtual ~MOD_QPSK() {}
//! Modulation of bits
void modulate_bits(const bvec &bits, cvec &out);
//! Modulation of bits
cvec modulate_bits(const bvec &bits);
//! Demodulation of bits
void demodulate_bits(const cvec &signal, bvec &out);
//! Demodulation of bits
bvec demodulate_bits(const cvec &signal);
/*!
\brief Soft demodulator for AWGN channels
This function calculates the log-MAP estimates assuming equally likely bits transmitted
\f[
\log \left( \frac{\Pr(b_0=0|r)}{\Pr(b_0=1|r)} \right)
= \frac{4 \Re \{r\} }{N_0}
\f]
\f[
\log \left( \frac{\Pr(b_1=0|r)}{\Pr(b_1=1|r)} \right)
= \frac{4 \Im \{r\} }{N_0}
\f]
It is assumed that what is received is \f$r = s + n\f$. \f$s\f$ is the QPSK symbol
and the mapping between symbols and bits is Gray-coded.
\param rx_symbols The received noisy constellation symbols, \f$r\f$ (real)
\param N0 The single sided spectral density of the AWGN noise, \f$n\f$
\param soft_bits The soft bits calculated using the expression above
*/
void demodulate_soft_bits(const cvec &rx_symbols, double N0, vec &soft_bits);
/*!
\brief Soft demodulator for the Rayleigh fading channel
This function calculates the log-MAP estimate assuming equally likely bits transmitted
\f[
\log \left( \frac{\Pr(b_0=0|r)}{\Pr(b_0=1|r)} \right)
= \frac{4 \Re \{r c^{*} \} }{N_0}
\f]
\f[
\log \left( \frac{\Pr(b_1=0|r)}{\Pr(b_1=1|r)} \right)
= \frac{4 \Im \{r c^{*} \} }{N_0}
\f]
It is assumed that what is received is the complex-valued model: \f$r = c s + n\f$.
\param rx_symbols The received noisy constellation symbols, \f$r\f$ (complex)
\param channel The channel coefficients, \f$c\f$ (complex)
\param N0 The single sided spectral density of the AWGN noise, \f$n\f$
\param soft_bits The soft bits calculated using the expression above
*/
void demodulate_soft_bits(const cvec &rx_symbols, const cvec &channel, double N0, vec &soft_bits);
//cvec modulate(const svec &symbolnumbers);
//svec demodulate(const cvec &signal);
};
/*!
\ingroup modulators
\brief Mary-PSK modulator.
M-ary PSK modulator with \f$M = 2^k, \_ k = 1, 2, \ldots \f$.
Symbol numbering counter clockwise starting from the real axis.
The bit map is Gray encoded. The symbol energy is 1.
This class can also perform soft demodulation, calculating the log-MAP estimate of the individual bits.
To use the soft demodulate member functions the
received symbols shall equal
\f[ r_k = c_k \times s_k + n_k, \f]
where \f$c_k\f$ is the complex channel
gain, \f$s_k\f$ is the transmitted M-PSK symbols, and \f$n_k\f$ is the AWGN of the channel (with
variance \f$N_0/2\f$ in both the real and the imaginary valued components).
The input samples to the soft demodulate functions should be \f$r_k\f$. It is also assumed that the
channel estimates are perfect when calculating the soft bits.
When these member functions are used together with MAP-based turbo decoding algoritms then the channel
reliability factor \f$L_c\f$ of the turbo decoder shall be set to 1. The output from these member
functions can also be used by a Viterbi decoder.
*/
class MOD_PSK {
public:
//! Class constructor
MOD_PSK(int Mary) { set_M(Mary); }
//! Destructor
virtual ~MOD_PSK() { }
//! Modulation of bits
void modulate_bits(const bvec &bits, cvec &out);
//! Modulation of bits
cvec modulate_bits(const bvec &bits);
//! Demodulation of bits
void demodulate_bits(const cvec &signal, bvec &out);
//! Demodulation of bits
bvec demodulate_bits(const cvec &signal);
/*!
\brief Soft demodulator for AWGN channels
This function calculates
\f[
\log \left( \frac{\Pr(b_i=0|r)}{\Pr(b_i=1|r)} \right) =
\log \left( \frac{
\sum_{s_i \in S_0} \exp \left( -\frac{ |r - s_i|^2 }{N_0} \right) } {
\sum_{s_i \in S_1} \exp \left( -\frac{ |r - s_i|^2 }{N_0} \right) }
\right)
\f]
where \f$s_i \in S_0\f$ denotes a constellation symbol with the i-th bit equal to zero.
This function can be used on channels where the channel gain is \f$c = 1\f$.
\param rx_symbols The received noisy constellation symbols, \f$r\f$
\param N0 The single sided spectral density of the AWGN noise
\param soft_bits The soft bits calculated using the expression above
*/
void demodulate_soft_bits(const cvec &rx_symbols, double N0, vec &soft_bits);
/*!
\brief Soft demodulator for the Rayleigh fading channel
This function calculates
\f[
\log \left( \frac{\Pr(b_i=0|r)}{\Pr(b_i=1|r)} \right) =
\log \left( \frac{
\sum_{s_i \in S_0} \exp \left( -\frac{ |r - c s_i|^2 }{N_0} \right) } {
\sum_{s_i \in S_1} \exp \left( -\frac{ |r - c s_i|^2 }{N_0} \right) }
\right)
\f]
where \f$s_i \in S_0\f$ denotes a constellation symbol with the i-th bit equal to zero.
\param rx_symbols The received noisy constellation symbols, \f$r\f$
\param channel The channel coefficients (complex), \f$c\f$
\param N0 The single sided spectral density of the AWGN noise
\param soft_bits The soft bits calculated using the expression above
*/
void demodulate_soft_bits(const cvec &rx_symbols, const cvec &channel, double N0, vec &soft_bits);
//! Change the size of the signal constellation
void set_M(int Mary);
//cvec modulate(const svec &symbolnumbers);
//svec demodulate(const cvec &signal);
protected:
//! Number of bits per modulation symbol
int k;
//! Number of modulation symbols
int M;
//! bit patterns for symbols in order of symbol number
bmat bitmap;
//! bit pattern in decimal form ordered and the corresponding symbols
ivec bits2symbols;
//! A vector containing the modulation symbols
cvec symbols;
//! The average signal energy of the constallation
double average_energy;
//! Matrix where row k contains the constellation symbol numbers where bit k is 0
imat S0;
//! Matrix where row k contains the constellation symbol numbers where bit k is 1
imat S1;
};
/*!
\ingroup modulators
\brief Modulator class for square lattice Mary-QAM signals.
The size of the signal constellation is \f$M = 2^k,\_ k = 2, 3, \ldots \f$
The symbol values in each dimension is: \f$ \{ \sqrt{M}-1, \ldots, 3, 1, -1, -3, \ldots,-(\sqrt{M}-1) \} \f$
<h3>Symbol numbering:</h3>
<ul>
<li>Symbol 0: \f$(\sqrt{M}-1)+j(\sqrt{M}-1)\f$</li>
<li>Symbol 1: \f$(\sqrt{M}-3)+j(\sqrt{M}-1)\f$</li>
<li>...</li>
<li>Symbol (M-1): \f$-(\sqrt{M}-1)-j(\sqrt{M}-1)\f$.</li>
</ul>
The symbols are normalized so that the average energy is 1. That is, normalized with \f$ \sqrt{2*(M-1)/3}\f$.
This class can also perform soft demodulation, calculating the log-MAP estimate of the individual bits.
To use the soft demodulate member functions the
received symbols shall equal
\f[ r_k = c_k \times s_k + n_k, \f]
where \f$c_k\f$ is the complex channel
gain, \f$s_k\f$ is the transmitted QAM symbols, and \f$n_k\f$ is the AWGN of the channel (with
variance \f$N_0/2\f$ in both the real and the imaginary valued components).
The input samples to the soft demodulate functions should be \f$r_k\f$. It is also assumed that the
channel estimates are perfect when calculating the soft bits.
When these member functions are used together with MAP-based turbo decoding algoritms then the channel
reliability factor \f$L_c\f$ of the turbo decoder shall be set to 1. The output from these member
functions can also be used by a Viterbi decoder.
*/
class MOD_QAM {
public:
//! Class Constructor
MOD_QAM(int Mary) { set_M(Mary); }
//! Destructor
virtual ~MOD_QAM() { }
//! Modulation of bits
void modulate_bits(const bvec &bits, cvec &out);
//! Modulation of bits
cvec modulate_bits(const bvec &bits);
//! Demodulation of bits
void demodulate_bits(const cvec &signal, bvec &out);
//! Demodulation of bits
bvec demodulate_bits(const cvec &signal);
/*!
\brief Soft demodulator for AWGN channels
This function calculates
\f[
\log \left( \frac{\Pr(b_i=0|r)}{\Pr(b_i=1|r)} \right) =
\log \left( \frac{
\sum_{s_i \in S_0} \exp \left( -\frac{ |r - s_i|^2 }{N_0} \right) } {
\sum_{s_i \in S_1} \exp \left( -\frac{ |r - s_i|^2 }{N_0} \right) }
\right)
\f]
where \f$s_i \in S_0\f$ denotes a constellation symbol with the i-th bit equal to zero.
This function can be used on channels where the channel gain is \f$c = 1\f$.
\param rx_symbols The received noisy constellation symbols, \f$r\f$
\param N0 The single sided spectral density of the AWGN noise
\param soft_bits The soft bits calculated using the expression above
*/
void demodulate_soft_bits(const cvec &rx_symbols, double N0, vec &soft_bits);
/*!
\brief Soft demodulator for the Rayleigh fading channel
This function calculates
\f[
\log \left( \frac{\Pr(b_i=0|r)}{\Pr(b_i=1|r)} \right) =
\log \left( \frac{
\sum_{s_i \in S_0} \exp \left( -\frac{ |r - c s_i|^2 }{N_0} \right) } {
\sum_{s_i \in S_1} \exp \left( -\frac{ |r - c s_i|^2 }{N_0} \right) }
\right)
\f]
where \f$s_i \in S_0\f$ denotes a constellation symbol with the i-th bit equal to zero.
\param rx_symbols The received noisy constellation symbols, \f$r\f$
\param channel The channel coefficients (complex), \f$cff$
\param N0 The single sided spectral density of the AWGN noise
\param soft_bits The soft bits calculated using the expression above
*/
void demodulate_soft_bits(const cvec &rx_symbols, const cvec &channel, double N0, vec &soft_bits);
//! Change the size of the signal constellation
void set_M(int Mary);
//! Return the constellation symbols used
cvec get_symbols() { return symbols; }
//! Return the bit mapping used in decimal form
ivec get_bitmap() { return bits2symbols; }
//cvec modulate(const svec &symbolnumbers);
//svec demodulate(const cvec &signal);
protected:
//! Number of bits per modulation symbol
int k;
//! Number of modulation symbols
int M;
//! The square-root of M
int L;
//! Bit patterns for symbols in order of symbol number
bmat bitmap;
//! Bit pattern in decimal form ordered and the corresponding symbols
ivec bits2symbols;
//! A vector containing the modulation symbols
cvec symbols;
//! The average signal energy of the constallation
double average_energy;
//! Scaling factor used to normalize the average energy to 1
double scaling_factor;
//! Matrix where row k contains the constellation symbol numbers where bit k is 0/1
imat S0;
//! Matrix where row k contains the constellation symbol numbers where bit k is 0/1
imat S1;
};
}
#endif // __modulator_h
|
a9c9da45c50ca439a5d6bacca5cb9f94db182577
|
70a1e4e6b8d0f97ecabbc1b4b5b52a47da0520a5
|
/sources/ReadWriteShortcuts.h
|
583cb12daf53f1fef18a2c6cf49040a9cef3b6f1
|
[
"MIT"
] |
permissive
|
podgorskiy/fsal
|
18ad725158ac83ad49a0e9aedc9454f20ad60d88
|
43a10daf07a641b7be64c6a837393d4334c4b543
|
refs/heads/master
| 2022-06-15T03:49:53.466233
| 2020-05-05T09:11:40
| 2020-05-05T09:11:40
| 141,553,188
| 4
| 1
| null | null | null | null |
UTF-8
|
C++
| false
| false
| 862
|
h
|
ReadWriteShortcuts.h
|
#pragma once
#include "FileStream.h"
#include <cstdint>
#include <cstring>
namespace fsal
{
template<typename T>
inline void operator << (File& f, const T& d)
{
::fsal::FileStream(f) << d;
};
template<typename T>
inline void operator >> (File& f, T& d)
{
::fsal::FileStream(f) >> d;
};
/*
template<>
inline void operator << <std::string>(File& f, const std::string& s)
{
f.Write(reinterpret_cast<const uint8_t*>(s.c_str()), s.size());
};
template<>
inline void operator >> <std::string> (File& f, std::string& s)
{
size_t size = f.GetSize();
s.resize(size);
// http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-defects.html#530
// mystring.c_str() is equivalent to mystring.data() is equivalent to &mystring[0],
// mystring[mystring.size()] is guaranteed to be '\0'
f.Read(reinterpret_cast<uint8_t*>(&s[0]), size);
};
*/
}
|
ebe69377876d45d9bdb090a48b88e347bddea305
|
37c9a4c87319d33910db75f3c7c0d8356c3b433a
|
/.vscode/lab3/lab3.cpp
|
f6da246e636353001b00d324e9012b7c70ccbd02
|
[] |
no_license
|
alikhan2002/PP1
|
614dbc134f80370ededc1a2dba3c84328321a8ec
|
db333ef8bc6577f748a33c2208e381e9c55ed1b9
|
refs/heads/main
| 2023-03-04T15:54:50.829087
| 2021-02-16T08:14:30
| 2021-02-16T08:14:30
| 334,682,190
| 0
| 0
| null | null | null | null |
UTF-8
|
C++
| false
| false
| 203
|
cpp
|
lab3.cpp
|
#include <iostream>
#include <cmath>
using namespace std;
int main(){
int n,max=-1e9;
cin>>n;
int a[n];
for(int i=0;i<n;i++){
cin>>a[i];
if(a[i]>max) max=a[i];
}
cout<<max<<endl;
return 0;
}
|
9868758e380353963867fa17b3e4d636e52b6fa4
|
8c8658cd6bbd5368c14f29c38258bff58f988c5b
|
/ProjektFAP(myHope)/AI.h
|
691ceae14ab7b09d16cb4d9a8cfc7ae00301355a
|
[] |
no_license
|
SebKasch/ProjektFAP-myHope-
|
7c3b76f0e04acc1a931bff2f61923126e4225b4b
|
9ba9566d436bff7c71889efbb2ecf4ee7ffe5a2d
|
refs/heads/master
| 2020-06-09T06:19:33.354739
| 2019-06-24T13:00:45
| 2019-06-24T13:00:45
| 193,389,438
| 0
| 0
| null | null | null | null |
UTF-8
|
C++
| false
| false
| 280
|
h
|
AI.h
|
#pragma once
#include "Player.h"
#include <list>
#include "Insel.h"
#include <random>
class AI :
public Player
{
public:
Insel *target();
AI(const std::list<Node*> ©Insel, Insel &startinsel, int startguthaben);
~AI();
//private:
std::list<Insel*> m_besuchteInseln;
};
|
6023af61c187619a148a3e98c02dd8ae54d8b264
|
740af44094400a92ce2c7fb14d9def6771eacbfe
|
/src/libaten/deformable/DeformMeshSet.h
|
804d2107b9875e86ecb23700e23d5a553c21c2bf
|
[
"MIT"
] |
permissive
|
nackdai/aten
|
86f2de6b6e5d7931388bd7cbb466ae18f981de7a
|
a3c8c818be8d72a2267ed4c933ac60b4eb1c4ef4
|
refs/heads/main
| 2023-09-01T11:02:40.201933
| 2023-08-29T17:23:32
| 2023-08-30T10:02:59
| 81,186,981
| 57
| 4
|
MIT
| 2023-08-30T10:03:01
| 2017-02-07T08:51:24
|
C++
|
UTF-8
|
C++
| false
| false
| 1,269
|
h
|
DeformMeshSet.h
|
#pragma once
#include "deformable/DeformPrimitives.h"
#include "deformable/Skeleton.h"
#include "misc/stream.h"
#include "geometry/NoHitableMesh.h"
#include "scene/host_scene_context.h"
namespace aten
{
/**
* @brief メッシュセット.
* マテリアルごとのプリミティブセットの集まり
*/
class DeformMeshSet : public NoHitableMesh {
friend class DeformMeshGroup;
public:
DeformMeshSet() {}
~DeformMeshSet() {}
private:
bool read(
FileInputStream* stream,
bool isGPUSkinning);
void initGLResources(
shader* shd,
bool isGPUSkinning,
std::vector<GeomVertexBuffer>& vbs);
void setExternalVertexBuffer(GeomMultiVertexBuffer& vb);
void render(
const context& ctxt,
const SkeletonController& skeleton,
IDeformMeshRenderHelper* helper,
bool isGPUSkinning);
const std::vector<DeformPrimitives>& getPrimitives() const
{
return m_prims;
}
const MeshSet& getDesc() const
{
return m_desc;
}
private:
MeshSet m_desc;
std::vector<DeformPrimitives> m_prims;
};
}
|
d1c10fe45103258be72cabdfba2ef5b2374dd964
|
7441179ac1a2f9273f3783646f2f87d961fb2dc8
|
/Code/EX1/StereoPanorama.cpp
|
2eab0be283b6ff72e29a20d20d36aad3c32cae4f
|
[] |
no_license
|
GalZaidman/3D-StereoPanoramaCreator
|
4a4e0a5f5512e1c77ac1de3381888eea0c59658a
|
172313537364c5d0f470c5e19c071dbb29ee25bc
|
refs/heads/master
| 2020-03-10T06:03:45.448739
| 2018-04-12T11:30:31
| 2018-04-12T11:30:31
| 129,230,885
| 2
| 0
| null | null | null | null |
UTF-8
|
C++
| false
| false
| 21,834
|
cpp
|
StereoPanorama.cpp
|
//Stereo Panorama Program
//©All rights reserved to Avia Maza, Sabina Aledort and Gal Zaidman
//includes
#include <stdio.h>
#include <iostream>
#include <fstream>
#include <vector>
#include <opencv/cv.h>
#include <opencv/highgui.h>
#include "opencv2/core.hpp"
#include "opencv2/imgproc.hpp"
#include "opencv2/highgui.hpp"
#include "opencv2/core/core.hpp"
#include "opencv2/features2d/features2d.hpp"
#include "opencv2/highgui/highgui.hpp"
#include "opencv2/calib3d/calib3d.hpp"
#include "opencv2/imgproc/imgproc.hpp"
#include "opencv2/stitching.hpp"
#include <string>
//Namespace:
using namespace std;
using namespace cv;
//Declarations:
int calculateFramesPerSecond(VideoCapture video);
void convertImageToGrayScale(Mat& input, Mat& output);
void createTheFramesVectorFromVideo(VideoCapture video, int framesPerSecond, int framesFrequency, vector<Mat>& framesVec, int transposeRight);
void resizeFunc(vector<Mat>& framesVec);
void featureMatching(vector<Mat>& framesVec, vector<int>& dxsVec, int& totalSumOfdxs);
void createPanorama(vector<Mat> framesVec, vector<int> dxsVec, int numberOfSlice, int totalSumOfdxs);
void createPanoramaForSlice(vector<Mat> framesVec, vector<int> dxsVec, int position, int sliceWidth, int height, Mat& image, int sliceNumber, char strFileName[]);
void createStereoPanorama(Mat& leftEye, Mat& rightEye, int leftPosition, int rightPosition, Mat& stereo, char strFileName[]);
void combineLeftAndRightPanorama(Mat& leftEye, Mat& rightEye, Mat3b& combine, int leftUp, char strFileName[], char strLeft[], char strRight[]);
//Finals:
//Suffix
#define SUFFIX_JPG ".jpg"
//Max number for str
#define MAX_STR_NUM 100
//STR
#define STR_SPERATE_LINE "-----------------------------------------------------------------------\n"
#define STR_COPYRIGHT_SIGN "U+00A9"
#define STR_LEFT "Left"
#define STR_RIGHT "Right"
#define STR_PANORAMA "Panorama"
#define STR_STEREO "Stereo"
#define STR_CENTRAL "Central"
//File Names
#define FN_STEREO "StereoPanorama"
#define FN_LEFT "LeftPanorama"
#define FN_RIGHT "RightPanorama"
#define FN_L_AND_R "Left&RightPanorama"
#define FN_R_AND_L "Right&LeftPanorama"
//Video file name
#define VIDEO_FILE_MOUNTAIN "mountain.mov" //TRANSPOSE_RIGHT
#define VIDEO_FN_ROOFTOP "rooftop.mp4" //TRANSPOSE_LEFT
#define VIDEO_FN_BRIDGE "WilliamsburgBridge.mp4" //TRANSPOSE_RIGHT
#define VIDEO_FN_STREET "street.mp4" //TRANSPOSE_RIGHT
#define VIDEO_FN_POOL "pool.mp4" //TRANSPOSE_RIGHT
#define VIDEO_FN_JAFFA_PORT "JaffaPort.mp4" //TRANSPOSE_RIGHT
#define VIDEO_FN_BUCHAREST_CENTER "Bucharest.mp4"//NO_TRANSPOSE
#define VIDEO_FN_BUCHAREST_PARK "ArrestoPark.mp4"//NO_TRANSPOSE
#define VIDEO_FN_DARK_POOL "DarkPool.mp4"//NO_TRANSPOSE
#define VIDEO_FN_HOUSE "House.mp4"//TRANSPOSE_RIGHT
int main()
{
//Program variables
int videoFileNameNum = 0;
char videoForPanoramaStr[MAX_STR_NUM] = "";
int fContinue = 1;
VideoCapture videoForPanorama;
int frameFrequency = 0;
int numberOfSlices = 0;
int numberOfTotalFramesInVideo = 0;
int framesPerSecond = 0;
int framesForVector = 0;
int videoWidthOriginal = 0;
int videoHeightOriginal = 0;
int transposeRight = -1;
int totalSumOfdxs = 0;
Mat firstFrame;
int frameWidthUpdated = 0;
int frameHeightUpdated = 0;
vector<Mat> framesVec;
vector<int> dxsVec;
//Opening Remarks
cout << "Welcome to Stereo Panorama Program\n"
<< "All rights reserved to Avia Maza, Sabina Aledort and Gal Zaidman\n"
<< "Enjoy! (=\n"
<< STR_SPERATE_LINE;
//Menu 1: Choose a video to work with
while (fContinue)
{
cout << endl
<< "Menu 1:Choose a video to work with\n"
<< "Please enter The number of Video File Name you want to work with\n"
<< " 1 - Mountain\n"
<< " 2 - Rooftop\n"
<< " 3 - Williamsburg Bridge\n"
<< " 4 - Street\n"
<< " 5 - pool\n"
<< " 6 - JaffaPort\n"
<< " 7 - Bucharest Center\n"
<< " 8 - Bucharest Park\n"
<< " 9 - Dark Pool\n"
<< " 10- House\n"
<< " 11 - Enter other file name\n"
<< " 12- Exit\n"
<< " Enter your choice and press enter:\n----> ";
cin >> videoFileNameNum;
switch (videoFileNameNum)
{
case 1:
videoForPanorama.open(VIDEO_FILE_MOUNTAIN);
sprintf(videoForPanoramaStr, "%s", videoForPanoramaStr);
fContinue = 0;
break;
case 2:
videoForPanorama.open(VIDEO_FN_ROOFTOP);
sprintf(videoForPanoramaStr, "%s", VIDEO_FN_ROOFTOP);
fContinue = 0;
break;
case 3:
videoForPanorama.open(VIDEO_FN_BRIDGE);
sprintf(videoForPanoramaStr, "%s", VIDEO_FN_BRIDGE);
fContinue = 0;
break;
case 4:
videoForPanorama.open(VIDEO_FN_STREET);
sprintf(videoForPanoramaStr, "%s", VIDEO_FN_STREET);
fContinue = 0;
break;
case 5:
videoForPanorama.open(VIDEO_FN_POOL);
sprintf(videoForPanoramaStr, "%s", VIDEO_FN_POOL);
fContinue = 0;
break;
case 6:
videoForPanorama.open(VIDEO_FN_JAFFA_PORT);
sprintf(videoForPanoramaStr, "%s", VIDEO_FN_JAFFA_PORT);
fContinue = 0;
break;
case 7:
videoForPanorama.open(VIDEO_FN_BUCHAREST_CENTER);
sprintf(videoForPanoramaStr, "%s", VIDEO_FN_BUCHAREST_CENTER);
fContinue = 0;
break;
case 8:
videoForPanorama.open(VIDEO_FN_BUCHAREST_PARK);
sprintf(videoForPanoramaStr, "%s", VIDEO_FN_BUCHAREST_PARK);
fContinue = 0;
break;
case 9:
videoForPanorama.open(VIDEO_FN_DARK_POOL);
sprintf(videoForPanoramaStr, "%s", VIDEO_FN_DARK_POOL);
fContinue = 0;
break;
case 10:
videoForPanorama.open(VIDEO_FN_HOUSE);
sprintf(videoForPanoramaStr, "%s", VIDEO_FN_HOUSE);
fContinue = 0;
break;
case 11:
cout << "Pleae enter video file name with suffix\n--->";
cin >> videoForPanoramaStr;
videoForPanorama.open(videoForPanoramaStr);
fContinue = 0;
break;
case 12:
cout << "End of Program.\n GoodBye(=\n";
system("pause");
exit(-1);
break;
default:
cout << "Not a Valid Choice. \n"
<< "Choose again.\n";
break;
}
//Check if video exist
if (!videoForPanorama.isOpened())
{
cout << " ***Could not initialize capturing with this video, please try else...***\n";
fContinue = 1;
}
}//end menu 1
cout << STR_SPERATE_LINE;
//Menu 2: Choose if transpose right or left
while (!(transposeRight == 1 || transposeRight == 2 || transposeRight == 3))
{
cout << endl
<< "Menu 2: Choose if transpose right or left \n"
<< "Enter the number for frame frequency you want\n"
<< " 1 - right\n"
<< " 2 - left\n"
<< " 3 - no transpose\n"
<< " Enter your choice and press enter:\n----> ";
cin >> transposeRight;
if (!(transposeRight == 1 || transposeRight == 2 || transposeRight == 3))
cout << "\value need to be 1 or 2 or 3, please try again";
}//end menu 2
cout << STR_SPERATE_LINE;
//Menu 3: Choose the video frame frequency
while (frameFrequency < 1 || frameFrequency>4)
{
cout << endl
<< "Menu 3: Choose the video frame frequency(frames skip) \n"
<< "Enter the number for frame frequency you want\n"
<< " 1 - very slow\n"
<< " 2 - slow\n"
<< " 3 - fast\n"
<< " 4 - very fast\n"
<< " Enter your choice and press enter:\n----> ";
cin >> frameFrequency;
if (frameFrequency < 1 || frameFrequency>4)
cout << "\nframe frequency need to be between 1-4, please try again";
}//end menu 3
cout << STR_SPERATE_LINE;
//Menu 4: Choose the number of slices you want
while (!(numberOfSlices == 7 || numberOfSlices == 11))
{
cout << endl
<< "Menu 4: Choose the number of slices you want to use \n"
<< "Enter the number for frame frequency you want\n"
<< " 7 - good results\n"
<< " 11 - very good results\n"
<< " Enter your choice and press enter:\n----> ";
cin >> numberOfSlices;
if (!(numberOfSlices == 7 || numberOfSlices == 11))
cout << "\nframe frequency need to 7 or 11, please try again";
}//end menu 4
cout << STR_SPERATE_LINE;
//Caculate Details
numberOfTotalFramesInVideo = videoForPanorama.get(CV_CAP_PROP_FRAME_COUNT);
framesForVector = numberOfTotalFramesInVideo / frameFrequency;
framesPerSecond = calculateFramesPerSecond(videoForPanorama);
videoWidthOriginal = videoForPanorama.get(CV_CAP_PROP_FRAME_WIDTH);
videoHeightOriginal = videoForPanorama.get(CV_CAP_PROP_FRAME_HEIGHT);
//Present Video Deatails , after user choises
cout << endl;
cout << "Main Details:" << endl;
cout << "Video File Name: " << videoForPanoramaStr << endl;
cout << "Number Of Total Frames In Video: " << numberOfTotalFramesInVideo << endl;
cout << "Frame Frequency: " << frameFrequency << endl;
cout << "Frames For Vector: " << framesForVector << endl;
cout << "Frames Per Second: " << framesPerSecond << endl;
cout << "Video frame size Original: " << videoWidthOriginal << "X" << videoHeightOriginal << endl;
cout << "Number of slices: " << numberOfSlices << endl;
cout << "\nNow Start process...\n";
cout << "Part 1: Create the frames Vector from video frames" << endl;
createTheFramesVectorFromVideo(videoForPanorama, framesPerSecond, frameFrequency, framesVec, transposeRight);
videoForPanorama.release();
resizeFunc(framesVec);
firstFrame = framesVec.at(0);
frameWidthUpdated = firstFrame.cols;
frameHeightUpdated = firstFrame.rows;
cout << "Frame size Updated: " << frameWidthUpdated << "X" << frameHeightUpdated << endl;
cout << "Part 2: Do the feature matching and find the dx's and calculate the total sum of dx's.\n";
featureMatching(framesVec, dxsVec, totalSumOfdxs);
cout << "Part 3-7: Create the panoramas pictures:" << endl;
createPanorama(framesVec, dxsVec, numberOfSlices, totalSumOfdxs);
return 0;
}
int calculateFramesPerSecond(VideoCapture video) {
int framesPerSecond = video.get(CV_CAP_PROP_FPS);
if (framesPerSecond <= 0)
framesPerSecond = 10;
else
framesPerSecond = 1000 / framesPerSecond;
return framesPerSecond;
}
void createTheFramesVectorFromVideo(VideoCapture video, int framesPerSecond, int framesFrequency, vector<Mat>& framesVec, int transposeRight)
{
Mat image;
int counter = 0;
while (video.read(image))
{
if (counter % framesFrequency == 0)
{
if (transposeRight == 1)
transpose(image, image);
else if (transposeRight == 2)
{
transpose(image, image);
flip(image, image, 0);
}
framesVec.push_back(image.clone());
}
waitKey(framesPerSecond);
counter++;
}
image.release();
}
void resizeFunc(vector<Mat>& framesVec)
{
if (framesVec.at(0).cols > 1000 && framesVec.at(0).rows > 1000)
for (int i = 0; i < framesVec.size(); i++)
resize(framesVec.at(i), framesVec.at(i), Size(framesVec.at(i).rows / 2, framesVec.at(i).cols / 2));
}
void convertImageToGrayScale(Mat& input, Mat& output) {
cvtColor(input, output, CV_RGB2GRAY);
if (!output.data)
{
std::cout << " --(!) Error reading images " << std::endl;
exit(-1);
}
}
void featureMatching(vector<Mat>& framesVec, vector<int>& dxsVec, int& totalSumOfdxs)
{
ofstream fmfile;
fmfile.open("FM.txt");
for (int j = 0; j < framesVec.size() - 1; j++)
{
fmfile << "Part 2: Do the feature matching and find the dx's and calculate the total sum of dx's.\n";
cout << "dx num:" << j << endl;
fmfile << "dx num:" << j << endl;
Mat gray_image1;
Mat gray_image2;
fmfile << "number of frames for calculate this delta x: 2" << endl;
fmfile << "gray_image1: frame num: " << j + 1 << endl;
fmfile << "gray_image2: frame num: " << j << endl;
convertImageToGrayScale(framesVec.at(j + 1), gray_image1);
convertImageToGrayScale(framesVec.at(j), gray_image2);
Ptr<ORB> detector = cv::ORB::create(7000, 1.200000048F, 12, 31, 0, 2, ORB::HARRIS_SCORE, 31, 20);
std::vector< KeyPoint > keypoints_object, keypoints_scene;
detector->detect(gray_image1, keypoints_object);
detector->detect(gray_image2, keypoints_scene);
Ptr<ORB> extractor = cv::ORB::create(7000, 1.200000048F, 12, 31, 0, 2, ORB::HARRIS_SCORE, 31, 20);
Mat descriptors_object, descriptors_scene;
extractor->compute(gray_image1, keypoints_object, descriptors_object);
extractor->compute(gray_image2, keypoints_scene, descriptors_scene);
BFMatcher matcher;
std::vector< DMatch > matches;
matcher.match(descriptors_object, descriptors_scene, matches);
double max_dist = 0;
double min_dist = 100;
for (int i = 0; i < descriptors_object.rows; i++)
{
double dist = matches[i].distance;
if (dist < min_dist) min_dist = dist;
if (dist > max_dist) max_dist = dist;
}
fmfile << "min_dist: " << min_dist << endl;
fmfile << "max_dist: " << max_dist << endl;
std::vector< DMatch > good_matches;
int good = 0;
double count = 2;
while (good < 50)
{
good_matches.clear();
for (int i = 0; i < descriptors_object.rows; i++)
{
if (matches[i].distance <= count * (min_dist + 1))
{
fmfile << "matches[" << i << "].queryIdx: " << matches[i].queryIdx << endl;
fmfile << "matches[" << i << "].trainIdx: " << matches[i].trainIdx << endl;
good_matches.push_back(matches[i]);
}
}
good = good_matches.size();
count += 0.5;
}
std::vector< Point2f > obj;
std::vector< Point2f > scene;
fmfile << "good_matches.size(): " << good_matches.size() << endl;
for (int i = 0; i < good_matches.size(); i++)
{
obj.push_back(keypoints_object[good_matches[i].queryIdx].pt);
fmfile << "keypoints_object[good_matches[" << i << "].queryIdx].pt: " << keypoints_object[good_matches[i].queryIdx].pt << " was added to obj vec" << endl;
scene.push_back(keypoints_scene[good_matches[i].trainIdx].pt);
fmfile << "keypoints_scene[good_matches[" << i << "].trainIdx].pt: " << keypoints_scene[good_matches[i].trainIdx].pt << " was added to scene vec" << endl;
}
Mat H = findHomography(obj, scene, CV_RANSAC);
fmfile << "H :" << H.size() << endl;
double dx00 = (H.at<double>(Point(0, 0)));;
fmfile << "double dx00 Point(0, 0)) :" << dx00 << endl;
double dx01 = (H.at<double>(Point(0, 1)));;
fmfile << "double dx01 Point(0, 1)) :" << dx01 << endl;
double dx02 = (H.at<double>(Point(0, 2)));;
fmfile << "double dx02 Point(0, 2)) :" << dx02 << endl;
double dx10 = (H.at<double>(Point(1, 0)));;
fmfile << "double dx10 Point(1, 0)) :" << dx10 << endl;
double dx11 = (H.at<double>(Point(1, 1)));;
fmfile << "double dx11 Point(1, 1)) :" << dx11 << endl;
double dx12 = (H.at<double>(Point(1, 2)));;
fmfile << "double dx12 Point(1, 2)) :" << dx12 << endl;
double dx20 = (H.at<double>(Point(2, 0)));;
fmfile << "double dx20 Point(2, 0)) :" << dx20 << endl;
double dx21 = (H.at<double>(Point(2, 1)));;
fmfile << "double dx21 Point(2, 1)) :" << dx21 << endl;
double dx22 = (H.at<double>(Point(2, 2)));;
fmfile << "double dx22 Point(2, 2)) :" << dx22 << endl;
double dx2 = (H.at<double>(Point(2, 0)));;
cout << "double dx2 Point(2, 0)) :" << dx2 << endl;
fmfile << "double dx2 Point(2, 0)) :" << dx2 << endl;
if (dx2 < 0)
dx2 *= -1;
int dx = (int)(H.at<double>(Point(2, 0)));
if (dx < 0)
dx *= -1;
double difference = dx2 - dx;
fmfile << "difference" << difference << endl;
cout << "difference" << difference << endl;
if (difference > 0.5)
dx++;
fmfile << "dx :" << dx << endl;
cout << "dx :" << dx << endl;
totalSumOfdxs += dx;
dxsVec.push_back(dx);
//When find the dx, release all
gray_image1.release();
gray_image2.release();
descriptors_object.release();
descriptors_scene.release();
H.release();
}
fmfile.close();
}
void createPanorama(vector<Mat> framesVec, vector<int> dxsVec, int numberOfSlice, int totalSumOfdxs)
{
Mat firstFrame = framesVec.at(0);
int right = 0;
int left = numberOfSlice - 1;
int middle = numberOfSlice / 2;
int width = firstFrame.cols;
int height = firstFrame.rows;
int sliceWidth = width / numberOfSlice;
int widthForResult = totalSumOfdxs + sliceWidth;
int leftPosition = 0;
int rightPosition = 0;
int middlePosition = middle * sliceWidth;
char strFileNameForLeft[MAX_STR_NUM];
char strFileNameForRight[MAX_STR_NUM];
char strFileNameForCombineLeftRight[MAX_STR_NUM];
char strFileNameForCombineRightLeft[MAX_STR_NUM];
char strFileNameForStereo[MAX_STR_NUM];
char strFileNameForCentralPanorama[MAX_STR_NUM];
char strFileNameForCombineLeftRightCentral[MAX_STR_NUM];
//Create middle slice
cout << "Create middle slice (the central panorama).\n";
Mat panoramaMiddle(height, widthForResult, 16);
Mat3b combineForMiddle(height, widthForResult, 16);
sprintf(strFileNameForCentralPanorama, "%s%s%d%s", STR_CENTRAL, STR_PANORAMA, middle, SUFFIX_JPG);
sprintf(strFileNameForCombineLeftRightCentral, "%s%s%s%s%d%s", STR_LEFT, STR_RIGHT, STR_CENTRAL, STR_PANORAMA, middle, SUFFIX_JPG);
//For Middle
createPanoramaForSlice(framesVec, dxsVec, middlePosition, sliceWidth, height, panoramaMiddle, middle, strFileNameForCentralPanorama);
//For Combine
combineLeftAndRightPanorama(panoramaMiddle, panoramaMiddle, combineForMiddle, 1, strFileNameForCombineLeftRightCentral, strFileNameForCentralPanorama, strFileNameForCentralPanorama);
panoramaMiddle.release();
combineForMiddle.release();
for (right = 0, left = numberOfSlice - 1; right < middle; right++, left--)
{
cout << "Create pair: " << right << " and " << left << " slices.\n";
sprintf(strFileNameForLeft, "%s%s%d%s", STR_LEFT, STR_PANORAMA, left, SUFFIX_JPG);
sprintf(strFileNameForRight, "%s%s%d%s", STR_RIGHT, STR_PANORAMA, right, SUFFIX_JPG);
sprintf(strFileNameForCombineLeftRight, "%s%s%s%d%d%s", STR_LEFT, STR_RIGHT, STR_PANORAMA, left, right, SUFFIX_JPG);
sprintf(strFileNameForCombineRightLeft, "%s%s%s%d%d%s", STR_RIGHT, STR_LEFT, STR_PANORAMA, right, left, SUFFIX_JPG);
sprintf(strFileNameForStereo, "%s%s%d%d%s", STR_STEREO, STR_PANORAMA, right, left, SUFFIX_JPG);
//init mats
Mat stereoPanorama;
Mat panoramaLeft(height, widthForResult, 16);
Mat panoramaRight(height, widthForResult, 16);
Mat3b combine(height, widthForResult, 16);
//init postion
leftPosition = left * sliceWidth;
rightPosition = right * sliceWidth;
//For left
createPanoramaForSlice(framesVec, dxsVec, leftPosition, sliceWidth, height, panoramaLeft, left, strFileNameForLeft);
//For Right
createPanoramaForSlice(framesVec, dxsVec, rightPosition, sliceWidth, height, panoramaRight, right, strFileNameForRight);
//For Combine -Left Up
combineLeftAndRightPanorama(panoramaLeft, panoramaRight, combine, 1, strFileNameForCombineLeftRight, strFileNameForLeft, strFileNameForRight);
//For Combine -Right Up
combineLeftAndRightPanorama(panoramaLeft, panoramaRight, combine, 0, strFileNameForCombineRightLeft, strFileNameForLeft, strFileNameForRight);
//For Stereo
createStereoPanorama(panoramaLeft, panoramaRight, leftPosition, rightPosition, stereoPanorama, strFileNameForStereo);
//After create and save results, release all
stereoPanorama.release();
panoramaLeft.release();
panoramaRight.release();
combine.release();
}
}
void createPanoramaForSlice(vector<Mat> framesVec, vector<int> dxsVec, int position, int sliceWidth, int height, Mat& image, int sliceNumber, char strFileName[])
{
Mat temp = framesVec.at(0)(Rect(position, 0, sliceWidth, height));
temp.copyTo(image(Rect(0, 0, sliceWidth, height)));
int currentColAtRes = sliceWidth;
int xStartDrawPixsle = position;
int howManyColsDraw = sliceWidth;
for (int i = 1; i < framesVec.size(); i++)
{
if (dxsVec.at(i - 1) < sliceWidth)
{
xStartDrawPixsle = position + sliceWidth - dxsVec.at(i - 1);
howManyColsDraw = dxsVec.at(i - 1);
}
else
{
xStartDrawPixsle = position;
howManyColsDraw = sliceWidth;
}
Mat temp = framesVec.at(i)(Rect(xStartDrawPixsle, 0, howManyColsDraw, height));
temp.copyTo(image(Rect(currentColAtRes, 0, howManyColsDraw, height)));
currentColAtRes += howManyColsDraw;
}
imwrite(strFileName, image);
}
void createStereoPanorama(Mat& leftEye, Mat& rightEye, int leftPosition, int rightPosition, Mat& stereo, char strFileName[])
{
rightEye = rightEye(Rect(leftPosition - rightPosition, 0, rightEye.cols - (leftPosition - rightPosition), rightEye.rows));
if (leftEye.cols <= rightEye.cols)
rightEye = rightEye(Rect(0, 0, leftEye.cols, rightEye.rows));
else
leftEye = leftEye(Rect(0, 0, rightEye.cols, leftEye.rows));
for (int i = 0; i < rightEye.cols; i++)
for (int j = 0; j < rightEye.rows; j++)
(rightEye.at<Vec3b>(Point(i, j))).val[2] = 0;
for (int i = 0; i < leftEye.cols; i++)
for (int j = 0; j < leftEye.rows; j++)
{
(leftEye.at<Vec3b>(Point(i, j))).val[1] = 0;
(leftEye.at<Vec3b>(Point(i, j))).val[0] = 0;
}
stereo = leftEye + rightEye;
imwrite(strFileName, stereo);
}
void combineLeftAndRightPanorama(Mat& leftEye, Mat& rightEye, Mat3b& combine, int leftUp, char strFileName[], char strLeft[], char strRight[])
{
Mat3b img1, img2;
if (leftUp)
{
img1 = imread(strLeft);
img2 = imread(strRight);
}
else
{
img1 = imread(strRight);
img2 = imread(strLeft);
}
if (!img1.data || !img2.data)
{
std::cout << " --(!) Error reading images " << std::endl;
system("pause");
exit(-1);
}
// Get dimension of final image
int cols = max(img1.cols, img2.cols);
int rows = img1.rows + img2.rows;
// Create a black image
Mat3b res(rows, cols, Vec3b(0, 0, 0));
// Copy images in correct position
img1.copyTo(res(Rect(0, 0, img1.cols, img1.rows)));
img2.copyTo(res(Rect(0, img1.rows, img2.cols, img2.rows)));
imwrite(strFileName, res);
}
|
e1a072c895e217010ad1812bb964b651b6f199d1
|
c01252097566681a17f0a6aecf76a2e47e1a491e
|
/province.cc
|
1e23a8bfac82b0ac8f0dce1ddd0f99fb134d5ab4
|
[] |
no_license
|
jordanhunt20/cps222-project5
|
a60463f21d564ee767992592dcfa6aed0b526563
|
8511e31d4b15a57a853a4cd43e136923467bb5e0
|
refs/heads/master
| 2020-12-24T20:43:12.481216
| 2016-05-05T05:05:07
| 2016-05-05T05:05:07
| 56,542,877
| 0
| 0
| null | 2017-07-07T14:02:09
| 2016-04-18T21:17:56
|
C++
|
UTF-8
|
C++
| false
| false
| 17,386
|
cc
|
province.cc
|
/*
* Implentation of Province.h
* Copyright 2016 Adam Vigneaux and Jordan Hunt
* Based on algorithms by Dr. Bjork
*/
#include "./province.h"
#include <algorithm>
#include <stack>
#include <cfloat>
/*
* Constructor
* @param source File containing province:
* 1. One line: number of towns (n), number of roads (p)
* as integers
* 2. n lines: names of towns, all uppercase
* 3. p lines: roads, defined as names of towns they
* connect, bridge/not bridge, and length in miles
* ex: BEVERLY DANVERS N 2.9 (connects Beverly and
* Danvers, not a bridge, 2.9 miles long)
*/
Province::Province(std::istream &source) {
// Read first line of input
source >> _numberOfTowns >> _numberOfRoads;
_towns = new Town[_numberOfTowns];
std::map<std::string, int> nameMap;
// Read town names
for (int i = 0; i < _numberOfTowns; i++) {
source >> _towns[i]._name;
nameMap[_towns[i]._name] = i;
}
// Read roads
for (int i = 0; i < _numberOfRoads; i++) {
std::string tail, head;
source >> tail >> head;
int tailIndex = nameMap[tail]; // index of the first town
int headIndex = nameMap[head]; // index of the second town
// Get type of road (B for bridge, N for normal)
char type;
source >> type;
bool isBridge = (type == 'B');
// Get length of road
double length;
source >> length;
// Add road to road list
Road newRoad(headIndex, tailIndex, isBridge, length);
_roads.push_back(newRoad);
// Add road to both towns it connects
_towns[tailIndex]._roads.push_back(Road(headIndex, tailIndex,
isBridge, length));
_towns[headIndex]._roads.push_back(Road(tailIndex, headIndex,
isBridge, length));
}
}
/**
* Print list of towns and roads in province in
* breadth-first search order
* @param start Index to start traversal at
* @param output Output stream to write to
*/
void Province::printAll(int start, std::ostream &output) const {
// Keep track of whether a vertex has been scheduled to be visited, lest
// we get into a loop
bool scheduled[_numberOfTowns];
for (int i = 0; i < _numberOfTowns; i++) {
scheduled[i] = false; // default false value for each vertex
}
// keeps track of which vertices have been visited
// queue to keep track of which vertex to visit next
std::queue <int> toVisit;
toVisit.push(start);
scheduled[start] = true;
output << "The input data is:" << std::endl << std::endl;
// Visit each town in queue
while (!toVisit.empty()) {
// Visit front vertex in the queue
int current = toVisit.front();
toVisit.pop();
output << " ";
output << _towns[current]._name << std::endl;
// Enqueue current vertex's unscheduled neighbors
for (Town::RoadList::iterator neighbor = _towns[current]._roads.begin();
neighbor != _towns[current]._roads.end(); neighbor++) {
std::string neighborName = _towns[neighbor->_head]._name;
output << " ";
output << neighborName << " " << neighbor->_length << " mi";
// if the type is bridge, then add to output
if (neighbor->_isBridge) {
output << " via bridge";
}
output << std::endl;
int head = neighbor->_head;
// Add neighbor to queue if not scheduled
if (!scheduled[head]) {
toVisit.push(head);
scheduled[head] = true;
}
}
}
output << std::endl << std::endl;
}
int Province::smallest(double dist[], std::list <int> toVisit,
int numTowns) const {
int smallest = toVisit.front();
if (toVisit.size() > 1) {
for (int i = 0; i < numTowns; i++) {
if (dist[i] < dist[smallest]) {
bool found = (std::find(toVisit.begin(), toVisit.end(), i)
!= toVisit.end());
if (found) {
smallest = i;
}
}
}
}
return smallest;
}
/**
* Print the shortest route from the capital of the
* province to each of the other towns
* algorithm found at graphs lecture notes under
* "Single-Source" All Destinations Shortest Path
* @param output stream to write to
*/
void Province::printShortest(std::ostream & output) const {
// Bypass entire function if only one town
if (_numberOfTowns == 1) {
output << "There is only one town, so the provincial "
<< "officials have no need of efficient routes!";
return;
}
output << "The shortest routes from " + _towns[0]._name;
output << " are:" << std::endl << std::endl;
// keeps track of the index of the predecessor to each
// vertex n on the shortest path to n
int prev[_numberOfTowns];
// queue to keep track of which vertex to visit next
std::list <int> toVisit;
// keeps track of the distance from the capital to each town
// following the shortest path
double dist[_numberOfTowns];
// set defaults for dist, prev, and add all vertices to toVisit
for (int i = 0; i < _numberOfTowns; i++) {
dist[i] = DBL_MAX;
toVisit.push_back(i);
}
// distance from the capital to the capital is zero
dist[0] = 0.0;
while (!toVisit.empty()) {
int smallestIndex = smallest(dist, toVisit, _numberOfTowns);
toVisit.remove(smallestIndex);
// Enqueue current vertex's neighbors
for (Town::RoadList::iterator neighbor =
_towns[smallestIndex]._roads.begin();
neighbor != _towns[smallestIndex]._roads.end(); neighbor++) {
// new distance needed for testing
double newDist = dist[smallestIndex] + neighbor->_length;
// if new dist is smaller, replace the old one, and
// update the corresponding entry in prev
if (newDist < dist[neighbor->_head]) {
dist[neighbor->_head] = newDist;
prev[neighbor->_head] = smallestIndex;
}
}
}
// print out the data for each non capital town
for (int i = 1; i < _numberOfTowns; i++) {
output << " " << "The shortest route from " + _towns[0]._name;
output << " to " + _towns[i]._name + " is " << dist[i];
output << " mi:" << std::endl;
// stack to hold the path to the town at index i
std::stack <int> predecessors;
// add town at i to stack
int predecessor = i;
predecessors.push(i);
// follow the links in prev until we get to the capital,
// adding each town to the predecessor stack
while (predecessor != 0) {
predecessor = prev[predecessor];
predecessors.push(predecessor);
}
// print out the names for each entry in the stack
while (!predecessors.empty()) {
output << " " << _towns[predecessors.top()]._name;
output << std::endl;
predecessors.pop();
}
}
}
/**
* Overloads operator < when used to compare two roads
* @param road2 A road
* @return True if road1 is shorter in length than road 2
*/
bool Province::Road::operator < (Road road2) const {
return this->_length < road2._length;
}
/**
* Find minimum spanning tree of the province
* @param output Stream to print output to
*/
void Province::minSpan(std::ostream & output) const {
// Bypass entire function if only one town
if (_numberOfTowns == 1) {
output << "There is only one town, so the province "
<< "does not need to upgrade any roads!";
return;
}
std::list<Road> roads;
std::vector<Road> minSpanTree;
std::vector<int> higher;
// Initialize a numComponent value for each town to 0
int numComponent[_numberOfTowns];
for (int i = 0; i < _numberOfTowns; i++) {
numComponent[i] = 0;
}
// Add all roads to list of roads
for (int i = 0; i < _numberOfRoads; i++) {
roads.push_back(_roads[i]);
}
// Sort list of roads by length
roads.sort();
int compNum = 0; // Used to determine if edge forms a cycle
while (minSpanTree.size() < _numberOfTowns - 1) {
Road minRoad = roads.front();
roads.pop_front();
// Both towns have component number 0
if (numComponent[minRoad._head] == 0 &&
numComponent[minRoad._tail] == 0) {
minSpanTree.push_back(minRoad);
compNum++;
numComponent[minRoad._head] = compNum;
numComponent[minRoad._tail] = compNum;
// Only one town has component number 0
} else if (numComponent[minRoad._head] == 0) {
minSpanTree.push_back(minRoad);
numComponent[minRoad._head] = numComponent[minRoad._tail];
// Other town has component number 0
} else if (numComponent[minRoad._tail] == 0) {
minSpanTree.push_back(minRoad);
numComponent[minRoad._tail] = numComponent[minRoad._head];
// If component number of one town is less than other town
} else if (numComponent[minRoad._head] <
numComponent[minRoad._tail]) {
minSpanTree.push_back(minRoad);
higher.push_back(minRoad._tail);
// Set all higher road components to value of lower
for (int i = 0; i < higher.size(); i++) {
higher[i] = numComponent[minRoad._head];
}
// If component number of other town is less than other town
} else if (numComponent[minRoad._head] >
numComponent[minRoad._tail]) {
minSpanTree.push_back(minRoad);
higher.push_back(minRoad._head);
// Set all higher road components to value of lower
for (int i = 0; i < higher.size(); i++) {
higher[i] = numComponent[minRoad._tail];
}
}
}
output << "The road upgrading goal can be achieved at minimal cost by upgrading:";
output << std::endl << std::endl;
// Print names of towns in minimum spanning tree of province
for (int i = 0; i < minSpanTree.size(); i++) {
output << " ";
output << _towns[minSpanTree[i]._head]._name;
output << " to ";
output << _towns[minSpanTree[i]._tail]._name << std::endl;
}
}
/**
* Conduct a breadth-first traversal on the province, ignoring bridges
* @param start Index of town to start traversal at
* @return List of indices of towns in order of traversal
*/
std::vector<int> Province::bfs(int start) const {
// Initialize list of towns scheduled to visit
bool scheduled[_numberOfTowns];
for (int i = 0; i < _numberOfTowns; i ++) {
scheduled[i] = false;
}
// Initialize list of towns to visit with starting town
std::queue<int> toVisit;
toVisit.push(start);
scheduled[start] = true;
std::vector<int> results;
// While all towns have not been visited
while (!toVisit.empty()) {
// Remove current town from queue, add to results
int current = toVisit.front();
toVisit.pop();
results.push_back(current);
// Iterate over neighbors to current town
for (Town::RoadList::iterator neighbor =
_towns[current]._roads.begin();
neighbor != _towns[current]._roads.end();
neighbor ++) {
// If neighbor is not bridge and is not scheduled,
// add to results and schedule
if (!neighbor->_isBridge && !scheduled[neighbor->_head]) {
toVisit.push(neighbor->_head);
scheduled[neighbor->_head] = true;
}
}
}
return results;
}
/**
* Remove bridges and print the list of towns that remain connected
* 1. Remove all bridges
* 2. Make a list of towns to visit
* 3. Run a BFS from a town, remove that town and all reached towns
* from list to visit, then print all towns in that connected
* component.
* 4. Repeat step 3 for all remaining towns.
* @param output Stream to print output to
*/
void Province::removeBridges(std::ostream &output) const {
// Look for a bridge
bool hasBridge = false;
for (int roadNum = 0; roadNum < _roads.size(); roadNum++) {
if (_roads[roadNum]._isBridge) {
hasBridge = true;
break;
}
}
// Bypass entire function if only one town
if (_numberOfTowns == 1) {
output << "There is only one town, so the province "
<< "will not be affected by a major storm!";
return;
// Bypass entire function if province has no bridges
} else if (!hasBridge) {
output << "The province has no bridges, so it "
<< "will not be affected by a major storm!";
return;
}
// Mark all towns as unvisited
std::list<int> toVisit;
for (int i = 0; i < _numberOfTowns; i++) {
toVisit.push_back(i);
}
output << "Connected components in event of a major storm are: ";
output << std::endl << std::endl;
// While not all towns have been visited
while (!toVisit.empty()) {
// Mark current town as visited
int curr = toVisit.back();
toVisit.pop_back();
// Run BFS from current town
std::vector<int> bfsResult = bfs(curr);
// Mark all towns in BFS result as visited
for (int i = 0; i < bfsResult.size(); i++) {
toVisit.remove(bfsResult[i]);
}
output << " ";
output << "If all bridges fail, the following towns would form ";
output << "an isolated group:" << std::endl;
// Print names of all towns in connected component
for (int i = 0; i < bfsResult.size(); i++) {
output << " ";
output << _towns[bfsResult[i]]._name << std::endl;
}
}
}
/**
* Perform a depth-first search on province
* @param dfsTowns List to populate with results of search
*/
void Province::dfs(std::vector<int> &dfsTowns) const {
bool visited [ _numberOfTowns ];
for (int i = 0; i < _numberOfTowns; i++) {
visited[i] = false;
}
dfsAux(0, dfsTowns, visited);
}
/**
* Auxiliary function for recursive depth-first search
* @param current Current index
* @param dfsTowns List to populate with results of search
* @param visited List of visited town indices
*/
void Province::dfsAux(int current, std::vector<int> &dfsTowns,
bool visited[]) const {
visited[current] = true;
dfsTowns.push_back(current);
// Do a DFS recursively from each of its neighbors
for (Town::RoadList::iterator neighbor =
_towns[current]._roads.begin();
neighbor != _towns[current]._roads.end();
neighbor ++) {
if (!visited[neighbor->_head]) {
dfsAux(neighbor->_head, dfsTowns, visited);
}
}
}
/**
* Get Low V for a vertex, determined by the minimum of the following:
* 1. currNumV - vertex number in DFS traversal
* 2. lowV - low value of any child in DFS tree
* 3. numV - num value of any node reachable by following a back edge
* @param vertexNumV Number value in DFS tree of current vertex
* @param lowV List of low values of vertices in DFS tree
* @param numV List of number values of vertices in DFS tree
* @return Low value of current vertex
*/
int getLowV(int vertexNumV, int lowV[], int numV[],
std::vector<int> dfsTowns) {
int vertexLowV = vertexNumV;
// Look for lower value in list of vertex low values
for (int i = 0; i < dfsTowns.size(); i++) {
int currLowV = lowV[dfsTowns[i]];
vertexLowV = std::min(currLowV, vertexLowV);
}
// Look for lower value in nodes reachable by following back edge
return vertexLowV;
}
void Province::articulationPoints(std::ostream & output) const {
std::vector<int> dfsTowns;
int numV[_numberOfTowns];
int lowV[_numberOfTowns];
std::vector<Road> roadsUsed;
std::vector<Road> backRoads;
std::list<Road> allRoads;
for (int i = 0; i < _numberOfRoads; i++) {
allRoads.push_back(_roads[i]);
}
// Do depth-first traversal
dfs(dfsTowns);
// Number vertices in order visited
for (int i = 0; i < dfsTowns.size(); i++) {
numV[dfsTowns[i]] = i;
}
// Do a reverse depth-first traversal
for (int i = dfsTowns.size() - 1; i >= 0; i--) {
int currLowV = getLowV(numV[dfsTowns[i]], lowV, numV,
dfsTowns);
lowV[dfsTowns[i]] = currLowV;
for (std::list<Road>::iterator neighbor =
allRoads.begin();
neighbor != allRoads.end();
neighbor ++) {
if (neighbor->_head == dfsTowns[i]) {
if (neighbor->_tail == dfsTowns[i + 1]) {
}
} else if (neighbor->_tail == dfsTowns[i]) {
if (neighbor->_head == dfsTowns[i + 1]) {
}
}
}
}
}
|
4bff190f6eb18f530c5afa1f431bbdd34f508932
|
877fff5bb313ccd23d1d01bf23b1e1f2b13bb85a
|
/app/src/main/cpp/dir7941/dir7942/dir8062/dir8063/dir12766/dir12767/dir19789/dir19799/file19906.cpp
|
16e4599572e23982da6649575d6ca1865478c502
|
[] |
no_license
|
tgeng/HugeProject
|
829c3bdfb7cbaf57727c41263212d4a67e3eb93d
|
4488d3b765e8827636ce5e878baacdf388710ef2
|
refs/heads/master
| 2022-08-21T16:58:54.161627
| 2020-05-28T01:54:03
| 2020-05-28T01:54:03
| 267,468,475
| 0
| 0
| null | null | null | null |
UTF-8
|
C++
| false
| false
| 115
|
cpp
|
file19906.cpp
|
#ifndef file19906
#error "macro file19906 must be defined"
#endif
static const char* file19906String = "file19906";
|
d83793ac4a689b53b7e6fc6489d0cfe11e0d59b5
|
31c31345946b3526ffe3f1eafbc9dd7cdb48e03a
|
/URI Online Judge/Paradigmas/uri2920.cpp
|
6077d64e6d2e1f12745c110ca91897664e0251cb
|
[] |
no_license
|
felipefoschiera/Competitive-Programming
|
84967cb7c6b82df5990cccea5d5b6862b9e63f65
|
fe664046d0161fd6a15d4b8d8f983e77c6dc3dcb
|
refs/heads/master
| 2022-02-23T16:07:04.326089
| 2019-10-04T19:22:22
| 2019-10-04T19:22:22
| 198,893,046
| 0
| 0
| null | 2019-07-25T19:53:36
| 2019-07-25T19:53:36
| null |
UTF-8
|
C++
| false
| false
| 549
|
cpp
|
uri2920.cpp
|
// URI 2920 - Número Pequeno
// Felipe G. Foschiera
#include <iostream>
using namespace std;
int main(){
string s;
int K;
while(cin >> s >> K){
string ans = "";
for(int i = 0; i < (int)s.length(); i++){
while(!ans.empty() && K > 0 && ans.back() > s[i]){
ans.pop_back();
K--;
}
ans.push_back(s[i]);
}
while(!ans.empty() && K > 0){
ans.pop_back();
K--;
}
cout << ans << '\n';
}
return 0;
}
|
2253c6bfc9d341fb829249c20a5d8c859a6cbbee
|
d204eaf9449b2d03fc72bce1680904f5a18f6dc1
|
/560.subarray-sum-equals-k.cpp
|
d594d3be383e9b9c5b33f0fe24b2474adbd3cfd2
|
[] |
no_license
|
AkshatParihar/LeetCode-1
|
2b2e4455744d12ef56d7ff800a53ae88df80a50d
|
bf632201ea61aa0092ed538d13fbf28265bc5358
|
refs/heads/master
| 2023-03-22T02:55:51.622174
| 2020-08-24T19:46:32
| 2020-08-24T19:46:32
| null | 0
| 0
| null | null | null | null |
UTF-8
|
C++
| false
| false
| 773
|
cpp
|
560.subarray-sum-equals-k.cpp
|
class Solution {
public:
int subarraySum(vector<int>& nums, int k) {
int n=nums.size();
if(n==0)return 0;
unordered_map<int,int>map;
vector<int>prefix(n);
prefix[0]=nums[0];
for(int i=1;i<n;i++)
{
prefix[i]=prefix[i-1]+nums[i];
}
int count=0;
for(int i=0;i<prefix.size();i++)
{
if(prefix[i]==k )
{
count++;
}
if( map.find(prefix[i]-k)!=map.end())
count+=map[prefix[i]-k];
map[prefix[i]]++;;
}
return count;
}
};
|
a9282b53d397511a7db6c4ca1bb9fdfe9f11cdb7
|
2242466612d9a31e63bb913111d8b9843ecc8d77
|
/build/msvs2017/apps/vulkan_glfw_app/vulkan_material.hpp
|
23144a483285b1332c28f81097dbb8138a3cd06e
|
[
"MIT"
] |
permissive
|
SergeyLebedkin/VulkanPlayground
|
e14cd76bb6d873448e1d0b595b36d560873721a3
|
db90a0272efdc1dc6f164ce7c22ac36bb65e1280
|
refs/heads/master
| 2020-04-20T00:32:38.597127
| 2020-04-11T09:35:36
| 2020-04-11T09:35:36
| 168,523,902
| 0
| 0
| null | null | null | null |
UTF-8
|
C++
| false
| false
| 2,084
|
hpp
|
vulkan_material.hpp
|
#pragma once
#include "vulkan_descriptors.hpp"
#include "vulkan_context.hpp"
#include <glm/vec4.hpp>
// VulkanMaterialUsage
enum VulkanMaterialUsage {
VULKAN_MATERIAL_USAGE_COLOR = 0,
VULKAN_MATERIAL_USAGE_COLOR_LIGHT = 1,
VULKAN_MATERIAL_USAGE_COLOR_TEXTURE = 2,
VULKAN_MATERIAL_USAGE_COLOR_TEXTURE_LIGHT = 3,
VULKAN_MATERIAL_USAGE_COLOR_TEXTURE_LIGHT_BUMPMAP = 4,
VULKAN_MATERIAL_USAGE_COLOR_TEXTURE_LIGHT_PBR = 5,
VULKAN_MATERIAL_USAGE_BEGIN_RANGE = VULKAN_MATERIAL_USAGE_COLOR,
VULKAN_MATERIAL_USAGE_END_RANGE = VULKAN_MATERIAL_USAGE_COLOR_TEXTURE_LIGHT_PBR,
VULKAN_MATERIAL_USAGE_RANGE_SIZE = (VULKAN_MATERIAL_USAGE_END_RANGE - VULKAN_MATERIAL_USAGE_BEGIN_RANGE + 1),
VULKAN_MATERIAL_USAGE_MAX_ENUM = 0x7FFFFFFF
};
// VulkanMaterialInfo
struct VulkanMaterialInfo {
glm::vec4 diffuseColor = glm::vec4(1.0f);
glm::vec4 ambientColor = glm::vec4(1.0f);
glm::vec4 emissionColor = glm::vec4(1.0f);
glm::vec4 specularColor = glm::vec4(1.0f);
float specularFactor = 32.0f;
};
// VulkanMaterial
class VulkanMaterial : public VulkanContextObject {
protected:
// descriptor set
VulkanDescriptorSet descriptorSet{};
// buffer material colors
VulkanBuffer bufferMaterialColors{};
// material info
VulkanMaterialInfo materialInfo{};
public:
// constructor and destructor
VulkanMaterial(VulkanContext& context);
~VulkanMaterial();
// set colors
void setDiffuseColor(const glm::vec4 color);
void setAmbientColor(const glm::vec4 color);
void setEmissionColor(const glm::vec4 color);
void setSpecularColor(const glm::vec4 color);
void setSpecularFactor(float factor);
// get colors
glm::vec4 getDiffuseColor() const;
glm::vec4 getAmbientColor() const;
glm::vec4 getEmissionColor() const;
glm::vec4 getSpecularColor() const;
float getSpecularFactor() const;
// set diffuse image
void setDiffuseImage(VulkanImage* image, VulkanSampler* sampler);
void setNormalMapImage(VulkanImage* image, VulkanSampler* sampler);
// update
void update(VulkanCommandBuffer& commandBuffer) override;
// bind
virtual void bind(VulkanCommandBuffer& commandBuffer);
};
|
90cc37ebff15c024e01687f97997b69bad379278
|
bb705eea53fccdb9fad5cdae1190d19c6249918c
|
/Compute_nCr___p_Set_2_Lucas_Theorem.cpp
|
bbc98536d235411be17beac903e5e8e19e12a5f5
|
[] |
no_license
|
niteshcse14/geeksforgeeks
|
f1e4e935f7d420caed1c0a142798dae5d09e0dd8
|
99fbfcc6294ff8e148bc8a1f921c0a5ee7e87590
|
refs/heads/master
| 2020-03-29T13:49:21.000669
| 2018-09-23T12:50:34
| 2018-09-23T12:50:34
| null | 0
| 0
| null | null | null | null |
UTF-8
|
C++
| false
| false
| 525
|
cpp
|
Compute_nCr___p_Set_2_Lucas_Theorem.cpp
|
#include <bits/stdc++.h>
using namespace std;
const int MOD = 1e9 + 7;
int nCrDP(int N, int R){
int dp[R + 1];
memset(dp, 0, sizeof(dp));
dp[0] = 1;
for(int i = 1; i <= N; ++i){
for(int j = min(i, R); j > 0; --j){
dp[j] = (dp[j] + dp[j - 1]) % MOD;
}
}
return dp[R];
}
int nCrLucas(int N, int R){
if(R == 0){
return 1;
}
int Ni = N % MOD;
int Ri = R % MOD;
return (nCrLucas(N / MOD, R / MOD) * nCrDP(Ni, Ri));
}
int main(){
int N, R;
scanf("%d %d", &N, &R);
printf("%d\n", nCrLucas(N, R));
return 0;
}
|
5d9355c510336cfc35197bd395550b281e670007
|
573f60accd206a468729457976abe4e3b805edd8
|
/дз 25.11.18/10..cpp
|
1340f3e7dc752a7c74870376c34ad1593dc62bee
|
[] |
no_license
|
Le0nA/Informatika
|
d64865563a7412b2614016dccf6beab53dec3957
|
9d8fcc8c188ff49960b93ac0e807bb76cbce41f3
|
refs/heads/master
| 2021-06-11T20:14:39.026628
| 2019-12-25T18:02:52
| 2019-12-25T18:02:52
| 152,994,103
| 0
| 0
| null | null | null | null |
UTF-8
|
C++
| false
| false
| 405
|
cpp
|
10..cpp
|
#include <iostream>
#include <vector>
using namespace std;
int main(){
int n;
cin >> n;
vector <int> arr(n);
arr.assign(n, 1);
for (int i = 2; i < n; i++)
if (arr[i] == 1) {
for (int j = i * 2; j < n; j += i) {
arr[j] = 0;
}
}
int primorial = 1;
for (int i = 2; i < n; i++) {
if (arr[i] == 1)primorial *= i;
}
cout << primorial;
system("pause");
return 0;
}
|
969644b1878162f9fe456304251584df3b8f9e8c
|
59418b5794f251391650d8593704190606fa2b41
|
/sample_plugins/original_snippets/em5/logic/local/gangsters/GangsterKillerAllLogic.cpp
|
f160b731ce331ed5299e48598cf35fff460f30db
|
[] |
no_license
|
JeveruBerry/emergency5_sdk
|
8e5726f28123962541f7e9e4d70b2d8d5cc76cff
|
e5b23d905c356aab6f8b26432c72d18e5838ccf6
|
refs/heads/master
| 2023-08-25T12:25:19.117165
| 2018-12-18T16:55:16
| 2018-12-18T17:09:54
| null | 0
| 0
| null | null | null | null |
ISO-8859-1
|
C++
| false
| false
| 10,831
|
cpp
|
GangsterKillerAllLogic.cpp
|
// Copyright (C) 2012-2018 Promotion Software GmbH
//[-------------------------------------------------------]
//[ Includes ]
//[-------------------------------------------------------]
#include "em5/PrecompiledHeader.h"
#include "em5/logic/local/gangsters/GangsterKillerAllLogic.h"
#include "em5/command/component/CommandableComponent.h"
#include "em5/component/person/PersonComponent.h"
#include "em5/component/vehicle/HelicopterComponent.h"
#include "em5/action/move/MoveAction.h"
#include "em5/map/EntityHelper.h"
#include <qsf_game/base/DistanceHelper.h>
#include <qsf/component/base/TransformComponent.h>
#include <qsf/logic/action/ActionComponent.h>
#include <qsf/map/Map.h>
#include <qsf/map/query/ComponentMapQuery.h>
//[-------------------------------------------------------]
//[ Namespace ]
//[-------------------------------------------------------]
namespace em5
{
//[-------------------------------------------------------]
//[ Local definitions ]
//[-------------------------------------------------------]
namespace detail
{
// TODO(ks) Maybe replace it with a configurable value
static const float ATTACK_TARGETS_RANGE = 30.0f; ///< How far away may targets be so that the gangster attacks them?
static const float CHASE_MAX_RANGE = 100.0f; ///< At what distance will the gangster stop chasing his targets?
}
//[-------------------------------------------------------]
//[ Public definitions ]
//[-------------------------------------------------------]
const uint32 GangsterKillerAllLogic::GAMELOGIC_TYPE_ID = qsf::StringHash("em5::GangsterKillerAllLogic");
//[-------------------------------------------------------]
//[ Public methods ]
//[-------------------------------------------------------]
GangsterKillerAllLogic::GangsterKillerAllLogic() :
GangsterBaseLogic(GAMELOGIC_TYPE_ID),
mCurrentTargetId(qsf::getUninitialized<uint64>())
{
mEquippedWeaponTypes.set(weapon::PISTOL);
mEquippedWeaponTypes.set(weapon::KNIFE);
mEquippedWeaponTypes.set(weapon::FIST);
// This gangster type always show his weapon
mAlwaysShowWeapon = true;
}
/* Target Priorities (as defined by Mick)
Priority - Description - Components
1 - SEK-Spezialist zu Fuß (PC, CC)
2 - Polizist zu Fuß (PC, CC)
3 - Mannschaftstransportwagen (VC, CC)
4 - Streifenwagen (VC, CC)
5 - Zivilperson (!) zu Fuß (PC)
6 - Feuerwehrmann zu Fuß (PC, CC)
7 - Notarzt zu Fuß (PC, CC)
8 - Sanitäterteam zu Fuß (PC, CC)
9 - andere Einheiten (Ingenieur, Taucher) zu Fuß (PC, CC)
10 - Tanklöschfahrzeug (VC, CC)
11 - Drehleiterfahrzeug (VC, CC)
12 - Rüstwagen (VC, CC)
13 - Notarzteinsatzfahrzeug (VC, CC)
14 - Rettungstransportwagen (VC, CC)
15 - Andere Einsatzfahrzeuge (VC, CC)
PC = PersonComponent
VC = VehicleComponent
CC = CommandableComponent
*/
int GangsterKillerAllLogic::getSquadPriority(const CommandableComponent* comp) const
{
QSF_CHECK(nullptr != comp, "CommandableComponent is invalid!", return qsf::getUninitialized<int>());
uint32 unitType = comp->getUnitType();
// Lower number means higher priority, edit values if you want to change the order in which the gangster attacks them
if (unitType == CommandableComponent::UNITTAG_POLICE_SEK)
return 1;
if (unitType == CommandableComponent::UNITTAG_POLICE_POLICE)
return 2;
if (unitType == CommandableComponent::UNITTAG_POLICE_MTW)
return 3;
if (unitType == CommandableComponent::UNITTAG_POLICE_STW)
return 4;
// (_Walking_ Civil persons have priority 5)
if (unitType == CommandableComponent::UNITTAG_FIREFIGHTERS_FIREFIGHTER ||
unitType == CommandableComponent::UNITTAG_FIREFIGHTERS_FIREFIGHTER_ABC)
return 6;
if (unitType == CommandableComponent::UNITTAG_AMBULANCE_DOCTOR)
return 7;
if (unitType == CommandableComponent::UNITTAG_AMBULANCE_PARAMEDICS)
return 8;
// Other _walking_ units get priority 9 (engineer, diver, ...?)
if (unitType == CommandableComponent::UNITTAG_TECH_ENGINEER)
return 9;
if (unitType == CommandableComponent::UNITTAG_FIREFIGHTERS_DIVER)
return 9;
if (unitType == CommandableComponent::UNITTAG_FIREFIGHTERS_TLF)
return 10;
if (unitType == CommandableComponent::UNITTAG_FIREFIGHTERS_DLK)
return 11;
if (unitType == CommandableComponent::UNITTAG_FIREFIGHTERS_RW)
return 12;
if (unitType == CommandableComponent::UNITTAG_AMBULANCE_NEF)
return 13;
if (unitType == CommandableComponent::UNITTAG_AMBULANCE_RTW)
return 14;
HelicopterComponent* heliComp = comp->getEntity().getComponent<HelicopterComponent>();
if (nullptr != heliComp)
{
// Helicopter
if (heliComp->isFlying())
{
// Do not attack flying helicopter
return qsf::getUninitialized<int>();
}
else
{
// Helicopter on the ground
return 15;
}
}
// All other commandable vehicles
if (EntityHelper(comp->getEntity()).isVehicle())
return 15;
// Something bad - we ignore that
return qsf::getUninitialized<int>();
}
qsf::Entity* GangsterKillerAllLogic::getNextTarget() const
{
qsf::Entity* gangster = getEntity();
QSF_CHECK(nullptr != gangster, "Gangster does not exist!", return nullptr);
qsf::TransformComponent* tc = gangster->getComponent<qsf::TransformComponent>();
QSF_CHECK(nullptr != tc, "Gangster does not have a transform component!", return nullptr);
// Gangster position
const glm::vec3& gangsterPos = tc->getPosition();
// Create a component map query to search for suitable targets
qsf::ComponentMapQuery componentMapQuery(getMap());
// Entity and priority
std::vector<std::pair<qsf::Entity*, int> > validTargetsInRange;
std::vector<CommandableComponent*> commandableCompsInRange;
componentMapQuery.getInstancesInCircle<CommandableComponent>(gangsterPos, detail::ATTACK_TARGETS_RANGE, commandableCompsInRange);
for (const CommandableComponent* commandableComponent : commandableCompsInRange)
{
qsf::Entity& targetEntity = commandableComponent->getEntity();
// Do the usual tests (no injuries, deaths, no children, not part of an event, ...)
if (!EntityHelper(targetEntity).isValidGangsterEventTarget(*gangster, false))
continue;
int squadPriority = getSquadPriority(commandableComponent);
if (qsf::isUninitialized(squadPriority))
continue;
// Assume that every CommandableComponent in range, that is not injured etc., is valid
validTargetsInRange.emplace_back(&targetEntity, squadPriority);
}
// ks: As requested by Mick on 8.8.14, civil persons are no longer targeted by this gangster type
// (Explanation: It would be way too hard for the player to win the game - too many persons would be shot)
/*
// There might be civil persons that are in range
std::vector<PersonComponent*> civilPersonsInRange;
componentMapQuery.getInstancesInCircle<PersonComponent>(gangsterPos, detail::ATTACK_TARGETS_RANGE, civilPersonsInRange);
for (const PersonComponent* personComponent : civilPersonsInRange)
{
qsf::Entity& targetEntity = personComponent->getEntity();
if (!EntityHelper(targetEntity).isValidGangsterEventTarget(*gangster, true))
continue;
// Add civil person to valid targets (They always have priority 5)
validTargetsInRange.emplace_back(&targetEntity, 5);
}
*/
if (!validTargetsInRange.empty())
{
// Sorter-struct to sort the targets by priority
struct TargetSorter
{
explicit TargetSorter(const glm::vec3& _gangsterPosition) :
gangsterPosition(_gangsterPosition)
{ }
glm::vec3 gangsterPosition;
bool operator() (const std::pair<qsf::Entity*, int>& lhs, const std::pair<qsf::Entity*, int>& rhs)
{
int a = lhs.second;
int b = rhs.second;
if (a < b)
{
// a got higher priority than b
return true;
}
if (a == b)
{
// Same priority: Compare distances and pick the one closest to the gangster
const float squaredDistanceA = qsf::game::DistanceHelper::getSquaredDistance(gangsterPosition, *lhs.first);
const float squaredDistanceB = qsf::game::DistanceHelper::getSquaredDistance(gangsterPosition, *rhs.first);
// Distance-to-gangster comparison
return (squaredDistanceA < squaredDistanceB);
}
// b < a
return false;
}
};
return std::min_element(validTargetsInRange.begin(), validTargetsInRange.end(), TargetSorter(gangsterPos))->first;
}
// Nothing found
return nullptr;
}
//[-------------------------------------------------------]
//[ Protected virtual methods ]
//[-------------------------------------------------------]
void GangsterKillerAllLogic::onSimulationUpdate(const qsf::JobArguments& jobArguments)
{
QSF_CHECK(nullptr != getEntity(), "No entity exists! This must not happen!", return);
qsf::ActionComponent* actionComponent = getEntity()->getOrCreateComponent<qsf::ActionComponent>();
if (!actionComponent->getPlan().isEmpty())
{
// Gangster got work to do, let him finish that
return;
}
qsf::Entity* currentTarget = nullptr;
if (qsf::isUninitialized(mCurrentTargetId))
{
// Gangster needs a new target!
currentTarget = getNextTarget();
}
else
{
// Stick with the current target 8as it is still valid
currentTarget = getMap().getEntityById(mCurrentTargetId);
}
if (nullptr == currentTarget)
{
// No target in range. Become a Guard passage
changeLogic(qsf::StringHash("em5::GangsterGuardPassageLogic"));
}
else
{
// The gangster has a registered target
mCurrentTargetId = currentTarget->getId();
EntityHelper targetEntityHelper(*currentTarget);
bool isValid = targetEntityHelper.isValidGangsterEventTarget(*getEntity(), false);
if (isValid && qsf::game::DistanceHelper::getDistance(*getEntity(), *currentTarget) < detail::CHASE_MAX_RANGE)
{
// And the target is neither injured, nor dead, nor burning, ...
attack(*currentTarget);
}
else
{
// Reset target -> search new one
mCurrentTargetId = qsf::getUninitialized<uint64>();
return;
}
}
}
void GangsterKillerAllLogic::onUnitsSpotted(std::vector<SpottedUnit>& sightedPoliceUnits)
{
// Nothing here (Everything is handled in the onSimulationUpdate() )
}
void GangsterKillerAllLogic::onNoUnitsSpotted()
{
// Nothing here (Everything is handled in the onSimulationUpdate() )
}
//[-------------------------------------------------------]
//[ Namespace ]
//[-------------------------------------------------------]
} // em5
|
c79c9c629ce5d1f950de1371dc191ceae34f17f3
|
88e96058fe40cd571e03bd7c6ecea398f20b9caf
|
/Ratha.h
|
a76de2d0299beb58fc8a9a82ea21cf8ef8d182db
|
[] |
no_license
|
agreyest/P3Lab7_AlessandroReyes
|
4fe9b85ad3a392ed219b057864f2535cb36cb2b2
|
f5d72a11bdef37ef4fbaf3f7bd63b2777bc9a40c
|
refs/heads/master
| 2022-10-20T19:29:57.494300
| 2020-06-13T00:52:13
| 2020-06-13T00:52:13
| 271,874,806
| 0
| 0
| null | null | null | null |
UTF-8
|
C++
| false
| false
| 193
|
h
|
Ratha.h
|
#ifndef RATHA_H
#define RATHA_H
#include "Pieza.h"
//torre
class Ratha: public Pieza{
public:
Ratha(int, int, bool, char);
bool valido(int, int, Tablero*);
protected:
};
#endif
|
4f567cb776f13def968bbe44ad0c867a225d76fa
|
ceed8ee18ab314b40b3e5b170dceb9adedc39b1e
|
/android/external/pdfium/xfa/src/fxfa/src/common/xfa_localemgr.h
|
8dda6d0dffd316e7a9c72ddc32f97a660b3b895a
|
[
"BSD-3-Clause"
] |
permissive
|
BPI-SINOVOIP/BPI-H3-New-Android7
|
c9906db06010ed6b86df53afb6e25f506ad3917c
|
111cb59a0770d080de7b30eb8b6398a545497080
|
refs/heads/master
| 2023-02-28T20:15:21.191551
| 2018-10-08T06:51:44
| 2018-10-08T06:51:44
| 132,708,249
| 1
| 1
| null | null | null | null |
UTF-8
|
C++
| false
| false
| 2,132
|
h
|
xfa_localemgr.h
|
// Copyright 2014 PDFium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
// Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com
#ifndef _FXFA_LOCALEMGR_H
#define _FXFA_LOCALEMGR_H
class CXFA_Node;
class IFX_Locale;
class IFX_LocaleMgr;
class CXFA_LocaleMgr;
#define XFA_LANGID_zh_CN 0x0804
#define XFA_LANGID_zh_TW 0x0404
#define XFA_LANGID_zh_HK 0x0c04
#define XFA_LANGID_ja_JP 0x0411
#define XFA_LANGID_ko_KR 0x0412
#define XFA_LANGID_en_US 0x0409
#define XFA_LANGID_en_GB 0x0809
#define XFA_LANGID_es_ES 0x0c0a
#define XFA_LANGID_es_LA 0x080a
#define XFA_LANGID_de_DE 0x0407
#define XFA_LANGID_fr_FR 0x040c
#define XFA_LANGID_it_IT 0x0410
#define XFA_LANGID_pt_BR 0x0416
#define XFA_LANGID_nl_NL 0x0413
#define XFA_LANGID_ru_RU 0x0419
class CXFA_LocaleMgr : public IFX_LocaleMgr {
public:
CXFA_LocaleMgr(CXFA_Node* pLocaleSet, CFX_WideString wsDeflcid);
virtual void Release();
virtual FX_WORD GetDefLocaleID();
virtual IFX_Locale* GetDefLocale();
virtual IFX_Locale* GetLocale(FX_WORD lcid);
virtual IFX_Locale* GetLocaleByName(const CFX_WideStringC& wsLocaleName);
~CXFA_LocaleMgr();
void SetDefLocale(IFX_Locale* pLocale);
CFX_WideStringC GetConfigLocaleName(CXFA_Node* pConfig);
protected:
CFX_PtrArray m_LocaleArray;
CFX_PtrArray m_XMLLocaleArray;
IFX_Locale* m_pDefLocale;
CFX_WideString m_wsConfigLocale;
FX_WORD m_dwDeflcid;
FX_WORD m_dwLocaleFlags;
};
class IXFA_TimeZoneProvider {
public:
static IXFA_TimeZoneProvider* Create();
static IXFA_TimeZoneProvider* Get();
static void Destroy();
virtual ~IXFA_TimeZoneProvider() {}
virtual void SetTimeZone(FX_TIMEZONE& tz) = 0;
virtual void GetTimeZone(FX_TIMEZONE& tz) = 0;
};
class CXFA_TimeZoneProvider : public IXFA_TimeZoneProvider {
public:
CXFA_TimeZoneProvider();
virtual ~CXFA_TimeZoneProvider();
virtual void SetTimeZone(FX_TIMEZONE& tz);
virtual void GetTimeZone(FX_TIMEZONE& tz);
private:
FX_TIMEZONE m_tz;
};
#endif
|
fe4499980e7b9b0eabbbe64ae74f783e63228127
|
a4cbda2fc1b5a019562315300347ed4dbcf6ec1b
|
/Other/merge_sort.cpp
|
a92ec2dde379267b63e2be25f9291eb02ce79ff4
|
[] |
no_license
|
dshamany/Cpp
|
0a64026c932a7066ae81c209a29eb98fc0e2fe57
|
c1e551e89a5cd63a0a81eeb5b683fcb143f79c0b
|
refs/heads/main
| 2021-06-24T23:38:20.564510
| 2020-12-07T03:09:57
| 2020-12-07T03:09:57
| 159,065,473
| 0
| 0
| null | null | null | null |
UTF-8
|
C++
| false
| false
| 1,665
|
cpp
|
merge_sort.cpp
|
#include <iostream>
#include <algorithm>
#include <iterator>
#include <vector>
using namespace std;
void printVector(std::vector<int> v){
cout << "[ ";
for (auto i : v){
cout << i;
if (i != v[v.size() - 1]){ cout << ", "; }
}
cout << " ]";
}
void mergeSort(std::vector<int>& vec){
if (vec.size() > 1){
int mid = vec.size() / 2;
vector<int> left(begin(vec), begin(vec) + mid);
vector<int> right(begin(vec) + mid, end(vec));
// TODO: Recursively break down arrays
mergeSort(left);
mergeSort(right);
// TODO: now perform merging
auto i = 0; // left index
auto j = 0; // right index
auto k = 0; // index into merged array
// TODO: while both arrays have content
while (i < left.size() and j < right.size()){
if (left[i] < right[j]){
vec[k] = left[i];
i++;
} else {
vec[k] = right[j];
j++;
}
k++;
}
// TODO: if the left array still has content, add them
while (i < left.size()){
vec[k] = left[i];
i++;
k++;
}
// TODO: if the right array still has content, add them
while (j < right.size()){
vec[k] = right[j];
j++;
k++;
}
}
}
int main(int argc, char const *argv[]) {
std::vector<int> v1{ 109, 654, 246, 16, 354, 12, 25, 99, 0 };
cout << "UNSORTED:\t";
printVector(v1);
cout << endl;
mergeSort(v1);
cout << "SORTED:\t\t";
printVector(v1);
cout << endl;
return 0;
}
|
ec9b93a3ccc7ca14ade0df9691dbbb1b5280caf5
|
ec76c1297252070d72fd194baebca3146bafac59
|
/damBreak_turbulence/damBreak/2.8/nut
|
4df8f65ab81e10f0795eb921d79e0826f8243073
|
[] |
no_license
|
Shivam-IITKGP/CFD_InterFoam_BottleFill
|
413cdb5536cf71d95da882821fa36c7bd138e17e
|
be711e0f19a5331bb1094b8e54982c9ad101da5c
|
refs/heads/main
| 2023-04-13T12:58:09.332312
| 2021-04-15T16:24:42
| 2021-04-15T16:24:42
| 358,315,309
| 1
| 0
| null | null | null | null |
UTF-8
|
C++
| false
| false
| 113,862
|
nut
|
/*--------------------------------*- 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 "2.8";
object nut;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
dimensions [0 2 -1 0 0 0 0];
internalField nonuniform List<scalar>
9150
(
9.60064e-06
6.40377e-06
6.58941e-06
8.81361e-06
7.71481e-06
7.71929e-06
8.82017e-06
6.59226e-06
6.40396e-06
9.60072e-06
9.48783e-06
5.73599e-06
8.30274e-06
9.96194e-06
7.18091e-06
7.18488e-06
9.96858e-06
8.30685e-06
5.7362e-06
9.4879e-06
9.29583e-06
5.49895e-06
1.08356e-05
1.03385e-05
6.83061e-06
6.83439e-06
1.0345e-05
1.08409e-05
5.49918e-06
9.29589e-06
9.08017e-06
5.4213e-06
1.34432e-05
1.03365e-05
6.64312e-06
6.64684e-06
1.03429e-05
1.3449e-05
5.42151e-06
9.08023e-06
8.84534e-06
5.40504e-06
1.56888e-05
1.0245e-05
6.548e-06
6.5517e-06
1.02514e-05
1.56947e-05
5.40521e-06
8.8454e-06
5.91367e-06
1.12955e-05
1.39359e-05
1.75746e-05
1.68882e-05
1.68977e-05
1.75896e-05
1.39499e-05
1.1303e-05
5.91416e-06
6.28078e-06
8.86556e-06
1.14069e-05
1.54398e-05
1.46159e-05
1.4624e-05
1.54519e-05
1.14162e-05
8.86869e-06
6.28086e-06
6.83069e-06
7.90522e-06
9.41949e-06
1.31778e-05
1.22946e-05
1.23015e-05
1.31878e-05
9.42565e-06
7.90654e-06
6.83074e-06
7.38746e-06
7.29683e-06
8.00036e-06
1.1246e-05
1.03419e-05
1.03478e-05
1.12544e-05
8.00474e-06
7.29747e-06
7.38751e-06
8.0749e-06
6.84542e-06
7.07369e-06
9.72891e-06
8.76935e-06
8.77443e-06
9.73618e-06
7.07706e-06
6.8458e-06
8.07496e-06
1.33485e-05
1.78358e-05
1.36052e-05
1.59048e-05
1.76909e-05
1.7743e-05
1.6088e-05
1.45385e-05
2.08286e-05
1.41204e-05
7.89434e-06
1.08291e-05
1.25291e-05
1.59727e-05
1.77583e-05
1.77933e-05
1.60522e-05
1.26087e-05
1.08673e-05
7.90894e-06
7.46096e-06
1.01997e-05
1.25678e-05
1.6137e-05
1.78337e-05
1.7859e-05
1.61937e-05
1.26118e-05
1.02109e-05
7.46422e-06
7.03289e-06
9.81482e-06
1.25974e-05
1.62759e-05
1.78987e-05
1.79186e-05
1.63152e-05
1.26259e-05
9.82991e-06
7.03441e-06
6.51053e-06
1.00721e-05
1.26069e-05
1.64675e-05
1.7805e-05
1.78201e-05
1.64931e-05
1.26254e-05
1.00854e-05
6.5113e-06
1.1677e-05
1.16559e-05
1.16331e-05
1.16091e-05
1.15845e-05
1.15596e-05
1.1535e-05
1.15109e-05
1.14879e-05
1.14662e-05
0.000107581
0.000107221
0.000106844
0.000106459
0.000106072
0.000105691
0.000105323
0.000104975
0.000104655
0.000104368
0.00021241
0.000211798
0.000211142
0.000210454
0.000209749
0.000209038
0.000208333
0.000207646
0.000206987
0.000206363
0.000304706
0.000303929
0.00030307
0.000302146
0.000301172
0.000300164
0.000299134
0.000298097
0.000297061
0.000296035
0.000385488
0.000384594
0.000383575
0.000382449
0.000381232
0.00037994
0.000378585
0.000377182
0.000375739
0.000374264
0.000456667
0.000455682
0.000454525
0.000453215
0.000451767
0.000450195
0.000448514
0.000446734
0.000444865
0.000442913
0.000519816
0.000518752
0.000517469
0.000515984
0.000514311
0.000512464
0.000510456
0.000508296
0.000505993
0.000503552
0.00057617
0.000575033
0.00057363
0.000571976
0.000570085
0.000567968
0.000565637
0.000563101
0.000560367
0.00055744
0.000626712
0.000625506
0.000623988
0.000622171
0.000620069
0.000617691
0.000615047
0.000612146
0.000608993
0.000605593
0.000672238
0.000670966
0.000669339
0.000667367
0.000665063
0.000662436
0.000659494
0.000656245
0.000652694
0.000648844
0.000713406
0.000712072
0.000710341
0.000708224
0.00070573
0.000702869
0.000699648
0.000696074
0.000692149
0.000687879
0.000750763
0.00074937
0.000747543
0.000745291
0.000742623
0.000739546
0.000736067
0.000732192
0.000727924
0.000723267
0.00078477
0.000783322
0.000781407
0.000779031
0.000776203
0.00077293
0.000769216
0.000765068
0.000760488
0.000755478
0.000815814
0.000814317
0.000812321
0.000809833
0.00080686
0.000803409
0.000799485
0.000795091
0.00079023
0.000784903
0.000844228
0.000842683
0.000840612
0.000838023
0.000834921
0.000831311
0.000827198
0.000822585
0.000817473
0.000811864
0.000870289
0.000868697
0.000866558
0.000863876
0.000860658
0.000856907
0.000852627
0.000847819
0.000842485
0.000836624
0.000894233
0.000892594
0.00089039
0.000887624
0.000884302
0.000880427
0.000875999
0.000871021
0.000865491
0.000859409
0.000916255
0.000914567
0.0009123
0.000909459
0.000906045
0.000902061
0.000897507
0.000892381
0.000886683
0.000880409
0.000936512
0.000934773
0.000932447
0.000929537
0.000926044
0.000921969
0.00091731
0.000912063
0.000906225
0.000899791
0.000955123
0.000953331
0.00095095
0.000947982
0.000944427
0.000940283
0.000935545
0.000930208
0.000924264
0.000917705
0.000972158
0.000970314
0.000967887
0.000964877
0.000961282
0.000957097
0.000952316
0.000946929
0.000940923
0.000934287
0.000987628
0.000985738
0.000983279
0.000980248
0.000976643
0.000972456
0.000967677
0.000962292
0.000956285
0.000949637
0.00100147
0.000999543
0.000997074
0.000994056
0.000990482
0.000986343
0.000981627
0.000976314
0.000970385
0.000963815
0.0010135
0.00101157
0.00100913
0.00100617
0.00100268
0.000998663
0.000994089
0.000988941
0.000983193
0.000976814
0.00102344
0.00102153
0.00101916
0.00101633
0.00101302
0.00100921
0.00100488
0.00100001
0.000994559
0.0009885
0.00103083
0.00102898
0.00102674
0.00102412
0.00102109
0.00101761
0.00101366
0.00100921
0.00100421
0.00099863
0.00103509
0.00103333
0.00103129
0.00102896
0.00102632
0.00102335
0.00101997
0.00101616
0.00101186
0.00100701
0.00103541
0.00103379
0.001032
0.00103005
0.00102791
0.00102557
0.00102297
0.00102004
0.00101669
0.00101284
0.00103086
0.00102938
0.00102789
0.00102638
0.00102483
0.00102322
0.0010215
0.00101959
0.0010174
0.00101478
0.00102044
0.0010191
0.00101791
0.00101687
0.00101597
0.00101516
0.0010144
0.00101361
0.0010127
0.00101155
0.00100338
0.00100213
0.00100122
0.00100064
0.00100039
0.00100042
0.00100068
0.0010011
0.00100159
0.00100203
0.000979336
0.000978141
0.000977473
0.000977336
0.000977714
0.000978572
0.000979862
0.000981516
0.00098345
0.000985562
0.00094879
0.000947649
0.000947223
0.000947517
0.000948516
0.000950189
0.00095249
0.00095536
0.000958729
0.000962511
0.000913282
0.000912275
0.000912159
0.000912942
0.000914608
0.000917126
0.000920454
0.000924544
0.000929335
0.000934765
0.000875502
0.000874814
0.00087517
0.000876577
0.000879017
0.000882465
0.00088688
0.000892218
0.000898429
0.000905461
0.000839092
0.000839007
0.00084007
0.000842285
0.000845636
0.000850101
0.000855647
0.000862233
0.000869814
0.000878342
0.000808134
0.000809004
0.000811053
0.000814274
0.000818652
0.000824167
0.000830795
0.000838506
0.000847265
0.000857028
0.000786342
0.000788564
0.000791906
0.000796344
0.000801851
0.000808401
0.000815969
0.000824526
0.000834037
0.000844449
0.000776125
0.000780086
0.000785038
0.00079093
0.000797714
0.00080534
0.000813762
0.000822928
0.000832777
0.000843225
0.000777845
0.000783825
0.000790635
0.000798197
0.000806436
0.000815279
0.000824652
0.00083447
0.000844637
0.000855025
0.000789758
0.000797815
0.00080654
0.000815836
0.000825614
0.000835792
0.000846279
0.000856964
0.000867711
0.000878355
0.000808747
0.000818679
0.000829124
0.000839987
0.000851185
0.000862638
0.000874251
0.000885886
0.000897386
0.000908573
0.000831451
0.000842824
0.000854574
0.000866614
0.000878874
0.00089129
0.000903775
0.000916207
0.000928434
0.000940271
0.000855107
0.000867336
0.000879798
0.00089243
0.000905193
0.000918051
0.000930954
0.00094382
0.000956529
0.000968899
0.000877744
0.000890217
0.000902759
0.00091533
0.000927926
0.000940562
0.000953253
0.000965985
0.000978691
0.000991225
0.000898057
0.000910244
0.000922305
0.000934218
0.000946018
0.000957769
0.000969551
0.000981428
0.000993422
0.00100547
0.000915234
0.000926756
0.000937924
0.000948758
0.000959319
0.000969685
0.000979959
0.000990274
0.00100075
0.00101144
0.000929276
0.000939999
0.000950042
0.000959528
0.000968556
0.000977138
0.000985387
0.000993573
0.00100194
0.0010104
0.000939834
0.000949754
0.000958699
0.000966768
0.000974015
0.000980459
0.000986282
0.000991932
0.000997738
0.00100335
0.00094094
0.000949644
0.000957552
0.000964694
0.000971054
0.00097656
0.00098109
0.00098483
0.000988225
0.000990413
0.000930647
0.000938026
0.000944738
0.000950798
0.000956265
0.00096123
0.000965692
0.000969137
0.000970712
0.000969261
0.000914077
0.000920609
0.000926348
0.000931227
0.000935259
0.000938511
0.000941198
0.00094335
0.000942939
0.000939108
0.00089643
0.00090244
0.000907181
0.000910583
0.000912711
0.00091372
0.00091397
0.000913444
0.000910393
0.000905492
0.000883383
0.000888372
0.000891421
0.000892679
0.000892425
0.000890976
0.000888632
0.000885042
0.000879542
0.000873933
0.000879248
0.000881494
0.000881802
0.000880403
0.000877613
0.000873745
0.000868598
0.000861577
0.000853537
0.000846544
0.000882532
0.000881054
0.000878249
0.000873977
0.000868418
0.000861691
0.000853043
0.000842297
0.000831601
0.000822923
0.000888092
0.000883544
0.000877959
0.000870877
0.000862337
0.000851752
0.000838236
0.000823697
0.000810735
0.000800817
0.000892331
0.000885699
0.00087771
0.00086782
0.000855622
0.000839615
0.00082114
0.000803698
0.000789167
0.000778624
0.000893442
0.000885567
0.000875278
0.000862254
0.000844877
0.000822876
0.000800739
0.0007812
0.000765695
0.000755254
0.000892507
0.000882682
0.000869478
0.00085192
0.000828283
0.000801626
0.000776663
0.000755649
0.00073992
0.00073045
0.000888213
0.000875646
0.00085919
0.000836466
0.000806683
0.000776231
0.000749135
0.000727363
0.000712245
0.00070464
0.000878244
0.000862773
0.00084265
0.000814699
0.000780226
0.000746858
0.00071842
0.000696789
0.00068323
0.000678405
0.000861793
0.00084335
0.000819677
0.000786963
0.000748953
0.000713746
0.000685059
0.000664667
0.000653662
0.000652458
0.000839434
0.000818311
0.000791446
0.000754976
0.000714446
0.000678459
0.000650566
0.000632353
0.000624651
0.000627612
0.000811273
0.000788203
0.000758604
0.000719331
0.000677675
0.000642214
0.0006162
0.000600968
0.000597064
0.00060442
0.000777396
0.000753046
0.000721244
0.000680303
0.000639428
0.000606061
0.000583011
0.00057138
0.000571479
0.000583135
0.000738512
0.000713562
0.000680635
0.000639715
0.0006013
0.000571334
0.000552036
0.000544275
0.000548228
0.000563768
0.000696337
0.000671475
0.000638748
0.000599676
0.000565
0.000539271
0.000524078
0.000520065
0.000527406
0.000546191
0.000653212
0.000628813
0.000596967
0.000561745
0.000531867
0.000510765
0.000499606
0.00049888
0.000508926
0.000530214
0.000611007
0.000588463
0.000558511
0.000527782
0.000502975
0.000486379
0.000478789
0.000480644
0.000492605
0.000515633
0.000571379
0.000551855
0.000524775
0.000498854
0.000478884
0.000466245
0.000461481
0.000465109
0.000478246
0.00050236
0.000537157
0.000520846
0.000497265
0.000475635
0.000459589
0.00045001
0.000447233
0.000451916
0.000465696
0.0004905
0.000509432
0.000494797
0.000474547
0.00045677
0.000443984
0.000436799
0.000435401
0.000440674
0.000454823
0.000480148
0.000488423
0.000474134
0.000456446
0.00044157
0.000431268
0.000425903
0.000425464
0.000431089
0.000445525
0.000471289
0.000474707
0.000459743
0.00044299
0.000429571
0.000420835
0.000416778
0.000417054
0.000423007
0.000437818
0.000463998
0.000462816
0.000447684
0.000431474
0.000418974
0.000411543
0.000408764
0.000409851
0.000416358
0.000431817
0.000458564
0.00045185
0.00043659
0.000420665
0.000408955
0.000402929
0.000401647
0.000403785
0.000411132
0.000427485
0.000454846
0.00044348
0.000427511
0.000411246
0.000399915
0.000395191
0.000395514
0.000398877
0.000407299
0.000424687
0.000452461
0.000437527
0.00042044
0.00040325
0.000391804
0.000388186
0.000390188
0.000394975
0.000404797
0.000423483
0.0004515
0.000433052
0.000414721
0.000396198
0.000384179
0.000381473
0.00038528
0.000391798
0.00040356
0.000424219
0.000453137
0.000429391
0.000409756
0.0003896
0.000376561
0.00037456
0.000380348
0.000388969
0.000403269
0.000426604
0.000457099
0.000426466
0.000405362
0.000383213
0.000368603
0.000367
0.000374949
0.000386072
0.00040352
0.000430213
0.000463009
0.000424527
0.000401659
0.000377015
0.000360073
0.000358368
0.000368654
0.000382755
0.000404067
0.000434844
0.000470507
0.000423792
0.000398813
0.000371052
0.00035078
0.000348224
0.000361035
0.000378746
0.000404899
0.000440791
0.000480193
0.000424404
0.000396927
0.000365323
0.000340503
0.000336072
0.000351633
0.000373777
0.000406047
0.000448509
0.000493115
0.000426437
0.000396015
0.000359746
0.000328978
0.000321373
0.000339964
0.000367508
0.000407283
0.000457992
0.000509785
0.000430046
0.000396059
0.000354133
0.000315884
0.000303609
0.000325622
0.000359558
0.000407984
0.000468431
0.000529715
0.000435558
0.000397005
0.000348109
0.000300787
0.000282375
0.000308492
0.000349728
0.000407281
0.000478191
0.000551129
0.000443572
0.000398652
0.000340972
0.000283072
0.000257515
0.000289017
0.000338352
0.000404569
0.000485189
0.000570462
0.000454548
0.000400314
0.00033152
0.000261973
0.000229304
0.000268335
0.000326527
0.000400226
0.000488197
0.000583754
0.00046887
0.000400455
0.000318024
0.00023689
0.000198685
0.000247935
0.00031575
0.000395771
0.000488072
0.000589916
0.00048494
0.000395933
0.000298559
0.00020813
0.000167427
0.000228741
0.000307017
0.000393314
0.000487974
0.000591346
0.000495892
0.000381861
0.000272158
0.000177819
0.000137697
0.00020996
0.000299646
0.000393716
0.00049146
0.000595481
0.000489681
0.00035451
0.000241301
0.000150051
0.000110714
0.000188843
0.00029115
0.00039525
0.000497773
0.000602775
0.000452354
0.000317483
0.000213803
0.000128649
8.61325e-05
0.000162346
0.000278441
0.000396156
0.000507023
0.000614768
0.000405011
0.000292787
0.000199419
0.000113117
6.32921e-05
0.00012876
0.000257277
0.00039379
0.000520039
0.000635337
0.000386685
0.000290445
0.000192546
9.62784e-05
4.30281e-05
8.94066e-05
0.000220908
0.000381877
0.000536519
0.000670538
0.000412284
0.000307169
0.000180306
7.29115e-05
2.82606e-05
5.11111e-05
0.00016208
0.000344393
0.000548416
0.000732673
0.000511319
0.000319481
0.000141835
4.37825e-05
2.03939e-05
2.59159e-05
8.47017e-05
0.000250407
0.000510622
0.000824209
0.000595653
0.000230823
6.48528e-05
2.12412e-05
1.79288e-05
1.83079e-05
2.68733e-05
9.55985e-05
0.000300788
0.000709698
1.14456e-05
1.14255e-05
1.14076e-05
1.13919e-05
1.13781e-05
1.13661e-05
1.1356e-05
1.13508e-05
1.13565e-05
1.1365e-05
1.13723e-05
1.13771e-05
1.13783e-05
1.1375e-05
1.13662e-05
1.13506e-05
1.1327e-05
1.12942e-05
1.12506e-05
1.11947e-05
1.11248e-05
1.10394e-05
1.09368e-05
1.08156e-05
1.06754e-05
1.05146e-05
1.03377e-05
1.01357e-05
9.90027e-06
9.62791e-06
9.31365e-06
8.95232e-06
8.54221e-06
8.11463e-06
7.6682e-06
7.17872e-06
6.63097e-06
6.01218e-06
5.34377e-06
7.1307e-06
0.000104105
0.000103882
0.000103719
0.000103621
0.000103584
0.0001036
0.000103645
0.00010367
0.000103574
0.000103403
0.000103184
0.000102932
0.000102647
0.000102323
0.000101952
0.000101521
0.000101015
0.000100418
9.97116e-05
9.88755e-05
9.78867e-05
9.67195e-05
9.53456e-05
9.37333e-05
9.18491e-05
8.96616e-05
8.71392e-05
8.42758e-05
8.10541e-05
7.74969e-05
7.35764e-05
6.92386e-05
6.43577e-05
5.85961e-05
5.23514e-05
4.5857e-05
3.91793e-05
3.22012e-05
2.43027e-05
1.39312e-05
0.000205748
0.000205157
0.000204628
0.000204157
0.000203734
0.000203335
0.000202924
0.000202448
0.000201867
0.000201181
0.000200392
0.000199497
0.000198488
0.000197349
0.000196062
0.000194605
0.000192951
0.000191073
0.000188942
0.000186525
0.000183789
0.000180697
0.000177213
0.000173298
0.000168916
0.000164029
0.000158607
0.000152621
0.000146044
0.000138843
0.000130974
0.000122376
0.000112997
0.000102718
9.14916e-05
7.94746e-05
6.65452e-05
5.23705e-05
3.63608e-05
1.87602e-05
0.000294967
0.00029386
0.000292776
0.000291707
0.000290635
0.000289535
0.000288372
0.0002871
0.000285695
0.000284146
0.000282437
0.000280549
0.000278463
0.000276154
0.000273598
0.000270766
0.000267628
0.000264152
0.000260305
0.000256054
0.000251364
0.0002462
0.000240528
0.000234312
0.000227519
0.000220113
0.000212062
0.00020333
0.000193877
0.000183658
0.00017262
0.000160696
0.000147804
0.000133825
0.000118571
0.000101905
8.34035e-05
6.22651e-05
3.74806e-05
1.98022e-05
0.000372674
0.000370958
0.000369205
0.000367406
0.000365541
0.000363586
0.000361508
0.000359269
0.000356832
0.000354198
0.000351341
0.000348235
0.000344853
0.000341164
0.000337141
0.000332752
0.000327965
0.000322749
0.000317072
0.000310903
0.000304212
0.000296968
0.000289143
0.000280711
0.000271644
0.000261918
0.000251503
0.000240369
0.000228474
0.000215765
0.000202167
0.00018758
0.000171874
0.000154878
0.000136345
0.000115936
9.31272e-05
6.71319e-05
3.76169e-05
2.00455e-05
0.000440762
0.000438384
0.000435901
0.000433301
0.000430567
0.000427675
0.000424593
0.000421288
0.000417718
0.000413888
0.000409767
0.000405327
0.000400538
0.000395369
0.000389788
0.000383765
0.000377268
0.000370268
0.000362735
0.000354641
0.000345962
0.000336673
0.000326756
0.000316191
0.000304966
0.000293066
0.000280478
0.000267184
0.000253159
0.000238354
0.000222687
0.000206028
0.000188188
0.000168941
0.000148004
0.000124987
9.93016e-05
7.01167e-05
3.66642e-05
4.65868e-06
0.000500823
0.000497762
0.000494523
0.000491096
0.000487464
0.000483604
0.000479487
0.000475082
0.000470351
0.000465281
0.000459856
0.000454046
0.00044782
0.000441148
0.000433998
0.00042634
0.000418144
0.000409381
0.000400026
0.000390054
0.000379445
0.00036818
0.000356246
0.000343635
0.000330343
0.000316371
0.000301722
0.000286404
0.000270418
0.000253751
0.000236354
0.000218115
0.000198811
0.000178162
0.000155886
0.000131625
0.000104631
7.37494e-05
3.7788e-05
4.67511e-06
0.000554135
0.000550392
0.000546401
0.00054215
0.000537624
0.000532801
0.000527658
0.000522163
0.000516286
0.00050999
0.000503278
0.000496121
0.000488488
0.00048035
0.000471677
0.00046244
0.00045261
0.000442161
0.00043107
0.000419314
0.000406876
0.000393741
0.0003799
0.000365349
0.000350089
0.00033413
0.000317489
0.000300189
0.00028226
0.000263735
0.000244641
0.00022497
0.000204617
0.000183268
0.000160576
0.000136026
0.00010874
7.7269e-05
4.01527e-05
4.71999e-06
0.000601729
0.000597325
0.000592603
0.000587554
0.000582163
0.000576411
0.000570276
0.000563732
0.000556749
0.000549295
0.000541352
0.00053291
0.000523941
0.000514418
0.000504311
0.000493594
0.000482242
0.000470229
0.000457534
0.000444137
0.000430021
0.000415173
0.000399585
0.000383252
0.000366177
0.000348368
0.000329841
0.000310622
0.000290747
0.000270266
0.000249246
0.000227769
0.000205903
0.000183495
0.000160004
0.000134618
0.000106742
7.53071e-05
3.87784e-05
4.6746e-06
0.000644448
0.000639416
0.000634001
0.000628195
0.000621986
0.000615356
0.000608286
0.000600754
0.000592733
0.000584196
0.000575113
0.00056548
0.000555278
0.00054448
0.000533061
0.000520999
0.00050827
0.000494851
0.000480725
0.000465872
0.000450278
0.000433931
0.000416822
0.000398945
0.000380301
0.000360894
0.000340737
0.00031985
0.000298265
0.000276031
0.000253213
0.000229895
0.000206147
0.000181912
0.000156805
0.000130371
0.000102025
7.09715e-05
3.64887e-05
4.71524e-06
0.000682986
0.000677367
0.000671307
0.000664797
0.000657827
0.000650383
0.000642448
0.000634003
0.000625026
0.000615495
0.000605384
0.000594669
0.000583352
0.00057141
0.000558823
0.00054557
0.000531634
0.000516995
0.000501639
0.00048555
0.000468716
0.000451126
0.000432774
0.000413655
0.000393766
0.000373113
0.000351704
0.000329559
0.000306707
0.000283189
0.00025906
0.000234374
0.000209152
0.000183308
0.000156584
0.000128645
9.92556e-05
6.83259e-05
3.59152e-05
2.02225e-05
0.000717916
0.000711759
0.000705105
0.00069795
0.000690283
0.000682095
0.00067337
0.000664095
0.000654251
0.00064382
0.000632782
0.000621118
0.000608814
0.000595868
0.000582264
0.000567988
0.000553025
0.000537363
0.000520991
0.000503899
0.000486079
0.000467524
0.000448227
0.000428187
0.0004074
0.000385871
0.000363605
0.000340617
0.000316928
0.000292565
0.000267561
0.000241937
0.00021568
0.0001887
0.00016082
0.000131808
0.000101439
6.94683e-05
3.56695e-05
4.75384e-06
0.000749713
0.000743065
0.000735873
0.000728132
0.000719835
0.000710973
0.000701536
0.000691513
0.000680891
0.000669656
0.000657796
0.000645295
0.000632139
0.000618329
0.00060386
0.000588724
0.000572913
0.000556422
0.000539246
0.000521381
0.000502822
0.000483567
0.000463611
0.000442951
0.000421583
0.000399504
0.000376712
0.000353208
0.000328996
0.000304079
0.000278459
0.000252125
0.000225034
0.00019709
0.000168125
0.000137901
0.000106097
7.23159e-05
3.64301e-05
4.79816e-06
0.000778764
0.000771675
0.000763999
0.00075573
0.000746865
0.000737398
0.000727322
0.00071663
0.000705314
0.000693366
0.00068078
0.000667547
0.000653662
0.000639118
0.000623924
0.00060808
0.000591586
0.000574445
0.000556658
0.000538227
0.000519153
0.000499433
0.000479065
0.000458041
0.000436349
0.000413976
0.000390903
0.000367109
0.000342569
0.000317255
0.000291132
0.000264155
0.000236248
0.00020729
0.000177091
0.000145376
0.000111771
7.58798e-05
3.78643e-05
5.05706e-06
0.000805389
0.000797906
0.000789795
0.000781054
0.00077168
0.00076167
0.00075102
0.000739729
0.000727794
0.000715214
0.000701987
0.000688114
0.000673597
0.000658437
0.000642642
0.000626223
0.00060919
0.000591553
0.000573321
0.000554502
0.000535098
0.000515109
0.000494529
0.000473342
0.000451526
0.000429048
0.000405867
0.000381931
0.000357181
0.000331553
0.000304973
0.000277362
0.000248615
0.000218581
0.000187034
0.000153655
0.000118042
7.98185e-05
3.94075e-05
5.36861e-06
0.000829852
0.000822017
0.000813517
0.000804352
0.000794521
0.000784022
0.000772857
0.000761027
0.000748536
0.000735389
0.000721594
0.000707158
0.000692091
0.000676405
0.000660111
0.000643228
0.000625774
0.000607769
0.000589228
0.000570162
0.000550579
0.000530474
0.000509836
0.00048864
0.000466848
0.000444405
0.000421241
0.000397273
0.000372402
0.000346522
0.000319525
0.000291303
0.000261734
0.000230642
0.000197774
0.000162777
0.000125201
8.46337e-05
4.16035e-05
5.74795e-06
0.000852373
0.000844225
0.000835379
0.000825834
0.000815589
0.000804648
0.000793014
0.000780694
0.000767698
0.000754039
0.000739731
0.000724792
0.000709242
0.000693101
0.000676389
0.000659129
0.000641349
0.000623075
0.000604331
0.000585131
0.000565482
0.000545378
0.0005248
0.000503711
0.000482054
0.000459752
0.000436709
0.000412805
0.000387903
0.000361854
0.000334511
0.000305746
0.000275415
0.000243316
0.000209155
0.000172558
0.000133094
9.03712e-05
4.48252e-05
6.17508e-06
0.000873143
0.000864719
0.000855563
0.000845676
0.000835057
0.000823711
0.000811648
0.000798877
0.000785417
0.000771288
0.000756513
0.00074112
0.000725138
0.000708597
0.000691529
0.000673961
0.000655928
0.000637464
0.000618599
0.000599349
0.000579722
0.000559707
0.000539275
0.000518377
0.000496941
0.000474867
0.000452034
0.000428293
0.000403474
0.000377389
0.000349851
0.000320698
0.000289761
0.000256764
0.000221341
0.000183063
0.000141493
9.62757e-05
4.79391e-05
6.62178e-06
0.000892329
0.000883665
0.000874237
0.000864042
0.000853084
0.000841369
0.000828908
0.000815721
0.000801831
0.000787266
0.000772062
0.000756255
0.000739885
0.000722992
0.000705617
0.000687798
0.000669572
0.000650981
0.000632058
0.000612825
0.000593284
0.00057342
0.000553196
0.000532552
0.000511398
0.000489621
0.000467075
0.000443593
0.000418986
0.000393048
0.000365562
0.000336312
0.000305043
0.000271378
0.000234865
0.000194974
0.000151149
0.00010292
5.09306e-05
7.08309e-06
0.000910086
0.000901223
0.000891562
0.000881099
0.000869836
0.000857783
0.000844959
0.000831386
0.000817098
0.000802133
0.000786535
0.000770352
0.000753635
0.000736434
0.000718799
0.000700777
0.000682409
0.000663742
0.000644814
0.000625645
0.000606236
0.000586567
0.000566593
0.000546244
0.000525422
0.000503998
0.000481816
0.000458694
0.000434434
0.000408823
0.000381628
0.000352557
0.000321204
0.000287118
0.000249752
0.000208461
0.000162547
0.000111395
5.54642e-05
7.57026e-06
0.000926563
0.000917555
0.000907709
0.000897019
0.00088549
0.000873137
0.000859984
0.000846062
0.000831413
0.000816086
0.000800136
0.00078362
0.000766601
0.000749138
0.000731291
0.000713112
0.000694648
0.000675949
0.000657055
0.000637983
0.000618734
0.00059928
0.000579573
0.000559536
0.000539067
0.000518035
0.000496278
0.000473605
0.000449801
0.000424629
0.000397802
0.000368963
0.000337654
0.000303313
0.00026527
0.000222783
0.000174997
0.000121006
6.08147e-05
8.049e-06
0.000941881
0.000932801
0.000922835
0.000911975
0.000900233
0.00088763
0.000874196
0.000859974
0.000845014
0.000829377
0.000813126
0.000796331
0.000779062
0.00076139
0.00074338
0.000725091
0.000706572
0.000687876
0.000669039
0.000650081
0.000630995
0.000611752
0.000592297
0.000572551
0.000552412
0.00053175
0.000510409
0.000488195
0.000464866
0.000440143
0.000413686
0.000385072
0.000353774
0.00031913
0.000280391
0.000236706
0.000187055
0.000130271
6.59767e-05
8.4916e-06
0.000956129
0.000947084
0.00093709
0.000926141
0.000914264
0.000901485
0.000887843
0.000873391
0.000858189
0.000842308
0.000825825
0.000808816
0.000791362
0.000773538
0.000755418
0.000737066
0.000718527
0.000699853
0.000681083
0.00066223
0.000643288
0.000624224
0.00060498
0.000585475
0.000565605
0.000545247
0.000524251
0.00050242
0.000479489
0.000455134
0.000428949
0.000400448
0.000369032
0.000333979
0.000294475
0.000249567
0.000198091
0.000138684
7.07284e-05
8.90142e-06
0.000969333
0.000960476
0.000950588
0.000939682
0.000927792
0.000914948
0.0009012
0.000886613
0.000871263
0.00085523
0.0008386
0.000821458
0.000803892
0.000785982
0.000767809
0.000749433
0.000730897
0.000712248
0.000693525
0.000674742
0.000655892
0.000636943
0.000617839
0.000598499
0.000578815
0.00055866
0.000537888
0.0005163
0.000493614
0.000469452
0.000443365
0.00041482
0.000383162
0.000347629
0.000307309
0.000261168
0.000207913
0.000145991
7.46359e-05
9.2907e-06
0.000981369
0.000972884
0.000963314
0.000952648
0.000940925
0.000928179
0.000914481
0.000899911
0.000884552
0.000868495
0.000851831
0.000834657
0.000817062
0.000799138
0.000780968
0.000762606
0.000744076
0.000725429
0.000706701
0.000687911
0.000669054
0.000650105
0.000631017
0.000611718
0.000592107
0.000572047
0.000551358
0.00052983
0.00050718
0.000483021
0.000456882
0.000428178
0.00039619
0.000360188
0.000319177
0.000271965
0.000217094
0.000152849
7.83137e-05
9.65182e-06
0.000992023
0.000984112
0.000975129
0.000964915
0.000953579
0.000941183
0.000927789
0.000913472
0.000898316
0.000882417
0.000865875
0.000848794
0.000831276
0.000813417
0.000795294
0.000776952
0.000758419
0.000739732
0.000720926
0.000702022
0.000683022
0.000663913
0.000644666
0.000625223
0.000605495
0.000585345
0.000564585
0.000542981
0.000520224
0.000495914
0.000469613
0.000440708
0.000408469
0.000372039
0.000330365
0.000282152
0.000225796
0.000159403
8.18708e-05
9.99188e-06
0.00100121
0.000994171
0.000986064
0.000976646
0.00096594
0.000954156
0.000941345
0.000927543
0.000912817
0.000897269
0.000881013
0.000864167
0.000846842
0.000829132
0.000811104
0.000792796
0.000774239
0.000755463
0.000736494
0.000717354
0.000698061
0.000678622
0.000659026
0.00063923
0.000619147
0.000598641
0.000577564
0.000555683
0.000532682
0.000508162
0.00048163
0.000452472
0.000419932
0.000383091
0.000340818
0.000291709
0.000234017
0.000165657
8.53108e-05
1.03128e-05
0.00100814
0.00100226
0.000995326
0.000987123
0.000977537
0.0009668
0.000954988
0.000942043
0.000927994
0.000913012
0.000897237
0.000880806
0.000863831
0.000846396
0.00082855
0.000810317
0.00079173
0.000772812
0.000753588
0.000734094
0.000714361
0.000694407
0.000674267
0.000653903
0.000633239
0.000612167
0.000590541
0.000568145
0.00054468
0.000519755
0.000492867
0.000463384
0.000430515
0.000393284
0.000350479
0.000300586
0.000241713
0.000171574
8.86147e-05
1.06141e-05
0.00101141
0.00100695
0.00100147
0.000994818
0.000986905
0.000977731
0.000967378
0.000955772
0.00094288
0.000928857
0.000913924
0.000898239
0.000881907
0.000864983
0.000847482
0.00082941
0.000810811
0.000791716
0.000772156
0.000752219
0.000731959
0.000711402
0.000690565
0.000669427
0.000647937
0.000626019
0.00060357
0.000580409
0.000556266
0.000530759
0.000503385
0.000473492
0.000440256
0.000402644
0.000359362
0.000308787
0.000248875
0.000177141
9.17728e-05
1.08961e-05
0.00100988
0.00100732
0.0010038
0.000999214
0.000993461
0.000986398
0.000977883
0.000967955
0.000956545
0.000943876
0.000930206
0.000915695
0.000900391
0.000884268
0.000867294
0.000849511
0.000830964
0.000811761
0.000791954
0.000771606
0.000750776
0.00072951
0.000707835
0.000685754
0.000663241
0.000640265
0.000616769
0.000592626
0.000567604
0.000541348
0.000513356
0.000482962
0.000449309
0.000411308
0.000367586
0.000316405
0.000255569
0.000182391
9.47952e-05
1.1161e-05
0.00100231
0.00100211
0.00100108
0.00099907
0.00099595
0.000991519
0.000985481
0.000977736
0.000968298
0.000957356
0.000945326
0.000932371
0.000918413
0.000903292
0.00088694
0.000869569
0.000851269
0.000832118
0.000812188
0.000791548
0.000770258
0.000748368
0.00072591
0.000702891
0.000679301
0.00065515
0.000630446
0.000605149
0.000579082
0.000551919
0.00052317
0.00049216
0.000458007
0.000419575
0.00037541
0.000323652
0.00026195
0.000187421
9.77217e-05
1.14145e-05
0.000987866
0.000990153
0.000991959
0.000992862
0.00099271
0.000991309
0.000988356
0.000983393
0.000976915
0.000968368
0.000958316
0.000947155
0.000934595
0.000920337
0.000904676
0.000887847
0.000869982
0.000851165
0.000831452
0.000810891
0.000789519
0.000767371
0.000744465
0.000720792
0.0006963
0.000670989
0.000645044
0.000618514
0.000591281
0.000563062
0.000533396
0.000501615
0.000466826
0.000427859
0.000383182
0.000330812
0.000268231
0.000192385
0.000100634
1.16681e-05
0.000966861
0.00097166
0.00097636
0.000980398
0.000983442
0.00098529
0.000985583
0.000983866
0.000980332
0.00097474
0.000967433
0.000958427
0.000946755
0.000932861
0.000917787
0.000901725
0.00088472
0.000866795
0.000847939
0.000828132
0.000807357
0.000785604
0.00076286
0.000739073
0.000714074
0.000687927
0.000660935
0.000633231
0.000604782
0.000575378
0.000544615
0.000511865
0.000476245
0.000436552
0.000391205
0.000338128
0.000274667
0.000197522
0.000103677
1.19382e-05
0.000941138
0.000948443
0.000956031
0.000963385
0.000969813
0.00097504
0.000978471
0.000979862
0.000979324
0.000976643
0.000971512
0.000962829
0.00095074
0.000937345
0.000923269
0.000908539
0.000893109
0.000876896
0.000859788
0.000841665
0.000822418
0.00080196
0.000780213
0.000757036
0.000732104
0.000705604
0.00067797
0.000649364
0.000619814
0.000589194
0.000557189
0.000523252
0.000486547
0.000445886
0.000399665
0.000345753
0.000281374
0.000202916
0.000106898
1.22255e-05
0.000913756
0.000923393
0.000933692
0.000944212
0.000953791
0.000961781
0.000967786
0.000971751
0.000973387
0.000971751
0.000965454
0.000955312
0.000943721
0.000931664
0.000919328
0.000906697
0.000893665
0.000880046
0.000865622
0.000850164
0.000833457
0.000815301
0.000795516
0.000773823
0.000749771
0.000723669
0.000695972
0.000666869
0.000636446
0.000604678
0.000571368
0.000536079
0.000498054
0.000456159
0.000408802
0.000353823
0.000288311
0.000208418
0.000110159
1.25067e-05
0.000888353
0.00089997
0.000912464
0.000925281
0.000937184
0.000946709
0.000953709
0.000957897
0.000958511
0.000954107
0.00094614
0.000936685
0.000926706
0.000916643
0.000906663
0.000896746
0.000886726
0.000876344
0.000865294
0.000853255
0.000839898
0.000824893
0.000807919
0.000788562
0.000766326
0.000741482
0.000714445
0.000685401
0.000654494
0.000621806
0.000587267
0.000550558
0.000511031
0.000467629
0.000418792
0.000362347
0.000295304
0.000213639
0.000113174
1.27533e-05
0.000868398
0.000881505
0.000895529
0.000909569
0.000921907
0.000931334
0.000936956
0.000938013
0.000934579
0.000928519
0.00092106
0.000912934
0.000904705
0.00089674
0.000889195
0.000882041
0.000875086
0.000868027
0.000860512
0.000852156
0.000842532
0.000831172
0.00081761
0.000801329
0.000781783
0.000759067
0.000733426
0.000705035
0.000674101
0.0006408
0.000605178
0.000567046
0.000525886
0.000480751
0.000430169
0.000372009
0.000303273
0.000219727
0.000116733
1.30462e-05
0.000856369
0.000869826
0.000883845
0.000897696
0.000909782
0.00091835
0.000922299
0.000920804
0.000915302
0.000908334
0.000900841
0.000893279
0.000886034
0.000879396
0.000873498
0.000868316
0.000863656
0.00085921
0.000854628
0.000849505
0.000843335
0.00083553
0.000825494
0.000812644
0.000796401
0.000776497
0.000752925
0.000725802
0.00069539
0.000661896
0.000625439
0.000585948
0.000543043
0.000495917
0.000443209
0.000382833
0.000311728
0.000225559
0.000119567
1.33512e-05
0.000854821
0.000867437
0.000880032
0.000892043
0.000902526
0.000910287
0.000914139
0.000913189
0.000908142
0.000901127
0.000893431
0.000885728
0.000878475
0.000871998
0.00086646
0.000861879
0.000858112
0.00085489
0.000851971
0.000848975
0.000845348
0.000840422
0.000833477
0.000823819
0.000810767
0.000793779
0.000772676
0.000747438
0.000718172
0.000685036
0.000648139
0.000607493
0.000562847
0.000513543
0.000458362
0.000395317
0.000321366
0.000232111
0.000122641
1.36702e-05
0.000866113
0.000877622
0.000888546
0.000898437
0.000906705
0.000912697
0.000915829
0.000915911
0.000913165
0.000907985
0.000901077
0.000893401
0.000885783
0.00087872
0.000872493
0.000867225
0.000862856
0.0008593
0.000856477
0.000854082
0.000851593
0.000848324
0.000843498
0.000836317
0.000825994
0.000811815
0.000793317
0.000770349
0.000742677
0.000710319
0.000673378
0.000631872
0.000585604
0.00053404
0.000476131
0.000410026
0.00033274
0.000239819
0.000126283
1.40586e-05
0.000889342
0.000900272
0.000910159
0.000918643
0.000925385
0.000930114
0.000932652
0.000932998
0.000931194
0.000927319
0.000921646
0.000914689
0.000907105
0.000899426
0.000892033
0.000885247
0.000879264
0.00087421
0.000870142
0.000866889
0.000864035
0.000860956
0.00085691
0.000851103
0.000842672
0.000830785
0.000814779
0.000794165
0.000768463
0.000737281
0.000700659
0.000658614
0.000610926
0.000557157
0.000496433
0.000427026
0.000345987
0.000248778
0.000130348
1.44536e-05
0.000919899
0.000930898
0.000940589
0.000948689
0.000954986
0.000959334
0.000961694
0.000962101
0.000960594
0.000957245
0.000952209
0.000945736
0.000938246
0.00093018
0.000921858
0.000913588
0.000905729
0.000898662
0.000892617
0.000887571
0.000883256
0.00087918
0.000874726
0.000869135
0.000861505
0.000851026
0.000836934
0.000818396
0.000794696
0.000765131
0.000729296
0.000687153
0.000638483
0.000582874
0.000519533
0.000446798
0.000361703
0.000259585
0.000135365
1.49126e-05
0.000952199
0.000963714
0.00097382
0.000982272
0.000988906
0.000993574
0.000996261
0.000997015
0.000995897
0.000992973
0.000988348
0.000982187
0.000974761
0.000966416
0.000957482
0.000948239
0.000938995
0.00093015
0.000922053
0.000914867
0.00090853
0.000902758
0.000897066
0.000890769
0.000883026
0.000873041
0.000859952
0.000842859
0.000820787
0.000792875
0.000758291
0.000716544
0.000667418
0.000610545
0.000545044
0.000469211
0.000379987
0.000272483
0.000141362
1.54727e-05
0.000981441
0.000993641
0.00100445
0.00101363
0.00102099
0.00102638
0.0010298
0.00103129
0.0010309
0.0010287
0.00102477
0.00101924
0.00101228
0.00100415
0.000995121
0.000985444
0.0009754
0.000965343
0.000955643
0.00094657
0.000938226
0.000930516
0.000923137
0.000915516
0.000907002
0.000896812
0.00088403
0.000867688
0.000846751
0.000820133
0.000786828
0.000745904
0.000696885
0.000639312
0.000572151
0.000493529
0.000400181
0.000286854
0.000148064
1.61485e-05
0.00100412
0.00101685
0.00102831
0.00103822
0.00104636
0.00105265
0.00105708
0.0010597
0.00106052
0.00105958
0.00105692
0.0010526
0.00104675
0.00103951
0.00103108
0.00102166
0.00101151
0.00100095
0.000990322
0.000979944
0.000970014
0.000960572
0.000951443
0.000942279
0.000932589
0.000921668
0.000908662
0.000892605
0.000872403
0.000846789
0.000814534
0.000774583
0.000726119
0.000668338
0.000599965
0.000518891
0.000421548
0.000302235
0.000155259
1.68495e-05
0.00101811
0.00103085
0.00104251
0.00105279
0.00106155
0.00106877
0.00107446
0.00107859
0.00108115
0.00108208
0.00108137
0.00107899
0.00107496
0.00106936
0.00106229
0.00105391
0.00104443
0.00103412
0.00102332
0.00101234
0.00100143
0.000990746
0.000980204
0.000969646
0.000958738
0.000946907
0.000933382
0.000917208
0.000897279
0.00087233
0.000840981
0.000802059
0.000754372
0.000696694
0.000627466
0.000544285
0.00044322
0.000317987
0.000162675
1.7599e-05
0.00102284
0.00103455
0.0010455
0.00105551
0.00106459
0.00107272
0.00107985
0.00108588
0.00109069
0.00109412
0.00109603
0.0010963
0.00109484
0.00109162
0.00108667
0.00108008
0.001072
0.00106268
0.00105241
0.00104151
0.00103028
0.00101889
0.00100743
0.000995843
0.000983936
0.000971271
0.000957165
0.000940728
0.000920885
0.00089641
0.000865962
0.000828021
0.000781087
0.000723668
0.000653948
0.000569132
0.000464773
0.000334031
0.000170536
1.83586e-05
0.00101922
0.00102829
0.0010373
0.00104633
0.00105537
0.00106433
0.00107305
0.00108128
0.00108875
0.00109517
0.00110027
0.00110379
0.00110554
0.00110536
0.00110318
0.00109902
0.00109298
0.00108525
0.00107611
0.00106589
0.00105491
0.0010434
0.00103155
0.00101943
0.00100691
0.000993691
0.000979185
0.000962568
0.000942786
0.000918638
0.000888773
0.000851524
0.000805226
0.000748241
0.000678364
0.00059231
0.000484967
0.000348914
0.000177461
1.90626e-05
0.00100846
0.00101362
0.00101982
0.00102727
0.0010359
0.00104552
0.0010558
0.00106632
0.00107665
0.00108634
0.00109497
0.00110214
0.00110751
0.00111081
0.00111187
0.0011106
0.00110704
0.00110134
0.00109374
0.00108462
0.00107433
0.00106322
0.00105153
0.0010394
0.00102677
0.00101339
0.000998751
0.000982113
0.000962473
0.000938618
0.000909168
0.000872585
0.000827014
0.000770396
0.000700195
0.00061291
0.000502948
0.000362073
0.000183603
1.97613e-05
0.000990995
0.000992092
0.000995458
0.00100125
0.00100935
0.00101948
0.00103118
0.0010439
0.00105706
0.00107005
0.00108228
0.00109322
0.00110238
0.00110935
0.00111384
0.00111568
0.0011148
0.0011113
0.00110543
0.00109762
0.00108833
0.00107801
0.00106695
0.00105529
0.001043
0.00102985
0.00101541
0.000999012
0.000979702
0.000956276
0.000927322
0.000891236
0.000846084
0.000789485
0.000718616
0.000629713
0.000517031
0.000371848
0.000187763
2.03399e-05
0.000966113
0.000964668
0.00096629
0.000971038
0.000978899
0.000989606
0.00100267
0.00101747
0.00103331
0.00104946
0.0010652
0.00107982
0.00109268
0.00110326
0.00111112
0.001116
0.00111773
0.00111631
0.00111206
0.00110554
0.00109741
0.00108817
0.00107809
0.00106726
0.00105564
0.00104305
0.00102909
0.00101315
0.000994326
0.000971415
0.000942952
0.00090721
0.00086214
0.000805249
0.000733523
0.000642978
0.000527707
0.000379016
0.00019071
2.0845e-05
0.000935068
0.000933113
0.00093429
0.000938922
0.000947139
0.000958753
0.000973315
0.000990199
0.00100865
0.00102785
0.00104694
0.00106506
0.00108142
0.00109535
0.0011063
0.00111389
0.00111794
0.00111835
0.0011154
0.00110998
0.00110302
0.00109499
0.00108602
0.00107614
0.00106532
0.00105339
0.00104001
0.0010246
0.00100627
0.000983818
0.000955709
0.000920131
0.000874949
0.00081761
0.000744986
0.000652929
0.000535407
0.000383888
0.000192611
2.12964e-05
0.000901559
0.000899988
0.000901612
0.000906921
0.000916126
0.00092911
0.000945477
0.000964618
0.00098575
0.00100797
0.00103031
0.00105175
0.00107134
0.00108825
0.00110186
0.00111181
0.00111787
0.00111958
0.00111722
0.00111266
0.00110696
0.00110015
0.00109219
0.00108309
0.00107288
0.00106146
0.00104854
0.00103355
0.0010156
0.000993459
0.000965532
0.000929921
0.000884475
0.000826613
0.000753126
0.000659757
0.000540405
0.000386684
0.000193501
2.16878e-05
0.000869868
0.000868484
0.00087071
0.000877027
0.000887619
0.000902363
0.000920865
0.000942499
0.000966437
0.000991693
0.00101716
0.00104167
0.00106418
0.0010838
0.00109983
0.00111154
0.00111811
0.00112
0.00111865
0.00111537
0.00111082
0.00110492
0.00109755
0.0010888
0.00107882
0.00106762
0.00105495
0.0010402
0.00102246
0.00100044
0.00097251
0.000936726
0.00089091
0.000832473
0.000758173
0.000663691
0.000542883
0.000387516
0.000193438
2.20183e-05
0.000841679
0.000840168
0.000842989
0.000850503
0.000862785
0.000879631
0.000900582
0.000924936
0.000951768
0.000979967
0.00100831
0.00103558
0.00106067
0.00108237
0.00109931
0.00111122
0.00111847
0.00112157
0.00112153
0.00111936
0.00111549
0.0011098
0.00110233
0.00109335
0.00108321
0.00107197
0.00105936
0.00104472
0.00102704
0.00100499
0.000976902
0.00094083
0.000894549
0.000835494
0.000760433
0.000665014
0.000543084
0.000386639
0.000192504
2.22833e-05
0.000817056
0.000815414
0.000818969
0.000827937
0.000842243
0.000861551
0.000885269
0.000912543
0.000942274
0.000973228
0.00100416
0.00103361
0.00105978
0.00108161
0.00109906
0.00111213
0.00112062
0.00112485
0.00112608
0.00112509
0.00112154
0.00111502
0.00110647
0.00109673
0.00108612
0.00107467
0.00106201
0.0010474
0.0010297
0.00100751
0.000979142
0.000942657
0.000895837
0.000836157
0.000760398
0.000664207
0.00054147
0.000384478
0.00019096
2.24905e-05
0.000794483
0.000793291
0.000798144
0.000809119
0.000825994
0.000848268
0.000875156
0.000905576
0.000938245
0.000971785
0.00100446
0.00103416
0.0010601
0.00108239
0.00110081
0.00111494
0.00112439
0.00112972
0.00113188
0.0011313
0.00112749
0.00112003
0.00110998
0.00109907
0.00108778
0.00107601
0.00106325
0.0010486
0.00103084
0.00100846
0.000979767
0.000942827
0.000895465
0.000835176
0.000758762
0.000661934
0.000538666
0.000381582
0.000189147
2.26572e-05
0.000772564
0.000772665
0.00077966
0.000793463
0.000813674
0.000839577
0.000870126
0.000904001
0.000939641
0.000974909
0.00100756
0.00103691
0.00106315
0.00108605
0.00110509
0.00111995
0.00113035
0.00113621
0.00113816
0.0011368
0.00113204
0.00112351
0.00111225
0.00110024
0.00108832
0.00107624
0.00106339
0.00104873
0.0010309
0.00100834
0.000979325
0.000941934
0.00089402
0.000833081
0.000756002
0.000658589
0.00053505
0.000378294
0.000187276
2.28023e-05
0.000750355
0.000752748
0.000762894
0.000780501
0.000804931
0.000835182
0.000869915
0.000907467
0.000945408
0.000981007
0.0010134
0.00104295
0.00106958
0.00109303
0.00111286
0.00112834
0.0011388
0.00114378
0.00114427
0.00114134
0.00113515
0.00112561
0.00111371
0.00110084
0.00108829
0.00107592
0.00106298
0.0010483
0.00103041
0.00100766
0.0009783
0.000940422
0.000891893
0.000830272
0.000752549
0.000654689
0.000531089
0.000374917
0.000185479
2.29424e-05
0.000727686
0.000733415
0.00074774
0.000770115
0.000799589
0.000834796
0.000874035
0.000914849
0.000953753
0.000989198
0.00102178
0.00105186
0.00107932
0.00110359
0.00112395
0.00113961
0.00114895
0.00115151
0.00115002
0.00114567
0.00113821
0.00112753
0.00111455
0.00110103
0.00108805
0.00107553
0.00106259
0.00104793
0.00102996
0.00100698
0.000977208
0.000938752
0.000889514
0.000827146
0.000748803
0.000650612
0.00052714
0.000371722
0.000183951
2.31e-05
0.000704961
0.000715002
0.000734435
0.000762397
0.000797533
0.000838062
0.00088165
0.000924342
0.000963182
0.000998744
0.00103207
0.00106316
0.00109147
0.00111633
0.00113698
0.001152
0.00115828
0.0011581
0.00115534
0.00115003
0.00114162
0.00112978
0.00111537
0.00110135
0.00108817
0.00107565
0.0010628
0.00104816
0.00103005
0.00100675
0.00097649
0.00093741
0.000887457
0.000824372
0.000745405
0.000646837
0.000523436
0.000368749
0.000182482
2.32717e-05
0.000682714
0.000697927
0.000723216
0.000757328
0.0007985
0.000844447
0.000891301
0.000934358
0.000973106
0.00100947
0.0010438
0.00107562
0.00110441
0.00112962
0.0011501
0.0011624
0.00116509
0.00116355
0.00116006
0.00115396
0.00114461
0.00113133
0.00111615
0.00110212
0.00108904
0.00107671
0.00106398
0.00104929
0.00103093
0.00100719
0.000976364
0.000936653
0.000886061
0.000822344
0.00074275
0.000643629
0.000519901
0.000365495
0.000180407
2.33834e-05
0.000661496
0.000682496
0.00071407
0.000754535
0.000801627
0.000852299
0.000901004
0.000943892
0.000983337
0.00102083
0.00105582
0.00108794
0.00111702
0.0011425
0.00116138
0.00116876
0.00116921
0.0011676
0.00116385
0.00115727
0.0011472
0.0011317
0.00111727
0.00110334
0.00109059
0.00107859
0.00106597
0.00105113
0.00103239
0.0010081
0.000976639
0.00093632
0.000885189
0.000820945
0.000740819
0.000641218
0.000517262
0.000363076
0.000179022
2.34885e-05
0.000641782
0.000668798
0.000706662
0.000753318
0.000806037
0.00086033
0.000909435
0.000952842
0.00099386
0.00103235
0.00106771
0.00110004
0.00112963
0.00115507
0.00116819
0.00117125
0.00117191
0.00117056
0.00116642
0.00115845
0.00114529
0.00113102
0.0011174
0.00110394
0.00109189
0.00108036
0.00106786
0.0010528
0.00103358
0.00100868
0.000976583
0.000935699
0.000884117
0.000819458
0.000738919
0.000638974
0.000514991
0.00036125
0.000178143
2.3616e-05
0.000623777
0.000656682
0.000700546
0.000752911
0.000810528
0.000867212
0.000916651
0.000961506
0.00100418
0.00104355
0.0010792
0.00111183
0.00114194
0.00116199
0.00116854
0.00117144
0.00117275
0.00117117
0.00116456
0.00115338
0.00114119
0.00112915
0.00111545
0.00110289
0.00109173
0.0010807
0.00106831
0.00105304
0.0010334
0.00100797
0.000975354
0.00093403
0.000882119
0.000817132
0.000736121
0.000635807
0.000511758
0.000358615
0.000176906
2.37341e-05
0.000607379
0.0006457
0.000695025
0.000752504
0.000814091
0.000871943
0.000921965
0.000968905
0.00101324
0.00105334
0.00108911
0.00112164
0.00114922
0.00116126
0.00116468
0.00116733
0.00116809
0.00116368
0.00115465
0.00114485
0.00113473
0.00112242
0.00110981
0.00109883
0.00108876
0.0010783
0.00106606
0.00105063
0.00103069
0.00100495
0.000972104
0.000930691
0.000878817
0.000813814
0.000732672
0.000632267
0.000508325
0.000355705
0.000175391
2.38158e-05
0.00059229
0.00063525
0.000689223
0.00075103
0.000815531
0.000873641
0.000924795
0.000974131
0.00102008
0.00106087
0.00109689
0.0011298
0.00115235
0.00115555
0.00115576
0.00115609
0.00115347
0.00114712
0.00114007
0.00113183
0.00112115
0.00110986
0.00109988
0.00109091
0.00108204
0.00107214
0.00106
0.00104441
0.00102425
0.000998407
0.000965677
0.000924652
0.000873374
0.000808966
0.000728501
0.000628874
0.000505746
0.000353997
0.000174649
2.39111e-05
0.000578237
0.000624968
0.000682652
0.000747756
0.000813853
0.00087183
0.000924623
0.000976333
0.00102366
0.00106481
0.00110084
0.00113392
0.00114948
0.00114377
0.00113904
0.00113486
0.0011296
0.00112461
0.00111829
0.00110994
0.00110136
0.00109352
0.00108634
0.00107922
0.00107132
0.00106172
0.00104941
0.00103348
0.00101307
0.000987251
0.000954964
0.000914799
0.000864637
0.000801669
0.000723085
0.000625474
0.000504316
0.000354247
0.000175471
2.41388e-05
0.000565012
0.000614752
0.000675431
0.000743153
0.000809331
0.000866383
0.000921276
0.000975108
0.00102332
0.00106402
0.00109877
0.00112984
0.00113898
0.00112466
0.00111318
0.00110522
0.00109986
0.00109478
0.00108955
0.00108446
0.00107967
0.00107502
0.00107008
0.00106422
0.00105672
0.00104682
0.00103387
0.00101727
0.000996502
0.000970828
0.000939185
0.000900074
0.000851433
0.000790728
0.000714979
0.00062042
0.000502289
0.000354813
0.0001769
2.45382e-05
0.000552417
0.000604419
0.000667366
0.000736824
0.000801346
0.00085732
0.000914518
0.000970344
0.00101923
0.00105921
0.00109227
0.0011216
0.00112326
0.00109968
0.0010838
0.00107409
0.00106798
0.001064
0.00106136
0.00105942
0.0010576
0.00105526
0.0010517
0.00104624
0.00103827
0.00102735
0.00101316
0.000995501
0.000974116
0.000948433
0.000917459
0.000879703
0.000833104
0.000775126
0.000702655
0.000611697
0.000497274
0.000352996
0.000176976
2.49549e-05
0.000540438
0.00059391
0.000658179
0.00072771
0.000789049
0.000844433
0.000903995
0.000961807
0.00101139
0.00105066
0.00108177
0.00110676
0.00110158
0.00107599
0.00105822
0.00104669
0.00104006
0.00103688
0.00103591
0.00103599
0.00103601
0.00103489
0.00103166
0.00102557
0.00101619
0.00100339
0.000987258
0.000968022
0.00094572
0.000919889
0.000889541
0.000853166
0.00080873
0.000753639
0.000684692
0.000597824
0.00048779
0.000347845
0.000175323
2.53018e-05
0.000529434
0.000583731
0.000648248
0.000715345
0.000772426
0.000828002
0.000889813
0.000949543
0.000999922
0.0010387
0.00106802
0.00108765
0.00107785
0.00105358
0.00103552
0.00102367
0.00101694
0.00101414
0.00101394
0.00101494
0.00101565
0.00101463
0.00101065
0.0010029
0.000991098
0.000975502
0.000956737
0.000935471
0.000912004
0.000885905
0.000856001
0.000820652
0.000777909
0.000725317
0.000659686
0.000577002
0.000471939
0.000337745
0.000171306
2.55356e-05
0.000519724
0.000574478
0.000638729
0.000700872
0.000752395
0.000808729
0.000872447
0.000933953
0.00098528
0.0010237
0.00105098
0.00106427
0.00105259
0.0010319
0.00101614
0.00100525
0.000998824
0.00099611
0.000995963
0.000996916
0.000997283
0.000995354
0.000989674
0.000979352
0.000964297
0.000945242
0.00092344
0.000900007
0.000875311
0.000848751
0.000818864
0.000783848
0.00074185
0.00069072
0.000627579
0.00054854
0.000448395
0.000320776
0.000162839
2.54576e-05
0.000511305
0.000566031
0.000628767
0.000684106
0.000730438
0.000787174
0.000852422
0.000915706
0.00096847
0.00100736
0.00103353
0.001041
0.00102915
0.00101413
0.00100128
0.000991698
0.000985643
0.000982748
0.00098209
0.000982262
0.000981507
0.000977948
0.000969949
0.000956547
0.000937896
0.000915342
0.000890864
0.000865912
0.000840527
0.000813511
0.000782788
0.000746473
0.000703291
0.00065179
0.00058954
0.000512844
0.000416642
0.000294806
0.000145731
2.50188e-05
0.000504178
0.000558205
0.000617136
0.000664334
0.000706915
0.000764077
0.000830509
0.000895301
0.000949585
0.000989328
0.00101448
0.00102135
0.00101299
0.00100147
0.00099082
0.00098235
0.000976558
0.000973288
0.000971785
0.000970746
0.000968428
0.000962881
0.000952353
0.000935862
0.000913846
0.000888478
0.000862849
0.000839028
0.000815694
0.000788426
0.000754134
0.000713094
0.000665657
0.000611244
0.000547792
0.000471781
0.000378484
0.000262921
0.000127865
2.43783e-05
0.000498852
0.000551782
0.000605129
0.000643847
0.000684302
0.000741504
0.000808305
0.000873891
0.00092943
0.000970417
0.000996198
0.00100577
0.00100119
0.000992307
0.000983478
0.000976007
0.000970439
0.00096673
0.000964253
0.000961815
0.000957746
0.000950098
0.000937078
0.000917766
0.000893049
0.000866366
0.000843148
0.000827591
0.0008145
0.000784006
0.0007382
0.000687734
0.000632903
0.000573227
0.000506839
0.000430538
0.000340324
0.000232947
0.000114439
2.35442e-05
0.000495101
0.000546636
0.000592636
0.000623543
0.000663122
0.000719815
0.000786305
0.000852213
0.000908884
0.000951592
0.000979374
0.000992568
0.000991843
0.000985388
0.000978292
0.000971799
0.000966457
0.000962295
0.000958795
0.000954878
0.000948977
0.000939219
0.000923836
0.000902057
0.000875486
0.000849571
0.000834085
0.000840267
0.00083144
0.000789408
0.000732658
0.000670865
0.000607474
0.00054171
0.000471883
0.000395301
0.000308912
0.000210857
0.000107189
2.26271e-05
0.000492064
0.000541523
0.000579465
0.000604104
0.000643222
0.0006993
0.000765411
0.000831668
0.00088957
0.000934263
0.000964559
0.00098131
0.000984437
0.000980323
0.000974907
0.000969339
0.000964176
0.00095952
0.000954943
0.000949468
0.000941645
0.000929719
0.000911957
0.00088773
0.00085937
0.000834339
0.000825766
0.000846738
0.000835541
0.000786475
0.000728281
0.000660129
0.000590476
0.000519934
0.00044747
0.000371182
0.000288861
0.000199117
0.000105527
2.18031e-05
0.000489298
0.0005335
0.000564214
0.000586076
0.000624884
0.000680829
0.00074705
0.000813938
0.000873083
0.000919637
0.000952255
0.000971528
0.000978298
0.000977099
0.000973205
0.000968377
0.000963266
0.000958007
0.000952267
0.000945191
0.000935452
0.00092137
0.000901234
0.000874395
0.000843474
0.000817172
0.000810698
0.00083864
0.000836504
0.000783656
0.000726044
0.000656526
0.000583701
0.000510444
0.000436508
0.000360823
0.000281722
0.00019736
0.000107999
2.12149e-05
0.000489641
0.000526353
0.000549256
0.000571713
0.000611168
0.000667422
0.000733975
0.000801257
0.00086099
0.000908628
0.000942742
0.000964271
0.000974122
0.000975262
0.000972634
0.000968326
0.000963097
0.00095718
0.000950315
0.000941736
0.000930208
0.000914128
0.000891758
0.000862364
0.00082834
0.000798532
0.000789619
0.000820194
0.000835917
0.000786843
0.000728324
0.000661651
0.000588624
0.000514401
0.000439776
0.000364353
0.000286688
0.000203967
0.000113139
2.09177e-05
0.000493015
0.00052434
0.000540395
0.000560936
0.000601046
0.000658211
0.000725485
0.000793126
0.000852853
0.000900673
0.000935729
0.000958931
0.000971406
0.000974678
0.000972846
0.000968753
0.000963242
0.000956607
0.000948662
0.000938722
0.000925649
0.000907919
0.000883747
0.000852203
0.000814933
0.000779341
0.000761038
0.000780859
0.000821757
0.000794338
0.000735832
0.000675254
0.000604927
0.000530648
0.000455712
0.000379889
0.000301562
0.000216658
0.000118588
2.10622e-05
0.000499349
0.000526585
0.000535868
0.000552225
0.000591266
0.000649255
0.000717283
0.000785603
0.000846111
0.000894744
0.000930822
0.000955433
0.000969892
0.000974903
0.000973629
0.000969436
0.000963428
0.000955994
0.000947027
0.00093593
0.000921659
0.00090276
0.000877413
0.000844505
0.000804702
0.000762864
0.000730965
0.000727007
0.000767829
0.00079508
0.000745312
0.000683996
0.000623379
0.000554478
0.000479942
0.000403649
0.000323328
0.000233325
0.000126665
2.16452e-05
0.000507792
0.000532522
0.000535652
0.000545479
0.000580964
0.000638129
0.00070724
0.000777149
0.000839212
0.000889272
0.000926708
0.000952785
0.000969029
0.000975657
0.000974631
0.000970013
0.00096335
0.000955112
0.00094526
0.000933278
0.000918229
0.000898729
0.000872973
0.000839799
0.00079897
0.000752774
0.000708798
0.000680508
0.000682934
0.000724535
0.000743844
0.000690026
0.000627774
0.000566952
0.0005009
0.000428694
0.000349182
0.000256107
0.00013907
2.26846e-05
0.000519258
0.000542636
0.000539626
0.000541631
0.00057182
0.000626673
0.000695874
0.000767005
0.000830695
0.000882398
0.000921335
0.00094879
0.000966521
0.000975135
0.000974928
0.000969759
0.000962449
0.000953576
0.000943108
0.000930606
0.000915232
0.000895706
0.000870413
0.000838142
0.00079784
0.000750158
0.000699059
0.000653208
0.000624559
0.000623554
0.00065409
0.000669705
0.000623659
0.000563259
0.000502716
0.000438484
0.000365641
0.000275766
0.000152795
2.40032e-05
0.00053544
0.00055724
0.000546957
0.000541886
0.000565717
0.000616223
0.000683651
0.000755057
0.000820199
0.000873797
0.000914623
0.000943764
0.00096309
0.000973845
0.000974696
0.000968734
0.000960757
0.000951385
0.000940572
0.000927914
0.000912651
0.000893638
0.000869404
0.000838846
0.000800474
0.000753989
0.000701007
0.000646219
0.000597657
0.000564571
0.000553568
0.000565759
0.000574312
0.000538718
0.000482676
0.000423056
0.000357346
0.000277808
0.000175605
0.000100693
0.000557545
0.000576851
0.0005586
0.000547597
0.000563738
0.000607757
0.000671201
0.000741512
0.000807691
0.000863426
0.000906623
0.000937958
0.000959202
0.000971738
0.000974273
0.000968219
0.000959252
0.000949213
0.00093809
0.000925473
0.00091064
0.000892542
0.000869815
0.000841414
0.000806145
0.000762883
0.000711886
0.000655222
0.000597484
0.000545403
0.000505611
0.000481882
0.000473282
0.000467426
0.000436619
0.000384918
0.000326424
0.00025754
0.000170988
7.17108e-05
0.000586065
0.000602897
0.000576276
0.000558447
0.000565876
0.000601061
0.000658284
0.000726273
0.000793466
0.000851803
0.000897908
0.000931795
0.000955016
0.000969153
0.00097378
0.000968356
0.000958229
0.000947378
0.000935881
0.000923366
0.000909151
0.000892275
0.000871535
0.000845734
0.000814002
0.000775267
0.000728743
0.000674824
0.000615789
0.000555821
0.000500103
0.000453114
0.000416931
0.000390295
0.000367957
0.000335491
0.000287256
0.000228622
0.000157158
7.0656e-05
0.000620601
0.000637497
0.000602826
0.000576807
0.000573013
0.000596538
0.000645248
0.000709821
0.000778044
0.000839917
0.000890051
0.000927263
0.000952887
0.000968914
0.000975481
0.000970385
0.00095898
0.000947046
0.000934898
0.000922292
0.000908613
0.00089294
0.000874178
0.000851263
0.000823277
0.00078935
0.000748531
0.000700119
0.00064463
0.000584334
0.000522529
0.000462876
0.000408489
0.00036099
0.000320157
0.000284373
0.00024614
0.000198173
0.00014019
6.41556e-05
0.000657472
0.000683846
0.000644237
0.000606948
0.000588647
0.000597333
0.000634584
0.00069368
0.000762332
0.000828344
0.000883764
0.000925674
0.000954732
0.000973305
0.00098238
0.000977277
0.0009638
0.000950243
0.000936977
0.000923821
0.000910206
0.00089523
0.000877897
0.000857398
0.000832942
0.000803607
0.000768351
0.000726137
0.00067656
0.000620336
0.000558982
0.000494704
0.000430197
0.000368096
0.000310402
0.000258292
0.000211503
0.000165508
0.000116623
5.72834e-05
0.000688708
0.000735819
0.000711442
0.000656953
0.000619968
0.000610335
0.000632253
0.000681879
0.000748008
0.000816991
0.00087813
0.000926036
0.000959907
0.000981819
0.000994416
0.000989975
0.000974198
0.000958655
0.000943814
0.000929496
0.000915178
0.000900071
0.000883308
0.000864201
0.000842156
0.000816379
0.000785807
0.000749317
0.000706154
0.000655925
0.000598721
0.000535343
0.000467415
0.000397282
0.000327675
0.000261315
0.000200186
0.000143448
8.88126e-05
4.98099e-05
0.000709714
0.000795581
0.000772523
0.000736357
0.000675001
0.00064332
0.000646189
0.000681341
0.000739644
0.000807632
0.000872581
0.000926303
0.000965734
0.000991393
0.00100512
0.00100597
0.000991628
0.000973462
0.000956636
0.00094058
0.000924754
0.000908569
0.000891373
0.000872577
0.00085169
0.000828079
0.000800831
0.000768894
0.000731302
0.000687123
0.000635534
0.000576189
0.000509534
0.000436988
0.000360933
0.000284489
0.000210903
0.000141725
7.40648e-05
1.98252e-05
0.000715206
0.000825825
0.000827347
0.000783839
0.000742994
0.000696981
0.000680118
0.000697805
0.000742964
0.000804455
0.000869184
0.000926689
0.000971162
0.00100119
0.00101796
0.00102355
0.00101354
0.000994494
0.000975792
0.000957694
0.000939892
0.000921974
0.000903491
0.00088398
0.000863049
0.000840229
0.00081479
0.000785784
0.000752226
0.000713022
0.000666914
0.000612772
0.000549987
0.000478854
0.000400822
0.000318558
0.000235596
0.000155126
7.80012e-05
1.82953e-05
0.000718724
0.000825853
0.000846219
0.00080622
0.000768102
0.000744204
0.000727549
0.000731159
0.000760552
0.000810683
0.000870447
0.0009281
0.000975719
0.00100962
0.00102973
0.00103787
0.00103487
0.00101957
0.0009993
0.000979272
0.000959551
0.00093982
0.000919733
0.000898953
0.00087715
0.000853958
0.000828853
0.00080107
0.000769767
0.000733922
0.000692142
0.000642984
0.000584996
0.000517319
0.000440183
0.000355241
0.000265525
0.000174682
8.58295e-05
1.74666e-05
0.000725129
0.000827176
0.000856403
0.000828759
0.000791015
0.000765408
0.000758132
0.000764011
0.000787698
0.000829269
0.000879456
0.00093201
0.00097886
0.00101407
0.0010363
0.00104647
0.00104663
0.0010378
0.00102064
0.00100003
0.000979275
0.000958586
0.000937671
0.000916161
0.000893681
0.000869848
0.000844225
0.000816212
0.000785128
0.000750343
0.000710873
0.000665228
0.000611643
0.000548248
0.000473648
0.000387924
0.000292991
0.000192238
9.1103e-05
1.70772e-05
0.000735518
0.00083449
0.000867969
0.000852808
0.000819192
0.000790406
0.00077716
0.000783377
0.000807842
0.000845748
0.000894163
0.00094337
0.000984123
0.00101448
0.00103452
0.00104405
0.0010449
0.00103896
0.00102701
0.00100985
0.000990485
0.000970852
0.000951169
0.000931027
0.000909787
0.000886801
0.000861453
0.000833045
0.000800825
0.000764411
0.00072365
0.000678144
0.000626781
0.000567236
0.000496224
0.000411248
0.000312296
0.000202674
9.20958e-05
1.68618e-05
0.000756741
0.000851664
0.000885989
0.000879812
0.000852255
0.000822613
0.000803023
0.000801167
0.000820528
0.000858411
0.000905974
0.000951593
0.000990142
0.00101438
0.0010257
0.00102781
0.00102387
0.00101616
0.00100612
0.00099399
0.000980132
0.000965338
0.000950552
0.000935783
0.000920017
0.000901971
0.000880371
0.000853929
0.00082135
0.000781747
0.000735456
0.00068401
0.000629042
0.000569786
0.000501748
0.000418858
0.000317644
0.000201628
8.83829e-05
1.66206e-05
0.000797296
0.000884353
0.00091355
0.000908391
0.000886552
0.000856331
0.000832309
0.000823048
0.00083454
0.000866509
0.000910971
0.000955614
0.000988784
0.00100332
0.0010025
0.000992171
0.000976703
0.000960846
0.000947773
0.000938479
0.000931201
0.000925605
0.000922266
0.000920344
0.000917655
0.000912082
0.000901437
0.000883241
0.000854924
0.000814553
0.000761543
0.000698331
0.000630383
0.000561711
0.000488974
0.00040434
0.000301507
0.000185349
8.17023e-05
1.62248e-05
0.000885057
0.000955785
0.000969074
0.000949201
0.000917521
0.000884075
0.000854857
0.000842631
0.000851208
0.000879979
0.000920754
0.000960454
0.000986569
0.00099134
0.000973853
0.00093987
0.000900663
0.000867332
0.000848148
0.000840577
0.000833592
0.000838959
0.000853997
0.000874731
0.000896253
0.000914747
0.000926756
0.000928396
0.000914383
0.000880567
0.000825701
0.0007515
0.000664125
0.000575594
0.000485538
0.000387266
0.000277073
0.000167367
7.97864e-05
1.62129e-05
0.00114227
0.00119867
0.0011723
0.00109996
0.00101687
0.000940133
0.000881531
0.000861536
0.000868273
0.000893332
0.000927123
0.000957489
0.000972615
0.000963587
0.000928409
0.000868429
0.000791782
0.000713344
0.000653135
0.000651244
0.000685084
0.000720313
0.00075782
0.000797008
0.000853693
0.000913131
0.000962135
0.000993523
0.00100709
0.00099917
0.000962676
0.00089291
0.000793799
0.000687489
0.000579974
0.000470547
0.000359093
0.000248644
0.000127527
3.05957e-05
0.00268431
0.00300692
0.00291892
0.00277674
0.00261104
0.00233564
0.00170323
0.000955213
0.00089523
0.000903609
0.000925151
0.000944043
0.000949212
0.000933497
0.000896509
0.000846202
0.000812831
0.000874524
0.00132113
0.00134163
0.00119339
0.00112723
0.00105464
0.000788117
0.000769648
0.00087657
0.000966619
0.00103818
0.00109071
0.00111526
0.00109296
0.00102645
0.000929306
0.00083963
0.000765107
0.000699506
0.000651121
0.000593792
0.000449236
9.63295e-05
8.49579e-06
5.5307e-06
5.96814e-06
6.49086e-06
6.97617e-06
7.41821e-06
7.81018e-06
8.16448e-06
8.48842e-06
8.78673e-06
9.0626e-06
9.31836e-06
9.55581e-06
9.77639e-06
9.98129e-06
1.01715e-05
1.03478e-05
1.05111e-05
1.06618e-05
1.08005e-05
1.09279e-05
1.10444e-05
1.11505e-05
1.12466e-05
1.1333e-05
1.14102e-05
1.14784e-05
1.15379e-05
1.15892e-05
1.16324e-05
1.16679e-05
1.16961e-05
1.17172e-05
1.17316e-05
1.17396e-05
1.17415e-05
1.17376e-05
1.17286e-05
1.17149e-05
1.16974e-05
1.59357e-05
2.88165e-05
3.97091e-05
4.77266e-05
5.3851e-05
5.88264e-05
6.3107e-05
6.69394e-05
7.04552e-05
7.37267e-05
7.67951e-05
7.96852e-05
8.24122e-05
8.49858e-05
8.7412e-05
8.96954e-05
9.18386e-05
9.38438e-05
9.57131e-05
9.74477e-05
9.90485e-05
0.000100517
0.000101854
0.000103064
0.000104152
0.000105122
0.000105976
0.000106721
0.000107358
0.000107889
0.000108317
0.000108641
0.000108861
0.000108981
0.000109004
0.000108935
0.000108785
0.000108561
0.000108276
0.000107939
1.99402e-05
3.78884e-05
6.02013e-05
7.84038e-05
9.2988e-05
0.000104978
0.000115156
0.000124054
0.000132018
0.000139271
0.000145955
0.000152164
0.00015796
0.000163386
0.000168471
0.000173235
0.000177692
0.000181856
0.000185733
0.000189332
0.00019266
0.000195721
0.000198522
0.000201072
0.000203377
0.000205445
0.000207284
0.000208901
0.0002103
0.000211487
0.000212465
0.000213239
0.000213811
0.000214188
0.000214379
0.000214394
0.000214246
0.000213953
0.000213531
0.000213
2.0135e-05
3.91537e-05
7.2372e-05
9.96557e-05
0.000121907
0.000140461
0.000156314
0.000170164
0.000182492
0.000193632
0.000203815
0.000213202
0.000221906
0.000230008
0.000237568
0.000244628
0.000251219
0.000257368
0.000263093
0.000268411
0.000273334
0.000277875
0.000282045
0.000285854
0.000289314
0.000292434
0.000295224
0.000297692
0.000299846
0.000301695
0.000303244
0.0003045
0.000305473
0.000306171
0.000306606
0.000306794
0.000306749
0.000306493
0.000306045
0.000305429
2.02819e-05
4.2647e-05
8.23501e-05
0.00011618
0.00014454
0.000168649
0.000189493
0.000207806
0.000224129
0.000238857
0.000252279
0.000264605
0.000275993
0.000286558
0.000296387
0.000305546
0.000314085
0.000322044
0.000329453
0.000336337
0.000342719
0.000348615
0.000354042
0.000359014
0.000363544
0.000367645
0.000371329
0.000374605
0.000377484
0.000379976
0.00038209
0.000383837
0.000385227
0.000386274
0.000386991
0.000387396
0.000387506
0.000387343
0.000386929
0.000386288
4.77883e-06
4.52012e-05
9.03656e-05
0.000129451
0.000162859
0.000191677
0.000216846
0.000239099
0.000258999
0.000276973
0.000293344
0.000308359
0.000322207
0.00033503
0.00034694
0.000358023
0.000368345
0.00037796
0.00038691
0.00039523
0.000402948
0.000410088
0.000416671
0.000422715
0.000428237
0.00043325
0.000437769
0.000441806
0.000445373
0.000448483
0.000451147
0.000453377
0.000455187
0.000456592
0.000457606
0.000458249
0.00045854
0.000458499
0.000458149
0.000457515
5.00545e-06
4.79916e-05
9.71133e-05
0.000140461
0.000178075
0.000210897
0.000239805
0.000265514
0.000288589
0.000309473
0.00032851
0.00034597
0.000362063
0.000376955
0.000390775
0.000403625
0.000415587
0.000426727
0.000437095
0.000446737
0.000455687
0.000463975
0.000471626
0.000478662
0.000485103
0.000490966
0.000496266
0.000501018
0.000505237
0.000508935
0.000512127
0.000514826
0.000517048
0.000518807
0.000520121
0.000521009
0.000521488
0.000521582
0.000521311
0.000520698
5.21331e-06
5.03405e-05
0.000102807
0.000149753
0.00019094
0.000227195
0.000259344
0.00028808
0.000313965
0.000337447
0.000358883
0.000378558
0.000396697
0.000413482
0.000429056
0.000443534
0.00045701
0.000469558
0.000481241
0.000492107
0.0005022
0.000511553
0.000520196
0.000528156
0.000535454
0.00054211
0.000548142
0.000553566
0.000558399
0.000562656
0.000566351
0.000569499
0.000572117
0.000574221
0.000575828
0.000576957
0.000577625
0.000577855
0.000577666
0.00057708
5.39983e-06
5.23655e-05
0.000107692
0.000157715
0.000201966
0.000241183
0.000276149
0.000307537
0.000335904
0.000361701
0.000385291
0.000406969
0.000426972
0.000445489
0.000462676
0.000478658
0.000493536
0.000507393
0.000520297
0.000532305
0.000543463
0.000553811
0.000563382
0.000572206
0.000580306
0.000587705
0.000594424
0.000600481
0.000605893
0.000610677
0.000614848
0.000618424
0.00062142
0.000623854
0.000625741
0.000627102
0.000627953
0.000628314
0.000628206
0.000627648
5.57051e-06
5.41423e-05
0.000111946
0.000164622
0.000211516
0.000253296
0.000290711
0.000324423
0.000354982
0.000382839
0.000408363
0.000431853
0.000453552
0.000473659
0.000492334
0.000509709
0.000525891
0.00054097
0.000555017
0.000568095
0.000580253
0.000591536
0.000601978
0.000611613
0.000620468
0.000628567
0.000635932
0.000642584
0.000648541
0.000653822
0.000658443
0.000662421
0.000665775
0.000668519
0.000670673
0.000672253
0.000673277
0.000673764
0.000673732
0.000673199
5.72958e-06
5.5722e-05
0.000115691
0.000170667
0.000219846
0.000263842
0.000303387
0.000339132
0.000371625
0.000401317
0.000428579
0.000453712
0.000476963
0.000498533
0.000518587
0.00053726
0.000554663
0.000570889
0.000586013
0.000600099
0.000613202
0.000625367
0.000636633
0.000647034
0.0006566
0.000665358
0.000673332
0.000680544
0.000687014
0.000692761
0.000697804
0.000702161
0.000705848
0.000708885
0.000711287
0.000713072
0.000714258
0.000714861
0.0007149
0.000714391
5.88119e-06
5.71418e-05
0.000119014
0.000175985
0.000227132
0.00027304
0.00031443
0.000351951
0.000386151
0.00041748
0.000446309
0.00047294
0.000497618
0.000520546
0.000541888
0.000561781
0.000580337
0.000597648
0.000613794
0.000628838
0.000642838
0.000655841
0.000667888
0.000679015
0.000689255
0.000698635
0.000707182
0.000714919
0.00072187
0.000728053
0.00073349
0.000738199
0.000742197
0.000745504
0.000748136
0.000750111
0.000751445
0.000752156
0.000752259
0.000751771
6.02844e-06
5.84244e-05
0.000121972
0.000180662
0.000233488
0.000281028
0.000324007
0.000363077
0.000398786
0.000431585
0.00046184
0.00048985
0.000515857
0.000540059
0.00056262
0.000583672
0.000603326
0.000621676
0.000638798
0.00065476
0.000669618
0.000683421
0.000696211
0.000708028
0.000718904
0.000728871
0.000737957
0.000746186
0.000753584
0.000760173
0.000765974
0.000771007
0.000775291
0.000778845
0.000781687
0.000783834
0.000785302
0.000786109
0.00078627
0.0007858
6.17316e-06
5.95882e-05
0.000124601
0.000184746
0.000238974
0.000287882
0.000332216
0.000372635
0.000409689
0.000443822
0.000475394
0.000504695
0.00053196
0.000557379
0.000581109
0.000603279
0.000623995
0.000643348
0.000661415
0.000678261
0.000693943
0.000708513
0.000722013
0.000734485
0.000745963
0.000756482
0.000766071
0.000774758
0.00078257
0.000789531
0.000795664
0.000800991
0.000805533
0.000809309
0.000812337
0.000814637
0.000816224
0.000817114
0.000817324
0.000816867
6.31508e-06
6.06464e-05
0.000126914
0.000188237
0.000243585
0.000293609
0.000339086
0.000380686
0.000418956
0.000454328
0.000487147
0.000517688
0.000546173
0.000572779
0.000597654
0.000620919
0.000642676
0.00066301
0.000681998
0.000699702
0.000716182
0.000731487
0.000745666
0.000758758
0.000770803
0.000781836
0.000791891
0.000800998
0.000809187
0.000816484
0.000822915
0.000828503
0.000833271
0.00083724
0.00084043
0.000842859
0.000844546
0.000845506
0.000845753
0.000845303
6.44972e-06
6.16201e-05
0.000128903
0.000191074
0.000247229
0.000298121
0.000344564
0.000387228
0.00042664
0.000463208
0.000497253
0.000529025
0.000558727
0.00058652
0.000612539
0.000636896
0.000659685
0.00068099
0.000700881
0.000719423
0.000736674
0.000752687
0.000767509
0.000781186
0.00079376
0.000805268
0.000815748
0.000825234
0.000833758
0.00084135
0.000848038
0.00085385
0.000858809
0.000862939
0.00086626
0.000868794
0.000870558
0.000871569
0.000871842
0.000871391
6.55323e-06
6.25745e-05
0.000130518
0.000193078
0.000249686
0.000301226
0.000348523
0.000392211
0.000432769
0.000470561
0.000505868
0.000538911
0.000569865
0.000598873
0.000626056
0.000651515
0.00067534
0.000697607
0.000718389
0.000737748
0.000755744
0.000772432
0.000787863
0.000802085
0.000815143
0.000827081
0.000837939
0.000847756
0.000856568
0.000864408
0.00087131
0.000877301
0.000882411
0.000886663
0.000890082
0.00089269
0.000894506
0.000895547
0.000895829
0.000895366
6.59241e-06
6.33722e-05
0.000131404
0.000193814
0.000250552
0.000302624
0.00035079
0.000395585
0.000437399
0.000476526
0.000513197
0.000547594
0.000579867
0.000610139
0.000638518
0.000665097
0.000689961
0.000713185
0.000734841
0.000754993
0.000773703
0.000791028
0.000807024
0.000821743
0.000835236
0.00084755
0.000858732
0.000868825
0.00087787
0.000885906
0.000892968
0.000899089
0.000904302
0.000908634
0.000912112
0.000914759
0.000916596
0.000917643
0.000917915
0.000917427
6.73649e-06
6.28279e-05
0.000130473
0.000192397
0.000249197
0.000301957
0.00035124
0.000397398
0.000440699
0.000481354
0.000519542
0.000555408
0.00058908
0.000620667
0.000650271
0.000677981
0.000703881
0.000728047
0.000750551
0.000771462
0.000790844
0.000808759
0.000825268
0.000840427
0.000854294
0.000866922
0.000878364
0.000888669
0.000897883
0.000906051
0.000913214
0.000919409
0.000924671
0.000929033
0.000932524
0.000935171
0.000936996
0.00093802
0.00093826
0.000937732
6.74434e-06
6.04938e-05
0.000126081
0.000187401
0.000244853
0.000298999
0.000349988
0.00039796
0.000443073
0.000485488
0.000525353
0.000562793
0.000597925
0.000630858
0.000661692
0.000690521
0.000717432
0.000742507
0.000765819
0.000787442
0.000807442
0.000825886
0.00084284
0.000858369
0.000872537
0.000885404
0.000897031
0.000907473
0.000916783
0.000925013
0.000932207
0.00093841
0.000943662
0.000947998
0.000951452
0.000954053
0.000955828
0.000956798
0.000956983
0.000956398
6.4536e-06
5.66198e-05
0.000119193
0.000180154
0.000238867
0.000294973
0.000348109
0.000398196
0.000445318
0.000489615
0.000531247
0.000570297
0.000606889
0.000641142
0.000673166
0.000703065
0.000730934
0.000756857
0.000780916
0.000803184
0.000823731
0.000842628
0.000859946
0.000875759
0.000890139
0.000903156
0.000914879
0.000925372
0.000934694
0.000942904
0.000950053
0.000956191
0.000961364
0.000965612
0.000968973
0.00097148
0.000973164
0.000974047
0.000974152
0.000973494
6.20703e-06
5.19444e-05
0.000112813
0.000174417
0.000234824
0.000292867
0.000347963
0.000399953
0.000448874
0.000494846
0.000538018
0.000578534
0.000616488
0.000651954
0.000685064
0.000715933
0.000744662
0.000771344
0.000796062
0.00081889
0.000839896
0.00085915
0.00087673
0.00089272
0.000907206
0.00092027
0.000931988
0.000942433
0.000951673
0.000959772
0.000966791
0.000972783
0.000977802
0.000981893
0.0009851
0.000987461
0.000989008
0.000989772
0.000989773
0.000989029
6.07947e-06
5.18954e-05
0.000112707
0.000174973
0.000236167
0.000295154
0.000351364
0.000404576
0.000454769
0.000502013
0.000546419
0.000588108
0.000627189
0.000663674
0.0006977
0.000729384
0.000758833
0.000786144
0.000811403
0.000834684
0.000856043
0.000875535
0.000893247
0.000909287
0.000923757
0.000936748
0.000948348
0.000958638
0.000967692
0.000975582
0.000982376
0.000988134
0.000992917
0.000996776
0.000999762
0.00100192
0.00100328
0.00100389
0.00100377
0.00100293
6.11621e-06
5.43867e-05
0.000116995
0.000180215
0.000241933
0.000301388
0.000358187
0.000412141
0.000463194
0.000511365
0.000556716
0.000599333
0.000639273
0.000676549
0.000711286
0.000743598
0.00077359
0.000801359
0.000826997
0.000850581
0.000872157
0.000891742
0.000909435
0.000925381
0.0009397
0.000952494
0.000963855
0.000973873
0.000982629
0.000990204
0.00099667
0.0010021
0.00100655
0.0010101
0.00101279
0.00101468
0.00101581
0.00101623
0.00101595
0.00101502
6.25363e-06
5.78088e-05
0.00012291
0.000187509
0.00025003
0.000310082
0.000367467
0.000422069
0.000473835
0.00052276
0.000568875
0.000612232
0.000652788
0.000690636
0.000725879
0.00075862
0.000788958
0.000816986
0.000842792
0.000866457
0.000888045
0.000907575
0.000925112
0.000940827
0.00095486
0.000967322
0.000978314
0.000987932
0.000996268
0.00100341
0.00100943
0.00101442
0.00101845
0.00102158
0.00102389
0.00102545
0.00102629
0.00102647
0.00102603
0.00102498
6.42382e-06
6.10782e-05
0.000128905
0.000195337
0.000259135
0.000320169
0.000378395
0.000433775
0.000486286
0.000535925
0.000582711
0.000626563
0.000667557
0.000705779
0.000741316
0.000774265
0.000804722
0.000832785
0.000858549
0.0008821
0.000903518
0.000922819
0.000940044
0.000955384
0.000968986
0.000980969
0.000991444
0.00100052
0.00100829
0.00101485
0.0010203
0.00102472
0.0010282
0.00103082
0.00103267
0.0010338
0.0010343
0.0010342
0.00103356
0.0010324
6.60125e-06
6.40919e-05
0.000134721
0.000203323
0.000268815
0.000331207
0.00039056
0.000446904
0.000500253
0.000550566
0.000597808
0.000642034
0.000683311
0.000721719
0.000757343
0.000790278
0.000820624
0.000848491
0.000873998
0.000897263
0.000918357
0.000937265
0.000954009
0.000968792
0.000981775
0.000993094
0.00100287
0.00101123
0.00101826
0.00102409
0.00102881
0.00103251
0.0010353
0.00103728
0.00103854
0.00103916
0.00103923
0.00103881
0.00103794
0.00103666
6.78239e-06
6.69714e-05
0.000140519
0.000211571
0.000279079
0.000343123
0.000403829
0.00046127
0.00051538
0.00056623
0.000613867
0.000658353
0.000699762
0.000738182
0.000773708
0.000806445
0.000836496
0.000863975
0.000889003
0.000911718
0.000932219
0.000950471
0.000966521
0.000980554
0.000992731
0.0010032
0.00101209
0.00101953
0.00102564
0.00103054
0.00103434
0.00103714
0.00103908
0.00104026
0.0010408
0.0010408
0.00104035
0.00103952
0.00103838
0.00103698
6.97118e-06
6.98631e-05
0.000146526
0.000220289
0.000290069
0.000355964
0.000418036
0.000476445
0.000531285
0.000582639
0.000630582
0.000675194
0.000716562
0.000754789
0.000789995
0.0008223
0.000851825
0.000878689
0.000903004
0.000924911
0.00094452
0.000961843
0.000976977
0.000990062
0.00100124
0.00101067
0.00101847
0.00102479
0.00102976
0.00103351
0.00103618
0.00103789
0.00103878
0.00103899
0.00103865
0.00103789
0.0010368
0.00103547
0.00103399
0.00103242
7.17307e-06
7.28912e-05
0.00015294
0.000229622
0.000301696
0.000369338
0.000432769
0.000492175
0.000547705
0.000599482
0.000647616
0.000692204
0.000733342
0.000771145
0.000805772
0.000837374
0.000866091
0.000892069
0.000915462
0.000936392
0.000954907
0.000971064
0.000985005
0.000996867
0.00100679
0.00101491
0.00102137
0.00102631
0.00102989
0.00103226
0.00103357
0.00103395
0.00103358
0.00103263
0.00103123
0.00102954
0.00102768
0.00102575
0.00102385
0.00102205
7.39627e-06
7.60975e-05
0.000159521
0.000239083
0.000313518
0.000382996
0.000447799
0.000508174
0.000564325
0.000616424
0.000664617
0.000709029
0.000749758
0.000786932
0.000820765
0.000851448
0.000879135
0.000903968
0.000926117
0.000945722
0.000962838
0.000977559
0.000990024
0.00100037
0.00100875
0.00101528
0.00102011
0.00102339
0.00102531
0.00102604
0.00102575
0.00102458
0.00102274
0.00102042
0.0010178
0.00101503
0.00101226
0.00100961
0.00100719
0.00100507
7.64004e-06
7.88981e-05
0.000165778
0.000248395
0.000325289
0.000396648
0.000462815
0.000524103
0.000580778
0.000633062
0.000681141
0.000725159
0.000765255
0.000801604
0.000834417
0.000863903
0.000890254
0.000913667
0.000934309
0.000952295
0.000967716
0.000980707
0.000991401
0.000999944
0.00100648
0.00101113
0.00101404
0.00101539
0.0010154
0.00101425
0.00101212
0.00100921
0.00100572
0.00100188
0.000997884
0.000993917
0.000990136
0.000986678
0.00098366
0.000981174
7.8855e-06
8.15539e-05
0.000171811
0.000257483
0.000336843
0.000410061
0.000477531
0.00053963
0.000596682
0.000648967
0.000696726
0.000740169
0.000779486
0.000814855
0.000846449
0.000874481
0.000899168
0.000920755
0.000939481
0.000955497
0.00096893
0.000979907
0.000988557
0.000995018
0.000999421
0.0010019
0.00100263
0.00100183
0.00099972
0.000996514
0.000992419
0.000987636
0.000982401
0.000976963
0.000971544
0.000966341
0.000961527
0.00095725
0.000953633
0.000950775
8.13029e-06
8.41589e-05
0.000177733
0.000266416
0.000348201
0.000423222
0.000491909
0.000554695
0.00061196
0.000664032
0.00071119
0.000753708
0.000791889
0.000825961
0.000856055
0.000882361
0.000905118
0.000924622
0.000941152
0.000954918
0.000966084
0.000974785
0.000981137
0.000985251
0.00098726
0.000987341
0.000985718
0.000982625
0.000978298
0.000972972
0.000966879
0.000960239
0.000953296
0.000946327
0.000939572
0.00093324
0.00092751
0.000922534
0.000918437
0.000915318
8.37703e-06
8.67227e-05
0.000183574
0.000275224
0.000359368
0.000436101
0.000505883
0.000569197
0.000626478
0.000678106
0.000724421
0.000765753
0.00080247
0.000834833
0.000863038
0.000887306
0.000907897
0.0009251
0.000939204
0.000950477
0.000959136
0.00096534
0.000969178
0.000970736
0.000970176
0.00096774
0.00096368
0.000958255
0.000951727
0.00094436
0.000936405
0.000928103
0.000919686
0.00091145
0.000903647
0.000896488
0.000890149
0.000884775
0.000880484
0.000877368
8.6322e-06
8.92614e-05
0.000189365
0.000283936
0.000370369
0.000448719
0.000519478
0.000583182
0.000640319
0.000691284
0.000736416
0.000776188
0.000811043
0.000841286
0.000867186
0.00088902
0.000907112
0.000921768
0.000933282
0.000941936
0.000947996
0.000951628
0.000952854
0.000951754
0.000948595
0.000943656
0.000937228
0.000929614
0.00092111
0.000912002
0.000902559
0.000893034
0.000883623
0.00087463
0.000866304
0.000858848
0.000852421
0.000847149
0.00084313
0.000840438
8.89346e-06
9.17213e-05
0.000194989
0.000292368
0.00038092
0.000460652
0.000532087
0.000595819
0.000652395
0.000702282
0.000745948
0.000783948
0.00081671
0.000844598
0.000867967
0.000887194
0.000902648
0.000914661
0.000923515
0.000929492
0.000932866
0.000933806
0.00093233
0.000928618
0.000922998
0.000915798
0.000907353
0.000897993
0.000888037
0.000877782
0.000867501
0.000857443
0.00084779
0.00083879
0.000830689
0.00082367
0.000817863
0.00081336
0.000810228
0.000808509
9.16909e-06
9.42044e-05
0.000200621
0.000300693
0.000391167
0.000472024
0.000543844
0.000607285
0.000662913
0.000711286
0.000753103
0.000788953
0.000819307
0.000844657
0.000865427
0.000882014
0.000894797
0.000904121
0.000910271
0.000913491
0.000914059
0.00091222
0.000908137
0.000902102
0.000894454
0.000885545
0.000875727
0.000865341
0.000854709
0.000844125
0.000833857
0.000824136
0.00081516
0.000807053
0.000800051
0.000794309
0.000789921
0.000786937
0.000785378
0.000785245
9.45075e-06
9.66466e-05
0.000206067
0.000308568
0.000400603
0.000482153
0.000553886
0.000616555
0.000670893
0.000717697
0.000757696
0.000791373
0.000819258
0.000841927
0.000859936
0.000873768
0.000883804
0.000890383
0.000893801
0.000894353
0.000892344
0.000888054
0.000881833
0.000874026
0.000864988
0.000855085
0.000844673
0.000834093
0.000823657
0.000813648
0.000804311
0.000795852
0.000788437
0.000782123
0.000777068
0.000773401
0.000771178
0.000770405
0.000771053
0.000773076
9.73585e-06
9.8962e-05
0.000211157
0.000315794
0.000409086
0.000491044
0.000562412
0.000624042
0.000676873
0.00072182
0.00075968
0.000791037
0.000816485
0.000836591
0.000851932
0.000863047
0.000870367
0.000874265
0.000875125
0.000873315
0.000869138
0.000862995
0.000855282
0.000846386
0.000836693
0.000826577
0.000816395
0.000806473
0.000797102
0.000788533
0.000780969
0.000774569
0.000769447
0.000765678
0.000763243
0.000762252
0.00076273
0.000764649
0.000767941
0.000772509
1.00049e-05
0.000100973
0.000215488
0.000321855
0.000416089
0.000498221
0.000569054
0.000629578
0.000680891
0.000723955
0.00075959
0.000788547
0.000811511
0.000829094
0.000841898
0.000850461
0.000855241
0.000856708
0.000855359
0.000851576
0.000845791
0.000838443
0.000829948
0.000820725
0.000811171
0.000801659
0.000792528
0.000784071
0.00077654
0.000770132
0.000764999
0.000761244
0.000758927
0.00075807
0.000758638
0.000760609
0.000764006
0.000768784
0.000774846
0.000782059
1.02595e-05
0.000102581
0.000218893
0.000326585
0.0004215
0.000503656
0.000573879
0.000633322
0.000683101
0.000724295
0.000757791
0.000784429
0.000804974
0.000820128
0.000830527
0.000836704
0.000839187
0.00083859
0.00083543
0.000830217
0.000823441
0.000815558
0.000807013
0.000798228
0.000789589
0.00078144
0.000774076
0.000767741
0.000762622
0.000758857
0.000756533
0.000755697
0.000756355
0.000758489
0.000762052
0.000766947
0.000773159
0.000780636
0.000789264
0.000798897
1.04797e-05
0.000103633
0.000221103
0.000329666
0.000424967
0.000507007
0.000576703
0.00063522
0.000683691
0.000723186
0.000754689
0.000779144
0.000797419
0.000810291
0.000818415
0.000822387
0.000822912
0.000820643
0.000816197
0.000810151
0.00080302
0.000795287
0.000787397
0.000779747
0.000772685
0.000766497
0.000761416
0.000757614
0.000755211
0.000754279
0.000754847
0.000756908
0.000760431
0.000765362
0.000771631
0.000779149
0.000787823
0.000797598
0.000808347
0.00081992
1.06975e-05
0.000104682
0.000223224
0.000332506
0.000428028
0.000509783
0.000578771
0.000636187
0.000683225
0.000720986
0.000750542
0.000772923
0.00078908
0.000799831
0.000805863
0.000807971
0.000806943
0.000803506
0.000798352
0.000792081
0.000785236
0.000778297
0.000771675
0.000765718
0.000760705
0.000756853
0.000754315
0.000753195
0.000753546
0.000755382
0.000758683
0.000763408
0.000769493
0.000776867
0.000785443
0.000795112
0.000805755
0.000817288
0.000829582
0.000842495
1.09206e-05
0.000105824
0.000225458
0.000335378
0.000430994
0.000512342
0.000580472
0.000636634
0.000682114
0.000718092
0.000745715
0.00076608
0.000780184
0.000788891
0.00079311
0.000793762
0.000791658
0.000787613
0.00078234
0.00077646
0.000770502
0.000764904
0.000760017
0.000756117
0.000753406
0.000752023
0.000752054
0.000753537
0.000756474
0.000760837
0.000766574
0.000773615
0.000781881
0.00079128
0.000801708
0.00081303
0.000825102
0.000837822
0.000851061
0.000864679
1.11482e-05
0.000106979
0.000227631
0.000338063
0.000433644
0.000514485
0.000581677
0.000636543
0.000680444
0.000714667
0.000740434
0.000758855
0.000770871
0.000777584
0.000780277
0.000779868
0.000777239
0.000773196
0.000768431
0.000763526
0.000758957
0.000755093
0.000752213
0.000750517
0.000750134
0.000751139
0.000753563
0.0007574
0.000762616
0.000769157
0.000776949
0.000785909
0.000795943
0.000806941
0.000818775
0.000831284
0.000844286
0.000857671
0.000871314
0.000885084
1.13785e-05
0.00010807
0.000229573
0.000340328
0.000435698
0.000515854
0.000581978
0.000635481
0.000677782
0.000710257
0.000734177
0.000750628
0.000760783
0.000766102
0.000767788
0.000766883
0.000764299
0.000760801
0.000757026
0.000753488
0.000750585
0.00074861
0.000747769
0.000748192
0.000749951
0.000753075
0.000757557
0.000763364
0.000770444
0.000778728
0.000788135
0.000798576
0.000809948
0.000822134
0.000834983
0.000848306
0.000861861
0.000875535
0.000889194
0.000902729
1.16103e-05
0.000109073
0.000231192
0.000342003
0.000436924
0.000516226
0.000581173
0.000633248
0.000673952
0.000704723
0.00072682
0.000741558
0.000750519
0.000755065
0.000756374
0.000755538
0.00075346
0.00075087
0.000748343
0.000746316
0.000745106
0.000744933
0.000745937
0.000748197
0.000751741
0.000756566
0.000762645
0.000769933
0.000778371
0.000787891
0.00079842
0.000809876
0.00082217
0.000835191
0.000848788
0.000862737
0.000876712
0.000890515
0.000904042
0.000917279
1.18459e-05
0.000110065
0.000232586
0.000343155
0.000437363
0.000515624
0.000579295
0.000629935
0.000669114
0.000698256
0.000718781
0.000732409
0.000740718
0.000744973
0.000746406
0.000746076
0.00074484
0.000743369
0.000742173
0.000741615
0.000741943
0.000743318
0.000745831
0.000749521
0.000754387
0.000760409
0.000767552
0.000775774
0.000785024
0.000795254
0.000806415
0.000818455
0.000831312
0.000844889
0.000859028
0.000873465
0.000887836
0.00090173
0.000915187
0.00092828
1.20837e-05
0.000111159
0.00023391
0.000343932
0.000437151
0.000514183
0.000576492
0.000625717
0.000663445
0.00069116
0.000710649
0.0007237
0.000731751
0.00073614
0.00073807
0.000738529
0.000738307
0.00073801
0.000738082
0.000738823
0.000740428
0.000743011
0.000746631
0.0007513
0.000757006
0.000763721
0.000771415
0.000780063
0.000789643
0.000800137
0.000811525
0.000823776
0.000836821
0.000850513
0.000864644
0.000878906
0.000892903
0.000906258
0.000918905
0.00093078
1.23197e-05
0.000112451
0.000235347
0.0003446
0.000436614
0.000512266
0.000573135
0.000620915
0.000657246
0.000683943
0.000702915
0.000715765
0.000723936
0.000728782
0.000731434
0.000732808
0.000733626
0.000734431
0.00073561
0.000737414
0.000739995
0.000743441
0.000747786
0.000753031
0.000759158
0.000766151
0.000773999
0.000782706
0.000792281
0.00080273
0.000814031
0.000826114
0.000838852
0.00085189
0.000864573
0.000877153
0.000889753
0.00090155
0.000912271
0.000922139
1.25445e-05
0.000113757
0.000236788
0.000345192
0.000435863
0.000510015
0.000569392
0.000615794
0.000651066
0.000677193
0.000695959
0.000708892
0.000717465
0.000722964
0.000726442
0.000728747
0.000730538
0.000732305
0.000734391
0.000737015
0.000740301
0.000744316
0.000749083
0.000754598
0.000760852
0.000767843
0.000775588
0.000784114
0.000793449
0.000803585
0.000814437
0.000825782
0.00083711
0.000847906
0.000858587
0.000869164
0.000879261
0.000888873
0.000897932
0.000906509
1.27659e-05
0.000114607
0.000237825
0.000345456
0.000434876
0.00050761
0.00056559
0.000610816
0.000645371
0.000671194
0.000689973
0.000703237
0.000712399
0.000718651
0.000722978
0.000726166
0.000728826
0.000731406
0.000734216
0.000737451
0.000741222
0.000745582
0.000750552
0.000756132
0.000762324
0.000769139
0.000776605
0.000784754
0.000793597
0.00080308
0.00081294
0.000822514
0.000831485
0.000840182
0.000848524
0.000856619
0.000864616
0.000872704
0.000880841
0.000889059
1.29646e-05
0.000114631
0.000237031
0.000344137
0.000432683
0.000504428
0.000561471
0.00060602
0.000640216
0.00066599
0.000685022
0.000698813
0.000708678
0.000715733
0.000720897
0.00072491
0.000728341
0.000731607
0.000734993
0.000738677
0.000742761
0.000747296
0.000752303
0.000757792
0.000763772
0.00077026
0.00077728
0.000784843
0.000792916
0.0008013
0.000809416
0.000816946
0.00082412
0.00083075
0.00083698
0.000843366
0.000850471
0.00085862
0.000867154
0.000876093
1.3021e-05
0.000113315
0.000234334
0.000341015
0.000429038
0.000500208
0.000556845
0.000601223
0.000635476
0.000661527
0.000681067
0.000695546
0.000706207
0.000714097
0.000720085
0.000724868
0.000728987
0.00073283
0.000736664
0.000740657
0.000744903
0.000749454
0.000754339
0.000759572
0.000765167
0.000771138
0.00077749
0.0007842
0.00079116
0.000798026
0.000804415
0.00081033
0.000815528
0.000820394
0.000825664
0.000832358
0.000841554
0.000853753
0.000864882
0.000874418
1.30828e-05
0.000112412
0.000231688
0.000337438
0.000424788
0.000495488
0.000551961
0.000596458
0.000631089
0.000657734
0.000678024
0.00069335
0.000704894
0.000713649
0.000720441
0.000725937
0.000730646
0.000734942
0.000739078
0.000743215
0.000747445
0.000751821
0.000756373
0.00076112
0.000766078
0.000771254
0.000776632
0.000782157
0.00078764
0.000792715
0.000797327
0.000801313
0.000804803
0.000808983
0.000815272
0.000825391
0.000840993
0.000862197
0.000877593
0.00088304
1.32211e-05
0.000111719
0.000228942
0.000333212
0.000419695
0.000490013
0.000546541
0.000591475
0.000626838
0.000654406
0.000675711
0.000692065
0.00070459
0.000714237
0.000721798
0.000727917
0.000733088
0.00073767
0.000741908
0.000745959
0.000749912
0.000753818
0.00075771
0.000761613
0.000765549
0.00076953
0.000773547
0.000777534
0.000781236
0.000784455
0.000787377
0.000790137
0.000793593
0.000799287
0.000809134
0.00082516
0.000849073
0.000878897
0.000897856
0.00089316
1.32471e-05
0.000109612
0.000224816
0.000327547
0.000413266
0.000483464
0.000540389
0.000586127
0.000622573
0.000651374
0.000673942
0.000691497
0.000705093
0.00071564
0.000723906
0.000730517
0.000735958
0.000740582
0.00074463
0.000748251
0.000751536
0.000754544
0.000757321
0.000759914
0.000762375
0.000764756
0.000767082
0.000769479
0.000771759
0.000773911
0.000776325
0.000779658
0.000785229
0.000794732
0.000809956
0.000832311
0.000861795
0.000896744
0.000910316
0.000899776
1.31701e-05
0.000106848
0.000219526
0.000320413
0.00040541
0.000475772
0.000533472
0.000580387
0.000618243
0.000648541
0.000672569
0.000691445
0.000706156
0.000717567
0.000726419
0.000733326
0.000738765
0.000743083
0.000746519
0.000749231
0.000751329
0.000752902
0.000754043
0.000754863
0.000755474
0.00075615
0.000757054
0.000758374
0.000760155
0.000762514
0.000766115
0.000771983
0.000781478
0.000795998
0.000816819
0.000844883
0.000880488
0.000909609
0.000908186
0.000900656
1.30311e-05
0.000103856
0.000213131
0.000311565
0.000395825
0.000466757
0.000525758
0.000574291
0.000613867
0.000645862
0.000671458
0.00069169
0.000707477
0.000719634
0.000728871
0.000735782
0.000740836
0.000744379
0.000746662
0.00074788
0.000748204
0.000747797
0.000746866
0.00074574
0.000744701
0.000744089
0.000744241
0.000745485
0.000748077
0.000752267
0.000758816
0.000768733
0.000783036
0.000802579
0.000827929
0.000859314
0.000896427
0.000915867
0.000907786
0.00090041
1.28133e-05
9.91577e-05
0.00020368
0.000299631
0.000383766
0.000456096
0.000517217
0.000568062
0.000609636
0.000643387
0.000670502
0.000691976
0.000708672
0.000721345
0.000730655
0.000737167
0.00074134
0.000743528
0.000744033
0.000743129
0.000741176
0.000738523
0.000735577
0.000732805
0.000730694
0.000729731
0.000730365
0.000732995
0.000737962
0.000745607
0.000756417
0.000771096
0.000790179
0.000813989
0.000842628
0.000876059
0.000907242
0.000912504
0.00090536
0.000897826
1.25441e-05
9.08353e-05
0.000190161
0.000284925
0.000370472
0.000445438
0.000509313
0.000562556
0.000606128
0.000641328
0.000669604
0.000691976
0.000709242
0.000722063
0.00073102
0.000736626
0.000739325
0.000739535
0.000737707
0.000734326
0.000729947
0.000725177
0.000720676
0.000717121
0.000715161
0.000715363
0.000718175
0.000723916
0.000732788
0.000744903
0.000760358
0.00077944
0.000802292
0.000828842
0.000858763
0.000890934
0.000908433
0.000904422
0.000898462
0.000890161
1.22735e-05
8.39656e-05
0.000178582
0.000273396
0.000360681
0.000437887
0.000504125
0.00055939
0.000603948
0.000639646
0.000668397
0.000691121
0.00070847
0.000720964
0.000729077
0.000733252
0.000733946
0.000731713
0.000727237
0.000721297
0.00071476
0.000708538
0.000703538
0.000700583
0.000700348
0.0007033
0.000709691
0.000719571
0.000732844
0.000749335
0.000768865
0.000791348
0.000816635
0.000844426
0.000874
0.000896477
0.000899077
0.000894417
0.000887483
0.0008768
1.21737e-05
8.40609e-05
0.000175955
0.000269495
0.000356951
0.00043481
0.000501865
0.000557835
0.000602691
0.000637846
0.00066621
0.000688647
0.000705587
0.000717303
0.000724088
0.000726331
0.0007246
0.000719695
0.000712632
0.000704579
0.000696762
0.000690374
0.000686455
0.000685801
0.000688901
0.000695922
0.000706759
0.000721107
0.000738565
0.000758718
0.000781214
0.000805784
0.000832229
0.00086019
0.00088415
0.000891085
0.000887202
0.000881006
0.000871643
0.000857606
1.23369e-05
8.91454e-05
0.000181041
0.000273507
0.000359912
0.000436668
0.000502604
0.000557594
0.000601959
0.00063556
0.000662745
0.000684259
0.000700206
0.000710571
0.000715489
0.000715398
0.000711073
0.000703673
0.00069464
0.000685559
0.000677962
0.000673163
0.000672121
0.000675366
0.000682995
0.000694744
0.000710103
0.000728445
0.00074914
0.000771636
0.000795514
0.000820508
0.000846498
0.000871046
0.000881024
0.000877824
0.00087195
0.000863219
0.000850313
0.00083235
1.2701e-05
9.67566e-05
0.00019113
0.000283479
0.000368731
0.000443675
0.000507508
0.000560337
0.000602991
0.000633691
0.000658515
0.000678225
0.000692448
0.000700816
0.000703364
0.000700694
0.00069394
0.000684713
0.000674898
0.000666404
0.000660866
0.000659458
0.000662794
0.000670935
0.000683489
0.000699761
0.000718916
0.00074012
0.000762642
0.000785927
0.000809598
0.000833461
0.000856966
0.000869335
0.000866953
0.000861087
0.000852449
0.000840114
0.000822964
0.000800936
1.31734e-05
0.000106435
0.000204797
0.000296036
0.000379019
0.000451206
0.000511986
0.000562048
0.000601244
0.000630494
0.000652793
0.000670216
0.000682185
0.000688047
0.000687933
0.000682812
0.000674317
0.000664513
0.000655592
0.000649544
0.000647815
0.000651162
0.00065967
0.000672867
0.000689915
0.000709801
0.000731496
0.000754077
0.000776793
0.000799206
0.000821084
0.000842382
0.000855639
0.000854932
0.000848952
0.000840004
0.000827813
0.000811344
0.000789745
0.000763902
1.38107e-05
0.000115623
0.000220643
0.000310616
0.000389072
0.000456311
0.000512851
0.000559265
0.000595615
0.000623073
0.000643891
0.000659549
0.000669181
0.000672373
0.000669759
0.000662888
0.000653911
0.000645215
0.000639038
0.000637122
0.000640434
0.000649152
0.000662798
0.000680453
0.000700976
0.000723188
0.000745998
0.00076849
0.000789999
0.000810093
0.000828458
0.000840829
0.000841868
0.000835991
0.000826586
0.000814222
0.00079829
0.000777626
0.000751765
0.000722737
1.41226e-05
0.000120189
0.000229778
0.000320006
0.000395789
0.000459073
0.000511434
0.000553977
0.000587199
0.000613001
0.000632987
0.000646771
0.000653787
0.000654392
0.00064997
0.000642647
0.000634897
0.000629123
0.000627285
0.000630594
0.000639397
0.00065329
0.000671351
0.000692376
0.000715083
0.00073826
0.000760849
0.000782001
0.000801081
0.000817575
0.0008297
0.000831532
0.000824518
0.000813946
0.000800832
0.000784968
0.000765236
0.000740331
0.000710505
0.000679269
1.37351e-05
0.000116587
0.000226406
0.000317289
0.000392652
0.000454316
0.000504369
0.00054471
0.000577107
0.000602531
0.000620994
0.000632205
0.00063651
0.000635178
0.000630262
0.000624218
0.000619501
0.000618174
0.000621654
0.000630507
0.000644491
0.000662763
0.000684134
0.000707284
0.00073091
0.000753834
0.000775058
0.000793819
0.000809565
0.000821703
0.000824143
0.000815765
0.000803458
0.000788892
0.000772363
0.00075311
0.000729487
0.000700285
0.000666984
0.000634941
1.297e-05
0.000108067
0.000216073
0.000307066
0.000381838
0.000443273
0.000493617
0.000534585
0.000567063
0.000591281
0.000607388
0.000615979
0.00061837
0.000616549
0.000612907
0.000609877
0.000609576
0.000613537
0.000622535
0.00063654
0.000654865
0.000676408
0.000699874
0.00072393
0.000747306
0.000768842
0.000787531
0.000802803
0.000814288
0.000817466
0.000809098
0.000795058
0.000778516
0.000760564
0.000741082
0.000718625
0.000691078
0.000657789
0.00062215
0.00059143
1.24249e-05
0.00010177
0.000206916
0.000297847
0.000373281
0.000435406
0.000486119
0.000526602
0.000557486
0.000579274
0.000592806
0.000599512
0.00060138
0.000600735
0.000599951
0.000601153
0.000605957
0.0006153
0.000629365
0.000647664
0.000669229
0.00069284
0.000717191
0.000741003
0.000763073
0.000782292
0.000797668
0.000808541
0.000812678
0.00080486
0.000788676
0.00076959
0.000749493
0.000728951
0.000707084
0.000681575
0.000650145
0.000613591
0.00057794
0.00055172
1.21988e-05
0.000103293
0.000207199
0.000297149
0.000371953
0.000433283
0.000482522
0.00052068
0.000548661
0.000567565
0.000578949
0.000584834
0.000587511
0.000589309
0.000592346
0.000598297
0.000608223
0.000622492
0.000640817
0.000662398
0.00068612
0.000710724
0.000734945
0.000757592
0.000777575
0.000793862
0.000805526
0.000811925
0.00080528
0.000785437
0.000762683
0.000739531
0.000716995
0.000694803
0.000670916
0.000642159
0.000606927
0.000568738
0.000536535
0.000518688
1.22435e-05
0.000104681
0.000210795
0.000300616
0.000374447
0.000433998
0.000480668
0.000515729
0.000540578
0.000556954
0.000566989
0.000573047
0.000577481
0.000582452
0.000589694
0.000600371
0.000614999
0.000633474
0.000655173
0.00067912
0.000704141
0.000728992
0.000752455
0.000773406
0.000790876
0.00080395
0.000811468
0.000807033
0.000785978
0.000758767
0.000731381
0.000705722
0.000682125
0.000659067
0.000633066
0.000600628
0.000562324
0.000525349
0.000500205
0.000492998
1.22691e-05
0.000105827
0.000213343
0.000303808
0.000377076
0.00043493
0.000479013
0.000511108
0.000533251
0.000547774
0.000557221
0.000564136
0.000570859
0.000579287
0.000590694
0.000605725
0.00062443
0.000646347
0.000670646
0.000696278
0.000722098
0.000746946
0.000769639
0.00078887
0.000803819
0.000813034
0.00081321
0.000793822
0.000759132
0.000725661
0.000695556
0.000669392
0.000646157
0.000622522
0.000593743
0.000557512
0.000518349
0.000486589
0.000471392
0.000475107
1.22669e-05
0.000106205
0.000215069
0.000306534
0.000379481
0.000435678
0.000477306
0.000506757
0.000526676
0.000539895
0.000549263
0.000557424
0.000566588
0.000578336
0.000593533
0.00061238
0.00063453
0.000659243
0.000685564
0.000712408
0.000738625
0.000763288
0.000785612
0.000803566
0.000813455
0.000817966
0.000802549
0.000759459
0.00071985
0.000685325
0.000656312
0.000632229
0.000610321
0.000585431
0.000552877
0.000513894
0.000477581
0.000454866
0.000450935
0.000462291
1.23092e-05
0.000106462
0.000217159
0.000309558
0.000381843
0.000436275
0.000475526
0.000502565
0.000520563
0.000532752
0.000542202
0.000551592
0.000562984
0.000577684
0.000596213
0.00061839
0.000643493
0.000670465
0.000698251
0.000725752
0.000751141
0.000772656
0.000788702
0.000798533
0.000805429
0.000796083
0.00075482
0.000711712
0.000674065
0.000642715
0.000617627
0.000596852
0.000575604
0.000547788
0.000511255
0.000472459
0.00044304
0.000430955
0.000436688
0.000452
1.23741e-05
0.000107179
0.00021924
0.000311837
0.00038336
0.000436068
0.000473107
0.000497947
0.000514189
0.000525377
0.000534757
0.000545042
0.000558214
0.000575405
0.000596866
0.000622051
0.00064978
0.00067824
0.000705044
0.000728089
0.000746715
0.000761193
0.000772368
0.000778867
0.000772514
0.000739116
0.000696606
0.000659149
0.00062753
0.00060234
0.000582642
0.00056463
0.000541933
0.000509743
0.000470946
0.000436402
0.000416492
0.000414278
0.000426834
0.000444445
1.24595e-05
0.000108937
0.0002215
0.000313588
0.000383669
0.000434443
0.000469342
0.00049212
0.000506639
0.000516651
0.000525546
0.000536115
0.000550369
0.000569448
0.000593598
0.000621726
0.000649713
0.000674355
0.000694853
0.000711794
0.000725566
0.000735808
0.000740682
0.000733068
0.000705257
0.000669708
0.000637107
0.000608606
0.000585467
0.000567757
0.000552918
0.000535237
0.000508503
0.000472069
0.000434428
0.000407532
0.00039755
0.000403224
0.000420057
0.000438993
1.2623e-05
0.000109969
0.000221782
0.000312634
0.000381284
0.000430521
0.000463852
0.000485088
0.000498147
0.000506843
0.000514638
0.0005244
0.000538253
0.000557557
0.000582571
0.000609174
0.000632335
0.000652096
0.000668802
0.000681789
0.000689434
0.00068938
0.000678809
0.000656291
0.000630314
0.000605774
0.000583823
0.000565486
0.000551569
0.000540597
0.00052791
0.000507089
0.000474898
0.000436527
0.000403786
0.000386043
0.000384724
0.000396082
0.000415432
0.000434982
1.26793e-05
0.000108684
0.000218722
0.000308027
0.000375495
0.00042389
0.000456569
0.000477135
0.000489308
0.000496738
0.0005028
0.000510343
0.00052146
0.000537328
0.000557831
0.000580368
0.00060028
0.000615597
0.000626416
0.000631801
0.000630498
0.000620607
0.00060418
0.000586137
0.000568758
0.000553703
0.000542117
0.000533832
0.000527854
0.000520447
0.000505671
0.000478928
0.000442207
0.00040543
0.000379997
0.000370958
0.000376355
0.000391619
0.000412521
0.000432102
1.26298e-05
0.00010597
0.000212654
0.000299754
0.000366195
0.000414465
0.00044752
0.000468509
0.000480697
0.000487325
0.000491488
0.000495876
0.00050246
0.000512255
0.000525255
0.000540366
0.000554606
0.000564696
0.000569427
0.000568802
0.000563237
0.000554002
0.000542922
0.000532023
0.000523055
0.000517418
0.000515558
0.000515558
0.00051382
0.00050507
0.00048435
0.000451275
0.00041288
0.000380601
0.000362843
0.000360884
0.000371139
0.000389109
0.000411076
0.000430305
1.2361e-05
0.00010175
0.000203795
0.000288127
0.000353634
0.000402353
0.000436714
0.000459282
0.000472722
0.000479739
0.000482928
0.000484647
0.000486764
0.000490383
0.000495744
0.00050232
0.000508824
0.000513468
0.000515173
0.000513804
0.000510078
0.000505184
0.00050049
0.000497439
0.000497329
0.00050065
0.000506136
0.000509936
0.00050681
0.000492062
0.00046394
0.000426541
0.000389426
0.000362671
0.000351358
0.000354563
0.000368256
0.000388243
0.000411089
0.000429782
1.19323e-05
9.50498e-05
0.000192201
0.000273606
0.000338202
0.00038768
0.000424011
0.000449202
0.000465303
0.000474424
0.000478597
0.000479693
0.000479347
0.000478783
0.000478663
0.000479106
0.000479907
0.000480619
0.000480902
0.00048072
0.000480506
0.000481045
0.000483268
0.000487972
0.000495314
0.00050417
0.000511601
0.000512936
0.00050334
0.000480584
0.000446428
0.000407504
0.000373179
0.00035119
0.000344413
0.000351103
0.000367299
0.000388991
0.000412713
0.000430743
1.14929e-05
8.72169e-05
0.000178556
0.000256992
0.000320464
0.000370567
0.000409008
0.000437389
0.000457253
0.000470127
0.000477503
0.000480784
0.000481268
0.000480115
0.000478286
0.000476483
0.000475217
0.000474781
0.000475425
0.000477396
0.000480995
0.000486543
0.000494179
0.000503562
0.000513515
0.000521732
0.000524801
0.000518856
0.000501019
0.000471564
0.000434199
0.000395766
0.000364139
0.000345246
0.000341101
0.000349989
0.000368132
0.000391449
0.000416117
0.000433336
1.10485e-05
7.99986e-05
0.000164949
0.000239564
0.000301284
0.000351392
0.000391438
0.000422772
0.000446593
0.000464013
0.000476112
0.000483912
0.000488394
0.000490536
0.000491238
0.000491384
0.000491785
0.000493096
0.000495838
0.000500365
0.000506756
0.000514776
0.000523763
0.000532524
0.000539261
0.000541628
0.000537011
0.000523154
0.000499102
0.000466253
0.000428441
0.000391427
0.00036158
0.000344001
0.000340873
0.000351001
0.00037078
0.000395791
0.000421517
0.0004377
1.06336e-05
7.4498e-05
0.00015293
0.000223052
0.000281834
0.000330822
0.000371453
0.000404867
0.000432004
0.000453697
0.000470725
0.000483848
0.000493806
0.000501326
0.00050712
0.000511874
0.000516331
0.000521018
0.000526425
0.000532721
0.000539703
0.00054681
0.000553106
0.000557331
0.000557982
0.000553484
0.000542393
0.000523724
0.000497412
0.000464778
0.00042872
0.000393568
0.000364576
0.000346872
0.000343508
0.000354159
0.000375408
0.000402277
0.000429221
0.000444059
1.02908e-05
7.21236e-05
0.000143596
0.000207439
0.000262205
0.000309216
0.000349542
0.00038405
0.000413461
0.000438407
0.000459467
0.000477185
0.000492094
0.000504703
0.000515507
0.000524953
0.000533408
0.000541163
0.000548382
0.000555032
0.000560787
0.000565098
0.000567261
0.000566513
0.00056207
0.000553207
0.000539309
0.000519972
0.00049519
0.000465703
0.000433313
0.000400734
0.000372124
0.000353486
0.000349131
0.000359814
0.000382425
0.00041138
0.000439823
0.00045292
9.97542e-06
6.97963e-05
0.000134464
0.000191893
0.000242556
0.000287301
0.000326818
0.000361667
0.000392369
0.000419392
0.000443151
0.000464021
0.000482351
0.000498454
0.00051261
0.000525035
0.000535862
0.000545152
0.000552854
0.000558783
0.000562681
0.000564257
0.000563225
0.000559365
0.000552511
0.000542493
0.000529117
0.000512153
0.000491405
0.000466927
0.000439312
0.000410105
0.000382979
0.000363844
0.000358487
0.000368963
0.000392806
0.000424055
0.000454473
0.00046537
9.61535e-06
6.54081e-05
0.000124316
0.000177006
0.000224232
0.00026683
0.000305296
0.000339993
0.000371252
0.000399359
0.000424568
0.000447112
0.00046719
0.000484971
0.000500582
0.0005141
0.000525548
0.000534894
0.000542062
0.000546931
0.000549408
0.000549457
0.000547145
0.00054256
0.000535817
0.000526987
0.000516032
0.00050276
0.000486823
0.00046777
0.000444903
0.000419461
0.000395934
0.000378346
0.00037301
0.000383428
0.000408303
0.000441975
0.000475319
0.000483235
9.15843e-06
5.88335e-05
0.000113323
0.000163135
0.000208358
0.000249677
0.00028745
0.000321934
0.00035328
0.000381614
0.000407084
0.000429848
0.000450055
0.000467837
0.000483306
0.000496549
0.000507623
0.000516549
0.000523324
0.000527934
0.0005304
0.000530808
0.000529298
0.000526025
0.000521144
0.000514769
0.000506897
0.000497345
0.00048571
0.000471267
0.000453232
0.000432668
0.000413078
0.000398637
0.00039477
0.000405706
0.00043146
0.000467426
0.000504738
0.000509388
8.65402e-06
5.31159e-05
0.000104623
0.000153389
0.00019858
0.000240162
0.000278045
0.000312257
0.000342876
0.000370061
0.000394049
0.000415128
0.000433613
0.000449823
0.000464064
0.0004766
0.000487615
0.000497177
0.000505244
0.00051169
0.000516378
0.000519225
0.000520238
0.00051951
0.000517174
0.00051335
0.00050809
0.000501346
0.000492735
0.000481715
0.000467933
0.000452077
0.000437082
0.000426912
0.000425964
0.000438607
0.000466148
0.000505166
0.000547661
0.000547284
8.28264e-06
5.3665e-05
0.00010627
0.000157236
0.000204829
0.000248014
0.000286164
0.000319078
0.000346915
0.000370162
0.000389551
0.000405952
0.000420278
0.000433398
0.000446056
0.000458761
0.000471676
0.000484569
0.000496892
0.000507941
0.000517058
0.000523809
0.000528077
0.00052998
0.000529769
0.000527598
0.000523674
0.000518224
0.000511143
0.000501938
0.000490963
0.000479269
0.000469555
0.000465019
0.000469066
0.000485953
0.000518623
0.000565096
0.00062067
0.000600382
8.37997e-06
6.46153e-05
0.000127729
0.000187327
0.000241495
0.000288436
0.000326836
0.000356292
0.000377394
0.000391602
0.000400964
0.000407776
0.000414276
0.000422388
0.000433494
0.00044818
0.000466042
0.000485768
0.000505536
0.000523517
0.000538295
0.00054917
0.00055609
0.000559522
0.000560014
0.000557891
0.000553399
0.000547162
0.000540259
0.000533235
0.000526021
0.000519502
0.000516364
0.000519
0.00052994
0.000554813
0.000602244
0.00065962
0.000687057
0.000649134
9.47655e-06
8.69013e-05
0.000172751
0.000251797
0.000321411
0.000377644
0.000417612
0.000440767
0.000449003
0.000446116
0.000436999
0.000426757
0.000419914
0.000419938
0.000428955
0.000447316
0.000473211
0.000503144
0.000533066
0.000559439
0.000579918
0.000593708
0.000601331
0.00060388
0.000602879
0.000599517
0.000594572
0.000588607
0.000583169
0.000579013
0.000576298
0.000576521
0.000582114
0.000591439
0.000605236
0.00062801
0.000653358
0.000680308
0.000724699
0.000643479
1.20767e-05
0.0001128
0.000233801
0.000350266
0.000451368
0.000526371
0.000569003
0.000579592
0.000564096
0.000531906
0.000493491
0.000458267
0.000433104
0.000422413
0.000428816
0.000452462
0.0004895
0.000533125
0.000575945
0.000611701
0.000636703
0.000650712
0.000655998
0.000655775
0.00065302
0.000649172
0.000645292
0.000641663
0.000639145
0.00063717
0.000636787
0.000641654
0.000643313
0.000637341
0.000635984
0.000642518
0.000661752
0.000691977
0.000691247
0.000563871
1.76338e-05
0.000140657
0.000313342
0.000493172
0.000648447
0.000751247
0.000788799
0.000767715
0.000706191
0.000626355
0.000548431
0.000485947
0.000443988
0.00042409
0.000428768
0.000459317
0.000510291
0.000571085
0.000629792
0.000675754
0.000703399
0.00071414
0.0007146
0.000711371
0.000708101
0.000705569
0.000702393
0.0006963
0.000686367
0.000673637
0.000661227
0.00065149
0.000641626
0.000632856
0.000632993
0.000644195
0.000659377
0.000663323
0.000626618
0.000512277
4.22131e-05
0.000217604
0.00048089
0.000763694
0.000998036
0.00111765
0.00110591
0.00100363
0.000858174
0.000709775
0.000591543
0.000511463
0.000460275
0.000434916
0.000438702
0.000475234
0.000539095
0.00061943
0.000699821
0.000755867
0.000776871
0.000775065
0.000766561
0.000761214
0.000757504
0.000751069
0.000740321
0.000724978
0.000702641
0.000673603
0.000644035
0.000621765
0.000609209
0.000605834
0.000610533
0.000618176
0.00062057
0.000614854
0.000582001
0.000511277
6.46442e-05
0.000387985
0.000924086
0.00147286
0.00182654
0.00185518
0.00161525
0.00133804
0.00107522
0.00083436
0.000673521
0.000583495
0.000502894
0.000470253
0.000495187
0.00053181
0.000584387
0.000680609
0.000811733
0.000862037
0.00085766
0.000823859
0.000804853
0.000802966
0.000798429
0.00078312
0.000757082
0.000723877
0.000685811
0.000646233
0.000610613
0.00058299
0.000562982
0.000547879
0.000536201
0.000545301
0.000574333
0.000612853
0.000641121
0.000652717
9.43551e-05
0.00108564
0.00300424
0.00432898
0.0047344
0.00415662
0.00259522
0.00203942
0.00192617
0.00227311
0.00169713
0.0011426
0.000531339
0.000415397
0.000510764
0.000589327
0.00055969
0.000704703
0.00155468
0.00197864
0.00166239
0.000886271
0.000806075
0.000801593
0.000798448
0.000781463
0.000751395
0.000713064
0.000671652
0.000632029
0.000597947
0.000570481
0.000549684
0.000555952
0.00108046
0.0014898
0.00167653
0.00183011
0.00202001
0.00211318
)
;
boundaryField
{
inlet
{
type nutkWallFunction;
Cmu 0.09;
kappa 0.41;
E 9.8;
value nonuniform List<scalar> 10(6.52139e-07 1.11845e-07 0 0 0 0 0 0 1.11875e-07 6.52148e-07);
}
inletWall
{
type nutkWallFunction;
Cmu 0.09;
kappa 0.41;
E 9.8;
value nonuniform List<scalar>
30
(
7.66184e-07
7.49235e-07
7.20321e-07
6.87742e-07
6.52139e-07
1.94391e-07
2.53288e-07
3.40566e-07
4.27873e-07
5.34354e-07
1.32627e-06
5.06727e-07
4.39373e-07
3.72411e-07
2.89893e-07
7.66196e-07
7.49246e-07
7.20331e-07
6.87751e-07
6.52148e-07
1.94465e-07
2.533e-07
3.40573e-07
4.27882e-07
5.34364e-07
1.42617e-06
5.08767e-07
4.39833e-07
3.72629e-07
2.90006e-07
)
;
}
bottleWall
{
type nutkWallFunction;
Cmu 0.09;
kappa 0.41;
E 9.8;
value nonuniform List<scalar>
290
(
0
0
0
0
3.5761e-10
0
0
1.43762e-09
0
9.46248e-10
2.48306e-09
3.75615e-09
1.27153e-08
5.48916e-08
1.05159e-07
1.66064e-07
2.34296e-07
3.05608e-07
3.78373e-07
4.54883e-07
5.30041e-07
5.99039e-07
6.62626e-07
7.22809e-07
7.78261e-07
8.30232e-07
8.79107e-07
9.2485e-07
9.67517e-07
1.00741e-06
1.04535e-06
1.08292e-06
1.12239e-06
1.1642e-06
1.2055e-06
1.24219e-06
1.28325e-06
1.33174e-06
1.3766e-06
1.43052e-06
1.4858e-06
1.54873e-06
1.626e-06
1.71876e-06
1.8148e-06
1.91642e-06
2.01627e-06
2.10961e-06
2.20225e-06
2.28088e-06
2.35032e-06
2.41241e-06
2.46653e-06
2.51262e-06
2.55062e-06
2.58161e-06
2.60785e-06
2.63192e-06
2.65544e-06
2.68148e-06
2.70694e-06
2.72488e-06
2.7426e-06
2.76251e-06
2.78077e-06
2.79813e-06
2.8242e-06
2.86861e-06
2.92558e-06
2.97661e-06
3.01196e-06
3.01857e-06
2.97975e-06
2.90708e-06
2.8095e-06
2.69634e-06
2.58651e-06
2.50042e-06
2.45158e-06
2.44784e-06
2.49861e-06
2.5827e-06
2.31934e-06
1.49548e-06
0
0
0
0
0
0
2.04589e-06
1.94241e-06
1.8771e-06
1.84777e-06
1.8289e-06
1.79688e-06
1.73412e-06
1.71039e-06
3.3255e-06
0
1.04295e-06
1.03997e-06
1.03731e-06
1.03497e-06
1.03293e-06
1.03113e-06
1.02961e-06
1.02871e-06
1.02942e-06
1.03063e-06
1.03172e-06
1.03243e-06
1.03262e-06
1.03215e-06
1.03087e-06
1.02861e-06
1.02519e-06
1.0204e-06
1.01403e-06
1.00586e-06
9.95634e-07
9.83109e-07
9.68041e-07
9.50237e-07
9.29612e-07
9.0592e-07
8.79794e-07
8.49781e-07
8.1468e-07
7.73897e-07
7.26609e-07
6.71935e-07
6.09484e-07
5.44004e-07
4.74978e-07
3.98545e-07
3.12038e-07
2.12953e-07
1.0413e-07
0
1.07717e-06
1.07405e-06
1.0707e-06
1.06717e-06
1.06352e-06
1.05985e-06
1.0562e-06
1.05265e-06
1.04924e-06
1.04601e-06
0
1.34419e-07
2.05115e-07
2.88708e-07
3.65469e-07
4.34713e-07
4.9568e-07
5.50396e-07
6.0012e-07
6.45672e-07
6.87605e-07
7.26321e-07
7.62133e-07
7.95292e-07
8.26002e-07
8.54432e-07
8.80727e-07
9.05008e-07
9.27384e-07
9.47953e-07
9.66804e-07
9.84021e-07
9.99678e-07
1.01384e-06
1.02658e-06
1.03794e-06
1.04797e-06
1.05672e-06
1.06425e-06
1.07059e-06
1.0758e-06
1.07994e-06
1.08304e-06
1.08516e-06
1.08634e-06
1.08662e-06
1.08607e-06
1.08475e-06
1.08275e-06
1.08017e-06
0
0
0
1.8766e-09
2.83879e-09
9.8649e-09
4.76406e-08
8.19423e-08
1.12533e-07
1.40385e-07
1.66229e-07
1.90767e-07
2.14519e-07
2.37772e-07
2.60468e-07
2.81813e-07
2.97724e-07
3.03695e-07
3.27899e-07
3.22685e-07
2.75951e-07
2.37388e-07
2.20708e-07
2.2849e-07
2.5103e-07
2.78166e-07
3.06159e-07
3.34572e-07
3.6406e-07
3.95471e-07
4.29945e-07
4.6773e-07
5.05631e-07
5.43232e-07
5.81016e-07
6.19973e-07
6.59798e-07
7.0159e-07
7.44035e-07
7.86755e-07
8.26871e-07
8.65039e-07
8.98449e-07
9.31491e-07
9.65142e-07
9.99426e-07
1.03404e-06
1.06895e-06
1.1043e-06
1.13935e-06
1.17324e-06
1.20558e-06
1.23941e-06
1.26742e-06
1.27623e-06
1.28844e-06
1.30371e-06
1.30283e-06
1.29047e-06
1.269e-06
1.23658e-06
1.19851e-06
1.16695e-06
1.16412e-06
1.19674e-06
1.25337e-06
1.32453e-06
1.40777e-06
1.42166e-06
1.34723e-06
1.24152e-06
1.17302e-06
1.15125e-06
1.15936e-06
1.16136e-06
1.16508e-06
1.1729e-06
1.1843e-06
1.19834e-06
1.22111e-06
1.22448e-06
1.21181e-06
1.16813e-06
1.10705e-06
1.0443e-06
9.81158e-07
9.23365e-07
8.74864e-07
8.27353e-07
7.71753e-07
7.01489e-07
6.25366e-07
5.6952e-07
5.80477e-07
7.36197e-07
1.11721e-06
1.89133e-06
0
0
0
)
;
}
atmosphere
{
type calculated;
value nonuniform List<scalar>
80
(
0.009
0.009
0.009
0.009
0.009
0.009
0.009
0.000955213
0.00089523
0.000903609
0.000925151
0.000944043
0.000949212
0.000933497
0.000896509
0.000846202
0.000812831
0.000874524
0.009
0.009
0.009
0.009
0.009
0.009
0.000769648
0.00087657
0.000966619
0.00103818
0.00109071
0.00111526
0.00109296
0.00102645
0.000929306
0.00083963
0.000765107
0.000699506
0.000651121
0.000593792
0.009
0.009
0.009
0.009
0.009
0.009
0.009
0.009
0.00259522
0.00203942
0.00192617
0.009
0.009
0.009
0.009
0.000415397
0.000510764
0.000589327
0.00055969
0.009
0.009
0.009
0.009
0.000886271
0.000806075
0.000801593
0.000798448
0.000781463
0.000751395
0.000713064
0.000671652
0.000632029
0.000597947
0.000570481
0.000549684
0.000555952
0.009
0.009
0.009
0.009
0.009
0.009
)
;
}
frontAndBack
{
type empty;
}
}
// ************************************************************************* //
|
|
a35186c52f24590d088b5afe0fb35961aebc2da5
|
d7a0d17211724bead2866fc17e1a02501a6fe79b
|
/include/FedTree/Tree/hist_tree_builder.h
|
843bb87380692d8154a849f74a0709271f3cb140
|
[
"Apache-2.0"
] |
permissive
|
tojhe/FedTree
|
f3cedaa33392703758256c6263a8806ce6555808
|
0544e6ac98c05da7e83d0db957fd93bf3bdf6ebf
|
refs/heads/main
| 2023-07-01T00:18:25.689832
| 2021-06-30T02:07:36
| 2021-06-30T02:07:36
| null | 0
| 0
| null | null | null | null |
UTF-8
|
C++
| false
| false
| 5,853
|
h
|
hist_tree_builder.h
|
//
// Created by liqinbin on 11/3/20.
//
#ifndef FEDTREE_HIST_TREE_BUILDER_H
#define FEDTREE_HIST_TREE_BUILDER_H
#include "tree_builder.h"
#include "hist_cut.h"
#include <thrust/copy.h>
#include <thrust/execution_policy.h>
class HistTreeBuilder : public TreeBuilder {
public:
HistCut cut;
void init(DataSet &dataset, const GBDTParam ¶m) override;
void init_nocutpoints(DataSet &dataset, const GBDTParam ¶m);
void get_bin_ids();
void find_split(int level) override;
void find_split_by_predefined_features(int level) override;
void compute_histogram_in_a_level(int level, int n_max_splits, int n_bins, int n_nodes_in_level, int* hist_fid_data,
SyncArray<GHPair> &missing_gh, SyncArray<GHPair> &hist) override;
void compute_histogram_in_a_node(SyncArray<GHPair> &gradients, HistCut &cut, SyncArray<unsigned char> &dense_bin_id);
void compute_gain_in_a_level(SyncArray<float_type> &gain, int n_nodes_in_level, int n_bins, int* hist_fid_data,
SyncArray<GHPair> &missing_gh, SyncArray<GHPair> &hist, int n_columns = 0) override;
void get_best_gain_in_a_level(SyncArray<float_type> &gain, SyncArray<int_float> &best_idx_gain, int n_nodes_in_level, int n_bins) override;
void get_split_points(SyncArray<int_float> &best_idx_gain, int level, int *hist_fid, SyncArray<GHPair> &missing_gh, SyncArray<GHPair> &hist);
SyncArray<GHPair> get_gradients();
void set_gradients(SyncArray<GHPair> &gh);
void get_split_points_in_a_node(int node_id, int best_idx, float best_gain, int n_nodes_in_level, int *hist_fid, SyncArray<GHPair> &missing_gh, SyncArray<GHPair> &hist) override;
virtual ~HistTreeBuilder() {};
void update_ins2node_id() override;
void update_ins2node_id_in_a_node(int node_id) override;
//support equal division or weighted division
void propose_split_candidates();
void merge_histograms_server_propose(SyncArray<GHPair> &hist, SyncArray<GHPair> &missing_gh);
void merge_histograms_client_propose(SyncArray<GHPair> &hist, SyncArray<GHPair> &missing_gh, int max_splits);
void concat_histograms() override;
SyncArray<float_type> gain(Tree &tree, SyncArray<GHPair> &hist, int level, int n_split);
HistCut get_cut() override{
return cut;
}
SyncArray<GHPair> get_hist() override{
SyncArray<GHPair> h(last_hist.size());
h.copy_from(last_hist);
return h;
}
void parties_hist_init(int party_size) override{
parties_hist.resize(party_size);
parties_missing_gh.resize(party_size);
parties_cut = vector<HistCut>(party_size);
this->party_size = party_size;
party_idx = 0;
}
void append_hist(SyncArray<GHPair> &hist) override {
CHECK_LT(party_idx, party_size);
parties_hist[party_idx].resize(hist.size());
parties_hist[party_idx].copy_from(hist);
party_idx += 1;
}
void append_hist(SyncArray<GHPair> &hist, SyncArray<GHPair> &missing_gh,int n_partition, int n_max_splits, int party_idx) override{
parties_missing_gh[party_idx].resize(n_partition);
//thrust::copy(thrust::host, missing_gh.host_data(), missing_gh.host_end(), parties_missing_gh[party_idx].host_data());
parties_missing_gh[party_idx].copy_from(missing_gh);
parties_hist[party_idx].resize(n_max_splits);
parties_hist[party_idx].copy_from(hist);
}
void set_cut (HistCut &commonCut) {
cut.cut_points_val.resize(commonCut.cut_points_val.size());
cut.cut_col_ptr.resize(commonCut.cut_col_ptr.size());
cut.cut_fid.resize(commonCut.cut_fid.size());
cut.cut_points_val.copy_from(commonCut.cut_points_val);
cut.cut_col_ptr.copy_from(commonCut.cut_col_ptr);
cut.cut_fid.copy_from(commonCut.cut_fid);
}
void set_last_hist(SyncArray<GHPair> &last_hist_input) {
last_hist.resize(last_hist_input.size());
last_hist.copy_from(last_hist_input);
}
void set_last_missing_gh(SyncArray<GHPair> &last_missing_gh_input) {
last_missing_gh.resize(last_missing_gh_input.size());
last_missing_gh.copy_from(last_missing_gh_input);
}
SyncArray<GHPair> get_last_hist() {
SyncArray<GHPair> last_hist_return(last_hist.size());
last_hist_return.copy_from(last_hist);
return last_hist_return;
}
SyncArray<GHPair> get_last_missing_gh() {
SyncArray<GHPair> last_missing_gh_return(last_missing_gh.size());
last_missing_gh_return.copy_from(last_missing_gh);
return last_missing_gh_return;
}
void append_to_parties_cut(HistCut &cut, int index) {
parties_cut[index].cut_col_ptr = SyncArray<int>(cut.cut_col_ptr.size());
parties_cut[index].cut_col_ptr.copy_from(cut.cut_col_ptr);
parties_cut[index].cut_points_val = SyncArray<float_type>(cut.cut_points_val.size());
parties_cut[index].cut_points_val.copy_from(cut.cut_points_val);
}
// void decrypt_histogram(AdditivelyHE::PaillierPrivateKey privateKey) {
// int size = last_hist.size();
// auto hist_data = last_hist.host_data();
// for (int i = 0; i < size; i++) {
// hist_data[i].decrypt(privateKey);
// }
// }
private:
vector<HistCut> parties_cut;
// MSyncArray<unsigned char> char_dense_bin_id;
SyncArray<unsigned char> dense_bin_id;
SyncArray<GHPair> last_hist;
SyncArray<GHPair> last_missing_gh;
MSyncArray<GHPair> parties_hist;
MSyncArray<GHPair> parties_missing_gh;
int party_idx = 0;
int party_size = 0;
double build_hist_used_time = 0;
int build_n_hist = 0;
int total_hist_num = 0;
double total_dp_time = 0;
double total_copy_time = 0;
};
#endif //FEDTREE_HIST_TREE_BUILDER_H
|
054cd64a48fccf5edab3e7433a2f115e2bca7187
|
08648c46598cda277e8231950746daf6ef863517
|
/TESTS/stress/network-https-range/main.cpp
|
aa84765ea35b34d546f9a344ee9ae9edee1c84c8
|
[] |
no_license
|
ARMmbed/mbed-stress-test
|
845fba227aa8ac9f2a174af06a83f79b423c9d12
|
8e8724407cf9a00869be0d317123c3c3c4c9420d
|
refs/heads/master
| 2023-03-16T14:57:07.424981
| 2020-07-28T03:48:10
| 2020-07-28T03:48:10
| 111,034,738
| 2
| 8
| null | 2019-05-07T14:23:53
| 2017-11-16T23:41:51
|
C
|
UTF-8
|
C++
| false
| false
| 4,337
|
cpp
|
main.cpp
|
/*
* mbed Microcontroller Library
* Copyright (c) 2006-2016 ARM Limited
*
* 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.
*/
/** @file fopen.cpp Test cases to POSIX file fopen() interface.
*
* Please consult the documentation under the test-case functions for
* a description of the individual test case.
*/
#define WIFI 2
#if !defined(MBED_CONF_TARGET_NETWORK_DEFAULT_INTERFACE_TYPE) || \
(MBED_CONF_TARGET_NETWORK_DEFAULT_INTERFACE_TYPE == WIFI && !defined(MBED_CONF_NSAPI_DEFAULT_WIFI_SSID))
#error [NOT_SUPPORTED] No network configuration found for this target.
#endif
#include "mbed.h"
#include "utest/utest.h"
#include "unity/unity.h"
#include "greentea-client/test_env.h"
#include "mbed_stress_test_network.h"
using namespace utest::v1;
#include MBED_CONF_APP_PROTAGONIST_DOWNLOAD
NetworkInterface* interface = NULL;
#define MAX_RETRIES 3
char filename[] = MBED_CONF_APP_PROTAGONIST_DOWNLOAD;
void download(size_t size)
{
/* remove .h from header file name */
size_t filename_size = sizeof(filename);
filename[filename_size - 3] = '\0';
char* buffer = new char[size];
size_t offset = 0;
while (offset < sizeof(story))
{
size_t actual_bytes = sizeof(story) - offset;
if (actual_bytes > size)
{
actual_bytes = size;
}
size_t received_bytes = mbed_stress_test_download(interface, filename, offset, buffer, actual_bytes, true);
TEST_ASSERT_EQUAL_INT_MESSAGE(actual_bytes, received_bytes, "received incorrect number of bytes");
TEST_ASSERT_EQUAL_STRING_LEN_MESSAGE(&story[offset],
buffer,
actual_bytes,
"character mismatch");
offset += received_bytes;
}
delete buffer;
}
static control_t setup_network(const size_t call_count)
{
interface = NetworkInterface::get_default_instance();
TEST_ASSERT_NOT_NULL_MESSAGE(interface, "failed to initialize network");
nsapi_error_t err = -1;
for (int tries = 0; tries < MAX_RETRIES; tries++) {
err = interface->connect();
if (err == NSAPI_ERROR_OK) {
break;
} else {
printf("Error connecting to network. Retrying %d of %d\r\n", tries, MAX_RETRIES);
}
}
TEST_ASSERT_EQUAL(NSAPI_ERROR_OK, err);
SocketAddress address;
interface->get_ip_address(&address);
printf("IP address is '%s'\r\n", address.get_ip_address());
printf("MAC address is '%s'\r\n", interface->get_mac_address());
return CaseNext;
}
static control_t download_1k(const size_t call_count)
{
download(1024);
return CaseNext;
}
static control_t download_2k(const size_t call_count)
{
download(2*1024);
return CaseNext;
}
static control_t download_4k(const size_t call_count)
{
download(4*1024);
return CaseNext;
}
static control_t download_8k(const size_t call_count)
{
download(8*1024);
return CaseNext;
}
static control_t download_16k(const size_t call_count)
{
download(16*1024);
return CaseNext;
}
static control_t download_32k(const size_t call_count)
{
download(32*1024);
return CaseNext;
}
utest::v1::status_t greentea_setup(const size_t number_of_cases)
{
GREENTEA_SETUP(10*60, "default_auto");
return greentea_test_setup_handler(number_of_cases);
}
Case cases[] = {
Case("Setup network", setup_network),
// Case("Download 1k", download_1k),
// Case("Download 2k", download_2k),
// Case("Download 4k", download_4k),
Case("Download 8k", download_8k),
// Case("Download 16k", download_16k),
// Case("Download 32k", download_32k),
};
Specification specification(greentea_setup, cases);
int main()
{
return !Harness::run(specification);
}
|
b46012645994c6e655f719c2ce541869120ad2a2
|
de8f9ebeb5dfdf9ad9b6e03f9ab726d117642de3
|
/mock_libep11/ep11grpc.cc
|
ba16f472ee4693b17d21d3326eac70f5b9225b70
|
[] |
no_license
|
jamesgua/tls_conn_test
|
335576168e9774caeea6677b800c15979a032be8
|
cdf99fce17b92a598614c5e8d8819ef3d213011a
|
refs/heads/master
| 2021-01-20T02:25:23.109709
| 2019-06-17T22:16:01
| 2019-06-17T22:16:01
| 101,321,238
| 0
| 0
| null | null | null | null |
UTF-8
|
C++
| false
| false
| 2,055
|
cc
|
ep11grpc.cc
|
#include "ep11grpc.h"
#include <iostream>
using std::cout;
using std::endl;
bool Grep11ManagerClient::loaded_ = false;
bool Grep11ManagerClient::isLoaded(void) {
return loaded_;
}
bool Grep11ManagerClient::Load(const LoadInfo& info, LoadStatus* status) {
if(loaded_) {
return loaded_;
}
cout << "Loading Grep11Manager" << endl;
Status grpcStatus = stub_->Load(ctx_, info, status);
if(!grpcStatus.ok()) {
cout << "Error in loading Grep11Manager " << status->error() << endl;
}
else {
loaded_ = true;
cout << "grpc status OK, grep11 server " << status->address() << ", is session " << status->session() << endl;
}
return loaded_;
}
bool Grep11Client::GenerateECKey(GenerateInfo& info, GenerateStatus* status) {
bool success = false;
if(!Grep11ManagerClient::isLoaded()) {
return success;
}
cout << "Generating ECDSA Key" << endl;
if (stub_->GenerateECKey(ctx_, info, status).ok()) {
success = true;
//cout << "ECDSA pubkey: " << status->pubkey() << ", privkey: " << status->privkey() << endl;
}
else {
cout << "ECDSA key generation error: " << status->error() << endl;
}
return success;
}
bool Grep11Client::SignP11ECDSA(SignInfo& info, SignStatus* status) {
bool success = false;
if(!Grep11ManagerClient::isLoaded()) {
return success;
}
cout << "Signing Grep11 ECDSA" << endl;
if(stub_->SignP11ECDSA(ctx_, info, status).ok()) {
success = true;
}
else {
cout << "Signing ECDSA failure: " << status->error() << endl;
}
return success;
}
bool Grep11Client::VerifyP11ECDSA(VerifyInfo& info, VerifyStatus* status) {
bool success = false;
if(!Grep11ManagerClient::isLoaded()) {
return success;
}
cout << "Verifying Grep11 ECDSA" << endl;
if(stub_->VerifyP11ECDSA(ctx_, info, status).ok()) {
success = true;
}
else {
cout << "Verify ECDSA failure " << status->error() << endl;
}
return success;
}
|
3e68fb9fe9f518916657d502723afcb913e315b3
|
4b430686ae824c78604e15818c4b864778468ca1
|
/Library/Sources/Stroika/Foundation/Streams/iostream/Utilities.cpp
|
7e07a6a887d0a104aae4161752ad9ff02dd8bcdb
|
[] |
no_license
|
kjax/Stroika
|
59d559cbbcfb9fbd619155daaf39f6805fa79e02
|
3994269f67cd9029b9adf62e93ec0a3bfae60b5f
|
refs/heads/master
| 2021-01-17T23:05:33.441132
| 2012-07-22T04:32:58
| 2012-07-22T04:32:58
| null | 0
| 0
| null | null | null | null |
UTF-8
|
C++
| false
| false
| 5,196
|
cpp
|
Utilities.cpp
|
/*
* Copyright(c) Sophist Solutions, Inc. 1990-2012. All rights reserved
*/
#include "../../Containers/Common.h"
#include "../../Execution/Exceptions.h"
#include "../../Execution/ErrNoException.h"
#include "../../Memory/SmallStackBuffer.h"
#include "Utilities.h"
using namespace Stroika::Foundation;
using namespace Stroika::Foundation::Characters;
using namespace Stroika::Foundation::Containers;
using namespace Stroika::Foundation::Execution;
using namespace Stroika::Foundation::Memory;
using namespace Stroika::Foundation::Streams;
using namespace Stroika::Foundation::Streams::iostream;
/*
********************************************************************************
********************* Streams::iostream::ReadTextStream ************************
********************************************************************************
*/
wstring Streams::iostream::ReadTextStream (istream& in)
{
streamoff start = in.tellg ();
in.seekg (0, ios_base::end);
streamoff end = in.tellg ();
Assert (start <= end);
if ((sizeof (streamoff) > sizeof (size_t)) and ((end - start) > static_cast<streamoff> (numeric_limits<ptrdiff_t>::max ()))) {
Execution::DoThrow (Execution::StringException (L"stream too large"));
}
size_t bufLen = static_cast<size_t> (end - start);
Memory::SmallStackBuffer<Byte> buf (bufLen);
in.seekg (start, ios_base::beg);
in.read (reinterpret_cast<char*> (buf.begin ()), bufLen);
size_t readLen = static_cast<size_t> (in.gcount ());
Assert (readLen <= bufLen);
const char* startOfBuf = reinterpret_cast<const char*> (static_cast<const Byte*> (buf));
return Characters::MapUNICODETextWithMaybeBOMTowstring (startOfBuf, startOfBuf + readLen);
}
wstring Streams::iostream::ReadTextStream (wistream& in)
{
streamoff start = in.tellg ();
in.seekg (0, ios_base::end);
streamoff end = in.tellg ();
Assert (start <= end);
if ((sizeof (streamoff) > sizeof (size_t)) and ((end - start) > static_cast<streamoff> (numeric_limits<ptrdiff_t>::max ()))) {
Execution::DoThrow (Execution::StringException (L"stream too large"));
}
size_t bufLen = static_cast<size_t> (end - start);
Memory::SmallStackBuffer<wchar_t> buf (bufLen);
in.seekg (start, ios_base::beg);
in.read (reinterpret_cast<wchar_t*> (buf.begin ()), bufLen);
size_t readLen = static_cast<size_t> (in.gcount ());
Assert (readLen <= bufLen);
const wchar_t* startOfBuf = reinterpret_cast<const wchar_t*> (static_cast<const wchar_t*> (buf));
return wstring (startOfBuf, startOfBuf + readLen);
}
#if 0
/*
********************************************************************************
********************* Streams::iostream::WriteString ***************************
********************************************************************************
*/
void Streams::iostream::WriteString (ostream& out, const wstring& s)
{
string s1 = WideStringToNarrow (s, kCodePage_UTF8);
out << s1.size ();
out << ' ';
out << s1 << '\t';
}
/*
********************************************************************************
********************** Streams::iostream::ReadString ***************************
********************************************************************************
*/
wstring Streams::iostream::ReadString (istream& in)
{
int strlen;
in >> strlen;
in.get (); // throw away character between size and string
string s;
s.reserve (strlen);
for (int i = 0; i < strlen; ++i) {
s += in.get ();
}
return NarrowStringToWide (s, kCodePage_UTF8);
}
#endif
/*
********************************************************************************
*********************** Streams::iostream::ReadBytes ***************************
********************************************************************************
*/
vector<Byte> Streams::iostream::ReadBytes (istream& in)
{
streamoff start = in.tellg ();
in.seekg (0, ios_base::end);
streamoff end = in.tellg ();
Assert (start <= end);
if ((sizeof (streamoff) > sizeof (size_t)) and ((end - start) > static_cast<streamoff> (numeric_limits<ptrdiff_t>::max ()))) {
Execution::DoThrow (StringException (L"stream too large"));
}
size_t len = static_cast<size_t> (end - start);
SmallStackBuffer<Byte> buf (len);
in.seekg (start, ios_base::beg);
in.read (reinterpret_cast<char*> (buf.begin ()), len);
size_t xxx = static_cast<size_t> (in.gcount ());
Assert (xxx <= len);
return vector<Byte> (static_cast<const Byte*> (buf), static_cast<const Byte*> (buf) + xxx);
}
/*
********************************************************************************
********************** Streams::iostream::WriteBytes ***************************
********************************************************************************
*/
void Streams::iostream::WriteBytes (ostream& out, const vector<Byte>& s)
{
out.write (reinterpret_cast<const char*> (Containers::Start (s)), s.size ());
}
|
e1fd40a4a06277ce3ca15c38b7ee601f4c6ac7f0
|
4cc998877a0df5e766554af806f94a79419a0178
|
/Longest K unique characters substring.cpp
|
ea7a3832fdb38882f8553b7a26b157217b99ea99
|
[] |
no_license
|
greeshma0601/Arrays
|
521ecb189b0c0ce0b4fcb1244d62a02386620c54
|
6b69562519663bc07706410d8e4c4c73cbe606b5
|
refs/heads/master
| 2020-04-13T20:43:18.904015
| 2019-06-25T05:32:55
| 2019-06-25T05:32:55
| 163,437,158
| 0
| 0
| null | null | null | null |
UTF-8
|
C++
| false
| false
| 1,832
|
cpp
|
Longest K unique characters substring.cpp
|
/*
https://www.geeksforgeeks.org/find-the-longest-substring-with-k-unique-characters-in-a-given-string/
Longest K unique characters substring
Given a string you need to print the size of the longest possible substring that has exactly k unique characters. If there is no possible substring print -1.
Example
For the string aabacbebebe and k = 3 the substring will be cbebebe with length 7.
Input:
The first line of input contains an integer T denoting the no of test cases then T test cases follow. Each test case contains two lines . The first line of each test case contains a string s and the next line conatains an integer k.
Output:
For each test case in a new line print the required output.
Constraints:
1<=T<=100
1<=k<=10
Example:
Input:
2
aabacbebebe
3
aaaa
1
Output:
7
4
*/
#include<bits/stdc++.h>
#include<iostream>
using namespace std;
bool isValid(int c[],int k)
{
int v=0;
for(int i=0;i<26;i++)
{
if(c[i]>0)
v++;
}
return (v<=k);
}
int lkucs(string s,int k)
{
int i,u=0;
int n=s.length();
int c[26]={0};
for(i=0;i<n;i++)
{
if(c[s[i]-'a'] == 0)
u++;
c[s[i]-'a']++;
}
if(u<k)
{
return -1;
}
int cur_start=0,cur_end=0,max_size=1,max_window_start=0;
for(i=0;i<26;i++)
c[i]=0;
c[s[0]-'a']++;
for(i=1;i<n;i++)
{
c[s[i]-'a']++;
cur_end++;
while(!isValid(c,k))
{
c[s[cur_start]-'a']--;
cur_start++;
}
int h=cur_end-cur_start+1;
if(h>max_size)
{
max_size=h;
max_window_start=cur_start;
}
}
return max_size;
}
int main()
{
int t;
cin>>t;
while(t--)
{
//int n,i;cin>>n;
//int a[n];for(i=0;i<n;i++)cin>>a[i];
string s;
cin>>s;
int k;
cin>>k;
cout<<lkucs(s,k)<<endl;
}
//code
return 0;
}
|
56f460a16412c9fb1708d3d346351938fab65bce
|
1e987bd8b8be0dc1c139fa6bf92e8229eb51da27
|
/maker/arduino/hopper/HttpUtil.h
|
8afc7f0f164594be4d0abaf27afa62471be48181
|
[] |
no_license
|
tszdanger/phd
|
c97091b4f1d7712a836f0c8e3c6f819d53bd0dd5
|
aab7f16bd1f3546f81e349fc6e2325fb17beb851
|
refs/heads/master
| 2023-01-01T00:54:20.136122
| 2020-10-21T18:07:42
| 2020-10-21T18:09:06
| null | 0
| 0
| null | null | null | null |
UTF-8
|
C++
| false
| false
| 1,363
|
h
|
HttpUtil.h
|
#pragma once
#include <Arduino.h>
namespace http {
// Simple container for HTTP responses. I have to define it in a separate
// header file because Arduino toolchain doesn't let you return custom classes
// from functions, unless they are defined in libraries.
class HttpResponse {
public:
HttpResponse(const String& response_line, const String& content_type,
const String& text_string)
: response_line_(response_line),
content_type_(content_type),
text_string_(text_string) {}
String ToString() const {
return (String("HTTP/1.1 ") + response_line_ +
"\r\n"
"Server: Hopper\r\n"
"Content-Type: " +
content_type_ + "\r\n\r\n" + text_string_ + "\r\n");
}
const String& GetResponseLine() const { return response_line_; }
private:
const String response_line_;
const String content_type_;
const String text_string_;
};
const char* WiFiStatusToString(int status) {
switch (status) {
case WL_CONNECT_FAILED:
return "WL_CONNECT_FAILED";
case WL_NO_SSID_AVAIL:
return "WL_NO_SSID_AVAIL";
case WL_CONNECTION_LOST:
return "WL_CONNECTION_LOST";
case WL_DISCONNECTED:
return "WL_DISCONNECTED";
case WL_IDLE_STATUS:
return "WL_IDLE_STATUS";
default:
return "Unknown status";
}
}
} // namespace http
|
ba70399746a07d688e3c69d63d320fd34d8bcec6
|
d9f4fe7a677c1d97446d523d4fa22b0fa4696cad
|
/Source/HalfLifeExperiment/DoorScript.cpp
|
94196eaf05e5523bc70612e60d3d364c8388043a
|
[] |
no_license
|
einsolihin/HalfLifeExperiment
|
1b2f9fc98bda2999d23efe3646842e5d555ede41
|
ec121dfd5c0761222c1056ac6ca7913526d2ef32
|
refs/heads/main
| 2023-06-04T19:34:06.925377
| 2021-06-27T03:38:18
| 2021-06-27T03:38:18
| 380,627,716
| 0
| 0
| null | null | null | null |
UTF-8
|
C++
| false
| false
| 1,362
|
cpp
|
DoorScript.cpp
|
// Fill out your copyright notice in the Description page of Project Settings.
#include "DoorScript.h"
#include "Components/StaticMeshComponent.h"
#include "Components/SceneComponent.h"
#include "HalfLifeExperimentCharacter.h"
#include "Components/InstancedStaticMeshComponent.h"
#include "Components/TimelineComponent.h"
// Sets default values
ADoorScript::ADoorScript()
{
// Set this actor to call Tick() every frame. You can turn this off to improve performance if you don't need it.
PrimaryActorTick.bCanEverTick = true;
}
// Called when the game starts or when spawned
void ADoorScript::BeginPlay()
{
Super::BeginPlay();
}
// Called every frame
void ADoorScript::Tick(float DeltaTime)
{
Super::Tick(DeltaTime);
}
void ADoorScript::SetDoorMesh(UStaticMeshComponent* mesh)
{
Door = mesh;
}
void ADoorScript::OpenDoor(AHalfLifeExperimentCharacter* character)
{
if (character->CheckItemFromList("Key"))
{
RotateTheDoor();
}
else
{
GEngine->AddOnScreenDebugMessage(-1, 5.f, FColor::Red, TEXT("It's Lock!"));
return;
}
}
void ADoorScript::RotateTheDoor()
{
FQuat quatRotation = FQuat(FRotator(0, 10, 0));
Door->AddRelativeRotation(quatRotation, false, 0, ETeleportType::None);
if (Door->GetRelativeRotation().Yaw < 90)
{
GetWorldTimerManager().SetTimer(UnusedHandle, this, &ADoorScript::RotateTheDoor, 0.01, false);
}
}
|
2a2f5f195c7184a50c0bbadf590b952185db7f63
|
a1b5d12d91c8f1b2875841ef0e1779d6ed8721a3
|
/src/sortingAlgo/mergeSort.cpp
|
94f9ad6898776b4647a67ae17564a7acc9470168
|
[] |
no_license
|
DishenMakwana/DataStructures-And-Algorithms
|
8d1504f5d4cae29a0409e40882823ff21cb7452f
|
66cddc702667e85bf9b429b3888dc4e458e80777
|
refs/heads/master
| 2023-04-28T01:48:41.440434
| 2021-05-19T14:26:49
| 2021-05-19T14:26:49
| 300,151,840
| 0
| 0
| null | null | null | null |
UTF-8
|
C++
| false
| false
| 1,202
|
cpp
|
mergeSort.cpp
|
#include<bits/stdc++.h>
#include<iostream>
#include<array>
using namespace std;
void merge(int *a,int *l,int L,int *r,int R)
{
int i=0,j=0,k=0;
while(i<L && j<R)
{
if(l[i]<r[j])
{
a[k++]=l[i++];
}
else
{
a[k++]=r[j++];
}
}
while(i<L)
{
a[k++]=l[i++];
}
while(j<R)
{
a[k++]=r[j++];
}
}
////////////////////////////////////////////////
void mergeSort(int *a,int n)
{
if(n<2)
{
return;
}
int mid=n/2;
int *l,*r;
l=(int*)malloc(mid*sizeof(int));
r=(int*)malloc((n-mid)*sizeof(int));
for(int i=0;i<mid;i++)
{
l[i]=a[i];
}
for(int i=mid;i<n;i++)
{
r[i-mid]=a[i];
}
mergeSort(l,mid);
mergeSort(r,n-mid);
merge(a,l,mid,r,n-mid);
free(l);
free(r);
}
////////////////////////////////////////////////
int main()
{
int n=10;
int a[n];
for(int i=0;i<n;i++)
{
cin >> a[i] ;
}
mergeSort(a,n);
for(int i=0;i<n;i++)
{
cout<<a[i]<<" ";
}
return 0;
}
|
37bfc08300b9a825f11d2aa869e1f314332b61e3
|
612252bef1d47b5d5bfe2d94e8de0a318db4fc8e
|
/3.6/MazeJump/Classes/PopUp/GroundGiveUpPopUpUI.cpp
|
c3f5eff2d3783d84a7b483269524710dce442568
|
[] |
no_license
|
dingjunyong/MyCocos2dxGame
|
78cf0727b85f8d57c7c575e05766c84b9fa726c1
|
c8ca9a65cd6f54857fc8f6c445bd6226f2f5409d
|
refs/heads/master
| 2020-06-05T08:32:45.776325
| 2016-10-08T16:09:38
| 2016-10-08T16:09:38
| null | 0
| 0
| null | null | null | null |
UTF-8
|
C++
| false
| false
| 2,646
|
cpp
|
GroundGiveUpPopUpUI.cpp
|
//
// GroundGiveUpPopUpUI.cpp
//
//
//
//
#include "GroundGiveUpPopUpUI.h"
#include "UtilityHelper.h"
#include "GameConst.h"
#include "UIManager.h"
#include "MainScene.h"
#include "ShopPopUpUI.h"
#include "GameController.h"
#include "SdkBoxManager.h"
#include "NativeBridge.h"
#include "storage/local-storage/LocalStorage.h"
USING_NS_CC;
GroundGiveUpPopUpUI* GroundGiveUpPopUpUI::create()
{
GroundGiveUpPopUpUI *pRet = new(std::nothrow) GroundGiveUpPopUpUI();
if (pRet)
{
pRet->autorelease();
return pRet;
}
CC_SAFE_DELETE(pRet);
return nullptr;
}
GroundGiveUpPopUpUI::GroundGiveUpPopUpUI()
{
}
GroundGiveUpPopUpUI::~GroundGiveUpPopUpUI()
{
}
void GroundGiveUpPopUpUI::onEnter()
{
BasePopUpUI::onEnter();
init();
NativeBridge::getInstance()->showAdsView();
}
void GroundGiveUpPopUpUI::onExit()
{
NativeBridge::getInstance()->hideAdsView();
BasePopUpUI::onExit();
}
bool GroundGiveUpPopUpUI::init()
{
auto size = Director::getInstance()->getVisibleSize();
float scale = size.width /640.0f;
m_popupBgLayer = cocos2d::ui::ImageView::create(UtilityHelper::getLocalString("UI_GROUND_GIVEUP_PANEL"),cocos2d::ui::TextureResType::PLIST);
m_popupBgLayer->setPosition(Vec2(size.width*0.5,size.height*0.5));
m_popupBgLayer->setScale(scale);
m_dialogLayer->addChild(m_popupBgLayer);
ui::Button* oKtn = cocos2d::ui::Button::create(UtilityHelper::getLocalString("UI_GROUND_BTN_GIVEUP_OK"),"","",cocos2d::ui::TextureResType::PLIST);
oKtn->setScale(scale);
oKtn->setPosition(Vec2(size.width*0.5,size.height*0.53));
m_dialogLayer->addChild(oKtn);
ui::Button* cancelBtn = cocos2d::ui::Button::create(UtilityHelper::getLocalString("UI_GROUND_BTN_GIVEUP_CANCEL"),"","",cocos2d::ui::TextureResType::PLIST);
cancelBtn->setScale(scale);
cancelBtn->setPosition(Vec2(size.width*0.5,size.height*0.43));
m_dialogLayer->addChild(cancelBtn);
oKtn->addClickEventListener(CC_CALLBACK_1(GroundGiveUpPopUpUI::onOK, this));
cancelBtn->addClickEventListener(CC_CALLBACK_1(GroundGiveUpPopUpUI::onBack, this));
return true;
}
void GroundGiveUpPopUpUI::onBack(cocos2d::Ref *ref)
{
UIManager::getInstance()->playBtnSound();
UIManager::getInstance()->hidePopUp();
}
void GroundGiveUpPopUpUI::onOK(cocos2d::Ref *ref)
{
if (GameController::getInstance()->getMazeMode() ==GameController::MAZE) {
GameController::getInstance()->switchToMenu();
}else if(GameController::getInstance()->getMazeMode() ==GameController::NORAML){
GameController::getInstance()->switchToRainbowRun();
}
}
|
8b2186d6b66d531b37d590ff0913dd8bb3b3cbb4
|
5999d1dddd8b7ede44388d91b00b1d8713f3fc3e
|
/OBJObject.cpp
|
89cd28af11a412ccf2115c517513a38752c9ea43
|
[] |
no_license
|
khalidsalata/167Final
|
5c8868a622eeafbb7c8b919c5de9af5a9b6060e8
|
26e7ac7b13c296d3fa024d8f23d93d4571070ac8
|
refs/heads/master
| 2021-01-17T20:36:20.324373
| 2016-06-07T21:26:14
| 2016-06-07T21:26:14
| 59,914,599
| 0
| 0
| null | null | null | null |
UTF-8
|
C++
| false
| false
| 16,097
|
cpp
|
OBJObject.cpp
|
#include "OBJObject.h"
#include "Window.h"
#include "Cube.h"
#include <fstream>
#include <string>
#include <sstream>
#include <errno.h>
#include <iostream>
using namespace std;
std::map<const char*, std::vector< std::vector<glm::vec3> > > OBJObject::perstV = std::map<const char*, std::vector< std::vector<glm::vec3> > >();
std::map<const char*, std::vector<GLuint> > OBJObject::perstIn = std::map<const char*, std::vector<GLuint> >();
std::map<const char*, int> OBJObject::perstCount = std::map<const char*, int>();
void OBJObject::genBigBuf()
{
for(int i = 0; i < vertices.size(); i++){
bigBuf.push_back(vertices[i].x);
bigBuf.push_back(vertices[i].y);
bigBuf.push_back(vertices[i].z);
bigBuf.push_back(normals[i].x);
bigBuf.push_back(normals[i].y);
bigBuf.push_back(normals[i].z);
bigBuf.push_back(textures[i].x);
bigBuf.push_back(textures[i].y);
}
}
void OBJObject::setExpo(float jump){ expo = expo + jump; }
OBJObject::OBJObject(const char *filepath)
{
this->angle = 0.0f;
this->facecount = 0;
expo = 100.0f;
tempW = toWorld = glm::mat4(1.0f);
parse(filepath);
boundBox = new boundingBox(minxg, minyg, minzg, maxxg, maxyg, maxzg);
name = filepath;
<<<<<<< HEAD
=======
if(Window::khalid){
objShade = LoadShaders("/Users/adboom/Downloads/skybox/objShader.vert", "/Users/adboom/Downloads/skybox/objShader.frag");
} else {
objShade = LoadShaders("/Users/ahmed.elhosseiny/Documents/_CSE 167/Elhosseiny-Ahmed/CSE-167-Final/CSE-167-Final/167Final/objShader.vert", "/Users/ahmed.elhosseiny/Documents/_CSE 167/Elhosseiny-Ahmed/CSE-167-Final/CSE-167-Final/167Final/objShader.frag");
}
>>>>>>> 1403a6471abeb90326555cf1b1d4d9b5c2e33959
// Create buffers/arrays
glGenVertexArrays(1, &VAO);
glGenBuffers(1, &VBO);
glGenBuffers(1, &EBO);
// Bind the Vertex Array Object first, then bind and set vertex buffer(s) and attribute pointer(s).
glBindVertexArray(VAO);
GLuint* i = &indices[0];
genBigBuf();
glBindBuffer(GL_ARRAY_BUFFER, VBO);
glBufferData(GL_ARRAY_BUFFER, sizeof(GLfloat) * bigBuf.size(), &bigBuf[0], GL_STATIC_DRAW);
glBindBuffer(GL_ELEMENT_ARRAY_BUFFER, EBO);
glBufferData(GL_ELEMENT_ARRAY_BUFFER, sizeof(GLuint) * indices.size(), i, GL_STATIC_DRAW);
glVertexAttribPointer(0, 3, GL_FLOAT, GL_FALSE, 8 * sizeof(GLfloat), (GLvoid*)0);
glEnableVertexAttribArray(0);
glVertexAttribPointer(1, 3, GL_FLOAT, GL_FALSE, 8 * sizeof(GLfloat), (GLvoid*) (3 * sizeof(GLfloat)));
glEnableVertexAttribArray(1);
glVertexAttribPointer(2, 2, GL_FLOAT, GL_FALSE, 8 * sizeof(GLfloat), (GLvoid*) (6 * sizeof(GLfloat)));
glEnableVertexAttribArray(2);
glBindBuffer(GL_ARRAY_BUFFER, 0); // Note that this is allowed, the call to glVertexAttribPointer registered VBO as the currently bound vertex buffer object so afterwards we can safely unbind
glBindVertexArray(0); // Unbind VAO (it's always a good thing to unbind any buffer/array to prevent strange bugs), remember: do NOT unbind the EBO, keep it bound to this VAO
<<<<<<< HEAD
//Get ready for some texture shit
glGenTextures(1, &textureID);
//glActiveTexture(GL_TEXTURE0);
glBindTexture(GL_TEXTURE_2D, textureID);
// Make sure no bytes are padded:
glPixelStorei(GL_UNPACK_ALIGNMENT, 1);
unsigned char * image;
int width = 512;
int height = 512;
std::string path = "/Users/adboom/Downloads/";
image = loadPPM((path + "rock_texture_jpg_phpfPp0Ku.ppm").c_str(), width, height);
glTexImage2D(GL_TEXTURE_2D, 0, GL_RGB, width, height, 0, GL_RGB, GL_UNSIGNED_BYTE, image);
glGenerateMipmap(GL_TEXTURE_2D);
// Use bilinear interpolation:
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST);
// Use clamp to edge to hide skybox edges:
//glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_REPEAT);
//glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_REPEAT);
//glEnable(GL_CULL_FACE);
//glCullFace(GL_BACK);
//We're done, we can unbind the texture
glBindTexture(GL_TEXTURE_2D, 0);
=======
// //Get ready for some texture shit
// glGenTextures(1, &textureID);
// glActiveTexture(GL_TEXTURE0);
// glBindTexture(GL_TEXTURE_2D, textureID);
//
// // Make sure no bytes are padded:
// glPixelStorei(GL_UNPACK_ALIGNMENT, 1);
//
// unsigned char * image;
// int width = 512;
// int height = 512;
// std::string path = "/Users/adboom/Downloads/skybox/";
//
// // Select GL_MODULATE to mix texture with polygon color for shading:
// glTexEnvf(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_MODULATE);
//
// // Use bilinear interpolation:
// glTexParameteri(GL_TEXTURE_CUBE_MAP, GL_TEXTURE_MIN_FILTER, GL_LINEAR);
// glTexParameteri(GL_TEXTURE_CUBE_MAP, GL_TEXTURE_MAG_FILTER, GL_LINEAR);
//
// // Use clamp to edge to hide skybox edges:
// glTexParameteri(GL_TEXTURE_CUBE_MAP, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE);
// glTexParameteri(GL_TEXTURE_CUBE_MAP, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE);
//
// //glEnable(GL_CULL_FACE);
// //glCullFace(GL_BACK);
//
//
// //We're done, we can unbind the texture
// glBindTexture(GL_TEXTURE_CUBE_MAP, 0);
//
//
>>>>>>> 1403a6471abeb90326555cf1b1d4d9b5c2e33959
}
OBJObject::~OBJObject(){
// Properly de-allocate all resources once they've outlived their purpose
glDeleteVertexArrays(1, &VAO);
glDeleteBuffers(1, &VBO);
glDeleteBuffers(1, &EBO);
}
void OBJObject::parse(const char *filepath)
{
GLfloat x,y,z; // vertex coordinates
ifstream myFile(filepath); // make the file name configurable so you can load other files
if (myFile.is_open() == false) {
int errsv = errno;
std::cerr << "error loading file with errno: " + to_string(errsv) << std::endl; exit(-1);
} // just in case the file can't be found or is corrupt
//printf("%s loading...", filepath);
string line;
int count = 1;
int shapeCount = 1;
minX = minY = minZ = FLT_MAX;
maxX = maxY = maxZ = FLT_MIN;
while (getline(myFile,line)){
if(line[0] == 'v' || line[0] == 'f'){
std::istringstream buffer(line);
std::vector<std::string> toks;
std::copy(std::istream_iterator<std::string>(buffer),
std::istream_iterator<std::string>(),
std::back_inserter(toks));
x = stof(toks[1]);
y = stof(toks[2]);
z = stof(toks[3]);
if(toks[0] == "v"){
if (x > maxX) { maxX = x; }
else if (x < minX) { minX = x; }
if (y > maxY) { maxY = y; }
else if (y < minY) { minY = y; }
if (z > maxZ) { maxZ = z; }
else if (z < minZ) { minZ = z; }
this->vertices.push_back({x, y, z});
}
else if(toks[0] == "vn"){
glm::vec3 colors = glm::normalize(glm::vec3({x, y, z}));
colors = (colors * glm::vec3(1,1,1))/glm::vec3(2,2,2);
this->normals.push_back(colors);
}
else if(toks[0] == "vt"){
this->textures.push_back(glm::vec2(x, y));
}
if(line[0] == 'f'){
<<<<<<< HEAD
unsigned long pos = toks[1].find("/");
unsigned int v = stoi(toks[1].substr(0,pos));
this->indices.push_back(v-1);
pos = toks[2].find("/");
v = stoi(toks[2].substr(0,pos));
this->indices.push_back(v-1);
pos = toks[3].find("/");
v = stoi(toks[3].substr(0,pos));
this->indices.push_back(v-1);
pos = toks[1].find("/");
v = stoi(toks[1].substr(0,pos));
this->indices.push_back(v-1);
pos = toks[3].find("/");
v = stoi(toks[3].substr(0,pos));
this->indices.push_back(v-1);
pos = toks[4].find("/");
v = stoi(toks[4].substr(0,pos));
this->indices.push_back(v-1);
shapeCount = shapeCount + 2;
=======
for(int i = 1; i < 5; i++){
unsigned long pos = toks[i].find("/");
unsigned int v = stoi(toks[i].substr(0,pos));
cout<<":"<<v<<endl;
this->indices.push_back(v-1);
}
shapeCount++;
>>>>>>> 1403a6471abeb90326555cf1b1d4d9b5c2e33959
}
else{ count++; }
}
// read normal data accordingly
}
this->facecount = shapeCount;
GLfloat deltaX = maxX - minX;
GLfloat deltaY = maxY - minY;
GLfloat deltaZ = maxZ - minZ;
GLfloat avgX = (minX + maxX)/2.0;
GLfloat avgY = (minY + maxY)/2.0;
GLfloat avgZ = (minZ + maxZ)/2.0;
GLfloat maxDel;
if(deltaX > deltaY) { maxDel = deltaX; }
else { maxDel = deltaY; }
if(maxDel < deltaZ) { maxDel = deltaZ; }
//Align with globals
maxxg = maxX/maxDel;
minxg = minX/maxDel;
minyg = minY/maxDel;
maxyg = maxY/maxDel;
minzg = minZ/maxDel;
maxzg = maxZ/maxDel;
for(int i = 0; i < this->vertices.size(); i++){
glm::vec3& name = this->vertices[i];
this->vertices[i] = glm::vec3((name.x - avgX)/maxDel, (name.y - avgY)/maxDel, (name.z - avgZ)/maxDel);
}
printf("%s is done\n", filepath);
printf("%lu vectors and %lu vector normals\n", vertices.size(), normals.size());
myFile.close(); // make sure you don't forget to close the file when done
printf("There are %d triangles\n", shapeCount);
}
void OBJObject::draw(glm::mat4 C, int type, GLuint* shader)
{
glm::mat4 temp = C * toWorld;
//temp = glm::rotate(temp, 0.02f * glm::pi<float>(), glm::vec3(0.0f, 1.0f, 0.0f));
// Calculate combination of the model (toWorld), view (camera inverse), and perspective matrices
glm::mat4 MVP = Window::P * Window::V * temp;
// We need to calculate this because as of GLSL version 1.40 (OpenGL 3.1, released March 2009), gl_ModelViewProjectionMatrix has been
// removed from the language. The user is expected to supply this matrix to the shader when using modern OpenGL.
// Clear the color and depth buffers
//glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
// Use the shader of programID
glUseProgram(*shader);
glUniform1i(glGetUniformLocation(*shader, "ourTexture"), 2);
GLuint MatrixID = glGetUniformLocation(*shader, "MVP");
glUniformMatrix4fv(MatrixID, 1, GL_FALSE, &MVP[0][0]);
glActiveTexture(GL_TEXTURE2);
glBindTexture(GL_TEXTURE_2D, textureID);
glBindVertexArray(VAO);
glDrawElements(GL_QUADS, this->facecount * 4, GL_UNSIGNED_INT, 0);
glBindVertexArray(0);
//glBindTexture(GL_TEXTURE_2D, 0);
}
void OBJObject::update(int dir){
if(dir > 0 && dir < 7){
translate(dir);
}
else if(dir == 7 || dir == 8){
scale(dir);
}
else if(dir == 9 || dir == 10){
orbit(dir);
}
else if(dir == 11){
toWorld = glm::mat4(1.0f);
}
dir = 0;
//spin(0.1f);
}
void OBJObject::spin(float deg){
this->angle += deg;
if (this->angle > 360.0f || this->angle < -360.0f) this->angle = 0.0f;
// This creates the matrix to rotate the cube
toWorld = glm::rotate(toWorld, 0.01f * glm::pi<float>(), glm::vec3(0.0f, 1.0f, 0.0f));
}
void OBJObject::translate(int dir){
switch (dir) {
case 1:
toWorld = glm::translate(glm::mat4(1.0f), glm::vec3(-1.0f, 0.0f, 0.0f)) * toWorld;
break;
case 2:
toWorld = glm::translate(glm::mat4(1.0f), glm::vec3(1.0f, 0.0f, 0.0f)) * toWorld;
break;
case 3:
toWorld = glm::translate(glm::mat4(1.0f), glm::vec3(0.0f, -1.0f, 0.0f)) * toWorld;
break;
case 4:
toWorld = glm::translate(glm::mat4(1.0f), glm::vec3(0.0f, 1.0f, 0.0f)) * toWorld;
break;
case 5:
toWorld = glm::translate(glm::mat4(1.0f), glm::vec3(0.0f, 0.0f, -1.0f)) * toWorld;
break;
case 6:
toWorld = glm::translate(glm::mat4(1.0f), glm::vec3(0.0f, 0.0f, 1.0f)) * toWorld;
break;
default:
break;
}
}
void OBJObject::mtranslate(glm::vec3 tv){
toWorld = glm::translate(glm::mat4(1.0f), tv) * toWorld;
float newminzg = boundBox->getMinZ() + tv.z;
float newmaxzg = boundBox->getMaxZ() + tv.z;
float newminyg = boundBox->getMinY() + tv.y;
float newmaxyg = boundBox->getMaxY() + tv.y;
float newminxg = boundBox->getMinX() + tv.x;
float newmaxxg = boundBox->getMaxX() + tv.x;
boundBox->update(newminxg, newminyg, newminzg, newmaxxg, newmaxyg, newmaxzg);
}
void OBJObject::hardTranslate(glm::vec3 tv){
toWorld[3] = glm::vec4(tv, 1.0f);
float newminzg = minzg + tv.z;
float newmaxzg = maxzg + tv.z;
float newminyg = minyg + tv.y;
float newmaxyg = maxyg + tv.y;
float newminxg = minxg + tv.x;
float newmaxxg = maxxg + tv.x;
boundBox->update(newminxg, newminyg, newminzg, newmaxxg, newmaxyg, newmaxzg);
}
void OBJObject::scale(int dir){
switch (dir){
case 7:
toWorld = glm::scale(toWorld, glm::vec3(0.5f, 0.5f, 0.5f));
break;
case 8:
toWorld = glm::scale(toWorld, glm::vec3(1.5f, 1.5f, 1.5f));
break;
default:
break;
}
}
void OBJObject::scale(glm::vec3 sv){
toWorld = glm::scale(toWorld, sv);
minzg = minzg * sv.z;
maxzg = maxzg * sv.z;
minyg = minyg * sv.y;
maxyg = maxyg * sv.y;
minxg = minxg * sv.x;
maxxg = maxxg * sv.x;
boundBox->update(minxg, minyg, minzg, maxxg, maxyg, maxzg);
}
void OBJObject::orbit(int dir){
switch (dir){
case 9:
toWorld = glm::rotate(glm::mat4(1.0f), 0.1f * glm::pi<float>(), glm::vec3(0.0f, 0.0f, 1.0f)) * toWorld;
break;
case 10:
toWorld = glm::rotate(glm::mat4(1.0f), -0.1f * glm::pi<float>(), glm::vec3(0.0f, 0.0f, 1.0f)) * toWorld;
break;
default:
break;
}
}
void OBJObject::selforbit(float deg, glm::vec3 rv){
toWorld = glm::rotate(toWorld, deg * glm::pi<float>(), rv);
}
void OBJObject::morbit(glm::vec3 rt, float deg){
toWorld = glm::rotate(glm::mat4(1.0f), deg * glm::pi<float>(), rt) * toWorld;
}
unsigned char* OBJObject::loadPPM(const char* filename, int& width, int& height)
{
const int BUFSIZE = 128;
FILE* fp;
unsigned int read;
unsigned char* rawData;
char buf[3][BUFSIZE];
char* retval_fgets;
size_t retval_sscanf;
if ( (fp=fopen(filename, "rb")) == NULL)
{
std::cerr << "error reading ppm file, could not locate " << filename << std::endl;
width = 0;
height = 0;
return NULL;
}
// Read magic number:
retval_fgets = fgets(buf[0], BUFSIZE, fp);
// Read width and height:
do
{
retval_fgets=fgets(buf[0], BUFSIZE, fp);
} while (buf[0][0] == '#');
retval_sscanf=sscanf(buf[0], "%s %s", buf[1], buf[2]);
width = atoi(buf[1]);
height = atoi(buf[2]);
// Read maxval:
do
{
retval_fgets=fgets(buf[0], BUFSIZE, fp);
} while (buf[0][0] == '#');
// Read image data:
rawData = new unsigned char[width * height * 3];
read = fread(rawData, width * height * 3, 1, fp);
fclose(fp);
if (read != 1)
{
std::cerr << "error parsing ppm file, incomplete data" << std::endl;
delete[] rawData;
width = 0;
height = 0;
return NULL;
}
return rawData;
}
|
3a4b76508288904c748e23a31cf8c2985a0b65e3
|
e46e6784b70b46c177267b18f7822bdd0b3e85ea
|
/Exercicios/Exercicios_extras/Rserie/main.cpp
|
13b1e03903bc2c20e726c91b5becc7edc35ced9a
|
[] |
no_license
|
Frannb/C-Plus-Plus
|
56b2518fa87a7f58a4f9399d26f1d04c6c372994
|
a793e28d0e150abca15404a8f7be69d439ef15e4
|
refs/heads/main
| 2023-08-15T12:26:40.178502
| 2021-10-07T19:35:15
| 2021-10-07T19:35:15
| null | 0
| 0
| null | null | null | null |
UTF-8
|
C++
| false
| false
| 215
|
cpp
|
main.cpp
|
#include <iostream>
#include <string>
using namespace std;
int main(int argc, char * argv[]) {
int n;
cout << "Quantos resistores serão calculados?";
cin >> n;
for (n = 0, n < )
return 0;
}
|
9cd39727a5bc96981000b9efd24dd9910794cc76
|
97e24508d15913f8f4b9fee9bfb2297bf92f58f6
|
/101-200/142 Linked List Cycle II.cpp
|
5cf9ed70c521561897bb9ef6ce7cc187c6bf808a
|
[] |
no_license
|
patrickwang96/lc-lib
|
9936b2015fe5ca1bf35a682817ee497d195c5609
|
278e85b88a11ab4cacc20c1db09f0b67cf74dc32
|
refs/heads/master
| 2023-01-29T00:03:02.392876
| 2020-12-14T15:09:15
| 2020-12-14T15:09:15
| 242,113,334
| 1
| 0
| null | null | null | null |
UTF-8
|
C++
| false
| false
| 1,442
|
cpp
|
142 Linked List Cycle II.cpp
|
#include "header.h"
// https://leetcode.com/problems/linked-list-cycle-ii/
/**
* Definition for singly-linked list.
* struct ListNode {
* int val;
* ListNode *next;
* ListNode(int x) : val(x), next(NULL) {}
* };
*/
class Solution {
public:
ListNode* stepForward(int step, ListNode* mover) {
if (mover == nullptr) {
return nullptr;
}
// return nullptr if reach the end of linked list
for (int i(0); i < step; i++) {
mover = mover->next;
if (mover == nullptr)
return nullptr;
}
return mover;
}
ListNode *detectCycle(ListNode *head) {
int currentPosition = 0;
bool hasCycle = false;
ListNode* fastptr = head;
ListNode* slowptr = head;
while (fastptr != nullptr && slowptr != nullptr) {
fastptr = stepForward(2, fastptr);
slowptr = stepForward(1, slowptr);
currentPosition++;
if (fastptr != nullptr && fastptr == slowptr) {
hasCycle = true;
break;
}
}
if (hasCycle) {
slowptr = head;
while (fastptr != slowptr) {
fastptr = stepForward(1, fastptr);
slowptr = stepForward(1, slowptr);
}
return fastptr;
}
else {
return NULL;
}
}
};
|
8b7351915569b776bdb7f74936340a6ac2608574
|
602fa7d7aaaa1486a6f3129d538ec2d8c0afa5e9
|
/Olimpíadas.cpp
|
2c92b9456248e19fb0d3f1dc1aa1e5cab55cacf6
|
[] |
no_license
|
MrCubble/Programas
|
94afc2950f366b2ba5c7ea0aac4129ac36854aff
|
be3b3d2fc52178857cbc54ac48bf25ac5b501d72
|
refs/heads/master
| 2020-03-22T18:22:46.971432
| 2018-07-10T15:38:02
| 2018-07-10T15:38:02
| 140,456,289
| 0
| 0
| null | null | null | null |
UTF-8
|
C++
| false
| false
| 932
|
cpp
|
Olimpíadas.cpp
|
#include <iostream>
#include <algorithm>
using namespace std;
struct Medalhas
{
int pais;
int o;
int p;
int b;
};
bool comparaMedalhas(Medalhas a, Medalhas b){
if(a.o == b.o && a.p == b.p && a.b == b.b)
return a.pais < b.pais;
if(a.o == b.o && a.p == b.p)
return a.b > b.b;
if(a.o == b.o)
return a.p > b.p;
return a.o > b.o;
}
int main()
{
int numero, modalidade, x, y, z;
Medalhas paises[1000];
cin>>numero>>modalidade;
for(int i=0; i<numero; i++)
{
paises[i].pais = i + 1;
paises[i].o =0;
paises[i].p =0;
paises[i].b =0;
}
for(int i=0; i<modalidade; i++)
{
cin>>x>>y>>z;
paises[x - 1].o++;
paises[y - 1].p++;
paises[z - 1].b++;
}
sort(paises, paises + numero, comparaMedalhas);
for(int i=0; i<numero; i++)
cout<<paises[i].pais<<" ";
cout<<endl;
}
|
bd4eb72d2026ab5fb36bce567493d696ddbf0960
|
86c11a70213da6fbac05cc09bfcd032c488d4584
|
/mausa18D.cpp
|
2130b20bc60a08ca06f44cf0dd05dd4ab2dd4287
|
[] |
no_license
|
R-penguins/Kattis-Solutions
|
3803449c665ca89585c8827e8564b0f4ab7d00ea
|
ca16ac19d3f0f4d8706b4c90268d6340fdeb7dd7
|
refs/heads/master
| 2023-04-10T09:56:49.273281
| 2021-04-22T13:45:50
| 2021-04-22T13:45:50
| 336,283,787
| 0
| 0
| null | null | null | null |
UTF-8
|
C++
| false
| false
| 1,567
|
cpp
|
mausa18D.cpp
|
#include <bits/stdc++.h>
using namespace std;
using Pt = pair<int, int>;
map<Pt, int> toID;
vector<vector<int>> adjs;
int id(const Pt &pt)
{
if (toID.count(pt))
return toID[pt];
adjs.push_back(vector<int>());
return toID[pt] = toID.size();
}
int main()
{
regex r("\\s*\\(\\s*(\\d*)\\s*,\\s*(\\d*)\\s*\\)\\s*,\\s*\\(\\s*(\\d*)\\s*,\\s*(\\d*)\\s*\\)\\s*;");
string line;
while (getline(cin, line))
for (sregex_iterator it(line.begin(), line.end(), r), end_it; it != end_it; ++it)
{
int x1 = stoi(it->str(1)), y1 = stoi(it->str(2)),
x2 = stoi(it->str(3)), y2 = stoi(it->str(4));
int id1 = id(Pt(x1, y1)), id2 = id(Pt(x2, y2));
adjs[id1].push_back(id2);
adjs[id2].push_back(id1);
}
int fig = 0, poly = 0;
vector<bool> vis(adjs.size(), false);
for (int i = 0; i < adjs.size(); ++i)
if (!vis[i])
{
vis[i] = true;
++fig;
bool isPoly = (adjs[i].size() % 2 == 0);
queue<int> q;
q.push(i);
while (!q.empty())
{
int cur = q.front();
q.pop();
isPoly &= (adjs[cur].size() % 2 == 0);
for (int next : adjs[cur])
if (!vis[next])
{
vis[next] = true;
q.push(next);
}
}
if (isPoly)
++poly;
}
cout << fig << " " << poly << "\n";
}
|
155dd9f47cb67be0639486022bba46d4c33bbc80
|
04ba30f9a64c4d884a873d567dfa04be6bb5bfb2
|
/src/hawkeye/CoverageRectCanvasItem.hh
|
a74adccdfa2cc12f6fac81a72ce83269c85112ee
|
[
"Artistic-1.0",
"LicenseRef-scancode-unknown-license-reference"
] |
permissive
|
sagrudd/amos
|
c87e369cd0f65aa6290ae26d873c6e7ab52f8cb1
|
47643a1d238bff83421892cb74daaf6fff8d9548
|
refs/heads/master
| 2021-03-29T05:04:20.824500
| 2020-06-18T09:40:06
| 2020-06-18T09:40:06
| 247,921,470
| 0
| 0
|
NOASSERTION
| 2020-03-17T08:52:26
| 2020-03-17T08:52:25
| null |
UTF-8
|
C++
| false
| false
| 949
|
hh
|
CoverageRectCanvasItem.hh
|
#ifndef COVERAGE_RECT_CANVAS_ITEM_HH_
#define COVERAGE_RECT_CANVAS_ITEM_HH_ 1
#include <q3canvas.h>
//Added by qt3to4:
#include <Q3PointArray>
#include <vector>
class CoverageRectCanvasItem : public Q3CanvasRectangle
{
public:
CoverageRectCanvasItem(int x, int y,
int width, int height,
int libid, double baseLevel,
Q3PointArray & arr,
std::vector<double> & raw,
bool copyRaw,
Q3Canvas * canvas,
const QColor & color);
static const int RTTI;
int rtti () const { return RTTI; }
Q3PointArray m_points;
std::vector<double> m_raw;
int m_libid;
double m_baseLevel;
QColor m_color;
bool m_copyraw;
double m_low;
double m_high;
protected:
void drawShape (QPainter & p);
};
#endif
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.