MᏫᎻᎯᎷᎷᎬᎠ
Anonymous
Sorry I didn't get your question
Well, if a constructor is created to initialized member variables, isn't it possible to have a situation those variables are modified without intending to do so?
olli
What's the benefit of writing a simple for loop in C like this long j; for (j = 0; j < N; j++) { // some computation } Instead of for (long j = 0; j < N; j++) { // some computation }
back in the days (C90) you were required to declare all your variables at the top of a block. int main() { for (int j = 0; j < 3; ++j) {} return 0; } this simple code would generate warnings or depending on your compiler would fail to compile (gcc-10 -std=c90 -Wall -pedantic below) <source>:2:10: warning: variable declaration in for loop is a C99-specific feature [-Wc99-extensions] for (int j = 0; j < 3; ++j) {} ^ <source>:2:10: warning: GCC does not allow variable declarations in for loop initializers before C99 [-Wgcc-compat]
محمود
Hello
محمود
Write the employee leave calculation program as every two time leave is considered a full day vacation, and every regular vacation is considered one day, and save the information of each employee and give each employee a sequence number that represents and add the ability to search for each employee via the serial number or name and add the ability to print Vacations for every employee.
Anonymous
Are anonymous objects destroyed after member-wise copy to actual objects?
Roy
Hi. Is there anyone who uses and knows Asio? I have ask about async methods, do async_ methods run on a other thread?
Roy
Do I have to make containers thread safe if the async_connect method calls a Callback that uses the container that is in the main thread?
klimi
Gopsi I am kindly asking you for an explanation why you have pmed members of this group. You have 5 minutes, to give explanation otherwise you will get warned without the ability to appel.
klimi
i just want to give him chance
klimi
they won't respond
Anonymous
i will :)
Let's warn
klimi
Let's warn
wanna have the honors?
Anonymous
I think he left
Anonymous
No
Today, you are less toxic😂
Anonymous
I think he left
My mistake, he just didn't give you the chance
klimi
I think he left
what a covard
IAmMADMAX
Given three integers x,y and z you need to find the sum of all the numbers formed by having 4 atmost x times , having 5 atmost y times and having 6 atmost z times as a digit. Note : Output the sum modulo 10^9+7. Input The first line of input contains of an integer 'T' denoting number of test cases. Then T test cases follow . The first line of each test case contains an three integers x , y and z . Output: For each test case print in a new line an integer corresponding to the answer. Constraints: 1<=t<=50 0<=x,y,z<=100 TEST CASE 1 INPUT 1 1 1 1 OUTPUT 3675 TEST CASE 2 INPUT 1 4 5 6 OUTPUT 129422134
IAmMADMAX
https://del.dog/gycritymea.txt
IAmMADMAX
Is My Code Right Can Anyone tell me?
Programmer
https://del.dog/gycritymea.txt
If you try it with x = 1, y = 0, z = 0 you'll see that the output is wrong.
Programmer
My output is not coming
Do you mean it has an error?
IAmMADMAX
Am not getting any output
Programmer
Am not getting any output
Probably because the array is too large. try this: #define _CRT_SECURE_NO_WARNINGS #include <stdio.h> #include <stdlib.h> const int N = 10; const int mod = 1000000007; int getSum(int x, int y, int z) { int exactsum[N][N][N]; int exactnum[N][N][N]; int ans = 0; exactnum[0][0][0] = 1; for (int i = 0; i <= x; ++i) { for (int j = 0; j <= y; ++j) { for (int k = 0; k <= z; ++k) { if (i > 0) { exactsum[i][j][k] += (exactsum[i - 1][j][k] * 10 + 4 * exactnum[i - 1][j][k]) % mod; exactnum[i][j][k] += exactnum[i - 1][j][k] % mod; } if (j > 0) { exactsum[i][j][k] += (exactsum[i][j - 1][k] * 10 + 5 * exactnum[i][j - 1][k]) % mod; exactnum[i][j][k] += exactnum[i][j - 1][k] % mod; } if (k > 0) { exactsum[i][j][k] += (exactsum[i][j][k - 1] * 10 + 6 * exactnum[i][j][k - 1]) % mod; exactnum[i][j][k] += exactnum[i][j][k - 1] % mod; } ans += exactsum[i][j][k] % mod; ans %= mod; } } } return ans; } int main() { int x = 1, y = 0, z = 0; //scanf("%d %d %d", &x, &y, &z); printf("%lld\n", getSum(x, y, z) % mod); system("Pause"); } This is just your code but with a smaller array.
IAmMADMAX
Let me try
Diego
Hello! I know this may seem like a dumb question, but I'm just barely starting out with C++ I wanted to ask about the __restrict keyword I understand so far that it's to explicitly inform the compiler that the argumented pointer you're feeding into it is not aliased by another pointer in the same context As I understand this, this means that if, for example, the function receives other pointer arguments of the same type, they do not dereference to the same object I wanted to make absolutely sure that I'm understanding this right Does this mean that the writes done through this pointer will not affect any other pointer in this function; so the compiler is free to not commit everything instantly and instead do other work first for faster performance And that even in a multithreading environment, when a reference to the same object might be used at the same time the function in question is acting on the object, this is in itself a completely separate __concurrency__ problem Is this correct? Sorry for the long question
Diego
So basically, as long as in the same function I don't send two pointers to the same object, I can use the __restrict keyword and I'd be doing dandy
Anonymous
Is My Code Right Can Anyone tell me?
I think they want you to build up the answer incrementally... Though you could probably do it directly using a BigNum library (like libgmp). The greatest integer with given digits would have the highest digits first followed by second highest digits. Recall how the value of a decimal integer is: sum = 0; for(int i = first; i <= last; i++) { sum = 10*sum + digits[i]; } Actually that might not be covered as much nowadays as in older CS textbooks... Of course in this problem there is no array but same idea.
Anonymous
Is My Code Right Can Anyone tell me?
There won't be any output without printing after all the work got done. It would be easier to use an update function: int update(int acc, int digit) { int sum = 10*acc + digit; return sum % MOD; } It benefits to have previously learned arithmatic tricks like: "the sum of digits from a decimal number are a multiple of 3 when the original number was also a multiple of 3". The proof of statements like that use similar MOD logic.
Dima
bruh
klimi
Can't believe my blacklist is working
klimi
Oh fuck I said black
klimi
Roxi will kill me
Anonymous
anyone can code me a qbot botnet dm
Anonymous
looking for business not time wasters and great methods
Rohit Kumar
Guys, I am facing some problem with promises in JS.
Rohit Kumar
Can anybody help?
Anonymous
hi
Anonymous
/get cbook
Pavel
What can be wrong with this usage of random shuffle? std::vector<SimpleBorder> result; ... std::mt19937 rng(666); std::random_shuffle(std::begin(result), std::end(result), rng); If I do it like this, then it says that std::mersenne_twister_engine doesn't have a constructor that accepts iterator and iterator difference types, and blames something in <functional> header. <algorithm> and <random> are included. I see on the internet that this example works for other people (it's even in the examples from the docs https://en.cppreference.com/w/cpp/algorithm/random_shuffle). Maybe I'm missing something?
Pavel
ah wait, random_shuffle => shuffle 🤦‍♂️
ken
/warn
ken
Hello guys, please what is the best possible way to measure the execution time of a C++ code with nanoseconds precision?
Anonymous
/ban
/ban
Anonymous
Oops.
ken
You can find techniques in geekforgeeks.com
Thank you very much. Seen something.
Levi
Any fresher or student interested in working in angular can DM me. I am developing an app to be enhanced. There will be no payment for this job, but you will earn experience which you can put into your resume along with an experience letter of my company. Note: Only sincere and serious person should ping me.
Pavel
How is better to sort a struct with 4 floats, to then find unique elements via std::unique? I need some comparator function. Can I just compare bit representations of these structs in this case? Is there a function for that to compare 16 bytes of raw data?
Pavel
Ok, I see there's memcmp function for that, now I only need to ensure that the allignment is correct and maybe it will do the trick 😅
Pavel
Well it probably will not work correctly for minus zero and zero comparison (also can have unexpected results with Infs and NaNs, but in this case it should be fine).
Andrew
why do i see "retard" on top right of message?
Andrew
i can't send pic, but when you type a message you have written "retard" in top right
Vedant
@K11M1 why 'RETARD' is written along with ur name?
klimi
@K11M1 why 'RETARD' is written along with ur name?
I don't know what you are talking about
Nameful
ssh
Mosh
klimi
telnet
Andrew
telnet
https://imgur.com/vxmRG3d
klimi
._.....
klimi
(was a joke)
Anonymous
anyone can code me a qbot botnet dm
I might be dumb here and i definitly won't code that for you. But what exactly is a qbot?