using scanf is a better option since scanf is said to faster than cin !
and reading until EOF is a factor...while(scanf("%d",&N)!=EOF) can help
Search found 22 matches: 10310
Searched query: 10310
- Fri Sep 16, 2011 7:13 pm
- Forum: Volume 103 (10300-10399)
- Topic: 10310 - Dog and Gopher
- Replies: 47
- Views: 22594
- Fri Apr 29, 2011 7:35 am
- Forum: Volume 103 (10300-10399)
- Topic: 10310 - Dog and Gopher
- Replies: 47
- Views: 22594
Re: 10310 - Dog and Gopher
I got TLE with my code.... Can someone help???? #include<cmath> #include<iostream> #include<cstdio> using namespace std; int main() { int N, i, c = 0; while(1) { if(c != 0) cout << endl; cin >> N; c++; int res = 0; float dogx, dogy, gopx, gopy, escapex, escapey; float holex[N], holey[N]; cin >> gop...
- Sun Oct 31, 2010 1:34 am
- Forum: Volume 103 (10300-10399)
- Topic: 10310 - Dog and Gopher
- Replies: 47
- Views: 22594
Re: 10310 - Dog and Gopher
I got TLE with my code.... Can someone help???? #include<cmath> #include<iostream> #include<cstdio> using namespace std; int main() { int N, i, c = 0; while(1) { if(c != 0) cout << endl; cin >> N; c++; int res = 0; float dogx, dogy, gopx, gopy, escapex, escapey; float holex[N], holey[N]; cin >> gopx...
- Tue Feb 03, 2009 9:12 am
- Forum: Volume 103 (10300-10399)
- Topic: 10310 - Dog and Gopher
- Replies: 47
- Views: 22594
Re: 10310 - Dog and Gopher
Sorry i was kidding.
- Tue Feb 03, 2009 8:53 am
- Forum: Volume 103 (10300-10399)
- Topic: 10310 - Dog and Gopher
- Replies: 47
- Views: 22594
Re: 10310 - Dog and Gopher
whats the logic behind this line? if(((dog_x>=gophar_x)&&(gophar_x>=hole_x[i]))||((dog_x<=gophar_x)&&(gophar_x<=hole_x[i]))||((dog_x-gophar_x==0)&&(((dog_y>=gophar_y)&&(gophar_y>=hole_y[i]))||((dog_y<=gophar_y)&&(gophar_y<=hole_y[i]))))) just comment this line...
- Tue Feb 03, 2009 8:42 am
- Forum: Volume 103 (10300-10399)
- Topic: 10310 - Dog and Gopher
- Replies: 47
- Views: 22594
Re: 10310 - Dog and Gopher
Can some one help me. I got TLE..
Code: Select all
removed
- Fri Jan 30, 2009 11:46 pm
- Forum: Volume 103 (10300-10399)
- Topic: 10310 - Dog and Gopher
- Replies: 47
- Views: 22594
Re: 10310 - Dog and Gopher
oh.. thats the easy part.. you can do like this.. typedef struct Hole { double x, y; } Hole hole[MAXHOLES]; for (int i = 0; i < nholes; i++) { scanf("%lf %lf", &hole[i].x, &hole[i].y); } for (int i = 0; i < nholes; i++) { // if feasible with this hole then set ur flag and break.. }
- Fri Jan 30, 2009 11:38 pm
- Forum: Volume 103 (10300-10399)
- Topic: 10310 - Dog and Gopher
- Replies: 47
- Views: 22594
Re: 10310 - Dog and Gopher
NEWKID,
IF NOT BREAK THE LOOP
THEN IT PRINT THE LAST ESCAPABLE HOLE.
IF MORE THEN 1 ESCAPABLE HOLE THEN WHAT SHOULD BE ANSWER????
IF NOT BREAK THE LOOP
THEN IT PRINT THE LAST ESCAPABLE HOLE.
IF MORE THEN 1 ESCAPABLE HOLE THEN WHAT SHOULD BE ANSWER????
- Fri Jan 30, 2009 9:46 pm
- Forum: Volume 103 (10300-10399)
- Topic: 10310 - Dog and Gopher
- Replies: 47
- Views: 22594
Re: 10310 - Dog and Gopher
@sazzadcsedu you are breaking the " for(i=0;i<nhole;i++) " loop if you find a suitable hole for the gopher. this loop happens to do the scanning as well " scanf("%lf %lf",&h_x,&h_y); ". now tell me what will happen if you find a suitable hole before scanning all...
- Thu Jan 29, 2009 9:45 pm
- Forum: Volume 103 (10300-10399)
- Topic: 10310 - Dog and Gopher
- Replies: 47
- Views: 22594
10310 - Dog and Gopher
whats wrong with my code?? #include<stdio.h> #include<math.h> #include<stdlib.h> #define eps 1e-7 double h[1001][1001]; int main() { int nhole,i,flag; double x1,x2,y1,y2,dis_gof,dis_dog,h_x,h_y; // freopen("input.txt","r",stdin); //freopen("output.txt","w",std...
- Tue Apr 24, 2007 6:42 am
- Forum: Volume 103 (10300-10399)
- Topic: 10310 - Dog and Gopher
- Replies: 47
- Views: 22594
Re: math is always important...
People, perhaps this may be the most useful tip on getting your 10310 program to AC. First of all, you can use doubles (no need to use long long and multiply input by 1000 blahblah). Secondly, when the dog & gopher reach the hole at same time, it's ...
- Tue Jan 17, 2006 3:39 am
- Forum: Volume 103 (10300-10399)
- Topic: 10310 - Dog and Gopher
- Replies: 47
- Views: 22594
Re: 10310: vague problem statement
you're right..shadow wrote:The problem hasnt precisely defined the answer when the dog and the gopher both reach a hole at the same time. I think the answer in this case is "can reach".
- Mon Jan 16, 2006 10:42 pm
- Forum: Volume 103 (10300-10399)
- Topic: 10310 - Dog and Gopher
- Replies: 47
- Views: 22594
10310: vague problem statement
The problem hasnt precisely defined the answer when the dog and the gopher both reach a hole at the same time. I think the answer in this case is "can reach".
- Sun Feb 06, 2005 1:16 am
- Forum: Volume 103 (10300-10399)
- Topic: 10310 - Dog and Gopher
- Replies: 47
- Views: 22594
10310
my code is but is wrong !! #include <stdio.h> #include <iostream.h> #include <math.h> void main (void){ double dg,dp,hx,hy,gx,gy,px,py,rhx,rhy; int i,nhole; while (scanf("%d %lf %lf %lf %lf",&nhole,&gx,&gy,&px,&py)==5){ int k=0; for (i=1;i<=nhole;i++){ scanf("%lf %...
- Wed Jan 26, 2005 7:29 am
- Forum: Volume 103 (10300-10399)
- Topic: 10310 - Dog and Gopher
- Replies: 47
- Views: 22594
10310 Please help me .......
is this is a valid in c or c++
all are in double
r1=sqrt(pow(x1-h1,2.0)+pow(y1-o1,2.0));
all are in double
r1=sqrt(pow(x1-h1,2.0)+pow(y1-o1,2.0));