|
|
Room arrangements
This year politicians and economists have been invited to participate in Stanford Institute for Theoretical Economics (SITE 2021) conference as guests. You have to accommodate them in r rooms such that-
No room may remain empty.
A room may contain either only politicians or only economists, not both.
No economists are allowed to stay alone in a room.
Find the number of ways to place them. Note though, that all the rooms are identical. But each of the economists and politicians are unique.
Since the number of ways can be very large, print the answer modulo 998,244,353.
Input Format:
The first line of the input contains a single integer T denoting the number of test cases. The description of T test cases follows.
The first and only line of each test case contains three space-separated integers p, q and r denoting the number of politicians, economists and rooms.
Output Format:
For each test case, output the number of ways to place them modulo 998,244,353.
Constraints
1≤T≤100
1≤p,q,r≤100
Sample Input:
4
2 1 4
2 4 4
2 5 4
2 8 4
Sample Output:
0
3
10
609
Explanation:
Test case 1: 4 rooms and 3 people. A room would remain empty.
Test case 2: There are 4 rooms and 6 people. There are 3 possible ways to distribute these 6 people in 3 rooms.
{Politician 1}, {Politician 2}, {Economist 1, Economist 2}, {Economist 3, Economist 4}
{Politician 1}, {Politician 2}, {Economist 1, Economist 3}, {Economist 2, Economist 4}
{Politician 1}, {Politician 2}, {Economist 1, Economist 4}, {Economist 2, Economist 3}
Please note that the rooms are identical.
|
|
|
|
|
Nobody here is going to do your homework for you. Unless you show the code you have tried and explain precisely where you are stuck, you will not get any help.
"These people looked deep within my soul and assigned me a number based on the order in which I joined."
- Homer
|
|
|
|
|
Currently I am receiving some JSON packets from my sensor and I am having some difficulties to extract some information from the JSON packet. I have extracted the device name/eui and data details using the method below but could not do the same to extract the rssi and loRaSNR values from the packet. Are there any better ways to achieve this? Thanks.
payload = json.loads(message.payload.decode())
deviceNAME = payload["deviceName"]
deviceEUI = payload["devEUI"]
info = payload["rxInfo"]
print (len(payload))
print (len(info))
print (payload)
print(info)
OUTPUT:
10
1
{'applicationID': '13', 'applicationName': '16_CH_CM_SYSTEM', 'deviceName': '16_CH_CM_SYSTEM_LORA', 'devEUI': 'ff00058011000004', 'rxInfo': [{'gatewayID': '54d0b4fffe0c89b2', 'name': 'F8L10GW-915-L-SR5G', 'time': '2022-11-25T05:39:41.352315Z', 'rssi': -107, 'loRaSNR': 6.3, 'location': {'latitude': na, 'longitude': na, 'altitude': na}}], 'txInfo': {'frequency': 923400000, 'dr': 4}, 'adr': False, 'fCnt': 5527, 'fPort': 21, 'data': 'VDI1NTI1NjI1OTI1ODI1OTI1NzI1NjI2MDI2Mjo='}
[{'gatewayID': '54d0b4fffe0c89b2', 'name': 'F8L10GW-915-L-SR5G', 'time': '2022-11-25T05:39:41.352315Z', 'rssi': -107, 'loRaSNR': 6.3, 'location': {'latitude': na, 'longitude': na, 'altitude': na}}]
modified 25-Nov-22 4:14am.
|
|
|
|
|
Your question is unclear, what do you mean by "could not do the same to extract the rssi and loRaSNR values"? What is the actual code you used, and what problems did you see?
Also, I have edited your question so the JSON text is readable.
[edit]
The info field is an array (of one item), so you just need to access element zero. something like:
gateway = info[0]
rssi = gateway["rssi"]
loRaSNR = gateway["loRaSNR"]
print(F"{rssi=}, {loRaSNR=}")
[/edit]
modified 25-Nov-22 7:47am.
|
|
|
|
|
Hello this is Gulshan Negi
Well, to iterate over a list in Python, you can use a for loop or a while loop. Both loops allow you to perform operations on each item in the list. The for loop is typically used when you know the number of iterations in advance, while the while loop is useful when you need more control over the iteration process.
I hope you are clear now.
Thanks
|
|
|
|
|
1) How can I make the sound of tires squealing and show smoke during sudden acceleration?
2) How do I make the game visible as a Forza telemetry server?
3) How do I add enemy cars to the game?
My code: https://github.com/sserver224/Car-Racing-3D
|
|
|
|
|
Hello this is Gulshan Negi
Well, to do this you can Include realistic vehicle and environment sounds and you can also improve graphics and UI.
Thanks
|
|
|
|
|
Hello!
Is it possible to blur a text automatically as you type ?
Please help me. 
|
|
|
|
|
Is this a console app?
What do you mean by "blur"?
|
|
|
|
|
Here i have the idea written down that i want to do as a project, i just cant find the method to mask my output..
NAME; Thoughts Diary APP:
1. English:
Your written words will be blurred by the diary as you take notes.
And you won't have to recall the words you just wrote.
You can continue taking notes, you don't have to know what you just wrote, the point is to get your next occurring thought out.
Your thoughts will continue to flow from a fresh place.
You can also set a time limit on how long you want to keep taking notes. Then the diary will show the plain text you just wrote when the times is ended.
2. Swedish:
Dina skrivna ord kommer att suddas ut av dagboken när du antecknar. Och du behöver inte komma ihåg orden du just skrev.
Du kan fortsätta anteckna, poängen är att få din nästa tanke som manifesterar sig. Dina tankar kommer att fortsätta att flöda från en ny plats. Du kan också ställa in en tidsgräns för hur länge du vill fortsätta att anteckna. Då kommer dagboken att visa den vanliga texten du just skrev när tiderna är slut
|
|
|
|
|
And?
What have you tried?
Where are you stuck?
What help do you need?
"I have no idea what I did, but I'm taking full credit for it." - ThisOldTony
"Common sense is so rare these days, it should be classified as a super power" - Random T-shirt
AntiTwitter: @DalekDave is now a follower!
|
|
|
|
|
Not knowing your user interface or how it is presented this suggestion may or may not help -- instead of blurring the text you could change the color of both the background and the text itself to the same color. If you put blue text on a blue background you will only see blue and the text will not be readable. Later you can change just the background color and the text will then be readable.
|
|
|
|
|
I provide no answer/solution, but I can add a few elements to your box of ideas ...
My problem when trying to write down my thoughts is that they are not linear but branching and jumping, and later, I may tie together a lot of loose ends from several parallel trains of thoughts. They are unsuitable for stringing out as a single strand of text.
I read Ted Nelson's classic Computer Lib / Dream Machines in the late 1970s, many years before Web Hypertext became a household word. Nelson actually describes two different ways of creating hypertext: Either you find the contents on the path between two nodes; the nodes are no more than selection points where you can decide which path to follow from there, or all the contents is located in the node; the edge is not a 'path' that you walk/read along, but a direct skip to the next node and its contents. There is no explicit discussion of the two alternatives and the effect it has on how information is structured, but some of his examples clearly indicate that he is thinking along the first alternative (for that example, other examples lean more towards the second "www-like" model).
The www model is clearly best suited when node information blobs, i.e. web page contents, is developed/maintained more or less independent of other nodes, the way we use today. But when the information to be presented is deeply intertwingled (as Nelson calls it), like my nest of interconnected thoughts and ideas, I do not want to jump off one chain of thought (or "web page") on to another, leaving the preceding thoughts in the dark. I have several alternative direct continuations of the first chain. I want to see them all as direct continuations in the text, not leaving the thoughts that led up to them.
So, according to the first model, the presentation system fills in the text of the first path (/edge) into the display window, reaching another node. If there is a default 'next path', a small selection marker and the text of the default path, is added to the window contents, and the process is repeated until the window is full. If there is no default text, the path selection tags are displayed. When the reader clicks one of them, the tags are replaced by the contents of the path (and its succeeding default path(s)) is shown.
When a default text is displayed, a small selection marker appears in the text where there is as node. Clicking the marker pops up a selection box with the labels of all outgoing paths, for the reader to select some other alternative. Upon selection, the default text (to the end of the window) is replaced by the contents of the selected path (and its succeeding defaults). If you are the author, you navigate to the node where you want to add a new outgoing path: In edit mode, there is a choice option for creating it. Or you could select an existing path and modify the text as desired. Or you could insert a branch point, i.e. a new node, at the selected point in a path, effectively breaking it into two parts, all done in WYSIWYG-style.
This is the basic idea of a (single) document of hyper-structured text, rather than a hyper-structure of many independent documents. I created a quite extensive design document, dated 1980, and hoped to implement it shortly thereafter ... but development tools anno 1980 was far too primitive. The implementation project never got off the ground. Some of the ideas have crept into HTML pages, but only as a way to hide one text and display another - the HTML document itself has no hyper-structure.
Today, the tool situation is quite different. A couple of months ago, I dug up that 40+ years old design (and was sort of impressed by the quality and completeness of my design work as a university junior student ), thinking (and still believing) that I could make an implementation of it with moderate effort. (I promise nothing!)
Now that you are suggesting an editor for writing down thoughts: Feel free to steal adapt these ideas into your thoughts editor.
If you think it is worth considering, I will gladly supply more detail from my old design; there is a lot of stuff in it. I developed it into not just an editor for random thoughts, but also for e.g. online documentation. So it is not quite as simple as I describe it here.
|
|
|
|
|
Can i message you privately? So much rules so I cant send the explaining description 
|
|
|
|
|
Absolutely not.
Everything happens in this forum or it doesn't happen at all.
|
|
|
|
|
Yes, but only in an application that has a GUI front end.
|
|
|
|
|
Is Python much better than PHP? Is Python suitable to build a large web application? From looking at Python, it seems great for small scripts. But not to build a massive web application like a scheduling app or a CRM.
|
|
|
|
|
All big massive applications are made up of smaller parts / scripts that need to work together. The smaller a part (partitioning an application), the easier it is to understand and build; but only as small as it needs to be.
"Before entering on an understanding, I have meditated for a long time, and have foreseen what might happen. It is not genius which reveals to me suddenly, secretly, what I have to say or to do in a circumstance unexpected by other people; it is reflection, it is meditation." - Napoleon I
|
|
|
|
|
|
Write some code to de-serialise TCP data from 4different scales (different IP address) to be visualise
as digital LED object. The value that is being read is weight [40]. Anyone who can assist in this question please
|
|
|
|
|
|
Me enviaron hacer que el algorimo heruistico que esta de forma lineal sea dinamico, osea que el cambio de posicion lo genere de forma dinamica mediante el ingreso del tamaño del array, pero no me sale me podrian ayudar??? solo he logrado que imprima el array pero no me sale el cambio de posicion
Google translate: They sent me to make the heruistic algorithm that is linearly dynamic, that is, the change of position is generated dynamically by entering the size of the array, but it doesn't work out, could you help me??? I have only managed to print the array but I do not get the change of position
from re import I
from ClaseNodo import Nodo
def buscar_solucion_heuristica(nodo_inicial, solucion, visitados):
visitados.append(nodo_inicial.get_datos())
if nodo_inicial.get_datos() == solucion:
return nodo_inicial
else:
dato_nodo = nodo_inicial.get_datos()
i=0
while i < tamaño :
hijo=[]
hijo.append(dato_nodo)
i=i+1
hijo=[dato_nodo[1], dato_nodo[0], dato_nodo[2], dato_nodo[3], dato_nodo[4], dato_nodo[5]]
hijo_izquierdo = Nodo(hijo)
hijo=[dato_nodo[1], dato_nodo[0], dato_nodo[3], dato_nodo[2], dato_nodo[4], dato_nodo[5]]
hijo_central = Nodo(hijo)
hijo=[dato_nodo[1], dato_nodo[0], dato_nodo[3], dato_nodo[2], dato_nodo[5], dato_nodo[4]]
hijo_derecho = Nodo(hijo)
nodo_inicial.set_hijos([hijo_izquierdo, hijo_central, hijo_derecho])
for nodo_hijo in nodo_inicial.get_hijos():
if not nodo_hijo.get_datos() in visitados and mejora(nodo_inicial, nodo_hijo):
sol= buscar_solucion_heuristica(nodo_hijo, solucion, visitados)
if sol != None:
return sol
return None
def mejora(nodo_padre, nodo_hijo):
calidad_padre=0
calidad_hijo=0
dato_padre = nodo_padre.get_datos()
dato_hijo = nodo_hijo.get_datos()
for n in range(1,len(dato_padre)):
if (dato_padre[n]>dato_padre[n-1]):
calidad_padre = calidad_padre + 1;
if (dato_hijo[n]>dato_hijo[n-1]):
calidad_hijo = calidad_hijo + 1;
if calidad_hijo>=calidad_padre:
return True
else:
return False
if __name__ == "__main__":
i=0
j=0
estado_inicial=[]
tamaño =int(input("Por Favor, Introduzca el tamaño del array"))
while i < tamaño:
inicio =int(input("Por Favor, Introduzca un numero"))
estado_inicial.append(inicio)
i=i+1
solucion=[]
while j < tamaño:
final =int(input("Por Favor, Introduzca el solucion"))
solucion.append(final)
j=j+1
nodo_solucion = None
visitados=[]
nodo_inicial = Nodo(estado_inicial)
nodo = buscar_solucion_heuristica(nodo_inicial, solucion, \
visitados)
resultado=[]
while nodo.get_padre() != None:
resultado.append(nodo.get_datos())
nodo = nodo.get_padre()
resultado.append(estado_inicial)
resultado.reverse()
print(resultado)
|
|
|
|
|
This is an English language site, and we can only accept and answer questions in that language.
I have run this through Google Translate to produce a probably-good version, but you should check it and make sure it does say what you are actually asking.
"I have no idea what I did, but I'm taking full credit for it." - ThisOldTony
"Common sense is so rare these days, it should be classified as a super power" - Random T-shirt
AntiTwitter: @DalekDave is now a follower!
|
|
|
|
|
I want to secure my python app using an online license key. Consider the following simple example:
import requests
def license():
keys = requests.get("http://yourlink.com/licensekeys.txt").text
keyfromuser = "mykey"
for key in keys.splitlines():
if key == keyfromuser:
return
exit()
license()
Anybody can open my code in notepad and make some changes to disable the license key requirement.
What is the best strategy to implement license approach to make it harder to beginner and intermediate level programmers to reverse engineer my app?
|
|
|
|
|