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

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




PostPosted: Sat Oct 15, 2011 2:15 pm   Post subject: RE:Question about CCC

But the code is marked by the teacher, then sent to the CCC, and since it's any language the school supports, as long as SOME compiler supports it, the CCC will be okay (for 1st round).

And if you are willing to support a new language, then I'd request for the newest C# to be supported.

I would have just asked, but I assumed there was a technical reason why it wasn't (considering the fact that it was unsupported last year, so support is recent). I didn't think that there was any reason to use a compiler from 2 versions ago, other than it not working (which is possible since it runs XP).
Sponsor
Sponsor
Sponsor
sponsor
Tony




PostPosted: Sat Oct 15, 2011 2:20 pm   Post subject: RE:Question about CCC

Right. But if the school doesn't support the language, you fail just the same. Granted that you have some leeway to convince the school to support your tools after the contest is over, but before the marks are sent in. Since DWITE marks submissions much faster, that is obviously one of the (many) points where the contests differ.

I'll ping Dan about C#.
Latest from compsci.ca/blog: Tony's programming blog. DWITE - a programming contest.
mirhagk




PostPosted: Sat Oct 15, 2011 2:31 pm   Post subject: RE:Question about CCC

Okay, but if you guys can't set up .NET 4.0 with C# 4.0, even when asked beforehand, I still gotta downgrade the school's compilers, and relearn the older language?
Tony




PostPosted: Sat Oct 15, 2011 3:50 pm   Post subject: RE:Question about CCC

Or learn a new different language Wink

But ultimately yes, you get to play within our limitations.
Latest from compsci.ca/blog: Tony's programming blog. DWITE - a programming contest.
mirhagk




PostPosted: Sat Oct 15, 2011 4:20 pm   Post subject: RE:Question about CCC

I know many more languages, but I'm going to choose the language that lets me write code the fastest, and that is definitely C#.

Let me know if it can't be supported, because I probably won't be able to convince the school to get older compilers on several machines, just for a practice competition.
ultimatebuster




PostPosted: Tue Nov 01, 2011 12:15 pm   Post subject: RE:Question about CCC

Speaking of languages, I thought they added Java to stage 2 some time ago?

Also, for the senior contest, they're requesting a file as input, how are the input filenames laid out? just s1.txt s2.txt and do I have to get each of that? Or how do they do it?
d310




PostPosted: Tue Nov 01, 2011 5:18 pm   Post subject: Re: Question about CCC

I don't believe so.
The purpose of CCC Stage 2 is to select students for the IOI.
Since IOI doesn't use Java then CCC Stage 2 won't allow Java.
Yves




PostPosted: Tue Nov 01, 2011 5:30 pm   Post subject: Re: RE:Question about CCC

ultimatebuster @ Tue Nov 01, 2011 12:15 pm wrote:
how are the input filenames laid out?

Input files are sn.in for problem n.
(e.g. s3.in for problem 3.)
Sponsor
Sponsor
Sponsor
sponsor
ultimatebuster




PostPosted: Sun Nov 06, 2011 4:29 pm   Post subject: Re: RE:Question about CCC

Yves @ Tue Nov 01, 2011 5:30 pm wrote:
ultimatebuster @ Tue Nov 01, 2011 12:15 pm wrote:
how are the input filenames laid out?

Input files are sn.in for problem n.
(e.g. s3.in for problem 3.)


So do I have to write a reader that reads anything from s1 to s...
I don't even know how many inputs there are.
crossley7




PostPosted: Sun Nov 06, 2011 6:27 pm   Post subject: RE:Question about CCC

Each question has it's own set of input and will tell you what test cases consist of and you just need to read in based on what it says like you do for reading from any text file.

The language should have its own read in from file type of command/library and you just use it for reading in.

In C++ it would be
#include <fstream>
and in the main function
ifstream input;
input.open ("file.in");
input >> (whatever you are reading in);

In turing it would be
var IN : int
open : IN, get
get : IN, (whatever you are reading in)

any other language you will have to ask around since I don't know how it works for those.
Tony




PostPosted: Sun Nov 06, 2011 6:32 pm   Post subject: RE:Question about CCC

Naturally one should be comfortable reading from a file, in the language of their choice. It would be kind of embarrassing to get stuck at the very first step and not be able to even attempt any of the questions.

It might be a good idea to participate in a couple of rounds of DWITE, just to get some practice in.
Latest from compsci.ca/blog: Tony's programming blog. DWITE - a programming contest.
Yves




PostPosted: Mon Nov 07, 2011 9:03 pm   Post subject: Re: RE:Question about CCC

ultimatebuster @ Sun Nov 06, 2011 4:29 pm wrote:
Yves @ Tue Nov 01, 2011 5:30 pm wrote:
ultimatebuster @ Tue Nov 01, 2011 12:15 pm wrote:
how are the input filenames laid out?

Input files are sn.in for problem n.
(e.g. s3.in for problem 3.)


So do I have to write a reader that reads anything from s1 to s...
I don't even know how many inputs there are.


Sample code for CCC 1996 Stage 1 Problem A (analogous to S1):

code:

#include <cmath>
#include <cstdio>
int main() {
    using namespace std;
    freopen("s1.in", "r", stdin);
    int n; // s = sum of factors
    scanf("%d", &n);
    for (int l = 0; l < n; l++) {
        int a, s;
        scanf("%d", &a);
        s = -a;
        for (int i = 0; i < (int)ceil(sqrt(a)); i++)
            if (a % i == 0)
                if (i * i == a)
                    s += i;
                else
                    s += i + a / i;
        if (s < a)
            printf("%d is a deficient number.\n", a);
        else if (s > a)
            printf("%d is an abundant number.\n", a);
        else
            printf("%d is a perfect number.\n", a);
    }
    fclose(stdin);
    return 0;
}

Offtopic:
Alternatively:
code:

#include <cmath>
#include <cstdio>
int main() {
    freopen("s1.in", "r", stdin);
    int a, s, i, n; // s = sum of factors
    for (scanf("%d%d", &n, &a); n --> 0 && (s = -a); scanf("%d", &a)) {
        for (i = 1; i < (int)std::sqrt(a) + 1; i++)
            s += a % i ? 0 : i * i == a ? i : i + a / i; // if i | a, then add i and its complement (unless i = a^(1/2))
        printf("%d is a%s number.\n", a, s < a ? " deficient" : s > a ? "n abundant" : " perfect");
    }
    fclose(stdin);
    return 0;
}

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  [ 42 Posts ]
Goto page Previous  1, 2, 3
Jump to:   


Style:  
Search: