Yatish
C.
man gets getline
We don't know if he's on linux
Yatish
no sir, have'nt studied them yet and don't know how to use them
Go through those functions. They're good at rounding up.
C.
int/int returns int
C.
You can transform one of the numbers in float to solve that
Yatish
int/int returns int
Yes, either use type casting or float
Jhagrut
We don't know if he's on linux
no sir currently working on windows 10 i want to use linux but still i have not come to the conclusion as to how much memory i have to allot to it while dual booting my laptop also i don't know the risks involved in dual booting
C.
sir which one
You can put tipp/100.0 or (float)tipp/100
C.
You can put tipp/100.0 or (float)tipp/100
One of those two, in both of the divisions.
Jhagrut
sir what does this float in brackets next to a variable mean?
数学の恋人
it is used to convert variables of other datatype to the one mentioned inside brackets
Jhagrut
you can try WSL
Mam is it effecient or i should go for dual boot
Artöm
Mam is it effecient or i should go for dual boot
Quite efficient. Not as real linux of course, but not slow either
Jhagrut
int main() 1st try { int taxp, tipp, itotal; float ftotal, mc, tip, tax; scanf("%f%d%d", &mc, &tipp, &taxp); tip=mc*(float)tipp/100; tax=mc*(float)taxp/100; ftotal=mc+tip+tax; itotal = ftotal; printf("%d\n", itotal); return 0; } failed for test case 10.25 17 5 2nd try tip=mc*((float)tipp/100); tax=mc*((float)taxp/100); same test case failed 3rd try int main() { int taxp, tipp, itotal,z; float ftotal, mc, tip, tax, x, y; scanf("%f%d%d", &mc, &tipp, &taxp); z=100; x=(float)tipp/(float)z; y=(float)taxp/(float)z; tip=mc*x; tax=mc*y; ftotal=mc+tip+tax; itotal = ftotal; printf("%d\n", itotal); return 0; } same test case failed
C.
What is itotal?
Jhagrut
total bill in integer
C.
Do you have to print it as an int?
C.
Normally they ask to print as a float with precision 2
Jhagrut
tried to represent float answer in integer so store the float value in an integer variable so that it returns an integer
Jhagrut
C.
Oh, no
C.
You have to use round()
Jhagrut
why will this not work
C.
You have to include math.h
Spirit
Half a warning
C.
Lol
Anonymous
Does using % operator in a loop cause TLE?
Anonymous
I am getting TLE in a certain problem . I searched for the reasons . Someone mentioned using the "%" operator often can cause TLE
Anonymous
Time limit exceeded
Anonymous
In online judge
Anonymous
I AM GETTING TLE(Time limit exceeded) IN THE ONLINE JUDGE ,BUT THE CODE WORKS FINE  . WHAT IMPROVEMENTS CAN BE DONE TO MAKE THE CODE MORE EFFICIENT ? problem- https://www.codechef.com/SEPT19B/problems/FIBEASY my solution- #include <bits/stdc++.h> using namespace std; int main()  {   int t;   cin>>t;   while(t--) {      int n,i;     cin>>n;     int a[n];     a[0]=0;     a[1]=1;  for(i=2;i<n;i++)  {       a[i]=a[i-1]+a[i-2];      a[i]=a[i]%10;      }  int j=0;  int b=n/2;  while(b--)  {      j=0;      for(i=0;i<n;i++)  {     if(i%2!=0)   {         a[j]=a[i];       j++;   }    }  n=j;  }  cout<<a[0]; } return 0; }
Anonymous
Also it's not cool to discuss solutions for ongoing contests.
Mat
Aniket
Anonymous
Okay sorry
Anonymous
I don't know how to optimize a code and analysis of algorithms
Anonymous
You have O(n²) That's why you have TLE
1<=N<=10^18 Time limit 1 second
Anonymous
In one second you can do 10^8 computation mostly.
Anonymous
What improvement can be done in my code
Mat
I don't know how to optimize a code and analysis of algorithms
Write Fibonacci algorithm and try to translate it in cpp
Anonymous
What improvement can be done in my code
You'll get to know when then editorial is posted.😅
Anonymous
😂
Anonymous
I can only solve 1st problem in long challenges . This time it would be 0
Anonymous
How can one improve himself I am a beginner
Anonymous
Please guide
Anonymous
😂😂
Mat
That's spam
Mat
How can one improve himself I am a beginner
Learn how to create and evaluate an algorithm
Anonymous
Lol
Deni
Hi guys, if i Need to create a std::function<void()> with void(...) with infinite types i get an error like: void f(int m){ } void r(std::function<void(...)> n){ } int main(){ r(f); } That's the code how its possibile to solve this?
Dima
Eh I am late
Deni
The error Is that it requires void(int) and not ...
Anonymous
What can i use?
Google for variadic templates But it is can be a hard topic So, tell what are trying to solve?