## c++ – seek the highest value

I’ve been having trouble with a programming exercise where your goal is to find the highest value of assigned experience, example:

input

``````n=6 k=2
a=6 1 2 5 3 1
d=0 1 1 1 0 0

n= are the characters.
a= are the experience
d= are the assignment
``````

output

``````    na=0 expT=10

na=personage with more experience

expT=the total experience
``````

My Code:

``````#include<iostream>
#include<vector>

using namespace std;

int main()
{
int k,n;
vector<int>regalos,ident;
cin>>n>>k;

regalos.resize(n);
ident.resize(n);

for(int i=0;i<n;i++)
{
cin>>regalos(i);
}
for(int i=0;i<n;i++)
{
cin>>ident(i);
}

for(int i=0;i<n;i++)
{
for(int j=k;j>=0;j--)
{
if(ident(i)==j)
{

}
}
}

}
``````

## How to see highest available block number in “Bitcoin Wallet” app for Android (Schildbach wallet)?

At the main screen tap the menu icon (three dots at top right) and choose “Network Monitor” from the available options.

Then swipe left to switch from the “Peers” tab to the “Blocks” tab.

The top of this list shows the highest block number that the app knows about.

## How to see highest available block number in Schildbach wallet?

At the main screen tap the menu icon (three dots at top right) and choose “Network Monitor” from the available options.

Then swipe left to switch from the “Peers” tab to the “Blocks” tab.

The top of this list shows the highest block number that the app knows about.

## dnd 3.5e – What is the highest racial or template charisma boost you can get for a +1 LA?

I’m currently working on a Sha’ir Gish character that will eventually PrC into Zhentarim Skymage (LoD) and I need to buff my charisma as much as possible. Skymage has a gimmick of giving you a paladin mount, or at least a close facsimile thereof, which can be any creature that’s a size larger than you and has no more hit die than your Skymage level + Charisma mod + 1.

I already have Spark (Dragon Mag.) for +2. I’m also considering Prestige Races (also Dragon) for another +1. Unseelie Fey is unfortunately banned so that’s not an option. Other than that just about anything official is allowed. I’d prefer to stay at or below LA +1 is possible.

Some other options I considered were Athasian Human (also Dragon mag.) +2 to two stats, Draconic Creature for +2 to strength, con, and charisma, and savage progression half fey. Spark was ruled to only work on PHB races and not variants like Athasian so that’s probably off the table, and it kind of negates the benefits of any +2 charisma LA 0 race like Spellscale and Savage Progression Aasimar.

I could use magic items like tomes eventually to raise it farther, but I can’t rely on temporary boosts like cloaks of charisma because if my charisma gets lowered, like taking the cloak off, my mount might rebel and attack or abandon me, and that’s not fun for anyone.

I’d prefer human for story reasons in the setting and to open up Human paragon as an option for another +2 untyped bonus, though small races aren’t a bad choice either because that opens up a medium mount.

Which race or template can I use to gain the highest boost to charisma with no more than a +1 LA?

## Why is the Halting problem decidable for Goto languages limited on the highest value of constants and variables?

This is taken from an old exam of my university that I am using to prepare myself for the coming exam:

Given is a language $$text{Goto}_{17}^c subseteq text{Goto}$$. This language contains exactly those $$text{Goto}$$ programs in which no constant is ever above $$17$$ nor any variable ever above $$c$$.

$$Goto$$ here describes the set of all programs written in the $$Goto$$ language made up of the following elements:

With variables $$v_i in mathbb{N}$$ and constants $$c in mathbb{N}$$
Assignment: $$x_i := c, x_i := x_i pm c$$
Conditional Jump: if(Comparison) goto $$L_i$$
Haltcommand: halt

I am currently struggling with the formalization of a proof, but this is what I have come to so far, phrased very casually:
For any given program in this set we know that it is finite. A finite program contains a finite amount of variables and a finite amount of states, or lines to be in. As such, there is a finite amount of configurations in which this process can be. If we let this program run, we can keep a list of all configurations we have seen. That is, the combination of all used variable-values and the state of the program. If we let the program run, there must be one of two things that happens eventually:
The program halts. In this case, we return YES and have decided that it halts.
The program reaches a configuration that has been recorded before. As the language is deterministic, this means that we must have gone a full loop which will exactly repeat now.

No other case can exist as that would mean that we keep running forever on finite code without repeating a configuration. This means after every step, among our list of infinite steps, there is a new configuration. This would mean that there are infinite configurations, which is a contradiction.

Is this correct? Furthermore, how would a more formal proof look if it is? If not, how would a correct proof look?

## sql server – How to get the registers in the highest time of period

I have 2 tables all with relations and i want to get the contracts in the highest time of period in order to do a hystorical report wheter if the tima of period is closed or active

This is the code that i have or that ive been trying

Select a.id, a.ordinalperiod,b.name, a.fecin,a.fecend,b.dtend,a.contrato

From historiccontrat a
Left join periodo b
On a.id=b.id
And a.ordinalperiod=b.ordinalperiod
Where
a.fecend in(select max(b.dtend)where a.id=b.id and a.ordinalperiod=b.ordinalperiod and b.dtend <>’4000-01-01′)

Th thing is that the employee have 5 period of times taht works in the company liket this

Id período dt_start dt_end
000 1 2012-01-01 2012-04-01

000 2 2013-05-01 2016-04-03

….
….
….

And in each of these períods of time have diferente type of contrats

With this say what i want is that the filter show me Just the contrats in the Last period

But the result with my query is the row with the data of the period 2 but no the contrats

## Tanky Warlock, I Like It

I made a Bladelock several years ago that used the strategy of “hit me” with Armor of Agathys to great effect. The nice thing about this build is that it doesn’t rely on ideal stats to make it work. This build can be made a little better in spots based on racial selections (i.e. pick Tiefling for Hellish Rebuke), but the boost to damage is pretty minimal. Instead of focusing on 1 reaction, I instead focus on getting hit and dealing way more damage in response regardless.

This build is an extension of that but with an attempt to optimize towards the stated goal:

• Fighter 1/Warlock 9 (Fighter needs to be 1st so that you’ve got Heavy Armor proficiency for free, but this can be swapped with any other class that grants Heavy Armor proficiency at 1st)
• Race: Whatever you want
• Feats: Heavy Armor Master, Anything Else you Want (maybe Lucky to cancel crits)
• Equipment: 2 Rods of the Pact Keeper +2, Ring of Spell Storing with Catnap stored

## Setup before the Day

• Hex somebody in the last 24 hours and reduce them to 0, this way you can transfer the Hex to the elementals to add on damage.
• Be attuned to 1 of the Rods of the Pact Keeper ahead of time.
• Cast Armor of Agathys (AoA) using a 5th level spell slot.
• Recover the slot using the Rod.
• Ensure you’re wearing your worst heavy armor and leave the shield behind to increase hits taken.

## Combat 1

• Round 1 – You have 25 Temp from AoA, use your Bonus Action to transfer your Hex to the elemental next in the initiative order. Move next to monsters and go prone. Suffer 3 hits which each deal 11 damage, you will automatically hit back on each hit with 25 damage for 75 damage overall. Additionally, each hit will proc your Hex adding an average of 3.5 extra damage.

Take a 4th hit (or don’t).

(DPR: 85.5)

• Round 2 – Recast AoA. Remain next to monsters and repeat cycle.

(DPR: 85.5)

• Round 3 – Recast AoA. Remain next to monsters and repeat cycle.

(DPR: 85.5)

Summary: No warlock slots left. Overall per round damage was 85.5.

## Combat 2

• Setup – Using your Ring of Spell Storing, cast Catnap and knock yourself out. You’ll lose concentration on your Hex, but it’s better to have all your slots.

• Round 0 – Recast AoA.

• Round 1 – You have 25 Temp from AoA. Move next to monsters and go prone. Suffer 3 hits which each deal 11 damage, you will automatically hit back on each hit with 25 damage for 75 damage overall. Hex damage isn’t available this time.

Take a 4th hit (or don’t).

(DPR: 75)

• Round 2 – Recast AoA. Remain next to monsters and repeat cycle.

(DPR: 75)

• Round 3 – No warlock slots left. Take the Dodge action.

(DPR: 0)

Summary: No warlock slots left. Overall per round damage was 50.

SUMMARY BEFORE SHORT REST: Average damage per round was 67.75.

Because each event is separated by 30 minutes, I’m thinking that there is a full 2 hours between Combats 2 and 3. Which means you’ve got 1 hour to remove your attunement to one Rod of the Pact Keeper and another hour to attune to the second.

Short Rest: Recover your warlock slots and attune to another Rod.

## Combat 3

• Round 0 – Recast AoA. Use Rod of the Pact Keeper to recover the slot.

• Round 1 – You have 25 Temp from AoA. Move next to monsters and go prone. Suffer 3 hits which each deal 11 damage, you will automatically hit back on each hit with 25 damage for 75 damage overall. Hex damage isn’t available this time.

Take a 4th hit (or don’t).

(DPR: 75)

• Round 2 – Recast AoA. Remain next to monsters and repeat cycle.

(DPR: 75)

• Round 3 – Recast AoA. Remain next to monsters and repeat cycle.

(DPR: 75)

Summary: No warlock slots left. Overall per round damage was 75.

## Combat 4

(DPR: 0)

• Round 2 – No warlock slots left. Take the Dodge action.

(DPR: 0)

• Round 3 – No warlock slots left. Take the Dodge action.

(DPR: 0)

Summary: No warlock slots left. Overall per round damage was 0.

## Daily Summary

Your overall responsive damage for the day was 631.5, your average DPR was 52.625.

## direct3d12 – Why can’t I create a D3D12 Device with the highest performance adpater retrieved by EnumAdapterByGpuPreference?

``````    IDXGIAdapter* higher_performance_adapter;
if(SUCCEEDED(dx_result))
{
UINT output_index = 0;
IDXGIOutput* output;
{
DXGI_OUTPUT_DESC output_description = {0};
output->GetDesc(&output_description);

++output_index;
}

ID3D12Device* device;
D3D_FEATURE_LEVEL_12_1,
__uuidof(ID3D12Device),
(void**)&device);
if(SUCCEEDED(dx_result))
{

...
``````

I’m trying to create a D3D12 device selecting the GPU with the higher performance because passing null to the adapter parameter at D3D12CreateDevice gets the first adapater from EnumAdapters, which is the Intel integrated GPU. But, when I got a IDXGIAdapter object of my dedicated GPU, the EnumOutputs function failed, as well as the D3D12CreateDevice. Why is that? Why these functions fails when using the dedicated GPU, which in my case is a NVIDIA, ?

The returned dx_result is “0x887a0004 : The specified device interface or feature level is not supported on this system. “

That don’t makes sense, since my system supports DirectX12.

## differential equations – What is the most accurate way of getting the highest derivative from NDSolve?

I would like to compare my simulations in Mathematica to measured data. I measure acceleration but for simulations the starting point is displacement. How does one get accurate simulations of higher derivatives of the solutions to differential equations?

Here is a simple example of a simulation where we have the exact solution. (My actual problems are much more complicated). First I define a few parameters and then get exact results for displacement, velocity and acceleration.

``````vals = {
a -> 100, (* frequency *)
b -> 10,    (* damping *)
y0 -> 1,    (* initial displacement *)
v0 -> 0      (* initial velocity *)
};
tmax = 0.5 ;(* simulation time *)
SetOptions(Plot, PlotRange -> All, ImageSize -> 2.5 72);
d0 = y(t) /.
First@DSolve({y''(t) + 2 b y'(t) + (2 π a)^2 y(t) == 0,
y(0) == 1, y'(0) == 0}, y(t), t);
de = d0 /. vals;
ve = D(d0, t) /. vals;
ae = D(d0, {t, 2}) /. vals;
Row({
Plot(de, {t, 0, tmax}),
Plot(ve, {t, 0, tmax}),
Plot(ae, {t, 0, tmax})
})
``````

The three plots are displacement, velocity and acceleration. The scales are very different but are noted in the next stage.

One equation

I use one equation in the simulation using `NDSolve` and look at the errors between the displacement velocity and acceleration. The errors are normalised so that the functions being differenced are of order 1.

``````vmax = 600; amax = 400000;
d1 = y /. First@NDSolve({
y''(t) + 2 b y'(t) + (2 (Pi) a)^2 y(t) == 0,
y(0) == y0, y'(0) == v0} /. vals, y, {t, 0, tmax});

Row({Plot(d1(t) - de, {t, 0, tmax}),
Plot((d1'(t) - ve)/vmax, {t, 0, tmax}),
Plot((d1''(t) - ae)/amax, {t, 0, 0.5})})
``````

The errors in displacement and velocity are of order 10^-7 which is reasonable but the error in acceleration is of order 10^-5. The errors in acceleration are particularly uneven with significant spikes.

Two equations

The differential equation is now split into two equations, one for displacement and one for velcity.

``````{d2, v2} = {y, v} /. First@NDSolve({
y'(t) == v(t),
v'(t) + 2 b v(t) + (2 (Pi) a)^2 y(t) == 0,
y(0) == y0, v(0) == v0} /. vals, {y, v}, {t, 0, tmax});
Row({
Plot(d2(t) - de, {t, 0, tmax}),
Plot((v2(t) - ve)/vmax, {t, 0, tmax}),
Plot((v2'(t) - ae)/amax, {t, 0, tmax})
})
``````

The accuracy is worse for the displacement and velocity and no better for the acceleration.

Three equations

Here we have differential equations for the velocity and acceleration. The interaction between these derivatives is expressed as an algebraic equation.

``````{d3, v3, ac3} = {y, v, ac} /. First@NDSolve({
v'(t) == ac(t),
y'(t) == v(t),
ac(t) + 2 b v(t) + (2 π a)^2 y(t) == 0,
y(0) == y0, v(0) == v0} /. vals, {y, v, ac}, {t, 0, tmax});
Row({
Plot(d3(t) - de, {t, 0, tmax}),
Plot((v3(t) - ve)/vmax, {t, 0, tmax}),
Plot((ac3(t) - ae)/amax, {t, 0, tmax})
})
``````

For this simulation the three results are of order 10^-6 and there are no spikes on any of the simulations. I guess the issues I am seeing are to due to the type of interpolation used. Derivatives of interpolation functions do not work well.

This suggests that the third approach is best if I want about equal errors for displacement, velocity and acceleration. Is this the best approach? Are there other approaches to getting a good second derivative?

If one had a third order, or forth order differential equation (I sometimes do) should one extend this method?

## how to display highest no?

It’s time for the highest bid. Ask three friends of yours to enter their bid for a Harry Potter antique broomstick and find out the highest bid by writing a program to calculate so in just a single line.