can you please give some more examples?
jonsca commented: Fail -1
Shankye commented: We are not here to do your project +0
can you please give some more examples?
well,if we get some questions of this type in exams or so then no one could deduct our marks?haha
does that means we can never calculate the answer?
it is not showing the correct result. i mean the printf("%f",i) is valid upto number i=56 which has 17 digits in its answer but for number exceeding 56 its shows 17 significant digits and all other digits are zeroes.
for eg
your code will give "144115188075855870" for 57 but the exact answer is "144115188075855872"...
the answer should not be in exponential form.
In a program i have to calculate pow(2,N) where 0<N<=1000. which data type is suitable for this?
I have used unsigned long long int but its range is also limited.
iteration is repeating a set of statements(block)
recursion is calling a function itself and in a function we have set of statements. does this means it is iteration??
what is the difference between recursion and iteration?
yes...i agree with narue...
check this
#include <stdio.h>
int main()
{
int a;
a = 1+1;
if (a!=2) {
printf("abcde");
goto error;
}
error:
printf("error is here\n");
return 0;
}
first printf statement will never execute
after the execution of statement "if(a!=2)" condition is false, then the control will move to "error:" irrespective of whether it is true or not.
can anyone explain any of the successful C++ code posted there????
then how should i approach it ...i mean there are successful submissions of this problem too but i didnot understand their approach.
what will u do to make it successful.???
here is the link of the site i have tried ...
http://codechef.com/problems/MULTQ3
run time error is SIGSEGV
this code is giving me run time error now
#include<iostream>
int a[10000]={0};
using namespace std;
int main()
{
int i,c,n,q,x,y,z;
cin>>n>>q;
while(q>0)
{ q--;c=0;
cin>>x>>y>>z;
if(x==0)
{ for(i=0;i<n;i++)
{ if(i>=y&&i<=z)
a[i]++;
}
}
else
{ for(i=0;i<n;i++)
if(i>=y&&i<=z)
if(a[i]%3==0)
c++;
cout<<c<<endl;
}
}
}
and the code i have posted earlier is giving time limit exceeded error.
above codes are my two logics to solve the problem.
actually run time error was coming when i was declaring array 'a' inside main().
but now its showing time limit exceeded. i mean the site on which i am checking my solution showing "time limtit exceeded".
i know the array size is very big and using this big size in the loop basically the main reason of time limit exceeded.
there are many questions of such big range and i have same time problem.
how do i overcome this???
this is my code....
#include<iostream>
using namespace std;
/*#define N1 1000000
#define a[N1]
#define C[N1][3]*/
int a[1000000]={0};
int C[1000000][3];
int main()
{
long N,Q,A,B,count,A1,B1;
int i,j,k,i1,j1;
cin>>N>>Q;
/*for(i=0;i<N;i++)
{a[i]=0;}*/
for(j=0;j<Q;j++)
{ for(k=0;k<3;k++)
{cin>>C[j][k];
}
if(C[j][0]==0)
{ A=C[j][1];
B=C[j][2];
for(i1=A;i1<=B;i1++)
{a[i1]+=1;}
}
if(C[j][0]==1)
{count=0;
A1=C[j][1];
B1=C[j][2];
for(j1=A1;j1<=B1;j1++)
{if(a[j1]%3==0)
{count++;}
}cout<<"\n"<<count;
}
}
/* for(o=0;o<=o1;o++)
{ cout<<"\n"<<output[o];}
*/
return 0;
}
the question of the program i have posted...
There are N numbers a[0],a[1]..a[N - 1]. Initally all are 0. You have to perform two types of operations :
1) Increase the numbers between indices A and B by 1. This is represented by the command "0 A B"
2) Answer how many numbers between indices A and B are divisible by 3. This is represented by the command "1 A B".
Input :
The first line contains two integers, N and Q. Each of the next Q lines are either of the form "0 A B" or "1 A B" as mentioned above.
Output :
Output 1 line for each of the queries of the form "1 A B" containing the required answer for the corresponding query.
Sample Input :
4 7
1 0 3
0 1 2
0 1 3
1 0 0
0 0 3
1 3 3
1 0 3
Sample Output :
4
1
0
2
Constraints :
1 <= N <= 100000
1 <= Q <= 100000
0 <= A <= B <= N - 1
it is giving run time error..earlier there is time limit exceeded error.
i want to know how should one approach with such a high range of input. time limit exceeded and run time error are most common errors i am facing with such hight input questions.
please explain...!!!
actually i just made a code in which i need to know who's the caller but later i managed the alternate way to solve my problem.
but still i wanna know whos is the caller..???
suppose i have 3 functions:
a()
b()
and c()
both a() and b() can called c(). if function c() is called how do i know who is the caller??
i have just giving a command
textcolor(5+BLINK);
cprintf("abc");
it will blink and print abc.
but now after this i want to input a string and the problem is the input string also blinking which i dont want.
how do i solve this????
can u tell me the functions which is to be used. i am using turbo c++.
can we open .jpeg file using c/c++.
instead of
C:\\TC\\BGI
use
C:/TC/BGI
may be u al are right.i have just wasted my time.
i believe in myself nd prove it.
@adak..i m in college doing computer engineering and have a good hand in programming.
i just think of making balloon shooting game.if u have better idea u r most welcome.
@lvl99..thanks for the advice
@waltp...they told us in mid dec...
v have to submit the synopsis before 31 dec bt no last date for its submission is decided..
i think i have to work hard.
Do me 1 favour... can u guys help me in giving ideas..i mean what kind of topic should i choose?
@kamatari..not yet..!!!
bt i am thinking of making a game and it will surely take time.
our teachers has informed us about dis project at the last moment.
@alexchen..i know no1 is here for that.But i dont have time left thats why i m asking.
hi guys...actually m in deep trouble.i have to make projct in turbo C.
but i dont have any time left.Can ny1 help me.
can ny1 send me projct so dat i cant lose my marks.
plz help meee...
i want to learn basics of graphics in c/c++.
please refer any book