Search found 214 matches

by CDiMa
Fri Apr 08, 2005 9:33 am
Forum: Volume 105 (10500-10599)
Topic: 10591 - Happy Number
Replies: 61
Views: 20963

Re: 10591-CE

pls tell me why CE on 10591 : #include<stdio.h> int main(void) { unsigned long a,b,i,c,num[500],u[500],sum; scanf("%lu",&c); for(i=0;i<c;i++) scanf("%ld",&num[i]); for(i=0;i<c;i++) u[i]=num[i]; for(i=0;i<c;i++) { do{ sum=0; a=u[i]; do{ b=a%10; // sum=sum+(b*b); a=a/10; } while(a!=0); u[i]=sum; }whi...
by CDiMa
Wed Apr 06, 2005 1:55 pm
Forum: Volume 100 (10000-10099)
Topic: 10055 - Hashmat the Brave Warrior
Replies: 166
Views: 46420

Re: 10055-ll i ever get rid from PE

i got PE from about 50% of my AC problems.can anyone pls tell me why i got PE for this: #include<stdio.h> #include<math.h> int main(void) { double a1,a2; while(scanf("%lf %lf",&a1,&a2)!=EOF) printf("\n%.0lf\n",fabs(a1-a2)); return 0; } Well, you print a redundant newline at the beginning of output....
by CDiMa
Fri Mar 18, 2005 5:26 pm
Forum: Volume 3 (300-399)
Topic: 336 - A Node Too Far
Replies: 121
Views: 40151

There is one more thing - can there be any isolated vertex. the problem description says There will be no more than one (direct) communication line between any pair of nodes but it doesn't say that all the vertices will have at least one edge. How does your code handle this. My code will surely fai...
by CDiMa
Thu Feb 24, 2005 10:18 am
Forum: Volume 100 (10000-10099)
Topic: 10000 - Longest Paths
Replies: 160
Views: 36476

Re: 10000, help me to understand the meaning of "p,q&qu

Does the pair of p and q means: 1.There is a path from p to q. And there may be some other nodes between p and q. For example, it can be p->1->2->q Or 2.There is a edge from p to q in the graph. That is p->q, no other nodes between them. Which of the two understanding is right? The latter will do.....
by CDiMa
Fri Jan 14, 2005 11:11 am
Forum: C
Topic: What's wrong with this "scanf()"??
Replies: 2
Views: 1912

Re: What's wrong with this "scanf()"??

ImLazy wrote:

Code: Select all

#include<stdio.h>
int main()
{
  double p;
  scanf("%f",&p);
  printf("%f\n",p);
  return 0;
}
when input 11111, the output is -0.000000. Why??
%f reads a float which has a different machine representation than a double.
use %lf instead and it will work as expected.

Ciao!!!

Claudio
by CDiMa
Fri Jan 14, 2005 10:56 am
Forum: Volume 103 (10300-10399)
Topic: 10347 - Medians
Replies: 32
Views: 14142

Re: Why output limit exceeded in 10347(median)

Hi, why I get output limit exceeded? #include<stdio.h> #include<math.h> void main() { int x,y,z; double s,v; while(scanf("%d%d%d",&x,&y,&z)!=EOF) /* ... */ after the last number you should expect some whitespace and so probably scanf never returns EOF. while(scanf("%d%d%d",&x,&y,&z)==3) will probab...
by CDiMa
Wed Jan 05, 2005 11:31 am
Forum: Off topic (General chit-chat)
Topic: How many language do you know?
Replies: 32
Views: 16239

I've used to some (little) extent any of:
  • ADL
    AmigaE
    Basic
    C
    CSP
    CSS
    C++
    Fortran
    LISP
    Modula 2
    Occam
    Pascal
    Perl
    PL/SQL
    REXX
    Sh
Ciao!!!

Claudio
by CDiMa
Tue Dec 14, 2004 4:31 pm
Forum: C
Topic: Arrays with arbitrary offset in C
Replies: 8
Views: 3205

Claudio, i knew this was coming.Well I was thinking on programming in general, and the laxity which we allow in it (please do not read in between the lines), the language standard, what it says, and the fact that we already have a lot of that discussed out there - so a time saver in some way. Anywa...
by CDiMa
Tue Dec 14, 2004 12:28 pm
Forum: C
Topic: Arrays with arbitrary offset in C
Replies: 8
Views: 3205

sumankar wrote:hi

you can go over to comp.lang.c for all your troubles

suman.
An alternative is to post a question in this forum 8)
[c]
#define NROWS 41
#define NCOLS 41

int dummy[NROWS][NCOLS];
int (*myarray)[NCOLS] = (int (*)[NCOLS]) &(dummy[(NROWS-1)/2][(NCOLS-1)/2]);
[/c]

Ciao!!!

Claudio
by CDiMa
Thu Nov 25, 2004 11:35 am
Forum: Other words
Topic: Negative load average!
Replies: 1
Views: 869

Negative load average!

The Online Judge is going berzerk!!!
I just got this line in the Real Time System Status page:

Code: Select all

    -280.94    169.78    92.89      (12.07% idle)       11 Jobs (0 WC + 0 WR + 8 RR + 0 DL + 3 others)
Amazing how load average can be negative :)

Ciao!!!

Claudio
by CDiMa
Thu Nov 25, 2004 10:27 am
Forum: Volume 100 (10000-10099)
Topic: 10055 - Hashmat the Brave Warrior
Replies: 166
Views: 46420

Re: 10055 - Can't understand why WA

coolzero wrote: Input:
10 12
10 14
100 200
12 10

Output:
2
4
100
2


Can anyone help?

Tanks

Code: Select all

0 4294967296
2 4294967296
0 4294967295
2 4294967295
Ciao!!!

Claudio
by CDiMa
Wed Nov 24, 2004 6:14 pm
Forum: C++
Topic: New Problem arrised in c++
Replies: 2
Views: 1754

Re: New Problem arrised in c++

TISARKER wrote:So I am not getting the actual result.
But How can I get it?
floats don't have the necessary precision required to solve problems. Use doubles instead...

Ciao!!!

Claudio
by CDiMa
Mon Nov 15, 2004 10:49 am
Forum: C++
Topic: Debugging in VC++ : Watching Part of an array
Replies: 6
Views: 2341

Re: Debugging in VC++ : Watching Part of an array

suppose int xyz[10000] is an array. and we are using IDE Visual C++ 6.0 during debugging we can add xyz to watch window, it will show the whole array, when expanded. If the array is large, it becomes slow when expanded and debugging becomes tiresome. So how to view part of the array, say we want to...
by CDiMa
Fri Nov 12, 2004 12:48 pm
Forum: Volume 107 (10700-10799)
Topic: 10768 - Planarity
Replies: 19
Views: 4655

Meanwhile, Claudio's input contained multiple edges which I think will not be present in the input according to the problem statement - "There are no repeated edges." My example doesn't contain multiple edges. To make it clearer: Case 1(1 vertex no edges, clearly planar 8) ) 1 0 Case 2 (2 vertices,...
by CDiMa
Thu Nov 11, 2004 11:20 am
Forum: Volume 107 (10700-10799)
Topic: 10768 - Planarity
Replies: 19
Views: 4655

Mohammad Mahmudur Rahman wrote:

Code: Select all

1) Surely no planar graph can be formed with less than 5 vertices. So, if V<5 print NO & exit.
hmm, what about this?

Code: Select all

1 0
2 1
1 2
3 3
1 2
2 3
3 1
Ciao!!!

Claudio

Go to advanced search