Programming C, C++, Java, PHP, Ruby, Turing, VB
Computer Science Canada 
Programming C, C++, Java, PHP, Ruby, Turing, VB  

Username:   Password: 
 RegisterRegister   
 Usaco
Index -> Contests
Goto page Previous  1, 2, 3
View previous topic Printable versionDownload TopicSubscribe to this topicPrivate MessagesRefresh page View next topic
Author Message
Sane




PostPosted: Sun Apr 27, 2008 4:31 pm   Post subject: RE:Usaco

Yeah. And I find IOI freaking difficult too. xD

Those problems are just at a whole nother level. I never know how to deal with numbers that large. Well, time to get back to USACO training. Rob fixed the Castle problem.
Sponsor
Sponsor
Sponsor
sponsor
klopyrev




PostPosted: Sun Apr 27, 2008 5:10 pm   Post subject: Re: Usaco

long long is your friend.
Sane




PostPosted: Sun Apr 27, 2008 6:40 pm   Post subject: RE:Usaco

Ohshi. Damn Dev-C++. I didn't know long long could go up to 20 digits, because Dev-C++ doesn't support it.

I had been trying to do all those questions by manipulating char arrays. =.=
Saad




PostPosted: Sun Apr 27, 2008 6:51 pm   Post subject: Re: RE:Usaco

Sane @ Sun Apr 27, 2008 6:40 pm wrote:
Ohshi. Damn Dev-C++. I didn't know long long could go up to 20 digits, because Dev-C++ doesn't support it.

I had been trying to do all those questions by manipulating char arrays. =.=


Dev-C++ is not a compiler its an IDE. It uses the MinGW compiler which does support long long. Furthermore your forgetting literal constants. IE 1234LL is 1234 in long long format.
thegoose




PostPosted: Sun Apr 27, 2008 8:55 pm   Post subject: Re: Usaco

klopyrev @ Sun Apr 27, 2008 5:06 pm wrote:
I don't think COI is anymore difficult than IOI. I think this was actually a particularly easy COCI contest. I didn't actually participate in it. I was too lazy.


Stop being lazy.....^_^

I'd say the difficulty of this COI is the geometric mean between CCC and the hardest of IOIs. I was a bit surprised that none of the COCI's trademark hard problems were on this COI.
Sane




PostPosted: Mon Apr 28, 2008 4:32 am   Post subject: Re: RE:Usaco

Saad @ Sun Apr 27, 2008 6:51 pm wrote:
Sane @ Sun Apr 27, 2008 6:40 pm wrote:
Ohshi. Damn Dev-C++. I didn't know long long could go up to 20 digits, because Dev-C++ doesn't support it.

I had been trying to do all those questions by manipulating char arrays. =.=


Dev-C++ is not a compiler its an IDE. It uses the MinGW compiler which does support long long. Furthermore your forgetting literal constants. IE 1234LL is 1234 in long long format.


It does support it, but it's still bugged.

C:
#include <stdio.h>   
                               
typedef unsigned long long Long;

int main(void)                                       
{                                                     
   Long juul = 123456789012345678LL;   
   unsigned char *pjuul;                             
   int i;                                             
                                                     
   printf("sizeof(Long) = %d\n", sizeof (Long));
   printf("juuld: %lld\n",juul);
   printf("juulx: %016llX\n",juul);                     
   pjuul = (char *) &juul;                           
   printf("juulb: ");                                 
   for (i = 0;i < sizeof(Long); i++) printf("%02X",*(pjuul + i));
   printf("\n");         
                       
   return 0;



I get:

C:
sizeof(Long) = 8
juuld: - 1506741426
juulx: 00000000A630F34E
juulb: 4EF330A64B9BB601


Many people have found mingw's support for long long to be bugged.

The fix is to use:

C:
%I64d
%016I64X


Which works. But the Dev-C++ documentation and C standard says to use %lld, so I'm not sure how portable that fix would be.
Saad




PostPosted: Mon Apr 28, 2008 2:53 pm   Post subject: Re: RE:Usaco

Sane @ Mon Apr 28, 2008 4:32 am wrote:
Saad @ Sun Apr 27, 2008 6:51 pm wrote:
Sane @ Sun Apr 27, 2008 6:40 pm wrote:
Ohshi. Damn Dev-C++. I didn't know long long could go up to 20 digits, because Dev-C++ doesn't support it.

I had been trying to do all those questions by manipulating char arrays. =.=


Dev-C++ is not a compiler its an IDE. It uses the MinGW compiler which does support long long. Furthermore your forgetting literal constants. IE 1234LL is 1234 in long long format.


It does support it, but it's still bugged.

C:
#include <stdio.h>   
                               
typedef unsigned long long Long;

int main(void)                                       
{                                                     
   Long juul = 123456789012345678LL;   
   unsigned char *pjuul;                             
   int i;                                             
                                                     
   printf("sizeof(Long) = %d\n", sizeof (Long));
   printf("juuld: %lld\n",juul);
   printf("juulx: %016llX\n",juul);                     
   pjuul = (char *) &juul;                           
   printf("juulb: ");                                 
   for (i = 0;i < sizeof(Long); i++) printf("%02X",*(pjuul + i));
   printf("\n");         
                       
   return 0;



I get:

C:
sizeof(Long) = 8
juuld: - 1506741426
juulx: 00000000A630F34E
juulb: 4EF330A64B9BB601


Many people have found mingw's support for long long to be bugged.

The fix is to use:

C:
%I64d
%016I64X


Which works. But the Dev-C++ documentation and C standard says to use %lld, so I'm not sure how portable that fix would be.


Actually this bug would be windows related (specifically msvcrt.dll). However a simple #define and #ifdef could ensure portability.
More information here

On a smaller note, are you coding in C or C++?.

Sorry for going a little off topic Embarassed
Sane




PostPosted: Mon Apr 28, 2008 3:29 pm   Post subject: RE:Usaco

Usually C.
Sponsor
Sponsor
Sponsor
sponsor
Sane




PostPosted: Wed May 07, 2008 10:03 pm   Post subject: RE:Usaco

A.J, I found Camelot a lot easier than a lot of other chapter 3 problems. Camelot took me 2 tries to get working (forgot to handle the case where there are no knights). Some other problems like Humble Numbers took me a whole day to get working. Do you think Camelot was really the hardest one in chapter 3?

P.S. The most annoying part about that question was parsing the input in C. Since as far as I know, you can't use scanf if you want to stop at the EOF. I had to use getchar() and manually parse it.
A.J




PostPosted: Sat Jan 31, 2009 11:15 pm   Post subject: Re: Usaco

k, I am almost done USACO training....

and does anyone know whats the deal with the 'new' training pages? what is it about and how does one get access to it?
saltpro15




PostPosted: Sun Feb 01, 2009 8:41 am   Post subject: RE:Usaco

Well, about 2 months ago i started hearing about how great the USACO training is for DWITE, so I thought I'd check it out. So after a month and a half learning C++, I have 1 question done -.- I understand how to get the answer, I just don't know enough C++ to code it Very Happy
phreadj




PostPosted: Sun Mar 29, 2009 6:23 pm   Post subject: Re: Usaco

A.J @ Sat Jan 31, 2009 11:15 pm wrote:
k, I am almost done USACO training....

and does anyone know whats the deal with the 'new' training pages? what is it about and how does one get access to it?


you can easily make an account (possibly even the same as your contest account, not sure)
and it is sort of like a contest which never ends. once you look at the question, the timer starts and it doesnt stop
until you submit the right solution. The questions get harder as you do more, it is good practice
A.J




PostPosted: Sun Mar 29, 2009 9:18 pm   Post subject: RE:Usaco

nice

I am at the end of chapter 5 of the normal training pages

if I finish it, then I'll look into the new ones for sure. thanks
SJ




PostPosted: Sun Mar 29, 2009 10:59 pm   Post subject: Re: Usaco

phreadj @ Sun Mar 29, 2009 6:23 pm wrote:
A.J @ Sat Jan 31, 2009 11:15 pm wrote:
k, I am almost done USACO training....

and does anyone know whats the deal with the 'new' training pages? what is it about and how does one get access to it?


you can easily make an account (possibly even the same as your contest account, not sure)
and it is sort of like a contest which never ends. once you look at the question, the timer starts and it doesnt stop
until you submit the right solution. The questions get harder as you do more, it is good practice


I thought the new training problems are "invitation only"? are you referring to ace.delos.com/traingate
Display posts from previous:   
   Index -> Contests
View previous topic Tell A FriendPrintable versionDownload TopicSubscribe to this topicPrivate MessagesRefresh page View next topic

Page 3 of 3  [ 44 Posts ]
Goto page Previous  1, 2, 3
Jump to:   


Style:  
Search: