pllk's blog

By pllk, 4 years ago, In English,

QBASIC is a very cool programming language, but I have never been able to use it in a contest. However, I noticed that in IOI'97 and before that QBASIC was one of the official IOI programming languages.

Have you used QBASIC in a contest? Is it a good language for contests? It would be interesting to hear your stories.

Unfortunately, it seems that neither QBASIC nor any other BASIC dialect is available on Codeforces...

However, I coded a QBASIC solution for a recent problem, and you can see it here:

DIM d&(2, 2000)
m& = 1000000007
INPUT n%, k%
FOR i% = 1 TO n%
    d&(1, i%) = 1
NEXT
c% = 1
FOR i% = 1 TO k%
    FOR j% = 1 TO n%
        d&(3 - c%, j%) = 0
    NEXT
    FOR j% = 1 TO n%
        FOR k% = 1 TO n% \ j%
            u& = d&(3 - c%, j% * k%)
            u& = (u& + d&(c%, j%)) MOD m&
            d&(3 - c%, j% * k%) = u&
        NEXT
    NEXT
    c% = 3 - c%
NEXT
s& = 0
FOR i% = 1 TO n%
    s& = (s& + d&(3 - c%, i%)) MOD m&
NEXT
PRINT s&
PLAY "cccedddfeeddc"
 
 
 
 
  • Vote: I like it  
  • +18
  • Vote: I do not like it  

»
4 years ago, # |
Rev. 2   Vote: I like it +9 Vote: I do not like it

Is it a good language for contests?

I fear much time passed since I write code in it myself — perhaps 10 or 15 years... So I want to ask a few things.

Does QBASIC changed much since? Have it now built-in support for associative arrays? What about lists, trees, queues? I remember it at least have support for structs, however... Are algorithms like QuickSort presented nowadays in its API?

If it did not see much development during last years, probably it is the same case as with Pascal. Some people still have used it recently but their number is reducing each year...

  • »
    »
    4 years ago, # ^ |
      Vote: I like it +8 Vote: I do not like it

    Well, there are no built-in data structures and algorithms in QBASIC. But I don't know if this is a bad thing. I have noticed that many of my C++ codes are complex. For example, I often use the C++ set structure that is actually a complex balanced binary search tree. However, most problems could be solved using more elementary data structures with a little more thinking. Thus, QBASIC could teach how to solve problems efficiently with minimal tools.

»
4 years ago, # |
  Vote: I like it +6 Vote: I do not like it

hmm, i'm interested to know what the last line PLAY "cccedddfeeddc" does.

  • »
    »
    4 years ago, # ^ |
      Vote: I like it +3 Vote: I do not like it

    As far as I remember, it plays sequence of musical notes, one per time.

    Here is more detailed description.

  • »
    »
    4 years ago, # ^ |
      Vote: I like it +3 Vote: I do not like it

    It plays the beginning notes of Gubben Noak. I think it's a nice surprise to play some music after printing the answer.

»
4 years ago, # |
Rev. 3   Vote: I like it +3 Vote: I do not like it

One thing i really wanted to see in codeforces was QBASIC but there was nothing about it and about using it in codeforces contests but now im really happy that this has made me learn c++ as well :) Anyway i think if qbasic was available in CF it would be better and so many other people would join us in this website to compete and participate in contests .